OPAL
Version 3.18.8
|
#include <transports.h>
Public Member Functions | |
Construction | |
OpalTransportUDP (OpalEndPoint &endpoint, PIPSocket::Address binding=PIPSocket::GetDefaultIpAny(), WORD port=0, bool reuseAddr=false, bool preOpen=false) | |
OpalTransportUDP (OpalEndPoint &endpoint, const PMonitoredSocketsPtr &sockets, const PString &iface, const OpalTransportAddress &remoteAddress) | |
~OpalTransportUDP () | |
Destroy the UDP channel. More... | |
Overides from class PChannel | |
virtual PBoolean | Read (void *buffer, PINDEX length) |
Overides from class OpalTransport | |
virtual PBoolean | IsReliable () const |
virtual PBoolean | IsCompatibleTransport (const OpalTransportAddress &address) const |
virtual PBoolean | Connect () |
virtual PString | GetInterface () const |
virtual bool | SetInterface (const PString &iface) |
virtual OpalTransportAddress | GetLocalAddress () const |
virtual PBoolean | SetRemoteAddress (const OpalTransportAddress &address) |
virtual void | SetPromiscuous (PromisciousModes promiscuous) |
virtual OpalTransportAddress | GetLastReceivedAddress () const |
virtual PString | GetLastReceivedInterface () const |
virtual PBoolean | ReadPDU (PBYTEArray &packet) |
virtual PBoolean | WritePDU (const PBYTEArray &pdu) |
virtual bool | WriteConnect (const WriteConnectCallback &function) |
void | SetBufferSize (PINDEX size) |
![]() | |
virtual OpalTransportAddress | GetRemoteAddress () const |
![]() | |
OpalEndPoint & | GetEndPoint () 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 |
PBoolean | ConnectTo (const OpalTransportAddress &address) |
virtual PBoolean | Close () |
void | CloseWait () |
void | CleanUpOnTermination () |
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 |
![]() | |
OpalTransportIP (OpalEndPoint &endpoint, PChannel *channel, PIPSocket::Address binding, WORD port) | |
![]() | |
PDECLARE_NOTIFIER (PTimer, OpalTransport, KeepAlive) | |
OpalTransport (OpalEndPoint &endpoint, PChannel *channel) | |
Protected Attributes | |
OpalManager & | m_manager |
PINDEX | m_bufferSize |
PBYTEArray | m_preReadPacket |
bool | m_preReadOK |
![]() | |
PIPAddress | m_binding |
PIPSocketAddressAndPort | m_localAP |
PIPSocketAddressAndPort | m_remoteAP |
![]() | |
OpalEndPoint & | m_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 |
Friends | |
class | OpalListenerUDP |
OpalTransportUDP::OpalTransportUDP | ( | OpalEndPoint & | endpoint, |
PIPSocket::Address | binding = PIPSocket::GetDefaultIpAny() , |
||
WORD | port = 0 , |
||
bool | reuseAddr = false , |
||
bool | preOpen = false |
||
) |
Create a new transport channel.
endpoint | Endpoint object |
binding | Local interface to use |
port | Local port to bind to |
reuseAddr | Flag for binding to already bound interface |
preOpen | Flag to pre-open socket |
OpalTransportUDP::OpalTransportUDP | ( | OpalEndPoint & | endpoint, |
const PMonitoredSocketsPtr & | sockets, | ||
const PString & | iface, | ||
const OpalTransportAddress & | remoteAddress | ||
) |
Create a new transport channel.
endpoint | Endpoint object |
sockets | Bundle of sockets from OpalListenerUDP |
iface | Local interface to use |
remoteAddress | Remote address for NAT binding |
OpalTransportUDP::~OpalTransportUDP | ( | ) |
Destroy the UDP channel.
|
virtual |
Connect to the remote party. This will createa a socket for each interface on the system, then the use of WriteConnect() will send out on every interface. ReadPDU() will return the first interface that has data, then the user can select which interface it wants by further calls to ReadPDU(). Once it has selected one it calls SetInterface() to finalise the selection process.
Implements OpalTransport.
|
virtual |
Get the interface this transport is bound to.
Reimplemented from OpalTransportIP.
|
virtual |
Get the transport address of the last received PDU.
Default behaviour returns the lastReceivedAddress member variable.
Reimplemented from OpalTransport.
|
virtual |
Get the interface of the last received PDU arrived on.
Default behaviour returns GetLocalAddress().
Reimplemented from OpalTransport.
|
virtual |
Get the transport dependent name of the local endpoint.
Reimplemented from OpalTransportIP.
|
protectedvirtual |
Get the prefix for this transports protocol type.
Implements OpalTransportIP.
|
virtual |
Check that the transport address is compatible with transport.
Implements OpalTransport.
|
virtual |
Get indication of the type of underlying transport.
Implements OpalTransport.
|
virtual |
|
virtual |
Read a protocol data unit 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.
packet | Packet read from transport |
Implements OpalTransport.
|
inline |
Set the size of UDP packet reads.
References m_bufferSize.
|
virtual |
Bind this transport to an interface. This is generally only relevant for datagram based transports such as UDP and TCP is always bound to a local interface once open.
The default behaviour does nothing.
iface | Interface to use |
Reimplemented from OpalTransport.
|
virtual |
Set read to promiscuous mode. Normally only reads from the specifed remote address are accepted. This flag allows packets to be accepted from any remote, provided the underlying protocol can do so.
The Read() call may optionally set the remote address automatically to whatever the sender host of the last received message was.
Default behaviour sets the internal flag, so that Read() operates as described.
Reimplemented from OpalTransport.
|
virtual |
Set remote address to connect to. Note that this does not necessarily initiate a transport level connection, but only indicates where to connect to. The actual connection is made by the Connect() function.
Reimplemented from OpalTransportIP.
|
virtual |
Write the first packet to the transport, after a connect. This will adjust the transport object and call the callback function, possibly multiple times for some transport types.
It is expected that this is used just after a Connect() call where some transports (eg UDP) cannot determine its local address which is required in the PDU to be sent. This must be done fer each interface so WriteConnect() calls WriteConnectCallback for each interface. The subsequent ReadPDU() returns the answer from the first interface.
function | Function for writing data |
Reimplemented from OpalTransport.
|
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.
pdu | Packet to write |
Implements OpalTransport.
|
friend |
|
protected |
Referenced by SetBufferSize().
|
protected |
|
protected |
|
protected |