reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
reTurn::UdpServer Class Reference

#include <UdpServer.hxx>

Inheritance diagram for reTurn::UdpServer:
[legend]

Public Member Functions

 UdpServer (asio::io_context &ioService, RequestHandler &requestHandler, const asio::ip::address &address, unsigned short port)
 Create the server to listen on the specified UDP address and port.
 
 UdpServer (const UdpServer &)=delete
 
 UdpServer (UdpServer &&)=delete
 
 ~UdpServer ()
 
UdpServer & operator= (const UdpServer &)=delete
 
UdpServer & operator= (UdpServer &&)=delete
 
virtual void start () override
 
void setAlternateUdpServers (UdpServer *alternatePort, UdpServer *alternateIp, UdpServer *alternateIpPort)
 This method is used if this UdpServer supports RFC3489 operation - note turnFraming in constructor must be false.
 
bool isRFC3489BackwardsCompatServer ()
 
asio::ip::udp::socket & getSocket ()
 
void cleanupResponseMap (const asio::error_code &e, UInt128 tid)
 
- Public Member Functions inherited from reTurn::AsyncUdpSocketBase
 AsyncUdpSocketBase (asio::io_context &ioService)
 
unsigned int getSocketDescriptor () override
 
asio::error_code bind (const asio::ip::address &address, unsigned short port) override
 Note: The following API's are thread safe and queue the request to be handled by the ioService thread.
 
void connect (const std::string &address, unsigned short port) override
 
void transportReceive () override
 
void transportFramedReceive () override
 
void transportSend (const StunTuple &destination, std::vector< asio::const_buffer > &buffers) override
 
void transportClose () override
 
asio::ip::address getSenderEndpointAddress () override
 
unsigned short getSenderEndpointPort () override
 
- Public Member Functions inherited from reTurn::AsyncSocketBase
 AsyncSocketBase (asio::io_context &ioService)
 
virtual ~AsyncSocketBase ()
 
virtual void registerAsyncSocketBaseHandler (AsyncSocketBaseHandler *handler)
 
virtual void send (const StunTuple &destination, const std::shared_ptr< DataBuffer > &data)
 Note: destination is ignored for TCP and TLS connections.
 
virtual void send (const StunTuple &destination, unsigned short channel, const std::shared_ptr< DataBuffer > &data)
 
virtual void receive ()
 Overlapped calls to receive functions have no effect.
 
virtual void framedReceive ()
 
virtual void close ()
 
bool isConnected () const noexcept
 
asio::ip::address & getConnectedAddress () noexcept
 
unsigned short getConnectedPort () const noexcept
 
virtual void setOnBeforeSocketClosedFp (BeforeClosedHandler fp)
 
virtual void doSend (const StunTuple &destination, unsigned short channel, const std::shared_ptr< DataBuffer > &data, const std::size_t bufferStartPos=0)
 Use these if you already operating within the ioService thread.
 
virtual void doSend (const StunTuple &destination, const std::shared_ptr< DataBuffer > &data, const std::size_t bufferStartPos=0)
 
virtual void doReceive ()
 
virtual void doFramedReceive ()
 
virtual void onConnectSuccess ()
 Class override callbacks.
 
virtual void onConnectFailure (const asio::error_code &e)
 
virtual void stop ()
 
virtual void handleReadHeader (const asio::error_code &e)
 
virtual void handleServerHandshake (const asio::error_code &e)
 
virtual void handleTcpResolve (const asio::error_code &ec, const asio::ip::tcp::resolver::results_type &endpoints)
 
virtual void handleConnect (const asio::error_code &ec, const asio::ip::tcp::endpoint &endpoint)
 
virtual void handleClientHandshake (const asio::error_code &ec, const asio::ip::tcp::endpoint &endpoint)
 

Additional Inherited Members

- Public Types inherited from reTurn::AsyncSocketBase
using BeforeClosedHandler = std::function< void(unsigned int)>
 
- Static Public Member Functions inherited from reTurn::AsyncSocketBase
static std::shared_ptr< DataBuffer > allocateBuffer (size_t size)
 Utility API.
 
static size_t channelDataPadding (size_t length)
 Over TCP and TLS, a TURN ChannelData message is padded to a multiple of 4 bytes, the padding not counted in its length (RFC 5766 11.5, RFC 8656 12.5): the padding after one of length bytes.
 
