reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
re_rtp.h File Reference

Interface to Real-time Transport Protocol and RTCP. More...

#include <stdint.h>

Go to the source code of this file.

Classes

struct  rtp_header
 Defines the RTP header. More...
 
struct  rtcp_rr
 Reception report block. More...
 
struct  rtcp_sdes_item
 SDES item. More...
 
struct  rtcp_msg
 One RTCP Message. More...
 
struct  rtcp_msg::rtcp_hdr
 RTCP Header. More...
 
struct  rtcp_stats
 RTCP Statistics. More...
 

Typedefs

typedef void() rtp_recv_h(const struct sa *src, const struct rtp_header *hdr, struct mbuf *mb, void *arg)
 
typedef void() rtcp_recv_h(const struct sa *src, struct rtcp_msg *msg, void *arg)
 

Enumerations

enum  { RTP_VERSION = 2 , RTCP_VERSION = 2 , RTP_HEADER_SIZE = 12 }
 RTP protocol values. More...
 
enum  rtcp_type {
  RTCP_FIR = 192 , RTCP_NACK = 193 , RTCP_SR = 200 , RTCP_RR = 201 ,
  RTCP_SDES = 202 , RTCP_BYE = 203 , RTCP_APP = 204 , RTCP_RTPFB = 205 ,
  RTCP_PSFB = 206 , RTCP_XR = 207 , RTCP_AVB = 208
}
 RTCP Packet Types. More...
 
enum  rtcp_sdes_type {
  RTCP_SDES_END = 0 , RTCP_SDES_CNAME = 1 , RTCP_SDES_NAME = 2 , RTCP_SDES_EMAIL = 3 ,
  RTCP_SDES_PHONE = 4 , RTCP_SDES_LOC = 5 , RTCP_SDES_TOOL = 6 , RTCP_SDES_NOTE = 7 ,
  RTCP_SDES_PRIV = 8
}
 SDES Types. More...
 
enum  rtcp_rtpfb { RTCP_RTPFB_GNACK = 1 }
 Transport Layer Feedback Messages. More...
 
enum  rtcp_psfb { RTCP_PSFB_PLI = 1 , RTCP_PSFB_SLI = 2 , RTCP_PSFB_AFB = 15 }
 Payload-Specific Feedback Messages. More...
 

Functions

int rtp_alloc (struct rtp_sock **rsp)
 
int rtp_listen (struct rtp_sock **rsp, int proto, const struct sa *ip, uint16_t min_port, uint16_t max_port, bool enable_rtcp, rtp_recv_h *recvh, rtcp_recv_h *rtcph, void *arg)
 
int rtp_hdr_encode (struct mbuf *mb, const struct rtp_header *hdr)
 
int rtp_hdr_decode (struct rtp_header *hdr, struct mbuf *mb)
 
int rtp_encode (struct rtp_sock *rs, bool marker, uint8_t pt, uint32_t ts, struct mbuf *mb)
 
int rtp_decode (struct rtp_sock *rs, struct mbuf *mb, struct rtp_header *hdr)
 
int rtp_send (struct rtp_sock *rs, const struct sa *dst, bool marker, uint8_t pt, uint32_t ts, struct mbuf *mb)
 
int rtp_debug (struct re_printf *pf, const struct rtp_sock *rs)
 
void * rtp_sock (const struct rtp_sock *rs)
 
uint32_t rtp_sess_ssrc (const struct rtp_sock *rs)
 
const struct sa * rtp_local (const struct rtp_sock *rs)
 
void rtcp_start (struct rtp_sock *rs, const char *cname, const struct sa *peer)
 
void rtcp_enable_mux (struct rtp_sock *rs, bool enabled)
 
void rtcp_set_srate (struct rtp_sock *rs, uint32_t sr_tx, uint32_t sr_rx)
 
void rtcp_set_srate_tx (struct rtp_sock *rs, uint32_t srate_tx)
 
void rtcp_set_srate_rx (struct rtp_sock *rs, uint32_t srate_rx)
 
int rtcp_send_app (struct rtp_sock *rs, const char name[4], const uint8_t *data, size_t len)
 Send an RTCP Application-Defined (APP) packet.
 
int rtcp_send_fir (struct rtp_sock *rs, uint32_t ssrc)
 Send a Full INTRA-frame Request (FIR) packet.
 
int rtcp_send_nack (struct rtp_sock *rs, uint16_t fsn, uint16_t blp)
 Send an RTCP NACK packet.
 
int rtcp_send_pli (struct rtp_sock *rs, uint32_t fb_ssrc)
 Send an RTCP Picture Loss Indication (PLI) packet.
 
