C++ IP API  9.5.8
TCP & UDP for virtual user scripts
Facilita::IpEndPoint Class Reference

This class encapsulates IP address and port. Static member instances represent common patterns and address families. More...

Collaboration diagram for Facilita::IpEndPoint:

Public Types

enum  AddressType {
  NONE, ANY, STANDARD, ALL,
  BROADCAST
}
 A low level enumeration used internally. More...
 

Public Methods

 IpEndPoint ()
 Default constructor. More...
 
 IpEndPoint (int port)
 Construct an IpEndPoint with IP address "127.0.0.1" and the given IP port. More...
 
 IpEndPoint (const IpEndPoint &)
 Copy constructor. More...
 
 IpEndPoint (const string &host, int port=0, AddressType addressType=STANDARD)
 A commonly used constructor. More...
 
 IpEndPoint (SOCKADDR_IN &addr)
 A low level constructor used internally and not called directly by test scripts. More...
 
bool IpEndPoint::isIPV4 () const
 
bool IpEndPoint::isIPV6 () const
 
IpEndPointoperator= (const IpEndPoint &other)
 Assignment operator for this class. More...
 
string toString () const
 
Returns
The string describing this object.
More...
 
IpEndPoint withPort (int port) const
 Create a new IpEndPoint that differs from this one only by the port attribute. More...
 
Public Properties

Read only properties of the object.

const string & host () const
 
Returns
The host string (IP address).
More...
 
int port () const
 
Returns
The port (IP port).
More...
 
AddressType addressType () const
 
Returns
The AddressType of this object.
More...
 
bool isLegal () const
 
Returns
True if this object legal and ready for use in the API .
More...
 
bool isAll () const
 
Returns
True this object has an IP wild card address matching all networks in the address family.
More...
 
bool isBroadcast () const
 
Returns
True this object has an IP address representing the broadcast address.
More...
 
bool isStandard () const
 
Returns
True this object has a standard IP address and port.
More...
 

Public Static Members

static const IpEndPoint All
 This object and is used in server scripts as in the example. More...
 
static const IpEndPoint Any
 This object is a "wild card" and used to represent an IP address and port where the actual values used by the low level communication layers will be determined by the Operating System. More...
 
static const IpEndPoint Broadcast
 
static const IpEndPoint Local
 
static const IpEndPoint None
 This object is the value given to for to an uninitialized variable. More...
 

Detailed Description

This class encapsulates IP address and port. Static member instances represent common patterns and address families.

Objects of this class are safe to be copied and re-assigned.

Member Enumeration Documentation

A low level enumeration used internally.

Enumerator
NONE 
ANY 
STANDARD 
ALL 
BROADCAST 

Constructors

Facilita::IpEndPoint::IpEndPoint ( )

Default constructor.

Facilita::IpEndPoint::IpEndPoint ( int  port)

Construct an IpEndPoint with IP address "127.0.0.1" and the given IP port.

Parameters
portMust be non-negative number, being an IP port. 0 is a wild card.
Facilita::IpEndPoint::IpEndPoint ( const IpEndPoint )

Copy constructor.

Facilita::IpEndPoint::IpEndPoint ( const string &  host,
int  port = 0,
AddressType  addressType = STANDARD 
)

A commonly used constructor.

Parameters
hostA string which either requires DNS look up or is a dotted IP address.
portA non-negative number, being an IP port. 0 is a wild card.
addressTypeAs described by the enumeration, it is usually defaulted.
Facilita::IpEndPoint::IpEndPoint ( SOCKADDR_IN &  addr)

A low level constructor used internally and not called directly by test scripts.

Methods

AddressType Facilita::IpEndPoint::addressType ( ) const

Returns
The AddressType of this object.

const string& Facilita::IpEndPoint::host ( ) const

Returns
The host string (IP address).

bool Facilita::IpEndPoint::IpEndPoint::isIPV4 ( ) const
bool Facilita::IpEndPoint::IpEndPoint::isIPV6 ( ) const
bool Facilita::IpEndPoint::isAll ( ) const

Returns
True this object has an IP wild card address matching all networks in the address family.

bool Facilita::IpEndPoint::isBroadcast ( ) const

Returns
True this object has an IP address representing the broadcast address.

bool Facilita::IpEndPoint::isLegal ( ) const

Returns
True if this object legal and ready for use in the API .

bool Facilita::IpEndPoint::isStandard ( ) const

Returns
True this object has a standard IP address and port.

IpEndPoint& Facilita::IpEndPoint::operator= ( const IpEndPoint other)

Assignment operator for this class.

Returns
The this object.
int Facilita::IpEndPoint::port ( ) const

Returns
The port (IP port).

string Facilita::IpEndPoint::toString ( ) const

Returns
The string describing this object.

IpEndPoint Facilita::IpEndPoint::withPort ( int  port) const

Create a new IpEndPoint that differs from this one only by the port attribute.

Parameters
portA non-negative number, being the IP port of the newly created object.
Returns
A new IpEndPoint.

Attributes

const IpEndPoint Facilita::IpEndPoint::All
static

This object and is used in server scripts as in the example.

// wait for a connection on all networks on port 4321 within the address family.
TcpConnection ep1 = tcp().waitForConnection(IpEndPoint::All.withPort(4321));
const IpEndPoint Facilita::IpEndPoint::Any
static

This object is a "wild card" and used to represent an IP address and port where the actual values used by the low level communication layers will be determined by the Operating System.

const IpEndPoint Facilita::IpEndPoint::Broadcast
static
const IpEndPoint Facilita::IpEndPoint::Local
static
writeMessage(string("myPeer = ") + myPeer.toString(); // "127.0.0.1:4321"
const IpEndPoint Facilita::IpEndPoint::None
static

This object is the value given to for to an uninitialized variable.

IpEndPoint myPeer;
writeMessage(string("myPeer = ") + myPeer.toString(); // "none :"

The documentation for this class was generated from the following file: