Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

PIPSocket Class Reference

#include <ipsock.h>

Inheritance diagram for PIPSocket:

PSocket PChannel PObject PIPDatagramSocket PTCPSocket PICMPSocket PUDPSocket PSocksSocket PTelnetSocket PSocksUDPSocket PSTUNUDPSocket PSocks4Socket PSocks5Socket List of all members.

Public Member Functions

virtual PString GetName () const
virtual BOOL OpenSocket (int ipAdressFamily=PF_INET)=0
virtual BOOL Connect (const PString &address)
virtual BOOL Connect (const Address &addr)
virtual BOOL Connect (WORD localPort, const Address &addr)
virtual BOOL Connect (const Address &iface, const Address &addr)
virtual BOOL Connect (const Address &iface, WORD localPort, const Address &addr)
virtual BOOL Listen (unsigned queueSize=5, WORD port=0, Reusability reuse=AddressIsExclusive)
virtual BOOL Listen (const Address &bind, unsigned queueSize=5, WORD port=0, Reusability reuse=AddressIsExclusive)
virtual BOOL GetLocalAddress (Address &addr)
virtual BOOL GetLocalAddress (Address &addr, WORD &port)
virtual BOOL GetPeerAddress (Address &addr)
virtual BOOL GetPeerAddress (Address &addr, WORD &port)
PString GetLocalHostName ()
PString GetPeerHostName ()
 PLIST (RouteTable, RouteEntry)
 PLIST (InterfaceTable, InterfaceEntry)

Static Public Member Functions

int GetDefaultIpAddressFamily ()
void SetDefaultIpAddressFamily (int ipAdressFamily)
void SetDefaultIpAddressFamilyV4 ()
PIPSocket::Address GetDefaultIpAny ()
PString GetHostName ()
PString GetHostName (const PString &hostname)
PString GetHostName (const Address &addr)
BOOL GetHostAddress (Address &addr)
BOOL GetHostAddress (const PString &hostname, Address &addr)
PStringArray GetHostAliases (const PString &hostname)
PStringArray GetHostAliases (const Address &addr)
BOOL IsLocalHost (const PString &hostname)
void ClearNameCache ()
BOOL GetGatewayAddress (Address &addr)
PString GetGatewayInterface ()
BOOL GetRouteTable (RouteTable &table)
BOOL GetInterfaceTable (InterfaceTable &table)

Protected Member Functions

 PIPSocket ()

Detailed Description

This class describes a type of socket that will communicate using the Internet Protocol. If P_USE_IPV6 is not set, IPv4 only is supported. If P_USE_IPV6 is set, both IPv4 and IPv6 adresses are supported, with IPv4 as default. This allows to transparently use IPv4, IPv6 or Dual stack operating systems.


Constructor & Destructor Documentation

PIPSocket::PIPSocket  )  [protected]
 


Member Function Documentation

void PIPSocket::ClearNameCache  )  [static]
 

Clear the name (DNS) cache.

virtual BOOL PIPSocket::Connect const Address iface,
WORD  localPort,
const Address addr
[virtual]
 

Parameters:
localPort  Address of local interface to us.
addr  Local port number for connection Address of remote machine to connect to.

virtual BOOL PIPSocket::Connect const Address iface,
const Address addr
[virtual]
 

Parameters:
addr  Address of local interface to us. Address of remote machine to connect to.

virtual BOOL PIPSocket::Connect WORD  localPort,
const Address addr
[virtual]
 

Parameters:
addr  Local port number for connection Address of remote machine to connect to.

virtual BOOL PIPSocket::Connect const Address addr  )  [virtual]
 

Parameters:
addr  Address of remote machine to connect to.

Reimplemented in PSocksSocket, and PSocksUDPSocket.

virtual BOOL PIPSocket::Connect const PString address  )  [virtual]
 

Connect a socket to a remote host on the specified port number. This is typically used by the client or initiator of a communications channel. This connects to a "listening" socket at the other end of the communications channel.

The port number as defined by the object instance construction or the #PIPSocket::SetPort()# function.

Returns:
TRUE if the channel was successfully connected to the remote host.
Parameters:
address  Address of remote machine to connect to.

Reimplemented from PSocket.

Reimplemented in PUDPSocket, PSocksSocket, PSocksUDPSocket, and PTelnetSocket.

int PIPSocket::GetDefaultIpAddressFamily  )  [static]
 

PIPSocket::Address PIPSocket::GetDefaultIpAny  )  [static]
 

BOOL PIPSocket::GetGatewayAddress Address addr  )  [static]
 

Get the IP address that is being used as the gateway, that is, the computer that packets on the default route will be sent.

The string returned may be used in the Connect() function to open that interface.

Note that the driver does not need to be open for this function to work.

Returns:
TRUE if there was a gateway.
Parameters:
addr  Variable to receive the IP address.

PString PIPSocket::GetGatewayInterface  )  [static]
 

Get the name for the interface that is being used as the gateway, that is, the interface that packets on the default route will be sent.

The string returned may be used in the Connect() function to open that interface.

Note that the driver does not need to be open for this function to work.

Returns:
String name of the gateway device, or empty string if there is none.

BOOL PIPSocket::GetHostAddress const PString hostname,
Address addr
[static]
 

Parameters:
addr  Variable to receive hosts IP address

BOOL PIPSocket::GetHostAddress Address addr  )  [static]
 

Get the Internet Protocol address for the specified host, or if none specified, for the host this process is running on.

