arduino-audio-tools
Loading...
Searching...
No Matches
RTSPPlatform< TcpServer, TcpClient, UdpSocket > Class Template Reference

Template-based platform abstraction for RTSP networking. More...

#include <CodecOpusOgg.h>

Public Types

using TcpClientType = TcpClient
using TcpServerType = TcpServer
using UdpSocketType = UdpSocket

Static Public Member Functions

static void closeSocket (TcpClient *s)
 Close a TCP socket connection.
static void closeUdpSocket (UdpSocket *s)
 Close a UDP socket.
static TcpServerType * createServer (uint16_t port)
 Create a TCP server listening on provided port.
static UdpSocket * createUdpSocket (unsigned short portNum)
 Create and bind a UDP socket.
static TcpClientType getAvailableClient (TcpServerType *srv)
 Get next available client from server.
static void getSocketPeerAddr (TcpClient *s, IPAddress *addr, uint16_t *port)
 Get remote peer address and port from TCP socket.
static int readSocket (TcpClient *sock, char *buf, size_t buflen, int timeoutmsec)
 Read from TCP socket with timeout.
static ssize_t sendSocket (TcpClient *sockfd, const void *buf, size_t len)
 Send data over TCP socket.
static ssize_t sendUdpSocket (UdpSocket *sockfd, const void *buf, size_t len, IPAddress destaddr, uint16_t destport)
 Send UDP packet to specified destination.

Static Public Attributes

static constexpr TcpClient * NULL_TCP_SOCKET = nullptr
static constexpr UdpSocket * NULL_UDP_SOCKET = nullptr

Detailed Description

template<typename TcpServer, typename TcpClient, typename UdpSocket>
class audio_tools::audio_tools::RTSPPlatform< TcpServer, TcpClient, UdpSocket >

Template-based platform abstraction for RTSP networking.

This template class provides a unified interface for network operations across different platforms while maintaining type safety. The template parameters allow customization of the underlying network implementation.

Author
Phil Schatzmann
Template Parameters
TcpClientTCP client implementation (e.g., WiFiClient, EthernetClient)
UdpSocketUDP socket implementation (e.g., WiFiUDP, EthernetUDP)

Member Typedef Documentation

◆ TcpClientType

template<typename TcpServer, typename TcpClient, typename UdpSocket>
using TcpClientType = TcpClient

◆ TcpServerType

template<typename TcpServer, typename TcpClient, typename UdpSocket>
using TcpServerType = TcpServer

◆ UdpSocketType

template<typename TcpServer, typename TcpClient, typename UdpSocket>
using UdpSocketType = UdpSocket

Member Function Documentation

◆ closeSocket()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
void closeSocket ( TcpClient * s)
inlinestatic

Close a TCP socket connection.

Parameters
sTCP socket to close

◆ closeUdpSocket()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
void closeUdpSocket ( UdpSocket * s)
inlinestatic

Close a UDP socket.

Parameters
sUDP socket to close

◆ createServer()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
TcpServerType * createServer ( uint16_t port)
inlinestatic

Create a TCP server listening on provided port.

◆ createUdpSocket()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
UdpSocket * createUdpSocket ( unsigned short portNum)
inlinestatic

Create and bind a UDP socket.

Parameters
portNumPort number to bind to
Returns
Pointer to created UDP socket, or nullptr on failure

◆ getAvailableClient()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
TcpClientType getAvailableClient ( TcpServerType * srv)
inlinestatic

Get next available client from server.

◆ getSocketPeerAddr()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
void getSocketPeerAddr ( TcpClient * s,
IPAddress * addr,
uint16_t * port )
inlinestatic

Get remote peer address and port from TCP socket.

Parameters
sTCP socket
addrOutput parameter for remote IP address
portOutput parameter for remote port

◆ readSocket()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
int readSocket ( TcpClient * sock,
char * buf,
size_t buflen,
int timeoutmsec )
inlinestatic

Read from TCP socket with timeout.

Parameters
sockTCP socket
bufBuffer to read into
buflenBuffer length
timeoutmsecTimeout in milliseconds
Returns
0=socket closed, -1=timeout, >0=number of bytes read

◆ sendSocket()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
ssize_t sendSocket ( TcpClient * sockfd,
const void * buf,
size_t len )
inlinestatic

Send data over TCP socket.

Parameters
sockfdTCP socket
bufData buffer to send
lenLength of data
Returns
Number of bytes sent

◆ sendUdpSocket()

template<typename TcpServer, typename TcpClient, typename UdpSocket>
ssize_t sendUdpSocket ( UdpSocket * sockfd,
const void * buf,
size_t len,
IPAddress destaddr,
uint16_t destport )
inlinestatic

Send UDP packet to specified destination.

Parameters
sockfdUDP socket
bufData buffer to send
lenLength of data
destaddrDestination IP address
destportDestination port
Returns
Number of bytes sent

Member Data Documentation

◆ NULL_TCP_SOCKET

template<typename TcpServer, typename TcpClient, typename UdpSocket>
TcpClient* NULL_TCP_SOCKET = nullptr
staticconstexpr

◆ NULL_UDP_SOCKET

template<typename TcpServer, typename TcpClient, typename UdpSocket>
UdpSocket* NULL_UDP_SOCKET = nullptr
staticconstexpr

The documentation for this class was generated from the following file: