|
Compy 0.2.0
A lightweight RTSP 1.0 server library for embedded systems
|
A request context. More...
#include <compy/droppable.h>#include <compy/priv/compiler_attrs.h>#include <compy/types/message_body.h>#include <compy/types/status_code.h>#include <compy/writer.h>#include <stdarg.h>#include <stdint.h>#include <interface99.h>#include <slice99.h>

Go to the source code of this file.
Typedefs | |
| typedef struct Compy_Context | Compy_Context |
| An opaque type used to conveniently respond to RTSP clients. | |
Functions | |
| Compy_Context * | Compy_Context_new (Compy_Writer w, uint32_t cseq) COMPY_PRIV_MUST_USE |
| Creates a new Compy context. | |
| Compy_Writer | Compy_Context_get_writer (const Compy_Context *ctx) COMPY_PRIV_MUST_USE |
| Retrieves the writer specified in Compy_Context_new. | |
| uint32_t | Compy_Context_get_cseq (const Compy_Context *ctx) COMPY_PRIV_MUST_USE |
Retrieves cseq specified in Compy_Context_new. | |
| ssize_t | Compy_Context_get_ret (const Compy_Context *ctx) COMPY_PRIV_MUST_USE |
| Retrieves the RTSP respond return value. | |
| void | compy_vheader (Compy_Context *ctx, CharSlice99 key, const char *restrict fmt, va_list list) COMPY_PRIV_GCC_ATTR(format(printf |
| Appends an RTSP header to the request context. | |
| void void | compy_header (Compy_Context *ctx, CharSlice99 key, const char *restrict fmt,...) COMPY_PRIV_GCC_ATTR(format(printf |
| The compy_vheader twin. | |
| void void void | compy_body (Compy_Context *ctx, Compy_MessageBody body) |
| Sets an RTSP body in the request context. | |
| ssize_t | compy_respond (Compy_Context *ctx, Compy_StatusCode code, const char *reason) |
| Writes an RTSP response to the underlying writer. | |
| ssize_t | compy_respond_ok (Compy_Context *ctx) |
A shortcut for compy_respond(ctx, COMPY_STATUS_OK, "OK"). | |
| ssize_t | compy_respond_internal_error (Compy_Context *ctx) |
A shortcut for compy_respond(ctx, COMPY_STATUS_INTERNAL_SERVER_ERROR, "Internal error"). | |
| declImplExtern99 (Compy_Droppable, Compy_Context) | |
| Implements Compy_Droppable_IFACE for Compy_Context. | |
A request context.
| void void void compy_body | ( | Compy_Context * | ctx, |
| Compy_MessageBody | body | ||
| ) |
Sets an RTSP body in the request context.
| [out] | ctx | The request context to modify. |
| [in] | body | The RTSP body. |
ctx != NULL | uint32_t Compy_Context_get_cseq | ( | const Compy_Context * | ctx | ) |
Retrieves cseq specified in Compy_Context_new.
ctx != NULL | ssize_t Compy_Context_get_ret | ( | const Compy_Context * | ctx | ) |
Retrieves the RTSP respond return value.
If you have not responded yet, the result is 0.
ctx != NULL | Compy_Writer Compy_Context_get_writer | ( | const Compy_Context * | ctx | ) |
Retrieves the writer specified in Compy_Context_new.
ctx != NULL | Compy_Context * Compy_Context_new | ( | Compy_Writer | w, |
| uint32_t | cseq | ||
| ) |
Creates a new Compy context.
| [in] | w | The writer to be provided with the response. |
| [in] | cseq | The sequence number for an RTSP request/response pair. |
w.self && w.vptr | ssize_t compy_respond | ( | Compy_Context * | ctx, |
| Compy_StatusCode | code, | ||
| const char * | reason | ||
| ) |
Writes an RTSP response to the underlying writer.
The CSeq and Content-Length headers will be written automatically as first headers.
| [out] | ctx | The request context to write the response to. |
| [in] | code | The RTSP status code. |
| [in] | reason | The RTSP reason phrase. |
ctx != NULL reason is a null-terminated string.| void compy_vheader | ( | Compy_Context * | ctx, |
| CharSlice99 | key, | ||
| const char *restrict | fmt, | ||
| va_list | list | ||
| ) |
Appends an RTSP header to the request context.
| [out] | ctx | The request context to modify. |
| [in] | key | The header key. |
| [in] | fmt | The printf-like format string (header value). |
| [in] | list | The variadic function arguments. |
ctx != NULL ctx must contain strictly less than COMPY_HEADER_MAP_CAPACITY headers. fmt != NULL | declImplExtern99 | ( | Compy_Droppable | , |
| Compy_Context | |||
| ) |
Implements Compy_Droppable_IFACE for Compy_Context.
See Interface99 for the macro usage.