PMonitoredSocketBundle Class Reference

#include <psockbun.h>

Inheritance diagram for PMonitoredSocketBundle:

PMonitoredSockets PInterfaceMonitorClient PSafeObject PObject PSingleMonitoredSocket List of all members.

Public Member Functions

 PMonitoredSocketBundle (BOOL reuseAddr=FALSE, PSTUNClient *stunClient=NULL)
 ~PMonitoredSocketBundle ()
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 Types

typedef std::map< std::string,
SocketInfo > 
SocketInfoMap_T

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.
void OpenSocket (const PString &iface)
void CloseSocket (const SocketInfoMap_T::iterator &iterSocket)

Protected Attributes

SocketInfoMap_T socketInfoMap

Detailed Description

This concrete class bundles a set of UDP sockets which are dynamically adjusted as interfaces are added and removed from the system.


Member Typedef Documentation

typedef std::map<std::string, SocketInfo> PMonitoredSocketBundle::SocketInfoMap_T [protected]


Constructor & Destructor Documentation

PMonitoredSocketBundle::PMonitoredSocketBundle ( BOOL  reuseAddr = FALSE,
PSTUNClient stunClient = NULL 
)

PMonitoredSocketBundle::~PMonitoredSocketBundle (  ) 


Member Function Documentation

virtual BOOL PMonitoredSocketBundle::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.

Implements PMonitoredSockets.

Reimplemented in PSingleMonitoredSocket.

virtual BOOL PMonitoredSocketBundle::Close (  )  [virtual]

Close all socket(s).

Implements PMonitoredSockets.

Reimplemented in PSingleMonitoredSocket.

virtual BOOL PMonitoredSocketBundle::GetAddress ( const PString iface,
PIPSocket::Address address,
WORD &  port,
BOOL  usingNAT 
) const [virtual]

Get the local address for the given interface.

Parameters:
address  Interface to get address for
port  Address of interface
usingNAT  Port listening on Require NAT address/port

Implements PMonitoredSockets.

Reimplemented in PSingleMonitoredSocket.

virtual PChannel::Errors PMonitoredSocketBundle::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.

Implements PMonitoredSockets.

Reimplemented in PSingleMonitoredSocket.

virtual PChannel::Errors PMonitoredSocketBundle::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.

Implements PMonitoredSockets.

Reimplemented in PSingleMonitoredSocket.

virtual void PMonitoredSocketBundle::OnAddInterface ( const InterfaceEntry entry  )  [protected, virtual]

Call back function for when an interface has been added to the system.

Implements PInterfaceMonitorClient.

virtual void PMonitoredSocketBundle::OnRemoveInterface ( const InterfaceEntry entry  )  [protected, virtual]

Call back function for when an interface has been removed from the system.

Implements PInterfaceMonitorClient.

void PMonitoredSocketBundle::OpenSocket ( const PString iface  )  [protected]

void PMonitoredSocketBundle::CloseSocket ( const SocketInfoMap_T::iterator &  iterSocket  )  [protected]


Member Data Documentation

SocketInfoMap_T PMonitoredSocketBundle::socketInfoMap [protected]


The documentation for this class was generated from the following file:
Generated on Fri Mar 7 06:25:06 2008 for PTLib by  doxygen 1.5.1