|
SmolRTSP 0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
|
An RTSP requests controller. More...
#include <smolrtsp/context.h>#include <smolrtsp/droppable.h>#include <smolrtsp/types/request.h>#include <smolrtsp/writer.h>#include <stddef.h>#include <interface99.h>

Go to the source code of this file.
Macros | |
| #define | SmolRTSP_Controller_IFACE |
| A controller that handles incoming RTSP requests. | |
| #define | SmolRTSP_Controller_EXTENDS (SmolRTSP_Droppable) |
| The superinterfaces of SmolRTSP_Controller_IFACE. | |
Enumerations | |
| enum | SmolRTSP_ControlFlow { SmolRTSP_ControlFlow_Break , SmolRTSP_ControlFlow_Continue } |
| Whether to stop or continue some processing. More... | |
Functions | |
| interface99 (SmolRTSP_Controller) | |
Defines the SmolRTSP_Controller interface. | |
| void | smolrtsp_dispatch (SmolRTSP_Writer conn, SmolRTSP_Controller controller, const SmolRTSP_Request *restrict req) |
Dispatches an incoming request to controller. | |
An RTSP requests controller.
| #define SmolRTSP_Controller_IFACE |
A controller that handles incoming RTSP requests.
All RTSP command handlers accept the following parameters:
ctx – a request context used to respond to your RTSP client.req – a fully parsed request object. | enum SmolRTSP_ControlFlow |
| interface99 | ( | SmolRTSP_Controller | ) |
Defines the SmolRTSP_Controller interface.
See Interface99 for the macro usage.
| void smolrtsp_dispatch | ( | SmolRTSP_Writer | conn, |
| SmolRTSP_Controller | controller, | ||
| const SmolRTSP_Request *restrict | req | ||
| ) |
Dispatches an incoming request to controller.
The algorithm is as follows:
before method of controller. Here you should do some preliminary stuff like logging a request or setting up initial response headers via smolrtsp_header. If before returns SmolRTSP_ControlFlow_Break, jump to step #4.controller. Here you should handle the request and respond to your client via smolrtsp_respond/smolrtsp_respond_ok or similar.after method of controller. Here you automatically receive the return value of smolrtsp_respond_* (invoked during one of the previous steps). If it is <0, it means that something bad happened so that the handler has not been able to respond properly.| [out] | conn | The writer to send RTSP responses. |
| [in] | controller | The controller to handle the incoming request req. |
| [in] | req | The fully parsed RTSP request object. |
conn.self && conn.vptr controller.self && controller.vptr req != NULL