rtp

package module
v0.0.0-...-ec92b7c Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: BSD-2-Clause Imports: 7 Imported by: 0

README

goRtp

RTP impelmentation in Go for a media switch

Documentation

Index

Constants

View Source
const (
	Ke  byte = 0x00
	Ka  byte = 0x01
	Ks  byte = 0x02
	KCe byte = 0x03
	KCa byte = 0x04
	KCs byte = 0x05
)
View Source
const (
	MTU = 1500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CipherID

type CipherID uint16
const (
	// From https://www.iana.org/assignments/srtp-protection/srtp-protection.xhtml
	NONE                                     CipherID = 0x0000
	SRTP_AEAD_AES_128_GCM                    CipherID = 0x0007
	SRTP_AEAD_AES_256_GCM                    CipherID = 0x0008
	DOUBLE_AEAD_AES_128_GCM_AEAD_AES_128_GCM CipherID = 0x0009
	DOUBLE_AEAD_AES_256_GCM_AEAD_AES_256_GCM CipherID = 0x000a
)

type KDF

type KDF struct {
	// contains filtered or unexported fields
}

func NewKDF

func NewKDF(masterKey, masterSalt []byte) (*KDF, error)

func (KDF) Derive

func (kdf KDF) Derive(label byte, index uint64, size int) []byte

func (KDF) DeriveForStream

func (kdf KDF) DeriveForStream(cipher CipherID) ([]byte, []byte, []byte, []byte, error)

type RTCPCompoundPacket

type RTCPCompoundPacket struct {
	// contains filtered or unexported fields
}

func NewRTCPCompoundPacket

func NewRTCPCompoundPacket(buffer []byte, srtcpIndex uint32) (*RTCPCompoundPacket, error)

func NewSRTCPPacket

func NewSRTCPPacket(buffer []byte) (*RTCPCompoundPacket, error)

func (*RTCPCompoundPacket) Clone

func (*RTCPCompoundPacket) DecryptGCM

func (p *RTCPCompoundPacket) DecryptGCM(key, salt []byte) error

func (*RTCPCompoundPacket) EncryptGCM

func (p *RTCPCompoundPacket) EncryptGCM(key, salt []byte) error

func (*RTCPCompoundPacket) GetBuffer

func (p *RTCPCompoundPacket) GetBuffer() []byte

func (*RTCPCompoundPacket) GetE

func (p *RTCPCompoundPacket) GetE() bool

func (*RTCPCompoundPacket) GetESRTCPWord

func (p *RTCPCompoundPacket) GetESRTCPWord() []byte

SRTCP access functions

func (*RTCPCompoundPacket) GetHeader

func (p *RTCPCompoundPacket) GetHeader() *RTCPHeader

func (*RTCPCompoundPacket) GetPackets

func (p *RTCPCompoundPacket) GetPackets() []*RTCPPacket

func (*RTCPCompoundPacket) GetSRTCPIndex

func (p *RTCPCompoundPacket) GetSRTCPIndex() uint32

type RTCPHeader

type RTCPHeader struct {
	// contains filtered or unexported fields
}

func (*RTCPHeader) Clone

func (p *RTCPHeader) Clone() *RTCPHeader

func (*RTCPHeader) GetLength

func (p *RTCPHeader) GetLength() uint16

func (*RTCPHeader) GetLengthInBytes

func (p *RTCPHeader) GetLengthInBytes() int

func (*RTCPHeader) GetPT

func (p *RTCPHeader) GetPT() RTCPTypeClass

func (*RTCPHeader) GetRC

func (p *RTCPHeader) GetRC() int

func (*RTCPHeader) GetSenderSSRC

func (p *RTCPHeader) GetSenderSSRC() uint32

func (*RTCPHeader) SetLength

func (p *RTCPHeader) SetLength(length uint16)

func (*RTCPHeader) SetPT

func (p *RTCPHeader) SetPT(pt RTCPTypeClass)

func (*RTCPHeader) SetSenderSSRC

func (p *RTCPHeader) SetSenderSSRC(ssrc uint32)

type RTCPPacket

type RTCPPacket struct {
	// contains filtered or unexported fields
}

func NewRTCPPacket

func NewRTCPPacket(pt RTCPTypeClass, len uint16, senderSsrc uint32, payload []byte) *RTCPPacket

type RTCPTypeClass

type RTCPTypeClass uint8
const (
	RTCPTypeSR   RTCPTypeClass = 200
	RTCPTypeRR   RTCPTypeClass = 201
	RTCPTypeSDES RTCPTypeClass = 202
	RTCPTypeBYE  RTCPTypeClass = 203
	RTCPTypeAPP  RTCPTypeClass = 204
)

https://tools.ietf.org/html/rfc3550#section-12.1

type RTPPacket

type RTPPacket struct {
	// contains filtered or unexported fields
}

func NewRTPPacket

func NewRTPPacket(payload []byte, payloadType int8, seq uint16, ts uint32, ssrc uint32) *RTPPacket

func (*RTPPacket) Clone

func (p *RTPPacket) Clone() *RTPPacket

func (*RTPPacket) DecryptGCM

func (p *RTPPacket) DecryptGCM(roc uint32, key, salt []byte) error

func (*RTPPacket) EncryptGCM

func (p *RTPPacket) EncryptGCM(roc uint32, key, salt []byte) error

func (*RTPPacket) GetCC

func (p *RTPPacket) GetCC() int

func (*RTPPacket) GetCSRC

func (p *RTPPacket) GetCSRC() []uint32

func (*RTPPacket) GetExtBit

func (p *RTPPacket) GetExtBit() bool

func (*RTPPacket) GetExtClientVolume

func (p *RTPPacket) GetExtClientVolume(s *RTPSession) (vad bool, dBov int8)

func (*RTPPacket) GetGeneralExt

func (p *RTPPacket) GetGeneralExt(num int) []byte

func (*RTPPacket) GetHdrExt

func (p *RTPPacket) GetHdrExt() (extNum uint16, ext []byte)

func (*RTPPacket) GetHdrExtLen

func (p *RTPPacket) GetHdrExtLen() (extLen int)

func (*RTPPacket) GetMarker

func (p *RTPPacket) GetMarker() bool

func (*RTPPacket) GetOHB

func (p *RTPPacket) GetOHB() (pt int8, seq uint16, m bool)

func (*RTPPacket) GetOHBLen

func (p *RTPPacket) GetOHBLen() int

func (*RTPPacket) GetPT

func (p *RTPPacket) GetPT() int8

func (*RTPPacket) GetPad

func (p *RTPPacket) GetPad() bool

func (*RTPPacket) GetPayload

func (p *RTPPacket) GetPayload() []byte

func (*RTPPacket) GetSSRC

func (p *RTPPacket) GetSSRC() uint32

func (*RTPPacket) GetSeq

func (p *RTPPacket) GetSeq() uint16

func (*RTPPacket) GetTimestamp

func (p *RTPPacket) GetTimestamp() uint32

func (*RTPPacket) SetCC

func (p *RTPPacket) SetCC(cc int) error

func (*RTPPacket) SetCSRC

func (p *RTPPacket) SetCSRC(csrc []uint32) error

func (*RTPPacket) SetExtBit

func (p *RTPPacket) SetExtBit(x bool) error

func (*RTPPacket) SetExtClientVolume

func (p *RTPPacket) SetExtClientVolume(s *RTPSession, vad bool, dBov int8) error

func (*RTPPacket) SetGeneralExt

func (p *RTPPacket) SetGeneralExt(num int, data []byte) error

func (*RTPPacket) SetHdrExt

func (p *RTPPacket) SetHdrExt(extNum uint16, ext []byte) error

func (*RTPPacket) SetMarker

func (p *RTPPacket) SetMarker(marker bool) error

func (*RTPPacket) SetOHB

func (p *RTPPacket) SetOHB(pt int8, seq uint16, m bool) error

func (*RTPPacket) SetPT

func (p *RTPPacket) SetPT(pt int8) error

func (*RTPPacket) SetPad

func (p *RTPPacket) SetPad(marker bool) error

func (*RTPPacket) SetPadding

func (p *RTPPacket) SetPadding(sizeMult int) error

func (*RTPPacket) SetPayload

func (p *RTPPacket) SetPayload(payload []byte) error

func (*RTPPacket) SetSSRC

func (p *RTPPacket) SetSSRC(ssrc uint32) error

func (*RTPPacket) SetSeq

func (p *RTPPacket) SetSeq(seq uint16) error

func (*RTPPacket) SetTimestamp

func (p *RTPPacket) SetTimestamp(ts uint32) error

func (*RTPPacket) String

func (p *RTPPacket) String() string

type RTPSession

type RTPSession struct {
	// contains filtered or unexported fields
}

func NewRTPSession

func NewRTPSession(rewriteSeq bool) *RTPSession

func (*RTPSession) Decode

func (s *RTPSession) Decode(packetData []byte) (*RTPPacket, error)

func (*RTPSession) DecodeRTCP

func (s *RTPSession) DecodeRTCP(packetData []byte) (*RTCPCompoundPacket, error)

func (*RTPSession) Encode

func (s *RTPSession) Encode(p *RTPPacket) ([]byte, error)

func (*RTPSession) EncodeRTCP

func (s *RTPSession) EncodeRTCP(p *RTCPCompoundPacket) ([]byte, error)

func (*RTPSession) NewRtcpRR

func (s *RTPSession) NewRtcpRR() (*RTPPacket, error)

func (*RTPSession) SetExtMap

func (s *RTPSession) SetExtMap(num int, name string) error

func (*RTPSession) SetSRTP

func (s *RTPSession) SetSRTP(cipher CipherID, useEKT bool, masterKey, masterSalt []byte) error

type Ssrc

type Ssrc uint32

Jump to

Keyboard shortcuts

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