Returns:
TRUE if the IP number was returned.
Parameters:
addr  Variable to receive hosts IP address

PStringArray PIPSocket::GetHostAliases const Address addr  )  [static]
 

Parameters:
addr  Hosts IP address

PStringArray PIPSocket::GetHostAliases const PString hostname  )  [static]
 

Get the alias host names for the specified host. This includes all DNS names, CNAMEs, names in the local hosts file and IP numbers (as "dot" format strings) for the host.

Returns:
array of strings for each alias for the host.

PString PIPSocket::GetHostName const Address addr  )  [static]
 

Parameters:
addr  Hosts IP address to get name for

PString PIPSocket::GetHostName const PString hostname  )  [static]
 

Parameters:
hostname  Hosts IP address to get name for

PString PIPSocket::GetHostName  )  [static]
 

Get the "official" host name for the host specified or if none, the host this process is running on. The host may be specified as an IP number or a hostname alias and is resolved to the canonical form.

Returns:
Name of the host or IP number of host.

BOOL PIPSocket::GetInterfaceTable InterfaceTable &  table  )  [static]
 

Get a list of all interfaces

Returns:
TRUE if the interface table is returned, FALSE if an error occurs.
Parameters:
table  interface table

virtual BOOL PIPSocket::GetLocalAddress Address addr,
WORD &  port
[virtual]
 

Parameters:
port  Variable to receive peer hosts IP address Variable to receive peer hosts port number

Reimplemented in PSTUNUDPSocket, PSocksSocket, and PSocksUDPSocket.

virtual BOOL PIPSocket::GetLocalAddress Address addr  )  [virtual]
 

Get the Internet Protocol address for the local host.

Returns:
TRUE if the IP number was returned.
Parameters:
addr  Variable to receive hosts IP address

Reimplemented in PSTUNUDPSocket, PSocksSocket, and PSocksUDPSocket.

PString PIPSocket::GetLocalHostName  ) 
 

Get the host name for the local host.

Returns:
Name of the host, or an empty string if an error occurs.

virtual PString PIPSocket::GetName  )  const [virtual]
 

Get the platform and I/O channel type name of the channel. For an IP socket this returns the host name of the peer the socket is connected to, followed by the socket number it is connected to.

Returns:
the name of the channel.

Reimplemented from PChannel.

virtual BOOL PIPSocket::GetPeerAddress Address addr,
WORD &  port
[virtual]
 

Parameters:
port  Variable to receive peer hosts IP address Variable to receive peer hosts port number

Reimplemented in PSocksSocket, and PSocksUDPSocket.

virtual BOOL PIPSocket::GetPeerAddress Address addr  )  [virtual]
 

Get the Internet Protocol address for the peer host the socket is connected to.

Returns:
TRUE if the IP number was returned.
Parameters:
addr  Variable to receive hosts IP address

Reimplemented in PSocksSocket, and PSocksUDPSocket.

PString PIPSocket::GetPeerHostName  ) 
 

Get the host name for the peer host the socket is connected to.

Returns:
Name of the host, or an empty string if an error occurs.

BOOL PIPSocket::GetRouteTable RouteTable &  table  )  [static]
 

Get the systems route table.

Returns:
TRUE if the route table is returned, FALSE if an error occurs.
Parameters:
table  Route table

BOOL PIPSocket::IsLocalHost const PString hostname  )  [static]
 

Determine if the specified host is actually the local machine. This can be any of the host aliases or multi-homed IP numbers or even the special number 127.0.0.1 for the loopback device.

Returns:
TRUE if the host is the local machine.

virtual BOOL PIPSocket::Listen const Address bind,
unsigned  queueSize = 5,
WORD  port = 0,
Reusability  reuse = AddressIsExclusive
[virtual]
 

Parameters:
queueSize  Local interface address to bind to.
port  Number of pending accepts that may be queued.
reuse  Port number to use for the connection. Can/Can't listen more than once.

Reimplemented in PTCPSocket.

virtual BOOL PIPSocket::Listen unsigned  queueSize = 5,
WORD  port = 0,
Reusability  reuse = AddressIsExclusive
[virtual]
 

Listen on a socket for a remote host on the specified port number. This may be used for server based applications. A "connecting" socket begins a connection by initiating a connection to this socket. An active socket of this type is then used to generate other "accepting" sockets which establish a two way communications channel with the "connecting" socket.

If the port# parameter is zero then the port number as defined by the object instance construction or the #PIPSocket::SetPort()# function.

For the UDP protocol, the #queueSize# parameter is ignored.

Returns:
TRUE if the channel was successfully opened.
Parameters:
port  Number of pending accepts that may be queued.
reuse  Port number to use for the connection. Can/Cant listen more than once.

Reimplemented from PSocket.

Reimplemented in PTCPSocket, PSocksSocket, and PSocksUDPSocket.

virtual BOOL PIPSocket::OpenSocket int  ipAdressFamily = PF_INET  )  [pure virtual]
 

Implemented in PICMPSocket, PTCPSocket, and PUDPSocket.

PIPSocket::PLIST InterfaceTable  ,
InterfaceEntry 
 

PIPSocket::PLIST RouteTable  ,
RouteEntry 
 

void PIPSocket::SetDefaultIpAddressFamily int  ipAdressFamily  )  [static]
 

void PIPSocket::SetDefaultIpAddressFamilyV4  )  [static]
 


The documentation for this class was generated from the following file:
Generated on Sat Jul 24 15:35:59 2004 for PWLib by doxygen 1.3.7