#include <transports.h>
Inheritance diagram for OpalTransportUDP:
Public Member Functions | |
Construction | |
OpalTransportUDP (OpalEndPoint &endpoint, PIPSocket::Address binding=PIPSocket::GetDefaultIpAny(), WORD port=0, BOOL reuseAddr=FALSE) | |
OpalTransportUDP (OpalEndPoint &endpoint, PUDPSocket &socket) | |
OpalTransportUDP (OpalEndPoint &endpoint, PIPSocket::Address localAddress, const PBYTEArray &preReadPacket, PIPSocket::Address remoteAddress, WORD remotePort) | |
~OpalTransportUDP () | |
Destroy the UDP channel. | |
Overides from class PChannel | |
virtual BOOL | Read (void *buffer, PINDEX length) |
virtual BOOL | Close () |
Overides from class OpalTransport | |
virtual BOOL | IsReliable () const |
virtual BOOL | IsCompatibleTransport (const OpalTransportAddress &address) const |
virtual BOOL | Connect () |
virtual void | EndConnect (const OpalTransportAddress &localAddress) |
virtual BOOL | SetLocalAddress (const OpalTransportAddress &address) |
virtual BOOL | SetRemoteAddress (const OpalTransportAddress &address) |
virtual void | SetPromiscuous (PromisciousModes promiscuous) |
virtual OpalTransportAddress | GetLastReceivedAddress () const |
virtual BOOL | ReadPDU (PBYTEArray &packet) |
virtual BOOL | WritePDU (const PBYTEArray &pdu) |
virtual BOOL | WriteConnect (WriteConnectCallback function, void *userData) |
Protected Member Functions | |
virtual const char * | GetProtoPrefix () const |
Protected Attributes | |
PromisciousModes | promiscuousReads |
OpalTransportAddress | lastReceivedAddress |
BOOL | socketOwnedByListener |
PBYTEArray | preReadPacket |
PSocketList | connectSockets |
BOOL | reuseAddressFlag |
OpalTransportUDP::OpalTransportUDP | ( | OpalEndPoint & | endpoint, | |
PIPSocket::Address | binding = PIPSocket::GetDefaultIpAny() , |
|||
WORD | port = 0 , |
|||
BOOL | reuseAddr = FALSE | |||
) |
Create a new transport channel.
endpoint | Endpoint object |
binding | Local interface to use |
port | Local port to use |
reuseAddr | Flag for binding to already bound interface |
OpalTransportUDP::OpalTransportUDP | ( | OpalEndPoint & | endpoint, | |
PUDPSocket & | socket | |||
) |
Create a new transport channel.
endpoint | Endpoint object |
socket | Preopened socket |
OpalTransportUDP::OpalTransportUDP | ( | OpalEndPoint & | endpoint, | |
PIPSocket::Address | localAddress, | |||
const PBYTEArray & | preReadPacket, | |||
PIPSocket::Address | remoteAddress, | |||
WORD | remotePort | |||
) |
Create a new transport channel.
endpoint | Endpoint object |
localAddress | Local interface to use |
preReadPacket | Packet already read by OpalListenerUDP |
remoteAddress | Remote address received PDU on |
remotePort | Remote port received PDU on |
OpalTransportUDP::~OpalTransportUDP | ( | ) |
Destroy the UDP channel.
virtual BOOL OpalTransportUDP::Close | ( | ) | [virtual] |
Conditionally close the sockets.
Reimplemented from OpalTransport.
virtual BOOL OpalTransportUDP::Connect | ( | ) | [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 EndConnect() to finalise the selection process.
Implements OpalTransport.
virtual void OpalTransportUDP::EndConnect | ( | const OpalTransportAddress & | localAddress | ) | [virtual] |
End a connection to the remote address. This is requried in some circumstances where the connection to the remote is not atomic.
The default behaviour uses the socket defined by the localAddress parameter.
localAddress | Resultant local address |
Reimplemented from OpalTransport.
virtual OpalTransportAddress OpalTransportUDP::GetLastReceivedAddress | ( | ) | const [virtual] |
Get the transport address of the last received PDU.
Default behaviour returns the lastReceivedAddress member variable.
Reimplemented from OpalTransport.
virtual const char* OpalTransportUDP::GetProtoPrefix | ( | ) | const [protected, virtual] |
Get the prefix for this transports protocol type.
Implements OpalTransportIP.
virtual BOOL OpalTransportUDP::IsCompatibleTransport | ( | const OpalTransportAddress & | address | ) | const [virtual] |
Check that the transport address is compatible with transport.
Implements OpalTransport.
virtual BOOL OpalTransportUDP::IsReliable | ( | ) | const [virtual] |
Get indication of the type of underlying transport.
Implements OpalTransport.
virtual BOOL OpalTransportUDP::Read | ( | void * | buffer, | |
PINDEX | length | |||
) | [virtual] |
virtual BOOL OpalTransportUDP::ReadPDU | ( | PBYTEArray & | packet | ) | [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.
packet | Packet read from transport |
Implements OpalTransport.
virtual BOOL OpalTransportUDP::SetLocalAddress | ( | const OpalTransportAddress & | address | ) | [virtual] |
Set local address to connect from. Note that this may not work for all transport types or may work only before Connect() has been called.
Reimplemented from OpalTransportIP.
virtual void OpalTransportUDP::SetPromiscuous | ( | PromisciousModes | promiscuous | ) | [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.
virtual BOOL OpalTransportUDP::SetRemoteAddress | ( | const OpalTransportAddress & | address | ) | [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 BOOL OpalTransportUDP::WriteConnect | ( | WriteConnectCallback | function, | |
void * | userData | |||
) | [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 |
userData | User data to pass to write function |
virtual BOOL OpalTransportUDP::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.
pdu | Packet to write |
Implements OpalTransport.
PSocketList OpalTransportUDP::connectSockets [protected] |
PBYTEArray OpalTransportUDP::preReadPacket [protected] |
PromisciousModes OpalTransportUDP::promiscuousReads [protected] |
BOOL OpalTransportUDP::reuseAddressFlag [protected] |
BOOL OpalTransportUDP::socketOwnedByListener [protected] |