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

An RTSP message body. More...

#include <smolrtsp/priv/compiler_attrs.h>
#include <smolrtsp/types/error.h>
#include <stdbool.h>
#include <stddef.h>
#include <slice99.h>
Include dependency graph for message_body.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SMOLRTSP_MAX_CONTENT_LENGTH   65536
 The largest Content-Length a parsed request or response may declare.

Typedefs

typedef CharSlice99 SmolRTSP_MessageBody
 An RTSP message body.

Functions

SmolRTSP_ParseResult SmolRTSP_MessageBody_parse (SmolRTSP_MessageBody *restrict self, CharSlice99 input, size_t content_length) SMOLRTSP_PRIV_MUST_USE
 Parses data to self.
SmolRTSP_MessageBody SmolRTSP_MessageBody_empty (void) SMOLRTSP_PRIV_MUST_USE
 Returns an empty message body.
bool SmolRTSP_MessageBody_eq (const SmolRTSP_MessageBody *restrict lhs, const SmolRTSP_MessageBody *restrict rhs) SMOLRTSP_PRIV_MUST_USE
 Tests lhs and rhs for equality.

Detailed Description

An RTSP message body.

Macro Definition Documentation

◆ SMOLRTSP_MAX_CONTENT_LENGTH

#define SMOLRTSP_MAX_CONTENT_LENGTH   65536

The largest Content-Length a parsed request or response may declare.

Larger values are rejected with #SmolRTSP_ParseError_ContentLength rather than waited for: a peer that declares a body of SIZE_MAX bytes would otherwise keep a request Partial, and its bytes buffered, for as long as it keeps sending. RTSP bodies are SDP and parameter lists, a few kilobytes at most. The parsers are compiled with this value, so an override has to be in the library's own build: configure with -DSMOLRTSP_MAX_CONTENT_LENGTH=<n>, which also defines it for consumers of the target. Values above SIZE_MAX are treated as SIZE_MAX.

Function Documentation

◆ SmolRTSP_MessageBody_eq()

bool SmolRTSP_MessageBody_eq ( const SmolRTSP_MessageBody *restrict lhs,
const SmolRTSP_MessageBody *restrict rhs )

Tests lhs and rhs for equality.

Precondition
lhs != NULL
rhs != NULL

◆ SmolRTSP_MessageBody_parse()

SmolRTSP_ParseResult SmolRTSP_MessageBody_parse ( SmolRTSP_MessageBody *restrict self,
CharSlice99 input,
size_t content_length )

Parses data to self.

Precondition
self != NULL