SmolRTSP  0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
sdp.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <smolrtsp/priv/compiler_attrs.h>
10 #include <smolrtsp/writer.h>
11 
12 #include <slice99.h>
13 
17 typedef char SmolRTSP_SdpType;
18 
22 typedef struct {
27 
31  CharSlice99 value;
33 
46  const SmolRTSP_SdpLine *restrict self,
47  SmolRTSP_Writer w) SMOLRTSP_PRIV_MUST_USE;
48 
62  SmolRTSP_Writer w, SmolRTSP_SdpType ty, const char *restrict fmt,
63  ...) SMOLRTSP_PRIV_MUST_USE SMOLRTSP_PRIV_GCC_ATTR(format(printf, 3, 4));
64 
113 #define SMOLRTSP_SDP_DESCRIBE(ret, w, ...) \
114  SMOLRTSP_PRIV_SDP_DESCRIBE(ret, w, __VA_ARGS__)
115 
116 #ifndef DOXYGEN_IGNORE
117 
118 #include <metalang99.h>
119 
120 #define SMOLRTSP_PRIV_SDP_DESCRIBE(ret, w, ...) \
121  do { \
122  ssize_t smolrtsp_priv_sdp_ret = 0; \
123  ML99_EVAL(ML99_variadicsForEach( \
124  ML99_compose( \
125  ML99_appl(v(SMOLRTSP_PRIV_genSdpPrintf), v(ret, w)), \
126  v(ML99_untuple)), \
127  v(__VA_ARGS__))) \
128  } while (0)
129 
130 #define SMOLRTSP_PRIV_genSdpPrintf_IMPL(ret, w, ty, ...) \
131  v({ \
132  smolrtsp_priv_sdp_ret = smolrtsp_sdp_printf(w, ty, __VA_ARGS__); \
133  if (smolrtsp_priv_sdp_ret < 0) { \
134  break; \
135  } \
136  ret += smolrtsp_priv_sdp_ret; \
137  })
138 
139 #define SMOLRTSP_PRIV_genSdpPrintf_ARITY 2
140 
141 #endif // DOXYGEN_IGNORE
142 
146 #define SMOLRTSP_SDP_VERSION 'v'
147 
151 #define SMOLRTSP_SDP_ORIGIN 'o'
152 
156 #define SMOLRTSP_SDP_SESSION_NAME 's'
157 
161 #define SMOLRTSP_SDP_INFO 'i'
162 
166 #define SMOLRTSP_SDP_URI 'u'
167 
171 #define SMOLRTSP_SDP_EMAIL 'e'
172 
176 #define SMOLRTSP_SDP_PHONE 'p'
177 
181 #define SMOLRTSP_SDP_CONNECTION 'c'
182 
186 #define SMOLRTSP_SDP_BANDWIDTH 'b'
187 
191 #define SMOLRTSP_SDP_TIME 't'
192 
196 #define SMOLRTSP_SDP_REPEAT 'r'
197 
201 #define SMOLRTSP_SDP_TIME_ZONES 'z'
202 
206 #define SMOLRTSP_SDP_ENCRYPTION_KEYS 'k'
207 
211 #define SMOLRTSP_SDP_ATTR 'a'
212 
216 #define SMOLRTSP_SDP_MEDIA 'm'
char SmolRTSP_SdpType
An SDP type (one character).
Definition: sdp.h:17
ssize_t smolrtsp_sdp_printf(SmolRTSP_Writer w, SmolRTSP_SdpType ty, const char *restrict fmt,...) SMOLRTSP_PRIV_MUST_USE SMOLRTSP_PRIV_GCC_ATTR(format(printf
Printfs a single SDP line to w.
ssize_t SmolRTSP_SdpLine_serialize(const SmolRTSP_SdpLine *restrict self, SmolRTSP_Writer w) SMOLRTSP_PRIV_MUST_USE
Serialises self into w.
An SDP line.
Definition: sdp.h:22
SmolRTSP_SdpType ty
The type of this line.
Definition: sdp.h:26
CharSlice99 value
The value of this line.
Definition: sdp.h:31
The writer interface.