|
Compy 0.2.0
A lightweight RTSP 1.0 server library for embedded systems
|
RTSP data transport (level 4) implementations. More...
#include <compy/droppable.h>#include <compy/io_vec.h>#include <compy/writer.h>#include <interface99.h>#include <compy/priv/compiler_attrs.h>

Go to the source code of this file.
Macros | |
| #define | Compy_Transport_IFACE |
| A transport-level RTSP data transmitter. | |
| #define | Compy_Transport_EXTENDS (Compy_Droppable) |
| The superinterfaces of Compy_Transport_IFACE. | |
Functions | |
| interface99 (Compy_Transport) | |
Defines the Compy_Transport interface. | |
| Compy_Transport | compy_transport_tcp (Compy_Writer w, uint8_t channel_id, size_t max_buffer) COMPY_PRIV_MUST_USE |
| Creates a new TCP transport. | |
| Compy_Transport | compy_transport_udp (int fd) COMPY_PRIV_MUST_USE |
| Creates a new UDP transport. | |
| int | compy_dgram_socket (int af, const void *restrict addr, uint16_t port) COMPY_PRIV_MUST_USE |
| Creates a new datagram socket suitable for compy_transport_udp. | |
| int | compy_recv_dgram_socket (int af, uint16_t port) COMPY_PRIV_MUST_USE |
| Creates a new datagram socket bound to a local port for receiving. | |
| void * | compy_sockaddr_ip (const struct sockaddr *restrict addr) COMPY_PRIV_MUST_USE |
Returns a pointer to the IP address of addr. | |
RTSP data transport (level 4) implementations.
| #define Compy_Transport_IFACE |
A transport-level RTSP data transmitter.
See Interface99 for the macro usage.
| int compy_dgram_socket | ( | int | af, |
| const void *restrict | addr, | ||
| uint16_t | port | ||
| ) |
Creates a new datagram socket suitable for compy_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). | int compy_recv_dgram_socket | ( | int | af, |
| uint16_t | port | ||
| ) |
Creates a new datagram socket bound to a local port for receiving.
Mirrors compy_dgram_socket (which creates a connected send socket). Suitable for receiving backchannel RTP or RTCP data.
| [in] | af | The address family (AF_INET or AF_INET6). |
| [in] | port | The local port to bind to (host byte order). |
| void * compy_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 | Compy_Transport compy_transport_tcp | ( | Compy_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 | Compy_Transport compy_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 | interface99 | ( | Compy_Transport | ) |
Defines the Compy_Transport interface.
See Interface99 for the macro usage.