SmolRTSP  0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
transport.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <smolrtsp/droppable.h>
9 #include <smolrtsp/io_vec.h>
10 #include <smolrtsp/writer.h>
11 
12 #include <interface99.h>
13 
14 #include <smolrtsp/priv/compiler_attrs.h>
15 
22 #define SmolRTSP_Transport_IFACE \
23  \
24  /* \
25  * Transmits a slice of I/O vectors @p bufs. \
26  * \
27  * @return -1 if an I/O error occurred and sets `errno` appropriately, 0 \
28  * on success. \
29  */ \
30  vfunc99(int, transmit, VSelf99, SmolRTSP_IoVecSlice bufs) \
31  vfunc99(bool, is_full, VSelf99)
32 
36 #define SmolRTSP_Transport_EXTENDS (SmolRTSP_Droppable)
37 
44 interface99(SmolRTSP_Transport);
45 
55 SmolRTSP_Transport smolrtsp_transport_tcp(
56  SmolRTSP_Writer w, uint8_t channel_id,
57  size_t max_buffer) SMOLRTSP_PRIV_MUST_USE;
58 
70 SmolRTSP_Transport smolrtsp_transport_udp(int fd) SMOLRTSP_PRIV_MUST_USE;
71 
89 int smolrtsp_dgram_socket(int af, const void *restrict addr, uint16_t port)
90  SMOLRTSP_PRIV_MUST_USE;
91 
100 void *smolrtsp_sockaddr_ip(const struct sockaddr *restrict addr)
101  SMOLRTSP_PRIV_MUST_USE;
Droppable types support.
Vectored I/O support.
interface99(SmolRTSP_Transport)
Defines the SmolRTSP_Transport interface.
SmolRTSP_Transport smolrtsp_transport_udp(int fd) SMOLRTSP_PRIV_MUST_USE
Creates a new UDP transport.
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.
void * smolrtsp_sockaddr_ip(const struct sockaddr *restrict addr) SMOLRTSP_PRIV_MUST_USE
Returns a pointer to the IP address of addr.
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.
The writer interface.