SmolRTSP 0.2.0
A small, portable, extensible RTSP 1.0 implementation in C99
Loading...
Searching...
No Matches
rtcp.h File Reference

RFC 3550 §6.4-compliant RTCP Sender Report (SR) implementation. More...

#include <smolrtsp/priv/compiler_attrs.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for rtcp.h:

Go to the source code of this file.

Data Structures

struct  SmolRTSP_RtcpSr
 An RTCP Sender Report (SR) header. More...
 
struct  SmolRTSP_RtcpRr
 An RTCP Receiver Report (RR) header (RFC 3550 §6.4.2). More...
 
struct  SmolRTSP_RtcpSdesCname
 An RTCP SDES packet with a single chunk containing a single CNAME item (RFC 3550 §6.5). More...
 
struct  SmolRTSP_RtcpBye
 An RTCP BYE packet for a single SSRC, optionally carrying a reason text (RFC 3550 §6.6). More...
 

Macros

#define SMOLRTSP_RTCP_PT_SR   200
 RTCP packet type for Sender Report (RFC 3550 §6.4.1).
 
#define SMOLRTSP_RTCP_PT_RR   201
 RTCP packet type for Receiver Report (RFC 3550 §6.4.2).
 
#define SMOLRTSP_RTCP_PT_SDES   202
 RTCP packet type for Source Description (RFC 3550 §6.5).
 
#define SMOLRTSP_RTCP_PT_BYE   203
 RTCP packet type for Goodbye (RFC 3550 §6.6).
 
#define SMOLRTSP_RTCP_SDES_CNAME   1
 SDES item type for canonical end-point identifier (CNAME) (RFC 3550 §6.5.1).
 
#define SMOLRTSP_RTCP_SR_SIZE_BASE   28u
 The fixed wire size of an RTCP Sender Report with no reception report blocks (RC = 0).
 
#define SMOLRTSP_RTCP_RR_SIZE_BASE   8u
 The fixed wire size of an RTCP Receiver Report with no reception report blocks (RC = 0): a 4-byte common header plus the 4-byte SSRC of the packet sender = 8 bytes.
 

Functions

size_t SmolRTSP_RtcpSr_size (SmolRTSP_RtcpSr self) SMOLRTSP_PRIV_MUST_USE
 Computes the size of the binary self.
 
uint8_t * SmolRTSP_RtcpSr_serialize (SmolRTSP_RtcpSr self, uint8_t buffer[restrict]) SMOLRTSP_PRIV_MUST_USE
 Writes self to buffer.
 
size_t SmolRTSP_RtcpRr_size (SmolRTSP_RtcpRr self) SMOLRTSP_PRIV_MUST_USE
 Computes the size of the binary self.
 
uint8_t * SmolRTSP_RtcpRr_serialize (SmolRTSP_RtcpRr self, uint8_t buffer[restrict]) SMOLRTSP_PRIV_MUST_USE
 Writes self to buffer.
 
size_t SmolRTSP_RtcpSdesCname_size (SmolRTSP_RtcpSdesCname self) SMOLRTSP_PRIV_MUST_USE
 Computes the size of the binary self.
 
uint8_t * SmolRTSP_RtcpSdesCname_serialize (SmolRTSP_RtcpSdesCname self, uint8_t buffer[restrict]) SMOLRTSP_PRIV_MUST_USE
 Writes self to buffer.
 
size_t SmolRTSP_RtcpBye_size (SmolRTSP_RtcpBye self) SMOLRTSP_PRIV_MUST_USE
 Computes the size of the binary self.
 
uint8_t * SmolRTSP_RtcpBye_serialize (SmolRTSP_RtcpBye self, uint8_t buffer[restrict]) SMOLRTSP_PRIV_MUST_USE
 Writes self to buffer.
 

Detailed Description

RFC 3550 §6.4-compliant RTCP Sender Report (SR) implementation.

Macro Definition Documentation

◆ SMOLRTSP_RTCP_SR_SIZE_BASE

#define SMOLRTSP_RTCP_SR_SIZE_BASE   28u

The fixed wire size of an RTCP Sender Report with no reception report blocks (RC = 0).

4 (common header) + 4 (sender SSRC) + 8 (NTP timestamp) + 4 (RTP timestamp)

  • 4 (packet count) + 4 (octet count) = 28 bytes.

Function Documentation

◆ SmolRTSP_RtcpBye_serialize()

uint8_t * SmolRTSP_RtcpBye_serialize ( SmolRTSP_RtcpBye  self,
uint8_t  buffer[restrict] 
)

Writes self to buffer.

Precondition
buffer != NULL
self.reason == NULL || strlen(self.reason) <= 255

◆ SmolRTSP_RtcpBye_size()

size_t SmolRTSP_RtcpBye_size ( SmolRTSP_RtcpBye  self)

Computes the size of the binary self.

Without a reason: 8 bytes (4 header + 4 SSRC). With a reason: the above plus 1 byte length + N bytes text, zero-padded to a 32-bit boundary.

Precondition
self.reason == NULL || strlen(self.reason) <= 255

◆ SmolRTSP_RtcpRr_serialize()

uint8_t * SmolRTSP_RtcpRr_serialize ( SmolRTSP_RtcpRr  self,
uint8_t  buffer[restrict] 
)

Writes self to buffer.

Parameters
[in]selfThe RR packet to write.
[out]bufferMust be at least SmolRTSP_RtcpRr_size(self) bytes.
Returns
The pointer to the passed buffer.
Precondition
buffer != NULL
self.rc == 0

◆ SmolRTSP_RtcpRr_size()

size_t SmolRTSP_RtcpRr_size ( SmolRTSP_RtcpRr  self)

Computes the size of the binary self.

Currently always returns SMOLRTSP_RTCP_RR_SIZE_BASE.

◆ SmolRTSP_RtcpSdesCname_serialize()

uint8_t * SmolRTSP_RtcpSdesCname_serialize ( SmolRTSP_RtcpSdesCname  self,
uint8_t  buffer[restrict] 
)

Writes self to buffer.

Precondition
buffer != NULL
self.cname != NULL
strlen(self.cname) <= 255

◆ SmolRTSP_RtcpSdesCname_size()

size_t SmolRTSP_RtcpSdesCname_size ( SmolRTSP_RtcpSdesCname  self)

Computes the size of the binary self.

Layout: 4-byte common header + 4-byte SSRC + 2-byte CNAME item header

  • N bytes of CNAME text + 1-byte item-list terminator, then zero-padded to a 32-bit boundary.
Precondition
self.cname != NULL
strlen(self.cname) <= 255

◆ SmolRTSP_RtcpSr_serialize()

uint8_t * SmolRTSP_RtcpSr_serialize ( SmolRTSP_RtcpSr  self,
uint8_t  buffer[restrict] 
)

Writes self to buffer.

Parameters
[in]selfThe SR packet to write.
[out]bufferThe pointer to write to. Must be at least of size SmolRTSP_RtcpSr_size(self).
Returns
The pointer to the passed buffer.
Precondition
buffer != NULL
self.rc == 0 (reception report blocks not yet supported)

◆ SmolRTSP_RtcpSr_size()

size_t SmolRTSP_RtcpSr_size ( SmolRTSP_RtcpSr  self)

Computes the size of the binary self.

Currently always returns SMOLRTSP_RTCP_SR_SIZE_BASE; reserved for future support of reception report blocks.