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

#include <TlsBaseTransport.hxx>

Inheritance diagram for resip::TlsBaseTransport:
[legend]

Public Member Functions

 RESIP_HeapCount (TlsBaseTransport)
 
 TlsBaseTransport (Fifo< TransactionMessage > &fifo, int portNum, IpVersion version, const Data &interfaceObj, Security &security, const Data &sipDomain, SecurityTypes::SSLType sslType, TransportType transportType, AfterSocketCreationFuncPtr socketFunc=0, Compression &compression=Compression::Disabled, unsigned transportFlags=0, SecurityTypes::TlsClientVerificationMode cvm=SecurityTypes::None, bool useEmailAsSIP=false, const Data &certificateFilename="", const Data &privateKeyFilename="", const Data &privateKeyPassPhrase="")
 
virtual ~TlsBaseTransport ()
 
void onReload ()
 
SSL_CTX * getCtx ()
 
SecurityTypes::TlsClientVerificationMode getClientVerificationMode ()
 
bool isUseEmailAsSIP ()
 
bool setPeerCertificateVerificationCallback (SecurityTypes::SSLVendor vendor, void *func, void *arg)
 Set a custom callback function to be used by the SSL stack to inspect the peer certificate.
 
- Public Member Functions inherited from resip::TcpBaseTransport
 TcpBaseTransport (Fifo< TransactionMessage > &fifo, int portNum, IpVersion version, const Data &interfaceName, AfterSocketCreationFuncPtr socketFunc, Compression &compression, unsigned transportFlags=0, const Data &netNs=Data::Empty)
 
virtual ~TcpBaseTransport ()
 
virtual void processPollEvent (FdPollEventMask mask)
 Called by PollGrp when activity is possible.
 
virtual void process (FdSet &fdset)
 If there is work to do, this is the method that does it.
 
virtual void buildFdSet (FdSet &fdset)
 Adds the Transport's socket FD to the appropriate read or write sets as applicable.
 
virtual bool isReliable () const
 
virtual bool isDatagram () const
 
virtual void process ()
 Version of process to be invoked periodically when using callback-based IO (via FdPollGrp).
 
virtual void setPollGrp (FdPollGrp *grp)
 
virtual void setRcvBufLen (int buflen)
 
ConnectionManager & getConnectionManager ()
 
const ConnectionManager & getConnectionManager () const
 
virtual void invokeAfterSocketCreationFunc () const
 
- Public Member Functions inherited from resip::InternalTransport
 InternalTransport (Fifo< TransactionMessage > &rxFifo, int portNum, IpVersion version, const Data &interfaceObj, AfterSocketCreationFuncPtr socketFunc=0, Compression &compression=Compression::Disabled, unsigned transportFlags=0, const Data &netNs=Data::Empty)
 
virtual ~InternalTransport ()
 
virtual bool isFinished () const
 
virtual bool hasDataToSend () const
 only applies to transports that shareStackProcessAndSelect
 
virtual bool shareStackProcessAndSelect () const
 Returns true if this Transport should be included in the FdSet processing loop, false if the Transport will provide its own cycles.
 
virtual void startOwnProcessing ()
 transports that returned false to shareStackProcessAndSelect() shouldn't put messages into the fifo until this is called
 
void bind ()
 
virtual unsigned int getFifoSize () const
 
virtual void send (std::unique_ptr< SendData > data)
 
virtual void poke ()
 Called when a writer is done adding messages to the TxFifo; this is used to interrupt the select call if the Transport is running in its own thread.
 
virtual void setCongestionManager (CongestionManager *manager)
 
- Public Member Functions inherited from resip::Transport
void setSipMessageLoggingHandler (std::shared_ptr< SipMessageLoggingHandler > handler)
 
void addSipMessageLoggingHandler (std::shared_ptr< SipMessageLoggingHandler > handler)
 
void setSipMessageLoggingHandlers (const SipMessageLoggingHandlerList &handlers)
 
void unsetSipMessageLoggingHandler () noexcept
 
