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

#include <TurnTlsSocket.hxx>

Inheritance diagram for reTurn::TurnTlsSocket:
[legend]

Public Member Functions

 TurnTlsSocket (bool validateServerCertificateHostname, const asio::ip::address &address=UnspecifiedIpAddress, unsigned short port=0, const std::string &rootCertificatesFile="ca.pem")
 validateServerCertificateHostname: check the server certificate is for the host name (or IP address) passed to connect().
 
virtual unsigned int getSocketDescriptor ()
 
virtual asio::error_code connect (const std::string &address, unsigned short port)
 
- Public Member Functions inherited from reTurn::TurnTcpSocket
 TurnTcpSocket (const asio::ip::address &address=UnspecifiedIpAddress, unsigned short port=0)
 
void setConnectTimeout (unsigned int milliseconds)
 Milliseconds the TCP connect to each address connect() tries may take - and, for TLS, the handshake - before it fails with asio::error::timed_out.
 
- Public Member Functions inherited from reTurn::TurnSocket
 TurnSocket (const asio::ip::address &address=UnspecifiedIpAddress, unsigned short port=0)
 
virtual ~TurnSocket ()
 
asio::error_code requestSharedSecret (char *username, unsigned int usernameSize, char *password, unsigned int passwordSize)
 
void setUsernameAndPassword (const char *username, const char *password, bool shortTermAuth=false)
 
void setSoftware (const char *software)
 
asio::error_code bindRequest ()
 
asio::error_code createAllocation (unsigned int lifetime=UnspecifiedLifetime, unsigned int bandwidth=UnspecifiedBandwidth, unsigned char requestedProps=StunMessage::PropsNone, uint64_t reservationToken=UnspecifiedToken, StunTuple::TransportType requestedTransportType=StunTuple::None)
 
asio::error_code refreshAllocation ()
 
asio::error_code destroyAllocation ()
 
StunTuple & getRelayTuple ()
 
StunTuple & getReflexiveTuple ()
 
unsigned int getLifetime ()
 
unsigned int getBandwidth ()
 
asio::error_code setActiveDestination (const asio::ip::address &address, unsigned short port)
 
asio::error_code clearActiveDestination ()
 
asio::error_code send (const char *buffer, unsigned int size)
 
asio::error_code sendTo (const asio::ip::address &address, unsigned short port, const char *buffer, unsigned int size)
 
asio::error_code receive (char *buffer, unsigned int &size, unsigned int timeout, asio::ip::address *sourceAddress=0, unsigned short *sourcePort=0)
 
asio::error_code receiveFrom (const asio::ip::address &address, unsigned short port, char *buffer, unsigned int &size, unsigned int timeout)
 

Protected Member Functions

virtual asio::error_code rawWrite (const char *buffer, unsigned int size)
 
virtual asio::error_code rawWrite (const std::vector< asio::const_buffer > &buffers)
 
virtual void readHeader ()
 
virtual void readBody (unsigned int len)
 
virtual void cancelSocket ()
 
- Protected Member Functions inherited from reTurn::TurnTcpSocket
virtual asio::error_code rawRead (unsigned int timeout, unsigned int *bytesRead, asio::ip::address *sourceAddress=0, unsigned short *sourcePort=0)
 
virtual void handleReadHeader (const asio::error_code &e)
 Handle completion of a read operation for first 32 bits.
 
asio::error_code openAndBind (asio::ip::tcp::socket &socket)
 Opens socket and binds it to the local binding (address and port), for a connection attempt.
 
asio::ip::tcp protocol () const
 The protocol (IPv4 or IPv6) of the local binding.
 
