SmolRTSP
0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
|
RTSP data transport (level 4) implementations. More...
#include <smolrtsp/droppable.h>
#include <smolrtsp/io_vec.h>
#include <smolrtsp/writer.h>
#include <interface99.h>
#include <smolrtsp/priv/compiler_attrs.h>
Go to the source code of this file.
Macros | |
#define | SmolRTSP_Transport_IFACE |
A transport-level RTSP data transmitter. More... | |
#define | SmolRTSP_Transport_EXTENDS (SmolRTSP_Droppable) |
The superinterfaces of SmolRTSP_Transport_IFACE. | |
Functions | |
interface99 (SmolRTSP_Transport) | |
Defines the SmolRTSP_Transport interface. More... | |
SmolRTSP_Transport | smolrtsp_transport_tcp (SmolRTSP_Writer w, uint8_t channel_id, size_t max_buffer) SMOLRTSP_PRIV_MUST_USE |
Creates a new TCP transport. More... | |
SmolRTSP_Transport | smolrtsp_transport_udp (int fd) SMOLRTSP_PRIV_MUST_USE |
Creates a new UDP transport. More... | |
int | smolrtsp_dgram_socket (int af, const void *restrict addr, uint16_t port) SMOLRTSP_PRIV_MUST_USE |
Creates a new datagram socket suitable for smolrtsp_transport_udp. More... | |
void * | smolrtsp_sockaddr_ip (const struct sockaddr *restrict addr) SMOLRTSP_PRIV_MUST_USE |
Returns a pointer to the IP address of addr . More... | |
RTSP data transport (level 4) implementations.
#define SmolRTSP_Transport_IFACE |
A transport-level RTSP data transmitter.
See Interface99 for the macro usage.
interface99 | ( | SmolRTSP_Transport | ) |
Defines the SmolRTSP_Transport
interface.
See Interface99 for the macro usage.
int smolrtsp_dgram_socket | ( | int | af, |
const void *restrict | addr, | ||
uint16_t | port | ||
) |
Creates a new datagram socket suitable for smolrtsp_transport_udp.
The algorithm is:
socket(af, SOCK_DGRAM, 0)
.addr
with port
.IP_PMTUDISC_WANT
option to allow IP fragmentation.[in] | af | The socket namespace. Can be AF_INET or AF_INET6 ; if none of them, returns -1 and sets errno to EAFNOSUPPORT . |
[in] | addr | The destination IP address: struct in_addr for AF_INET and struct in6_addr for AF_INET6 . |
[in] | port | The destination IP port in the host byte order. |
errno
appropriately). void* smolrtsp_sockaddr_ip | ( | const struct sockaddr *restrict | addr | ) |
Returns a pointer to the IP address of addr
.
Currently, only AF_INET
and AF_INET6
are supported. Otherwise, NULL
is returned.
addr != NULL
SmolRTSP_Transport smolrtsp_transport_tcp | ( | SmolRTSP_Writer | w, |
uint8_t | channel_id, | ||
size_t | max_buffer | ||
) |
Creates a new TCP transport.
[in] | w | The writer to be provided with data. |
[in] | channel_id | A one-byte channel identifier, as defined in https://datatracker.ietf.org/doc/html/rfc2326#section-10.12. |
w.self && w.vptr
SmolRTSP_Transport smolrtsp_transport_udp | ( | int | fd | ) |
Creates a new UDP transport.
Strictly speaking, it can handle any datagram-oriented protocol, not necessarily UDP. E.g., you may use a SOCK_SEQPACKET
socket for local communication.
[in] | fd | The socket file descriptor to be provided with data. |
fd >= 0