SipMessageLoggingHandlerList getSipMessageLoggingHandlers () const noexcept
 
 Transport (Fifo< TransactionMessage > &rxFifo, const GenericIPAddress &address, const Data &tlsDomain=Data::Empty, AfterSocketCreationFuncPtr socketFunc=nullptr, Compression &compression=Compression::Disabled)
 
 Transport (Fifo< TransactionMessage > &rxFifo, int portNum, IpVersion version, const Data &interfaceObj, const Data &tlsDomain=Data::Empty, AfterSocketCreationFuncPtr socketFunc=nullptr, Compression &compression=Compression::Disabled, unsigned transportFlags=0, const Data &netNs=Data::Empty)
 
virtual ~Transport ()
 
std::unique_ptr< SendData > makeSendData (const Tuple &tuple, const Data &data, const Data &tid, const Data &sigcompId=Data::Empty)
 
virtual unsigned int getTimeTillNextProcessMS ()
 Returns the maximum timeout this object is willing to tolerate on the select call that is to be made, to prevent starvation of work that is not IO-based.
 
void flowTerminated (const Tuple &flow, TransportFailure::FailureReason failureReason, int failureSubCode, const Data &failureString, const std::list< Data > additionalFailureStrings)
 Posts a ConnectionTerminated message to TransactionMessage Fifo.
 
void keepAlivePong (const Tuple &flow)
 
void fail (const Data &tid, TransportFailure::FailureReason reason=TransportFailure::Failure, int subCode=0)
 Posts a TransportFailure to the TransactionMessage Fifo.
 
void setTcpConnectState (const Data &tid, TcpConnectState::State state)
 Posts a TcpConnectState to the TransactionMessage Fifo.
 
const Data & interfaceName () const
 
int port () const
 
bool isV4 () const
 
IpVersion ipVersion () const
 
const Data & tlsDomain () const
 
const sockaddr & boundInterface () const
 
const Tuple & getTuple () const
 
const TransportType transport () const
 
const Data & netNs () const
 
virtual bool hasSpecificContact () const
 
bool basicCheck (const SipMessage &msg)
 Perform basic sanity checks on message.
 
void makeFailedResponse (const SipMessage &msg, int responseCode=400, const char *warning=nullptr)
 
std::unique_ptr< SendData > make503 (SipMessage &msg, uint16_t retryAfter)
 
std::unique_ptr< SendData > make100 (SipMessage &msg)
 
void setRemoteSigcompId (SipMessage &msg, Data &id)
 
virtual void shutdown ()
 This starts shutting-down procedures for this Transport.
 
virtual bool isShuttingDown ()
 
bool operator== (const Transport &rhs) const
 
void callSocketFunc (Socket sock) const
 
bool setDscp (int dscp)
 Sets the DSCP class this transport puts on its sockets, and returns whether it was accepted.
 
int effectiveDscp () const
 The class to write to a socket right now, or -1 to leave it alone.
 
int effectiveDscp (int wanted) const
 effectiveDscp() for a value the caller has already read.
 
void applySocketOptions (Socket sock) const
 The one place a socket of this transport is configured.
 
void applyDscpToOwnSockets ()
 Re-runs the per-socket set-up on every socket this transport holds – the listener, and each established connection.
 
CongestionManager::RejectionBehavior getRejectionBehaviorForIncoming () const
 
void flushStateMacFifo ()
 
uint32_t getExpectedWaitForIncoming () const
 
virtual void pushRxMsgUp (SipMessage *msg)
 
unsigned int getKey () const
 
void setKey (unsigned int pKey)
 
- Public Member Functions inherited from resip::FdSetIOObserver
 FdSetIOObserver ()
 
virtual ~FdSetIOObserver ()
 
- Public Member Functions inherited from resip::FdPollItemIf
 FdPollItemIf ()
 
virtual ~FdPollItemIf ()
 

Protected Member Functions

Connection * createConnection (const Tuple &who, Socket fd, bool server=false)
 Makes new Connection using provided socket.
 
- Protected Member Functions inherited from resip::TcpBaseTransport
virtual void init ()
 Performs constructor activities that depend on virtual functions specified by derived classes.
 
