#include <psockbun.h>
Inheritance diagram for PSingleMonitoredSocket:
Public Member Functions | |
PSingleMonitoredSocket (const PString &theInterface, BOOL reuseAddr=FALSE, PSTUNClient *stunClient=NULL) | |
~PSingleMonitoredSocket () | |
virtual PStringArray | GetInterfaces (BOOL includeLoopBack=FALSE, const PIPSocket::Address &destination=PIPSocket::GetDefaultIpAny()) |
virtual BOOL | Open (WORD port) |
virtual BOOL | Close () |
Close all socket(s). | |
virtual BOOL | GetAddress (const PString &iface, PIPSocket::Address &address, WORD &port, BOOL usingNAT) const |
Get the local address for the given interface. | |
virtual PChannel::Errors | WriteToBundle (const void *buf, PINDEX len, const PIPSocket::Address &addr, WORD port, const PString &iface, PINDEX &lastWriteCount) |
virtual PChannel::Errors | ReadFromBundle (void *buf, PINDEX len, PIPSocket::Address &addr, WORD &port, PString &iface, PINDEX &lastReadCount, const PTimeInterval &timeout) |
Protected Member Functions | |
virtual void | OnAddInterface (const InterfaceEntry &entry) |
Call back function for when an interface has been added to the system. | |
virtual void | OnRemoveInterface (const InterfaceEntry &entry) |
Call back function for when an interface has been removed from the system. | |
BOOL | IsInterface (const PString &iface) const |
Protected Attributes | |
PString | theInterface |
InterfaceEntry | theEntry |
SocketInfo | theInfo |
PSingleMonitoredSocket::PSingleMonitoredSocket | ( | const PString & | theInterface, | |
BOOL | reuseAddr = FALSE , |
|||
PSTUNClient * | stunClient = NULL | |||
) |
PSingleMonitoredSocket::~PSingleMonitoredSocket | ( | ) |
virtual PStringArray PSingleMonitoredSocket::GetInterfaces | ( | BOOL | includeLoopBack = FALSE , |
|
const PIPSocket::Address & | destination = PIPSocket::GetDefaultIpAny() | |||
) | [virtual] |
Get an array of all current interface descriptors, possibly including the loopback (127.0.0.1) interface. Note the names are of the form ipname, eg "10.0.1.11%3Com 3C90x Ethernet Adapter" or "192.168.0.10%eth0"
destination | Flag for if loopback is to included in list |
Reimplemented from PInterfaceMonitorClient.
virtual BOOL PSingleMonitoredSocket::Open | ( | WORD | port | ) | [virtual] |
Open the socket(s) using the specified port. If port is zero then a system allocated port is used. In this case and when multiple interfaces are supported, all sockets use the same dynamic port value.
Returns TRUE if all sockets are opened.
Reimplemented from PMonitoredSocketBundle.
virtual BOOL PSingleMonitoredSocket::Close | ( | ) | [virtual] |
virtual BOOL PSingleMonitoredSocket::GetAddress | ( | const PString & | iface, | |
PIPSocket::Address & | address, | |||
WORD & | port, | |||
BOOL | usingNAT | |||
) | const [virtual] |
Get the local address for the given interface.
address | Interface to get address for |
port | Address of interface |
usingNAT | Port listening on Require NAT address/port |
Reimplemented from PMonitoredSocketBundle.
virtual PChannel::Errors PSingleMonitoredSocket::WriteToBundle | ( | const void * | buf, | |
PINDEX | len, | |||
const PIPSocket::Address & | addr, | |||
WORD | port, | |||
const PString & | iface, | |||
PINDEX & | lastWriteCount | |||
) | [virtual] |
Write to the remote address/port using the socket(s) available. If the iface parameter is empty, then the data is written to all socket(s). Otherwise the iface parameter indicates the specific interface socket to write the data to.
Reimplemented from PMonitoredSocketBundle.
virtual PChannel::Errors PSingleMonitoredSocket::ReadFromBundle | ( | void * | buf, | |
PINDEX | len, | |||
PIPSocket::Address & | addr, | |||
WORD & | port, | |||
PString & | iface, | |||
PINDEX & | lastReadCount, | |||
const PTimeInterval & | timeout | |||
) | [virtual] |
Read fram a remote address/port using the socket(s) available. If the iface parameter is empty, then the first data received on any socket(s) is used, and the iface parameter is set to the name of that interface. Otherwise the iface parameter indicates the specific interface socket to read the data from.
Reimplemented from PMonitoredSocketBundle.
virtual void PSingleMonitoredSocket::OnAddInterface | ( | const InterfaceEntry & | entry | ) | [protected, virtual] |
Call back function for when an interface has been added to the system.
virtual void PSingleMonitoredSocket::OnRemoveInterface | ( | const InterfaceEntry & | entry | ) | [protected, virtual] |
Call back function for when an interface has been removed from the system.
BOOL PSingleMonitoredSocket::IsInterface | ( | const PString & | iface | ) | const [protected] |
PString PSingleMonitoredSocket::theInterface [protected] |
InterfaceEntry PSingleMonitoredSocket::theEntry [protected] |
SocketInfo PSingleMonitoredSocket::theInfo [protected] |