#include <psockbun.h>
Inheritance diagram for PMonitoredSocketChannel:
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 PString & | GetInterface () |
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 PMonitoredSocketsPtr & | GetMonitoredSockets () 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 |
PMonitoredSocketChannel::PMonitoredSocketChannel | ( | const PMonitoredSocketsPtr & | sockets, | |
BOOL | shared | |||
) |
Construct a monitored socket bundle channel.
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.
shared | Monitored socket bundle to use in channel Monitored socket is shared by other channels |
virtual BOOL PMonitoredSocketChannel::IsOpen | ( | ) | const [virtual] |
virtual BOOL PMonitoredSocketChannel::Close | ( | ) | [virtual] |
Close the channel, shutting down the link to the data source.
Reimplemented from PChannel.
virtual BOOL PMonitoredSocketChannel::Read | ( | void * | buffer, | |
PINDEX | length | |||
) | [virtual] |
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.
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".
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.
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.
port | Remote IP address Remote port number |
void PMonitoredSocketChannel::SetRemote | ( | const PString & | hostAndPort | ) |
Set the remote address/port for all Write() functions.
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.
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.
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] |
port | Remote IP address Remote port number |
const PMonitoredSocketsPtr& PMonitoredSocketChannel::GetMonitoredSockets | ( | ) | const [inline] |
Get the monitored socket bundle being used by this channel.
BOOL PMonitoredSocketChannel::sharedBundle [protected] |
PString PMonitoredSocketChannel::currentInterface [protected] |
BOOL PMonitoredSocketChannel::promiscuousReads [protected] |
BOOL PMonitoredSocketChannel::closing [protected] |
WORD PMonitoredSocketChannel::remotePort [protected] |
WORD PMonitoredSocketChannel::lastReceivedPort [protected] |