base

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package base contains the primitives of the RTSP protocol.

Index

Constants

View Source
const (
	// InterleavedFrameMagicByte is the first byte of an interleaved frame.
	InterleavedFrameMagicByte = 0x24
)

Variables

View Source
var StatusMessages = statusMessages

StatusMessages contains the status messages associated with each status code.

Functions

This section is empty.

Types

type Header map[string]HeaderValue

Header is a RTSP reader, present in both Requests and Responses.

type HeaderValue

type HeaderValue []string

HeaderValue is an header value.

type InterleavedFrame

type InterleavedFrame struct {
	// channel ID
	Channel int

	// payload
	Payload []byte
}

InterleavedFrame is an interleaved frame, and allows to transfer binary data within RTSP/TCP connections. It is used to send and receive RTP and RTCP packets with TCP.

func (InterleavedFrame) Marshal

func (f InterleavedFrame) Marshal() ([]byte, error)

Marshal writes an InterleavedFrame.

func (InterleavedFrame) MarshalSize

func (f InterleavedFrame) MarshalSize() int

MarshalSize returns the size of an InterleavedFrame.

func (InterleavedFrame) MarshalTo

func (f InterleavedFrame) MarshalTo(buf []byte) (int, error)

MarshalTo writes an InterleavedFrame.

func (*InterleavedFrame) Unmarshal

func (f *InterleavedFrame) Unmarshal(br *bufio.Reader) error

Unmarshal decodes an interleaved frame.

type Method

type Method string

Method is the method of a RTSP request.

const (
	Announce     Method = "ANNOUNCE"
	Describe     Method = "DESCRIBE"
	GetParameter Method = "GET_PARAMETER"
	Options      Method = "OPTIONS"
	Pause        Method = "PAUSE"
	Play         Method = "PLAY"
	Record       Method = "RECORD"
	Setup        Method = "SETUP"
	SetParameter Method = "SET_PARAMETER"
	Teardown     Method = "TEARDOWN"
)

methods.

type Request

type Request struct {
	// request method
	Method Method

	// request url
	URL *url.URL

	// map of header values
	Header Header

	// optional body
	Body []byte
}

Request is a RTSP request.

func (Request) Marshal

func (req Request) Marshal() ([]byte, error)

Marshal writes a Request.

func (Request) MarshalSize

func (req Request) MarshalSize() int

MarshalSize returns the size of a Request.

func (Request) MarshalTo

func (req Request) MarshalTo(buf []byte) (int, error)

MarshalTo writes a Request.

func (Request) String

func (req Request) String() string

String implements fmt.Stringer.

func (*Request) Unmarshal

func (req *Request) Unmarshal(br *bufio.Reader) error

Unmarshal reads a request.

type Response

type Response struct {
	// numeric status code
	StatusCode StatusCode

	// status message
	StatusMessage string

	// map of header values
	Header Header

	// optional body
	Body []byte
}

Response is a RTSP response.

func (Response) Marshal

func (res Response) Marshal() ([]byte, error)

Marshal writes a Response.

func (Response) MarshalSize

func (res Response) MarshalSize() int

MarshalSize returns the size of a Response.

func (Response) MarshalTo

func (res Response) MarshalTo(buf []byte) (int, error)

MarshalTo writes a Response.

func (Response) String

func (res Response) String() string

String implements fmt.Stringer.

func (*Response) Unmarshal

func (res *Response) Unmarshal(br *bufio.Reader) error

Unmarshal reads a response.

type StatusCode

type StatusCode int

StatusCode is the status code of a RTSP response.

const (
	StatusContinue                           StatusCode = 100
	StatusOK                                 StatusCode = 200
	StatusMovedPermanently                   StatusCode = 301
	StatusFound                              StatusCode = 302
	StatusSeeOther                           StatusCode = 303
	StatusNotModified                        StatusCode = 304
	StatusUseProxy                           StatusCode = 305
	StatusBadRequest                         StatusCode = 400
	StatusUnauthorized                       StatusCode = 401
	StatusPaymentRequired                    StatusCode = 402
	StatusForbidden                          StatusCode = 403
	StatusNotFound                           StatusCode = 404
	StatusMethodNotAllowed                   StatusCode = 405
	StatusNotAcceptable                      StatusCode = 406
	StatusProxyAuthRequired                  StatusCode = 407
	StatusRequestTimeout                     StatusCode = 408
	StatusGone                               StatusCode = 410
	StatusPreconditionFailed                 StatusCode = 412
	StatusRequestEntityTooLarge              StatusCode = 413
	StatusRequestURITooLong                  StatusCode = 414
	StatusUnsupportedMediaType               StatusCode = 415
	StatusParameterNotUnderstood             StatusCode = 451
	StatusNotEnoughBandwidth                 StatusCode = 453
	StatusSessionNotFound                    StatusCode = 454
	StatusMethodNotValidInThisState          StatusCode = 455
	StatusHeaderFieldNotValidForResource     StatusCode = 456
	StatusInvalidRange                       StatusCode = 457
	StatusParameterIsReadOnly                StatusCode = 458
	StatusAggregateOperationNotAllowed       StatusCode = 459
	StatusOnlyAggregateOperationAllowed      StatusCode = 460
	StatusUnsupportedTransport               StatusCode = 461
	StatusDestinationUnreachable             StatusCode = 462
	StatusDestinationProhibited              StatusCode = 463
	StatusDataTransportNotReadyYet           StatusCode = 464
	StatusNotificationReasonUnknown          StatusCode = 465
	StatusKeyManagementError                 StatusCode = 466
	StatusConnectionAuthorizationRequired    StatusCode = 470
	StatusConnectionCredentialsNotAccepted   StatusCode = 471
	StatusFailureToEstablishSecureConnection StatusCode = 472
	StatusInternalServerError                StatusCode = 500
	StatusNotImplemented                     StatusCode = 501
	StatusBadGateway                         StatusCode = 502
	StatusServiceUnavailable                 StatusCode = 503
	StatusGatewayTimeout                     StatusCode = 504
	StatusRTSPVersionNotSupported            StatusCode = 505
	StatusOptionNotSupported                 StatusCode = 551
	StatusProxyUnavailable                   StatusCode = 553
)

status codes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL