|
SmolRTSP 0.2.0
A small, portable, extensible RTSP 1.0 implementation in C99
|
Utilitary stuff. More...
#include <smolrtsp/option.h>#include <smolrtsp/types/error.h>#include <stdint.h>#include <slice99.h>

Go to the source code of this file.
Data Structures | |
| struct | SmolRTSP_PortPair |
An RTP/RTCP port pair specified as a range, e.g., client_port=3456-3457. More... | |
| struct | SmolRTSP_ChannelPair |
An RTP/RTCP channel pair specified as a range, e.g., interleaved=4-5. More... | |
| struct | SmolRTSP_TransportConfig |
| The RTSP transport configuration. More... | |
Macros | |
| #define | SMOLRTSP_CRLF (CharSlice99_from_str("\r\n")) |
| Carriage-return + new-line represented as a data slice. | |
| #define | SMOLRTSP_DEFAULT_PORT 554 |
| The default RTSP port. | |
Enumerations | |
| enum | SmolRTSP_LowerTransport { SmolRTSP_LowerTransport_TCP , SmolRTSP_LowerTransport_UDP } |
| An RTSP lower transport. More... | |
| enum | SmolRTSP_InterleavedFrameStatus { SmolRTSP_InterleavedFrameStatus_Complete , SmolRTSP_InterleavedFrameStatus_Partial , SmolRTSP_InterleavedFrameStatus_NotInterleaved } |
| The result of smolrtsp_parse_interleaved_frame. More... | |
Functions | |
| const char * | SmolRTSP_LowerTransport_str (SmolRTSP_LowerTransport self) |
Converts self to a string representation ("TCP" for SmolRTSP_LowerTransport_TCP and "UDP" for SmolRTSP_LowerTransport_UDP). | |
| SMOLRTSP_DEF_OPTION (SmolRTSP_PortPair) | |
Defines SmolRTSP_PortPairOption. | |
| SMOLRTSP_DEF_OPTION (SmolRTSP_ChannelPair) | |
Defines SmolRTSP_ChannelPairOption. | |
| int | smolrtsp_parse_transport (SmolRTSP_TransportConfig *restrict config, CharSlice99 header_value) SMOLRTSP_PRIV_MUST_USE |
Parses the Transport header. | |
| uint32_t | smolrtsp_interleaved_header (uint8_t channel_id, uint16_t payload_len) SMOLRTSP_PRIV_MUST_USE |
| Returns a four-octet interleaved binary data header. | |
| void | smolrtsp_parse_interleaved_header (const uint8_t data[restrict static 4], uint8_t *restrict channel_id, uint16_t *restrict payload_len) |
Parses an four-octet interleaved binary data header data. | |
| SmolRTSP_InterleavedFrameStatus | smolrtsp_parse_interleaved_frame (CharSlice99 input, uint8_t *restrict channel_id, U8Slice99 *restrict payload, size_t *restrict consumed) SMOLRTSP_PRIV_MUST_USE |
| Parses one interleaved binary frame (RFC 2326 §10.12). | |
Utilitary stuff.
The result of smolrtsp_parse_interleaved_frame.
| Enumerator | |
|---|---|
| SmolRTSP_InterleavedFrameStatus_Complete | A complete interleaved frame was parsed.
|
| SmolRTSP_InterleavedFrameStatus_Partial | The input starts with the Outputs are untouched. The caller should preserve the buffer and wait for more bytes before retrying. |
| SmolRTSP_InterleavedFrameStatus_NotInterleaved | The input does not begin with Outputs are untouched. The caller should fall through to whichever other parser handles the protocol (typically SmolRTSP_Request_parse or SmolRTSP_Response_parse). |
| SMOLRTSP_DEF_OPTION | ( | SmolRTSP_ChannelPair | ) |
Defines SmolRTSP_ChannelPairOption.
See Datatype99 for the macro usage.
| SMOLRTSP_DEF_OPTION | ( | SmolRTSP_PortPair | ) |
Defines SmolRTSP_PortPairOption.
See Datatype99 for the macro usage.
| uint32_t smolrtsp_interleaved_header | ( | uint8_t | channel_id, |
| uint16_t | payload_len | ||
| ) |
Returns a four-octet interleaved binary data header.
| [in] | channel_id | The one-byte channel identifier. |
| [in] | payload_len | The length of the encapsulated binary data (network byte order). |
| SmolRTSP_InterleavedFrameStatus smolrtsp_parse_interleaved_frame | ( | CharSlice99 | input, |
| uint8_t *restrict | channel_id, | ||
| U8Slice99 *restrict | payload, | ||
| size_t *restrict | consumed | ||
| ) |
Parses one interleaved binary frame (RFC 2326 §10.12).
Used by RTSP servers that want to receive client-pushed media (RTSP back channel / ONVIF Profile T) on a TCP-interleaved RTSP connection. Frames look like $<channel:u8><length:u16-be><payload> on the wire.
| [in] | input | The raw bytes at the head of the receive buffer. |
| [out] | channel_id | The one-byte channel identifier of the frame, set only on SmolRTSP_InterleavedFrameStatus_Complete. |
| [out] | payload | A slice into input covering just the frame payload (no $/channel/length prefix), set only on Complete. The slice is valid as long as input remains valid. |
| [out] | consumed | The number of bytes (4-byte header + payload) the caller should drain from the buffer, set only on Complete. |
channel_id != NULL payload != NULL consumed != NULL | void smolrtsp_parse_interleaved_header | ( | const uint8_t | data[restrict static 4], |
| uint8_t *restrict | channel_id, | ||
| uint16_t *restrict | payload_len | ||
| ) |
Parses an four-octet interleaved binary data header data.
| [in] | data | The header to parse. |
| [out] | channel_id | The one-byte channel identifier. |
| [out] | payload_len | The length of the encapsulated binary data (host byte order). |
channel_id != NULL payload_len != NULL| int smolrtsp_parse_transport | ( | SmolRTSP_TransportConfig *restrict | config, |
| CharSlice99 | header_value | ||
| ) |
Parses the Transport header.
| [out] | config | The result of parsing. It remains unchanged on failure. |
| [in] | header_value | The value of the Transport header. |
config != NULL