asio::error_code waitForConnectStep (asio::error_code &result, const std::function< void()> &cancel)
 For a step of connect() started as an asynchronous operation that sets result (initially asio::error::would_block) when it completes: runs the io_context until it does, or until the connect timeout passes - when cancel() is called (eg.
 
- Protected Member Functions inherited from reTurn::TurnSocket
void startReadTimer (unsigned int timeout)
 
void handleRawRead (const asio::error_code &errorCode, size_t bytesRead)
 
void handleRawReadTimeout (const asio::error_code &errorCode)
 
void queueReceived (unsigned int size)
 

Additional Inherited Members

- Static Public Attributes inherited from reTurn::TurnSocket
static unsigned int UnspecifiedLifetime = 0xFFFFFFFF
 
static unsigned int UnspecifiedBandwidth = 0xFFFFFFFF
 
static unsigned short UnspecifiedToken = 0
 
static asio::ip::address UnspecifiedIpAddress = asio::ip::make_address("0.0.0.0")
 
- Protected Types inherited from reTurn::TurnSocket
typedef std::map< unsigned short, time_t > ChannelBindingRefreshTimeMap
 
- Protected Attributes inherited from reTurn::TurnTcpSocket
unsigned int mConnectTimeout = 10000
 
size_t mPadding = 0
 
- Protected Attributes inherited from reTurn::TurnSocket
StunTuple mLocalBinding
 
StunTuple mConnectedTuple
 
resip::Data mUsername
 
resip::Data mPassword
 
resip::Data mHmacKey
 
resip::Data mRealm
 
resip::Data mNonce
 
resip::Data mSoftware
 
unsigned int mRequestedLifetime
 
unsigned int mRequestedBandwidth
 
unsigned char mRequestedProps
 
uint64_t mReservationToken
 
StunTuple::TransportType mRequestedTransportType
 
bool mHaveAllocation
 
time_t mAllocationRefreshTime
 
StunTuple mRelayTuple
 
StunTuple mReflexiveTuple
 
unsigned int mLifetime
 
unsigned int mBandwidth
 
ChannelManager mChannelManager
 
ChannelBindingRefreshTimeMap mChannelBindingRefreshTimes
 
RemotePeer * mActiveDestination
 
asio::io_context mIOService
 
asio::steady_timer mReadTimer
 
size_t mBytesRead
 
asio::error_code mReadErrorCode
 
char mReadBuffer [8192]
 
char mWriteBuffer [8192]
 
bool mConnected
 
std::deque< std::vector< char > > mReceivedWhileWaiting
 
- Static Protected Attributes inherited from reTurn::TurnSocket
static const size_t MaxReceivedWhileWaiting = 100
 

Detailed Description

Definition at line 19 of file TurnTlsSocket.hxx.

Constructor & Destructor Documentation

◆ TurnTlsSocket()

reTurn::TurnTlsSocket::TurnTlsSocket ( bool  validateServerCertificateHostname,
const asio::ip::address &  address = UnspecifiedIpAddress,
unsigned short  port = 0,
const std::string &  rootCertificatesFile = "ca.pem" 
)
explicit

validateServerCertificateHostname: check the server certificate is for the host name (or IP address) passed to connect().

rootCertificatesFile: the PEM file of root certificates to verify the server certificate with.

Definition at line 44 of file TurnTlsSocket.cxx.

Member Function Documentation

◆ cancelSocket()

void reTurn::TurnTlsSocket::cancelSocket ( )
protectedvirtual

Reimplemented from reTurn::TurnTcpSocket.

Definition at line 151 of file TurnTlsSocket.cxx.

◆ connect()

asio::error_code reTurn::TurnTlsSocket::connect ( const std::string &  address,
unsigned short  port 
)
virtual

Reimplemented from reTurn::TurnTcpSocket.

Definition at line 58 of file TurnTlsSocket.cxx.

◆ getSocketDescriptor()

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

Reimplemented from reTurn::TurnTcpSocket.

Definition at line 30 of file TurnTlsSocket.hxx.

◆ rawWrite() [1/2]

asio::error_code reTurn::TurnTlsSocket::rawWrite ( const char *  buffer,
unsigned int  size 
)
protectedvirtual

Reimplemented from reTurn::TurnTcpSocket.

Definition at line 121 of file TurnTlsSocket.cxx.

◆ rawWrite() [2/2]

asio::error_code reTurn::TurnTlsSocket::rawWrite ( const std::vector< asio::const_buffer > &  buffers)
protectedvirtual

Reimplemented from reTurn::TurnTcpSocket.

Definition at line 129 of file TurnTlsSocket.cxx.

◆ readBody()

void reTurn::TurnTlsSocket::readBody ( unsigned int  len)
protectedvirtual

Reimplemented from reTurn::TurnTcpSocket.

Definition at line 144 of file TurnTlsSocket.cxx.

◆ readHeader()

void reTurn::TurnTlsSocket::readHeader ( )
protectedvirtual

Reimplemented from reTurn::TurnTcpSocket.

Definition at line 137 of file TurnTlsSocket.cxx.


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