int rtcp_debug (struct re_printf *pf, const struct rtp_sock *rs)
 
void * rtcp_sock (const struct rtp_sock *rs)
 
int rtcp_stats (struct rtp_sock *rs, uint32_t ssrc, struct rtcp_stats *stats)
 
int rtcp_encode (struct mbuf *mb, enum rtcp_type type, uint32_t count,...)
 
int rtcp_decode (struct rtcp_msg **msgp, struct mbuf *mb)
 
int rtcp_msg_print (struct re_printf *pf, const struct rtcp_msg *msg)
 Print an RTCP Message.
 
int rtcp_sdes_encode (struct mbuf *mb, uint32_t src, uint32_t itemc,...)
 
const char * rtcp_type_name (enum rtcp_type type)
 
const char * rtcp_sdes_name (enum rtcp_sdes_type sdes)
 

Detailed Description

Interface to Real-time Transport Protocol and RTCP.

Copyright (C) 2010 Creytiv.com

Definition in file re_rtp.h.

Typedef Documentation

◆ rtcp_recv_h

typedef void() rtcp_recv_h(const struct sa *src, struct rtcp_msg *msg, void *arg)

Definition at line 145 of file re_rtp.h.

◆ rtp_recv_h

typedef void() rtp_recv_h(const struct sa *src, const struct rtp_header *hdr, struct mbuf *mb, void *arg)

Definition at line 143 of file re_rtp.h.

Enumeration Type Documentation

◆ anonymous enum

RTP protocol values.

Enumerator
RTP_VERSION 

Defines the RTP version we support.

RTCP_VERSION 

Supported RTCP Version

RTP_HEADER_SIZE 

Number of bytes in RTP Header

Definition at line 10 of file re_rtp.h.

◆ rtcp_psfb

Payload-Specific Feedback Messages.

Enumerator
RTCP_PSFB_PLI 

Picture Loss Indication (PLI)

RTCP_PSFB_SLI 

Slice Loss Indication (SLI)

RTCP_PSFB_AFB 

Application layer Feedback Messages.

Definition at line 69 of file re_rtp.h.

◆ rtcp_rtpfb

Transport Layer Feedback Messages.

Enumerator
RTCP_RTPFB_GNACK 

Generic NACK.

Definition at line 64 of file re_rtp.h.

◆ rtcp_sdes_type

SDES Types.

Enumerator
RTCP_SDES_END 

End of SDES list

RTCP_SDES_CNAME 

Canonical name

RTCP_SDES_NAME 

User name

RTCP_SDES_EMAIL 

User's electronic mail address.

RTCP_SDES_PHONE 

User's phone number

RTCP_SDES_LOC 

Geographic user location

RTCP_SDES_TOOL 

Name of application or tool

RTCP_SDES_NOTE 

Notice about the source

RTCP_SDES_PRIV 

Private extension

Definition at line 51 of file re_rtp.h.

◆ rtcp_type

RTCP Packet Types.

Enumerator
RTCP_FIR 

Full INTRA-frame Request (RFC 2032)

RTCP_NACK 

Negative Acknowledgement (RFC 2032)

RTCP_SR 

Sender Report

RTCP_RR 

Receiver Report

RTCP_SDES 

Source Description

RTCP_BYE 

Goodbye

RTCP_APP 

Application-defined

RTCP_RTPFB 

Transport layer FB message (RFC 4585)

RTCP_PSFB 

Payload-specific FB message (RFC 4585)

RTCP_XR 

Extended Report (RFC 3611)

RTCP_AVB 

AVB RTCP Packet (IEEE1733)

Definition at line 36 of file re_rtp.h.

Function Documentation

◆ rtcp_debug()

int rtcp_debug ( struct re_printf *  pf,
const struct rtp_sock *  rs 
)

◆ rtcp_decode()

int rtcp_decode ( struct rtcp_msg **  msgp,
struct mbuf *  mb 
)

◆ rtcp_enable_mux()

void rtcp_enable_mux ( struct rtp_sock *  rs,
bool  enabled 
)

◆ rtcp_encode()

int rtcp_encode ( struct mbuf *  mb,
enum rtcp_type  type,
uint32_t  count,
  ... 
)

◆ rtcp_msg_print()

int rtcp_msg_print ( struct re_printf *  pf,
const struct rtcp_msg *  msg 
)

Print an RTCP Message.

Parameters
pfPrint handler for debug output
msgRTCP Message
Returns
0 if success, otherwise errorcode

Definition at line 153 of file rtcp.c.

◆ rtcp_sdes_encode()

