PMonitoredSocketChannel Class Reference

#include <psockbun.h>

Inheritance diagram for PMonitoredSocketChannel:

PChannel PObject List of all members.

Public Member Functions

Overrides from class PSocket
virtual BOOL IsOpen () const
virtual BOOL Close ()
virtual BOOL Read (void *buffer, PINDEX length)
virtual BOOL Write (const void *buffer, PINDEX length)
New functions for class
void SetInterface (const PString &iface)
const PStringGetInterface ()
 Get the current interface descriptor being used/.
BOOL GetLocal (PIPSocket::Address &address, WORD &port, BOOL usingNAT)
void SetRemote (const PIPSocket::Address &address, WORD port)
 Set the remote address/port for all Write() functions.
void SetRemote (const PString &hostAndPort)
 Set the remote address/port for all Write() functions.
void GetRemote (PIPSocket::Address &addr, WORD &port) const
 Get the current remote address/port for all Write() functions.
void SetPromiscuous (BOOL flag)
bool GetPromiscuous ()
 Get flag for receiving UDP data from any remote address.
void GetLastReceived (PIPSocket::Address &addr, WORD &port) const
const PMonitoredSocketsPtrGetMonitoredSockets () const
 Get the monitored socket bundle being used by this channel.

Protected Attributes

PMonitoredSocketsPtr socketBundle
BOOL sharedBundle
PString currentInterface
BOOL promiscuousReads
PIPSocket::Address remoteAddress
BOOL closing
WORD remotePort
PIPSocket::Address lastReceivedAddress
WORD lastReceivedPort

Detailed Description

This class can be used to access the bundled/monitored UDP sockets using the PChannel API.


Constructor & Destructor Documentation

PMonitoredSocketChannel::PMonitoredSocketChannel ( const PMonitoredSocketsPtr sockets,
BOOL  shared 
)

Construct a monitored socket bundle channel.

Parameters:
shared  Monitored socket bundle to use in channel Monitored socket is shared by other channels

PMonitoredSocketChannel::PMonitoredSocketChannel ( const PMonitoredSocketsPtr sockets,
BOOL  shared 
)

Construct a monitored socket bundle channel.

Parameters:
shared  Monitored socket bundle to use in channel Monitored socket is shared by other channels


Member Function Documentation

virtual BOOL PMonitoredSocketChannel::IsOpen (  )  const [virtual]

Determine if the channel is currently open. This indicates that read and write operations can be executed on the channel. For example, in the PFile# class it returns if the file is currently open.

Returns:
TRUE if the channel is open.

Reimplemented from PChannel.

virtual BOOL PMonitoredSocketChannel::Close (  )  [virtual]

Close the channel, shutting down the link to the data source.

Returns:
TRUE if the channel successfully closed.

Reimplemented from PChannel.

virtual BOOL PMonitoredSocketChannel::Read ( void *  buffer,
PINDEX  length 
) [virtual]

Override of PChannel functions to allow connectionless reads

Reimplemented from PChannel.

virtual BOOL PMonitoredSocketChannel::Write ( const void *  buffer,
PINDEX  length 
) [virtual]

Low level write to the channel. This function will block until the requested number of characters are written or the write timeout is reached. The GetLastWriteCount() function returns the actual number of bytes written.

The GetErrorCode() function should be consulted after Write() returns FALSE to determine what caused the failure.

Returns:
TRUE if at least len bytes were written to the channel.
Parameters:
buffer  Override of PChannel functions to allow connectionless writes

Reimplemented from PChannel.

void PMonitoredSocketChannel::SetInterface ( const PString iface  ) 

Set the interface descriptor to be used for all reads/writes to this channel. The iface parameter can be a partial descriptor eg "%eth0".

Parameters:
iface  Interface descriptor

const PString& PMonitoredSocketChannel::GetInterface (  ) 

Get the current interface descriptor being used/.

BOOL PMonitoredSocketChannel::GetLocal ( PIPSocket::Address address,
WORD &  port,
BOOL  usingNAT 
)

Get the local IP address and port for the currently selected interface.

Parameters:
port  IP address of local interface
usingNAT  Port listening on Require NAT address/port

void PMonitoredSocketChannel::SetRemote ( const PIPSocket::Address address,
WORD  port 
)

Set the remote address/port for all Write() functions.

Parameters:
port  Remote IP address Remote port number

void PMonitoredSocketChannel::SetRemote ( const PString hostAndPort  ) 

Set the remote address/port for all Write() functions.

Parameters:
hostAndPort  String of the form host[:port]

void PMonitoredSocketChannel::GetRemote ( PIPSocket::Address addr,
WORD &  port 
) const [inline]

Get the current remote address/port for all Write() functions.

Parameters:
port  Remote IP address Remote port number

void PMonitoredSocketChannel::SetPromiscuous ( BOOL  flag  )  [inline]

Set flag for receiving UDP data from any remote address. If the flag is FALSE then data received from anything other than the configured remote address and port is ignored.

Parameters:
flag  New flag

bool PMonitoredSocketChannel::GetPromiscuous (  )  [inline]

Get flag for receiving UDP data from any remote address.

void PMonitoredSocketChannel::GetLastReceived ( PIPSocket::Address addr,
WORD &  port 
) const [inline]

Parameters:
port  Remote IP address Remote port number

const PMonitoredSocketsPtr& PMonitoredSocketChannel::GetMonitoredSockets (  )  const [inline]

Get the monitored socket bundle being used by this channel.


Member Data Documentation

PMonitoredSocketsPtr PMonitoredSocketChannel::socketBundle [protected]

BOOL PMonitoredSocketChannel::sharedBundle [protected]

PString PMonitoredSocketChannel::currentInterface [protected]

BOOL PMonitoredSocketChannel::promiscuousReads [protected]

PIPSocket::Address PMonitoredSocketChannel::remoteAddress [protected]

BOOL PMonitoredSocketChannel::closing [protected]

WORD PMonitoredSocketChannel::remotePort [protected]

PIPSocket::Address PMonitoredSocketChannel::lastReceivedAddress [protected]

WORD PMonitoredSocketChannel::lastReceivedPort [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