SmolRTSP  0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
context.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <smolrtsp/droppable.h>
9 #include <smolrtsp/priv/compiler_attrs.h>
12 #include <smolrtsp/writer.h>
13 
14 #include <stdarg.h>
15 #include <stdint.h>
16 
17 #include <interface99.h>
18 #include <slice99.h>
19 
23 typedef struct SmolRTSP_Context SmolRTSP_Context;
24 
34 SmolRTSP_Context_new(SmolRTSP_Writer w, uint32_t cseq) SMOLRTSP_PRIV_MUST_USE;
35 
41 SmolRTSP_Writer
42 SmolRTSP_Context_get_writer(const SmolRTSP_Context *ctx) SMOLRTSP_PRIV_MUST_USE;
43 
49 uint32_t
50 SmolRTSP_Context_get_cseq(const SmolRTSP_Context *ctx) SMOLRTSP_PRIV_MUST_USE;
51 
59 ssize_t
60 SmolRTSP_Context_get_ret(const SmolRTSP_Context *ctx) SMOLRTSP_PRIV_MUST_USE;
61 
76  SmolRTSP_Context *ctx, CharSlice99 key, const char *restrict fmt,
77  va_list list) SMOLRTSP_PRIV_GCC_ATTR(format(printf, 3, 0));
78 
83  SmolRTSP_Context *ctx, CharSlice99 key, const char *restrict fmt, ...)
84  SMOLRTSP_PRIV_GCC_ATTR(format(printf, 3, 4));
85 
95 
112  SmolRTSP_Context *ctx, SmolRTSP_StatusCode code, const char *reason);
113 
118 
124 
131 declImplExtern99(SmolRTSP_Droppable, SmolRTSP_Context);
void void smolrtsp_header(SmolRTSP_Context *ctx, CharSlice99 key, const char *restrict fmt,...) SMOLRTSP_PRIV_GCC_ATTR(format(printf
The smolrtsp_vheader twin.
ssize_t SmolRTSP_Context_get_ret(const SmolRTSP_Context *ctx) SMOLRTSP_PRIV_MUST_USE
Retrieves the RTSP respond return value.
ssize_t smolrtsp_respond_internal_error(SmolRTSP_Context *ctx)
A shortcut for smolrtsp_respond(ctx, SMOLRTSP_STATUS_INTERNAL_SERVER_ERROR, "Internal error").
void smolrtsp_vheader(SmolRTSP_Context *ctx, CharSlice99 key, const char *restrict fmt, va_list list) SMOLRTSP_PRIV_GCC_ATTR(format(printf
Appends an RTSP header to the request context.
void void void smolrtsp_body(SmolRTSP_Context *ctx, SmolRTSP_MessageBody body)
Sets an RTSP body in the request context.
struct SmolRTSP_Context SmolRTSP_Context
An opaque type used to conveniently respond to RTSP clients.
Definition: context.h:23
SmolRTSP_Context * SmolRTSP_Context_new(SmolRTSP_Writer w, uint32_t cseq) SMOLRTSP_PRIV_MUST_USE
Creates a new SmolRTSP context.
uint32_t SmolRTSP_Context_get_cseq(const SmolRTSP_Context *ctx) SMOLRTSP_PRIV_MUST_USE
Retrieves cseq specified in SmolRTSP_Context_new.
SmolRTSP_Writer SmolRTSP_Context_get_writer(const SmolRTSP_Context *ctx) SMOLRTSP_PRIV_MUST_USE
Retrieves the writer specified in SmolRTSP_Context_new.
declImplExtern99(SmolRTSP_Droppable, SmolRTSP_Context)
Implements SmolRTSP_Droppable_IFACE for SmolRTSP_Context.
ssize_t smolrtsp_respond(SmolRTSP_Context *ctx, SmolRTSP_StatusCode code, const char *reason)
Writes an RTSP response to the underlying writer.
ssize_t smolrtsp_respond_ok(SmolRTSP_Context *ctx)
A shortcut for smolrtsp_respond(ctx, SMOLRTSP_STATUS_OK, "OK").
Droppable types support.
An RTSP message body.
CharSlice99 SmolRTSP_MessageBody
An RTSP message body.
Definition: message_body.h:19
An RTSP status code.
uint16_t SmolRTSP_StatusCode
An RTSP status code.
Definition: status_code.h:20
The writer interface.