void processAllWriteRequests ()
 Forms a connection if one doesn't exist, moves requests to the appropriate connection's fifo.
 
int processListen ()
 This doesn't exist anywhere that I can find? !kw! void sendFromRoundRobin(FdSet& fdset);.
 
Connection * makeOutgoingConnection (const Tuple &dest, TransportFailure::FailureReason &failCode, int &subCode)
 
- Protected Member Functions inherited from resip::InternalTransport
virtual Socket getListenerSocket () const
 The transport's own listening or bound socket, or INVALID_SOCKET for a transport that holds none.
 
- Protected Member Functions inherited from resip::Transport
void drainDscpRefresh ()
 Serves a pending refresh and a pending report.
 
void setTlsDomain (const Data &domain)
 

Protected Attributes

Security * mSecurity
 
SecurityTypes::SSLType mSslType
 
SSL_CTX * mDomainCtx
 
SecurityTypes::TlsClientVerificationMode mClientVerificationMode
 
bool mUseEmailAsSIP
 
const Data mCertificateFilename
 
const Data mPrivateKeyFilename
 
const Data mPrivateKeyPassPhrase
 
std::atomic< bool > mReloadCertificate
 
- Protected Attributes inherited from resip::InternalTransport
Socket mFd
 
SelectInterruptor mSelectInterruptor
 
FdPollItemHandle mInterruptorHandle
 
Fifo< SendData > mTxFifo
 
ConsumerFifoBuffer< SendData > mTxFifoOutBuffer
 
FdPollGrp * mPollGrp
 
FdPollItemHandle mPollItemHandle
 
- Protected Attributes inherited from resip::Transport
Data mInterface
 
Tuple mTuple
 
CongestionManager * mCongestionManager
 
ProducerFifoBuffer< TransactionMessage > mStateMachineFifo
 
bool mShuttingDown
 
AfterSocketCreationFuncPtr mSocketFunc
 
Compression & mCompression
 
unsigned mTransportFlags
 
std::atomic< int > mDscp { -1 }
 the class to write, -1 for "do not mark"
 
std::atomic< bool > mDscpRefreshPending { false }
 Set by setDscp() when the value changes, cleared by the owning thread's refresh.
 
std::atomic< bool > mDscpReportPending { false }
 Set by every setDscp() call, cleared by the owning thread's report, so a reload that changed nothing still says what the listener carries.
 
std::atomic< bool > mWasMarkRequested { false }
 Whether this transport has asked a socket to carry a class that a clear would have to undo.
 

Additional Inherited Members

- Public Types inherited from resip::Transport
using SipMessageLoggingHandlerList = std::vector< std::shared_ptr< SipMessageLoggingHandler > >
 
- Static Public Member Functions inherited from resip::InternalTransport
static Socket socket (TransportType type, IpVersion ipVer)
 
- Static Public Member Functions inherited from resip::Transport
static void error (int e)
 Generates a generic log for the platform specific socket error number.
 
static Data errorToString (int e)
 
static void stampReceived (SipMessage *request)
 
- Static Protected Attributes inherited from resip::TcpBaseTransport
static const size_t MaxWriteSize = 4096
 
static const size_t MaxReadSize = 4096
 

Detailed Description

Definition at line 25 of file TlsBaseTransport.hxx.

Constructor & Destructor Documentation

◆ TlsBaseTransport()

TlsBaseTransport::TlsBaseTransport ( Fifo< TransactionMessage > &  fifo,
int  portNum,
IpVersion  version,
const Data &  interfaceObj,
Security &  security,
const Data &  sipDomain,
SecurityTypes::SSLType  sslType,
TransportType  transportType,
AfterSocketCreationFuncPtr  socketFunc = 0,
Compression &  compression = Compression::Disabled,
unsigned  transportFlags = 0,
SecurityTypes::TlsClientVerificationMode  cvm = SecurityTypes::None,
bool  useEmailAsSIP = false,
const Data &  certificateFilename = "",
const Data &  privateKeyFilename = "",
const Data &  privateKeyPassPhrase = "" 
)

