OPAL  Version 3.18.8
OpalTransportTCP Class Reference

#include <transports.h>

Inheritance diagram for OpalTransportTCP:
Collaboration diagram for OpalTransportTCP:

Public Member Functions

void SetPDULengthFormat (int fmt, int off)
 
Construction
 OpalTransportTCP (OpalEndPoint &endpoint, PIPSocket::Address binding=PIPSocket::GetDefaultIpAny(), WORD port=0, bool dummy=false)
 
 OpalTransportTCP (OpalEndPoint &endpoint, PChannel *socket)
 
 ~OpalTransportTCP ()
 Destroy the TCP channel. More...
 
Overides from class OpalTransport
virtual PBoolean IsReliable () const
 
virtual PBoolean IsCompatibleTransport (const OpalTransportAddress &address) const
 
virtual PBoolean Connect ()
 
virtual PBoolean ReadPDU (PBYTEArray &pdu)
 
virtual PBoolean WritePDU (const PBYTEArray &pdu)
 
- Public Member Functions inherited from OpalTransportIP
virtual PString GetInterface () const
 
virtual OpalTransportAddress GetLocalAddress () const
 
virtual OpalTransportAddress GetRemoteAddress () const
 
virtual PBoolean SetRemoteAddress (const OpalTransportAddress &address)
 
- Public Member Functions inherited from OpalTransport
OpalEndPointGetEndPoint () const
 
bool IsOpen () const
 
bool IsGood () const
 
PChannel::Errors GetErrorCode (PChannel::ErrorGroup group=PChannel::NumErrorGroups) const
 
PString GetErrorText (PChannel::ErrorGroup group=PChannel::NumErrorGroups) const
 
int GetErrorNumber (PChannel::ErrorGroup group=PChannel::NumErrorGroups) const
 
void SetReadTimeout (const PTimeInterval &t)
 
PChannel * GetChannel () const
 
bool IsIdle () const
 
void ResetIdle ()
 
void Reference ()
 
void Dereference ()
 
void PrintOn (ostream &strm) const
 
virtual PBoolean Write (const void *buf, PINDEX len)
 
 ~OpalTransport ()
 
virtual bool IsAuthenticated (const PString &) const
 
virtual bool SetInterface (const PString &iface)
 
PBoolean ConnectTo (const OpalTransportAddress &address)
 
virtual PBoolean Close ()
 
void CloseWait ()
 
void CleanUpOnTermination ()
 
virtual void SetPromiscuous (PromisciousModes promiscuous)
 
virtual OpalTransportAddress GetLastReceivedAddress () const
 
virtual PString GetLastReceivedInterface () const
 
virtual bool WriteConnect (const WriteConnectCallback &function)
 
void SetKeepAlive (const PTimeInterval &timeout, const PBYTEArray &data)
 
bool HasKeepAlive () const
 Indicate keep alive is active. More...
 
virtual void AttachThread (PThread *thread)
 
virtual PBoolean IsRunning () const
 

Protected Member Functions

virtual const PCaselessString & GetProtoPrefix () const
 
bool OnConnectedSocket (PTCPSocket *socket)
 
- Protected Member Functions inherited from OpalTransportIP
 OpalTransportIP (OpalEndPoint &endpoint, PChannel *channel, PIPSocket::Address binding, WORD port)
 
- Protected Member Functions inherited from OpalTransport
 PDECLARE_NOTIFIER (PTimer, OpalTransport, KeepAlive)
 
 OpalTransport (OpalEndPoint &endpoint, PChannel *channel)
 

Protected Attributes

int m_pduLengthFormat
 
int m_pduLengthOffset
 
- Protected Attributes inherited from OpalTransportIP
PIPAddress m_binding
 
PIPSocketAddressAndPort m_localAP
 
PIPSocketAddressAndPort m_remoteAP
 
- Protected Attributes inherited from OpalTransport
OpalEndPointm_endpoint
 
PChannel * m_channel
 
PThread * m_thread
 Thread handling the transport. More...
 
PCriticalSection m_threadMutex
 
PTimer m_keepAliveTimer
 
PBYTEArray m_keepAliveData
 
PSimpleTimer m_idleTimer
 
atomic< unsigned > m_referenceCount
 

Constructor & Destructor Documentation

OpalTransportTCP::OpalTransportTCP ( OpalEndPoint endpoint,
PIPSocket::Address  binding = PIPSocket::GetDefaultIpAny(),
WORD  port = 0,
bool  dummy = false 
)

Create a new transport channel.

Parameters
endpointEndpoint object
bindingLocal interface to use
portLocal port to bind to
dummyPlace holder for template reuseAddr param
OpalTransportTCP::OpalTransportTCP ( OpalEndPoint endpoint,
PChannel *  socket 
)
Parameters
endpointEndpoint object
socketSocket to use
OpalTransportTCP::~OpalTransportTCP ( )

Destroy the TCP channel.

Member Function Documentation

virtual PBoolean OpalTransportTCP::Connect ( )
virtual

Connect to the remote address.

Implements OpalTransport.

virtual const PCaselessString& OpalTransportTCP::GetProtoPrefix ( ) const
protectedvirtual

Get the prefix for this transports protocol type.

Implements OpalTransportIP.

virtual PBoolean OpalTransportTCP::IsCompatibleTransport ( const OpalTransportAddress address) const
virtual

Check that the transport address is compatible with transport.

Implements OpalTransport.

virtual PBoolean OpalTransportTCP::IsReliable ( ) const
virtual

Get indication of the type of underlying transport.

Implements OpalTransport.

bool OpalTransportTCP::OnConnectedSocket ( PTCPSocket *  socket)
protected
virtual PBoolean OpalTransportTCP::ReadPDU ( PBYTEArray &  pdu)
virtual

Read a packet from the transport. This will read using the transports mechanism for PDU boundaries, for example UDP is a single Read() call, while for TCP there is a TPKT header that indicates the size of the PDU.

If false is returned but there is data returned in the packet that indicates that the available buffer space was too small, e.g. an EMSGSIZE error was returned by recvfrom.

Parameters
pduPDU read from transport

Implements OpalTransport.

void OpalTransportTCP::SetPDULengthFormat ( int  fmt,
int  off 
)
inline

Set PDU length format. Zero indicates TPKT format (default) Negative number is number of little endian bytes. Positive number is number of big endian bytes.

off is added to the length after the above is read.

Examples: 16 bit big endian length header which include the length itself, would be: 2, -2 -> 00 05 AA BB CC 32 bit little endian length header would be: -4, 0 -> 03 00 00 00 AA BB CC

References m_pduLengthFormat, and m_pduLengthOffset.

virtual PBoolean OpalTransportTCP::WritePDU ( const PBYTEArray &  pdu)
virtual

Write a packet to the transport. This will write using the transports mechanism for PDU boundaries, for example UDP is a single Write() call, while for TCP there is a TPKT header that indicates the size of the PDU.

Parameters
pduPacket to write

Implements OpalTransport.

Field Documentation

int OpalTransportTCP::m_pduLengthFormat
protected

Referenced by SetPDULengthFormat().

int OpalTransportTCP::m_pduLengthOffset
protected

Referenced by SetPDULengthFormat().


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