#include <psockbun.h>
Inheritance diagram for PMonitoredSocketChannel:
Public Member Functions | |
Overrides from class PSocket | |
virtual PBoolean | IsOpen () const |
virtual PBoolean | Close () |
virtual PBoolean | Read (void *buffer, PINDEX length) |
virtual PBoolean | Write (const void *buffer, PINDEX length) |
New functions for class | |
void | SetInterface (const PString &iface) |
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 |
Get the IP address and port of the last received UDP data. | |
PString | GetLastReceivedInterface () const |
Get the interface the last received UDP data was recieved on. | |
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 |
PString | lastReceivedInterface |
PMutex | mutex |
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 PBoolean PMonitoredSocketChannel::IsOpen | ( | ) | const [virtual] |
virtual PBoolean PMonitoredSocketChannel::Close | ( | ) | [virtual] |
Close the channel, shutting down the link to the data source.
Reimplemented from PChannel.
virtual PBoolean PMonitoredSocketChannel::Read | ( | void * | buffer, | |
PINDEX | length | |||
) | [virtual] |
virtual PBoolean 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 PFalse 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 |
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] |
Get the IP address and port of the last received UDP data.
port | Remote IP address Remote port number |
PString PMonitoredSocketChannel::GetLastReceivedInterface | ( | ) | const [inline] |
Get the interface the last received UDP data was recieved on.
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] |
PMutex PMonitoredSocketChannel::mutex [protected] |