int rtcp_sdes_encode ( struct mbuf *  mb,
uint32_t  src,
uint32_t  itemc,
  ... 
)

◆ rtcp_sdes_name()

const char * rtcp_sdes_name ( enum rtcp_sdes_type  sdes)

Definition at line 127 of file rtcp.c.

◆ rtcp_send_app()

int rtcp_send_app ( struct rtp_sock *  rs,
const char  name[4],
const uint8_t *  data,
size_t  len 
)

Send an RTCP Application-Defined (APP) packet.

Parameters
rsRTP Socket
nameAscii name (4 octets)
dataApplication-dependent data
lenNumber of bytes of data
Returns
0 for success, otherwise errorcode

Definition at line 55 of file rtcp.c.

◆ rtcp_send_fir()

int rtcp_send_fir ( struct rtp_sock *  rs,
uint32_t  ssrc 
)

Send a Full INTRA-frame Request (FIR) packet.

Parameters
rsRTP Socket
ssrcSynchronization source identifier for the sender of this packet
Returns
0 for success, otherwise errorcode

Definition at line 71 of file rtcp.c.

◆ rtcp_send_nack()

int rtcp_send_nack ( struct rtp_sock *  rs,
uint16_t  fsn,
uint16_t  blp 
)

Send an RTCP NACK packet.

Parameters
rsRTP Socket
fsnFirst Sequence Number lost
blpBitmask of lost packets
Returns
0 for success, otherwise errorcode

Definition at line 86 of file rtcp.c.

◆ rtcp_send_pli()

int rtcp_send_pli ( struct rtp_sock *  rs,
uint32_t  fb_ssrc 
)

Send an RTCP Picture Loss Indication (PLI) packet.

Parameters
rsRTP Socket
fb_ssrcFeedback SSRC
Returns
0 for success, otherwise errorcode

Definition at line 100 of file rtcp.c.

◆ rtcp_set_srate()

void rtcp_set_srate ( struct rtp_sock *  rs,
uint32_t  sr_tx,
uint32_t  sr_rx 
)

◆ rtcp_set_srate_rx()

void rtcp_set_srate_rx ( struct rtp_sock *  rs,
uint32_t  srate_rx 
)

◆ rtcp_set_srate_tx()

void rtcp_set_srate_tx ( struct rtp_sock *  rs,
uint32_t  srate_tx 
)

◆ rtcp_sock()

void * rtcp_sock ( const struct rtp_sock *  rs)

◆ rtcp_start()

void rtcp_start ( struct rtp_sock *  rs,
const char *  cname,
const struct sa *  peer 
)

◆ rtcp_stats()

int rtcp_stats ( struct rtp_sock *  rs,
uint32_t  ssrc,
struct rtcp_stats *  stats 
)

◆ rtcp_type_name()

const char * rtcp_type_name ( enum rtcp_type  type)

Definition at line 107 of file rtcp.c.

◆ rtp_alloc()

int rtp_alloc ( struct rtp_sock **  rsp)

◆ rtp_debug()

int rtp_debug ( struct re_printf *  pf,
const struct rtp_sock *  rs 
)

◆ rtp_decode()

int rtp_decode ( struct rtp_sock *  rs,
struct mbuf *  mb,
struct rtp_header *  hdr 
)

◆ rtp_encode()

int rtp_encode ( struct rtp_sock *  rs,
bool  marker,
uint8_t  pt,
uint32_t  ts,
struct mbuf *  mb 
)

◆ rtp_hdr_decode()

int rtp_hdr_decode ( struct rtp_header *  hdr,
struct mbuf *  mb 
)

◆ rtp_hdr_encode()

int rtp_hdr_encode ( struct mbuf *  mb,
const struct rtp_header *  hdr 
)

◆ rtp_listen()

int rtp_listen ( struct rtp_sock **  rsp,
int  proto,
const struct sa *  ip,
uint16_t  min_port,
uint16_t  max_port,
bool  enable_rtcp,
rtp_recv_h *  recvh,
rtcp_recv_h *  rtcph,
void *  arg 
)

◆ rtp_local()

const struct sa * rtp_local ( const struct rtp_sock *  rs)

◆ rtp_send()

int rtp_send ( struct rtp_sock *  rs,
const struct sa *  dst,
bool  marker,
uint8_t  pt,
uint32_t  ts,
struct mbuf *  mb 
)

◆ rtp_sess_ssrc()

uint32_t rtp_sess_ssrc ( const struct rtp_sock *  rs)

◆ rtp_sock()

void * rtp_sock ( const struct rtp_sock *  rs)