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

#include <TurnAsyncTcpSocket.hxx>

Inheritance diagram for reTurn::TurnAsyncTcpSocket:
[legend]

Public Member Functions

 TurnAsyncTcpSocket (asio::io_context &ioService, TurnAsyncSocketHandler *turnAsyncSocketHandler, const asio::ip::address &address=UnspecifiedIpAddress, unsigned short port=0)
 
virtual unsigned int getSocketDescriptor ()
 
- Public Member Functions inherited from reTurn::TurnAsyncSocket
 TurnAsyncSocket (asio::io_context &ioService, AsyncSocketBase &asyncSocketBase, TurnAsyncSocketHandler *turnAsyncSocketHandler, const asio::ip::address &address=UnspecifiedIpAddress, unsigned short port=0)
 
virtual ~TurnAsyncSocket ()
 
virtual void disableTurnAsyncHandler ()
 
const asio::error_code & getBindError () const
 The outcome of binding the socket to the local address and port it was created with: eg.
 
void requestSharedSecret ()
 
void setUsernameAndPassword (const char *username, const char *password, bool shortTermAuth=false)
 
void setLocalPassword (const char *password)
 
void setSoftware (const char *software)
 
void connect (const std::string &address, unsigned short port)
 
void bindRequest ()
 
void connectivityCheck (const StunTuple &targetAddr, uint32_t peerRflxPriority, bool setIceControlling, bool setIceControlled, unsigned int numRetransmits, unsigned int retrans_iterval_ms)
 
void createAllocation (unsigned int lifetimeSecs=UnspecifiedLifetime, unsigned int bandwidth=UnspecifiedBandwidth, unsigned char requestedPortProps=StunMessage::PropsNone, uint64_t reservationToken=UnspecifiedToken, StunTuple::TransportType requestedTransportType=StunTuple::None)
 
void refreshAllocation (unsigned int lifetimeSecs)
 
void destroyAllocation ()
 
void setActiveDestination (const asio::ip::address &address, unsigned short port)
 
void clearActiveDestination ()
 
asio::ip::address & getConnectedAddress () noexcept
 
unsigned short getConnectedPort () const noexcept
 
virtual void send (const char *buffer, size_t size)
 
virtual void sendTo (const asio::ip::address &address, unsigned short port, const char *buffer, size_t size)
 
virtual void sendUnframed (const std::shared_ptr< DataBuffer > &data)
 
virtual void sendFramed (const std::shared_ptr< DataBuffer > &data)
 
virtual void sendToUnframed (const asio::ip::address &address, unsigned short port, const std::shared_ptr< DataBuffer > &data)
 
virtual void sendToFramed (const asio::ip::address &address, unsigned short port, const std::shared_ptr< DataBuffer > &data)
 
virtual void close ()
 
virtual void turnReceive ()
 
virtual void setOnBeforeSocketClosedFp (AsyncSocketBase::BeforeClosedHandler fp)
 
- Public Member Functions inherited from reTurn::AsyncTcpSocketBase
 AsyncTcpSocketBase (asio::io_context &ioService)
 
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
 
virtual void setConnectedAddressAndPort ()
 
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 start ()
 
virtual void stop ()
 
virtual void handleServerHandshake (const asio::error_code &e)
 
virtual void handleUdpResolve (const asio::error_code &ec, const asio::ip::udp::resolver::results_type &endpoints)
 
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().
 
- Static Public Attributes inherited from reTurn::TurnAsyncSocket
static unsigned int UnspecifiedLifetime = 0xFFFFFFFF
 
static unsigned int UnspecifiedBandwidth = 0xFFFFFFFF
 
static unsigned short UnspecifiedToken = 0
 
static asio::ip::address UnspecifiedIpAddress
 
- Protected Member Functions inherited from reTurn::TurnAsyncSocket
void handleReceivedData (const asio::ip::address &address, unsigned short port, const std::shared_ptr< DataBuffer > &data)
 
void handleChannelData (const std::shared_ptr< DataBuffer > &data)
 
- Protected Member Functions inherited from reTurn::AsyncTcpSocketBase
void handleReadHeader (const asio::error_code &e) override
 
void handleTcpResolve (const asio::error_code &ec, const asio::ip::tcp::resolver::results_type &endpoints) override
 
void handleConnect (const asio::error_code &ec, const asio::ip::tcp::endpoint &endpoint) 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::TurnAsyncSocket
asio::error_code mBindError
 
asio::io_context & mIOService
 
TurnAsyncSocketHandler * mTurnAsyncSocketHandler
 
resip::RecursiveMutex mHandlerMutex
 
StunTuple mLocalBinding
 
resip::Data mUsername
 
resip::Data mPassword
 
resip::Data mHmacKey
 
resip::Data mRealm
 
resip::Data mNonce
 
resip::Data mSoftware
 
resip::Data mLocalHmacKey
 
StunTuple::TransportType mRequestedTransportType
 
bool mHaveAllocation
 
StunTuple::TransportType mRelayTransportType
 
unsigned int mLifetime
 
ChannelManager mChannelManager
 
RemotePeer * mActiveDestination
 
- Protected Attributes inherited from reTurn::AsyncTcpSocketBase
asio::ip::tcp::socket mSocket
 
asio::ip::tcp::resolver mResolver
 
- 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 14 of file TurnAsyncTcpSocket.hxx.

Constructor & Destructor Documentation

◆ TurnAsyncTcpSocket()

reTurn::TurnAsyncTcpSocket::TurnAsyncTcpSocket ( asio::io_context &  ioService,
TurnAsyncSocketHandler *  turnAsyncSocketHandler,
const asio::ip::address &  address = UnspecifiedIpAddress,
unsigned short  port = 0 
)
explicit

Definition at line 18 of file TurnAsyncTcpSocket.cxx.

Member Function Documentation

◆ getSocketDescriptor()

virtual unsigned int reTurn::TurnAsyncTcpSocket::getSocketDescriptor ( )
inlinevirtual

Implements reTurn::TurnAsyncSocket.

Definition at line 22 of file TurnAsyncTcpSocket.hxx.


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