Definition at line 24 of file TlsBaseTransport.cxx.

◆ ~TlsBaseTransport()

TlsBaseTransport::~TlsBaseTransport ( )
virtual

Definition at line 137 of file TlsBaseTransport.cxx.

Member Function Documentation

◆ createConnection()

Connection * TlsBaseTransport::createConnection ( const Tuple &  who,
Socket  fd,
bool  server = false 
)
protectedvirtual

Makes new Connection using provided socket.

Implements resip::TcpBaseTransport.

Reimplemented in resip::WssTransport.

Definition at line 205 of file TlsBaseTransport.cxx.

◆ getClientVerificationMode()

SecurityTypes::TlsClientVerificationMode resip::TlsBaseTransport::getClientVerificationMode ( )
inline

Definition at line 51 of file TlsBaseTransport.hxx.

◆ getCtx()

SSL_CTX * TlsBaseTransport::getCtx ( )

Definition at line 153 of file TlsBaseTransport.cxx.

◆ isUseEmailAsSIP()

bool resip::TlsBaseTransport::isUseEmailAsSIP ( )
inline

Definition at line 53 of file TlsBaseTransport.hxx.

◆ onReload()

void TlsBaseTransport::onReload ( )
virtual

Reimplemented from resip::Transport.

Definition at line 146 of file TlsBaseTransport.cxx.

◆ RESIP_HeapCount()

resip::TlsBaseTransport::RESIP_HeapCount ( TlsBaseTransport  )

◆ setPeerCertificateVerificationCallback()

bool TlsBaseTransport::setPeerCertificateVerificationCallback ( SecurityTypes::SSLVendor  vendor,
void *  func,
void *  arg 
)

Set a custom callback function to be used by the SSL stack to inspect the peer certificate.

callback semantics (the arguments and return values) are very specific to the SSL stack in use. If the vendor parameter does not match the SSL stack then this method returns false and does not use the callback.

This method should be called before the stack starts accepting connections, otherwise, any connection received before setting the callback would be validated using the default validation function provided by the SSL stack.

Parameters
vendorthe SSL stack vendor, for example, SecurityTypes::OpenSSL
funca pointer to the callback function, 0 to disable callback
argan argument to be passed to the callback if the vendor API supports this
Returns
true if successful, false on failure

Definition at line 185 of file TlsBaseTransport.cxx.

Member Data Documentation

◆ mCertificateFilename

const Data resip::TlsBaseTransport::mCertificateFilename
protected

Definition at line 92 of file TlsBaseTransport.hxx.

◆ mClientVerificationMode

SecurityTypes::TlsClientVerificationMode resip::TlsBaseTransport::mClientVerificationMode
protected

Definition at line 87 of file TlsBaseTransport.hxx.

◆ mDomainCtx

SSL_CTX* resip::TlsBaseTransport::mDomainCtx
protected

Definition at line 86 of file TlsBaseTransport.hxx.

◆ mPrivateKeyFilename

const Data resip::TlsBaseTransport::mPrivateKeyFilename
protected

Definition at line 93 of file TlsBaseTransport.hxx.

◆ mPrivateKeyPassPhrase

const Data resip::TlsBaseTransport::mPrivateKeyPassPhrase
protected

Definition at line 94 of file TlsBaseTransport.hxx.

◆ mReloadCertificate

std::atomic<bool> resip::TlsBaseTransport::mReloadCertificate
protected

Definition at line 96 of file TlsBaseTransport.hxx.

◆ mSecurity

Security* resip::TlsBaseTransport::mSecurity
protected

Definition at line 84 of file TlsBaseTransport.hxx.

◆ mSslType

SecurityTypes::SSLType resip::TlsBaseTransport::mSslType
protected

Definition at line 85 of file TlsBaseTransport.hxx.

◆ mUseEmailAsSIP

bool resip::TlsBaseTransport::mUseEmailAsSIP
protected

Definition at line 91 of file TlsBaseTransport.hxx.


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