OpalTransportTCP Class Reference

`#include <transports.h>`

Inheritance diagram for OpalTransportTCP:

## Public Member Functions

Construction
| OpalTransportTCP (OpalEndPoint &endpoint, PIPSocket::Address binding=PIPSocket::GetDefaultIpAny(), WORD port=0, PBoolean reuseAddr=false)
| OpalTransportTCP (OpalEndPoint &endpoint, PTCPSocket *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
| OpalTransportIP (OpalEndPoint &endpoint, PIPSocket::Address binding, WORD port)
virtual OpalTransportAddress | GetLocalAddress (bool allowNAT=true) const
virtual PBoolean | SetLocalAddress (const OpalTransportAddress &address)
virtual OpalTransportAddress | GetRemoteAddress () const
virtual PBoolean | SetRemoteAddress (const OpalTransportAddress &address)
Public Member Functions inherited from OpalTransport
OpalEndPoint & | GetEndPoint () const
PMutex & | GetWriteMutex ()
| OpalTransport (OpalEndPoint &endpoint)
| ~OpalTransport ()
void | PrintOn (ostream &strm) const
virtual PString | GetInterface () 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 PBoolean | WriteConnect (WriteConnectCallback function, void *userData)
virtual void | AttachThread (PThread *thread)
virtual PBoolean | IsRunning () const

## Protected Member Functions

virtual const char * | GetProtoPrefix () const
virtual PBoolean | OnOpen ()

## Protected Attributes

PBoolean | reuseAddressFlag
Protected Attributes inherited from OpalTransportIP
PIPSocket::Address | localAddress
WORD | localPort
PIPSocket::Address | remoteAddress
WORD | remotePort
Protected Attributes inherited from OpalTransport
OpalEndPoint & | endpoint
PThread * | thread
| Thread handling the transport. More...
PMutex | m_writeMutex

## Additional Inherited Members

Public Types inherited from OpalTransport
enum | PromisciousModes { AcceptFromRemoteOnly, AcceptFromAnyAutoSet, AcceptFromAny, NumPromisciousModes }
typedef PBoolean(* | WriteConnectCallback) (OpalTransport &transport, void *userData)

## Constructor & Destructor Documentation

OpalTransportTCP::OpalTransportTCP | ( | OpalEndPoint & | endpoint,
|  | PIPSocket::Address | binding = `PIPSocket::GetDefaultIpAny()`,
|  | WORD | port = `0`,
|  | PBoolean | reuseAddr = `false`
| ) |  |

Create a new transport channel.

Parameters

  endpoint | Endpoint object
  binding | Local interface to use
  port | Local port to bind to
  reuseAddr | Flag for binding to already bound interface

OpalTransportTCP::OpalTransportTCP | ( | OpalEndPoint & | endpoint,
|  | PTCPSocket * | socket
| ) |  |

Parameters

  endpoint | Endpoint object
  socket | Socket 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 char* OpalTransportTCP::GetProtoPrefix | ( |  | ) | const

protected virtual

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.

virtual PBoolean OpalTransportTCP::OnOpen | ( |  | ) |

protected virtual

This callback is executed when the Open() function is called with open channels. It may be used by descendent channels to do any handshaking required by the protocol that channel embodies.

The default behaviour is to simply return true.

Returns
  Returns true if the protocol handshaking is successful.

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

  pdu | PDU read from transport

Implements OpalTransport.

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

  pdu | Packet to write

Implements OpalTransport.

## Field Documentation

PBoolean OpalTransportTCP::reuseAddressFlag

protected

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

- transports.h