Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

strmod::ehnet::InetAddress Class Reference

An IPV4 TCP or UDP address. More...

#include <EHnet++/InetAddress.h>

Inheritance diagram for strmod::ehnet::InetAddress:

Inheritance graph
[legend]
List of all members.

Public Methods

 InetAddress (const::std::string &h_name, U2Byte prt)
 Create an InetAddress from a hostname/dotted-quad and port #.

 InetAddress (U2Byte port)
 Create an InetAddress pointing an INADDR_ANY and a port #.

 InetAddress (const InetAddress &b)
 Create a copy of another InetAddress.

 InetAddress (const::sockaddr_in &iadr)
 Create an InetAddress from the associated sockaddr_in structure.

virtual ~InetAddress ()
 No pointers or anything, so not much to destroy.

virtual int AreYouA (const ClassIdent &cid) const
virtual::sockaddr * SockAddr ()
 Get the sockaddr struct this object is wrapping.

InetAddress * Copy () const
 Clone this address, no matter it's actual type.

virtual int AddressSize () const
 How long is this address in memory?

virtual::std::string AsString ()
 Fetch a string representation of the SocketAddress.

::std::string GetHostname () const
 Get the host name associated with this address, possibly the result of a reverse DNS lookup.

::std::string GetHostname (bool forcelookup)
 Get the host name associated with this address, possibly the result of a reverse DNS lookup.

U2Byte GetPort () const
 Get the port number.

const InetAddress & operator= (const InetAddress &b)
 Only necessary because of the DNS lookups.

const InetAddress & operator= (const::sockaddr_in &iadr)
 Copy an InetAddress from a sockaddr_in structure.


Static Public Attributes

const NET_ClassIdent identifier
 Globally unique identifier for this class.


Protected Methods

virtual const lcore::ClassIdent * i_GetIdent () const
 Returns the class identifier for the class the object actually is.

virtual SocketAddressMakeCopy () const
 Clone this address, no matter it's actual type.

void InvalidateAddress ()
 Mark this address as invalid.


Static Protected Methods

bool ParseNumeric (const char *numeric_addr, U4Byte &num)
 Parse out a dotted-quad.

bool NameToIaddr (const char *name_addr, U4Byte &num)
 Lookup an IPV4 address from a hostname - returns false on failure.

::std::string IaddrToName (const::sockaddr_in &inaddr)
 Lookup a hostname from an IPV4 address.


Detailed Description

An IPV4 TCP or UDP address.

This class represents an IPV4 TCP or UDP address. It doesn't represent a straight IPV4 address because it has a port number.

This class has the nasty habit of doing blocking DNS lookups at random times. This may cause a several second pause while they're going on.

Definition at line 88 of file InetAddress.h.


Constructor & Destructor Documentation

strmod::ehnet::InetAddress::InetAddress const::std::string &    h_name,
U2Byte    prt
 

Create an InetAddress from a hostname/dotted-quad and port #.

Parameters:
h_name A host name (i.e. omnifarious.omnifarious.org) , or dotted-quad (i.e. 208.42.65.33).
prt A TCP or UDP port number.

Definition at line 132 of file InetAddress.cxx.

strmod::ehnet::InetAddress::InetAddress U2Byte    port
 

Create an InetAddress pointing an INADDR_ANY and a port #.

Parameters:
port A TCP or UDP port number

Definition at line 166 of file InetAddress.cxx.

strmod::ehnet::InetAddress::InetAddress const::sockaddr_in &    iadr
 

Create an InetAddress from the associated sockaddr_in structure.

Useful for addresses you get back from accept(2) or getpeername(2)


Member Function Documentation

InetAddress* strmod::ehnet::InetAddress::Copy   const [inline]
 

Clone this address, no matter it's actual type.

This is a non-virtual for compilers that don't support contravariance in the return types of virtual functions.

Reimplemented from strmod::ehnet::SocketAddress.

Definition at line 120 of file InetAddress.h.

virtual const lcore::ClassIdent* strmod::ehnet::InetAddress::i_GetIdent   const [inline, protected, virtual]
 

Returns the class identifier for the class the object actually is.

Should always be overridden in any class that has a static identifier member.

Reimplemented from strmod::ehnet::SocketAddress.

Definition at line 140 of file InetAddress.h.

const InetAddress& strmod::ehnet::InetAddress::operator= const::sockaddr_in &    iadr
 

Copy an InetAddress from a sockaddr_in structure.

Useful for addresses you get back from accept(2) or getpeername(2).


Member Data Documentation

const NET_ClassIdent strmod::ehnet::InetAddress::identifier [static]
 

Globally unique identifier for this class.

Every class that might need to be identified should have a public static const identifier object in it.

Reimplemented from strmod::ehnet::SocketAddress.


The documentation for this class was generated from the following files:
Generated on Wed Jan 29 00:32:47 2003 for libNet by doxygen1.3-rc1