static void setExclusiveAddressUse (asio::ip::udp::socket &socket)
 For a UDP socket, between open() and bind().
 
- Protected Member Functions inherited from reTurn::AsyncUdpSocketBase
void handleUdpResolve (const asio::error_code &ec, const asio::ip::udp::resolver::results_type &endpoints) override
 
- Protected Member Functions inherited from reTurn::AsyncSocketBase
virtual void handleSend (const asio::error_code &e)
 Handle completion of a sendData operation.
 
virtual void handleReceive (const asio::error_code &e, size_t bytesTransferred)
 
asio::error_code openAndBind (asio::ip::tcp::socket &socket)
 For TCP and TLS client sockets.
 
void asyncConnect (asio::ip::tcp::socket &socket, const asio::ip::tcp::resolver::results_type &endpoints)
 
void startIdleTimer (unsigned int timeoutSeconds, std::function< bool()> inUse)
 For server connections (TcpConnectionIdleTimeout): the connection is closed, with close(), once nothing has been received on it for timeoutSeconds while inUse() is false - eg.
 
void noteReceived ()
 
void stopIdleTimer ()
 
- Protected Attributes inherited from reTurn::AsyncUdpSocketBase
asio::ip::udp::socket mSocket
 
asio::ip::udp::resolver mResolver
 
asio::ip::udp::endpoint mSenderEndpoint
 Endpoint info for current sender.
 
- Protected Attributes inherited from reTurn::AsyncSocketBase
asio::ip::tcp::endpoint mLocalTcpEndpoint
 
asio::io_context & mIOService
 The io_context used to perform asynchronous operations.
 
std::shared_ptr< DataBuffer > mReceiveBuffer
 Receive Buffer and state.
 
bool mReceiving
 
asio::ip::address mConnectedAddress
 Connected Info and State.
 
unsigned short mConnectedPort
 
bool mConnected
 
AsyncSocketBaseHandler * mAsyncSocketBaseHandler
 Handlers.
 
BeforeClosedHandler mOnBeforeSocketCloseFp
 Provides an opportunity for the app to clean up, e.g., QoS-related data or resources just before the socket is closed.
 

Detailed Description

Definition at line 16 of file UdpServer.hxx.

Constructor & Destructor Documentation

◆ UdpServer() [1/3]

reTurn::UdpServer::UdpServer ( asio::io_context &  ioService,
RequestHandler &  requestHandler,
const asio::ip::address &  address,
unsigned short  port 
)
explicit

Create the server to listen on the specified UDP address and port.

Definition at line 22 of file UdpServer.cxx.

◆ UdpServer() [2/3]

reTurn::UdpServer::UdpServer ( const UdpServer &  )
delete

◆ UdpServer() [3/3]

reTurn::UdpServer::UdpServer ( UdpServer &&  )
delete

◆ ~UdpServer()

reTurn::UdpServer::~UdpServer ( )

Definition at line 41 of file UdpServer.cxx.

Member Function Documentation

◆ cleanupResponseMap()

void reTurn::UdpServer::cleanupResponseMap ( const asio::error_code &  e,
UInt128  tid 
)

Definition at line 229 of file UdpServer.cxx.

◆ getSocket()

asio::ip::udp::socket & reTurn::UdpServer::getSocket ( )

Definition at line 78 of file UdpServer.cxx.

◆ isRFC3489BackwardsCompatServer()

bool reTurn::UdpServer::isRFC3489BackwardsCompatServer ( )

Definition at line 72 of file UdpServer.cxx.

◆ operator=() [1/2]

UdpServer & reTurn::UdpServer::operator= ( const UdpServer &  )
delete

◆ operator=() [2/2]

UdpServer & reTurn::UdpServer::operator= ( UdpServer &&  )
delete

◆ setAlternateUdpServers()

void reTurn::UdpServer::setAlternateUdpServers ( UdpServer *  alternatePort,
UdpServer *  alternateIp,
UdpServer *  alternateIpPort 
)

This method is used if this UdpServer supports RFC3489 operation - note turnFraming in constructor must be false.

Definition at line 61 of file UdpServer.cxx.

◆ start()

void reTurn::UdpServer::start ( )
overridevirtual

Reimplemented from reTurn::AsyncSocketBase.

Definition at line 52 of file UdpServer.cxx.


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