OLInternetAddress Class Reference
[Sockets]

An address in the Internet family of addresses. More...

#import <ObjectiveLib/SocketAddress.h>

Inheritance diagram for OLInternetAddress:

Inheritance graph
[legend]
List of all members.

Public Member Functions

(const char *) - canonicalName
 Return the canonical name of the host.
(BOOL) - isLocalWildcard
 Return whether this address is a local wildcard.
(uint16_t) - port
 Return the port.
(int) - socketType
 Return the type of socket with which this address may be used.
Initializers and Deallocators
(id) - free
 Finalize the address and deallocate any allocated memory.

Static Public Member Functions

(OLInternetAddress *) + addressWithCurrentHostAndPort:
 Create and return a new address.
(OLInternetAddress *) + addressWithCurrentHostAndService:
 Create and return a new address.
(OLInternetAddress *) + addressWithHost:port:
 Create and return a new address.
(OLInternetAddress *) + addressWithHost:service:
 Create and return a new address.
(OLVector *) + allAddressesWithHost:port:
 Return all addresses available from the given port of the given host.
(OLVector *) + allAddressesWithHost:service:
 Return all addresses available from the given service of the given host.
(id) + initialize
 Initialize the class when it is loaded into the runtime system.
(OLInternetAddress *) + loopbackWithPort:
 Return the loopback address for this machine associated with the given port.
(OLInternetAddress *) + loopbackWithService:
 Return the loopback address for this machine associated with the given service.
(BOOL) + preferIPv6Addresses
 Return whether the system prefers to use IPv6 addresses.
(void) + setPreferIPv6Addresses:
 Set whether the system should prefer IPv6 addresses.

Protected Attributes

char * canonicalName
 The canonical name.
int socketType
 The type of socket for which this address is suitable.

Detailed Description

An address in the Internet family of addresses.

Internet address are suitable for contacting Internet hosts.


Member Function Documentation

+ (OLInternetAddress*) addressWithCurrentHostAndPort: (uint16_t)  port  

Create and return a new address.

The address of the current host is determined and associated with the given port.

Exceptions:
OLSocketException if there is a problem determining the host's address
Parameters:
port the port that should be associated with the address
Returns:
a reference to the new address

+ (OLInternetAddress*) addressWithCurrentHostAndService: (const char *)  service  

Create and return a new address.

The address of the current host is determined and associated with the given service. Service names are those enumerated (usually) in the /etc/services file. The service entry corresponding to the requested service is retrieved and its port is associated with the new address.

Exceptions:
OLSocketException if there is a problem determining the host's address or if the service cannot be found
Parameters:
service the service to look up
Returns:
a reference to the new address

+ (OLInternetAddress*) addressWithHost: (const char *)  name
port: (uint16_t)  port 

Create and return a new address.

The address of the named host is looked up and associated with the given port.

Exceptions:
OLSocketException if the is a problem determining the host's address
Parameters:
name the name of the host
port the port that should be associated with the address
Returns:
a reference to the new address

+ (OLInternetAddress*) addressWithHost: (const char *)  name
service: (const char *)  service 

Create and return a new address.

The address of the named host is determined and associated with the given service. Service names are those enumerated (usually) in the /etc/services file. The service entry corresponding to the requested service is retrieved and its port is associated with the new address.

Exceptions:
OLSocketException if the is a problem determining the host's address or if the service cannot be found
Parameters:
name the name of the host
service the service to look up
Returns:
a reference to the new address

+ (OLVector*) allAddressesWithHost: (const char *)  name
port: (uint16_t)  port 

Return all addresses available from the given port of the given host.

The vector will contain objects of type OLInternetAddress.

Parameters:
name the name of the host to look up
port the port number of the desired host

+ (OLVector*) allAddressesWithHost: (const char *)  name
service: (const char *)  service 

Return all addresses available from the given service of the given host.

The vector will contain objects of type OLInternetAddress.

Parameters:
name the name of the host to look up
service the name of the service to look up

- (const char*) canonicalName  

Return the canonical name of the host.

The host to which this address points is looked up to determine its name. The name is returned.

Exceptions:
OLSocketException if there is a problem looking up the name
Returns:
the canonical name

- (id) free  

Finalize the address and deallocate any allocated memory.

Reimplemented in OLInternet4Address, and OLInternet6Address.

+ (id) initialize  

Initialize the class when it is loaded into the runtime system.

Please don't call this method.

- (BOOL) isLocalWildcard  

Return whether this address is a local wildcard.

A local wildcard address is one that can refer to any of the current host's IP addresses without specifying exactly which one.

Returns:
YES if this is a wildcard address, NO if not

Reimplemented in OLInternet4Address, and OLInternet6Address.

+ (OLInternetAddress*) loopbackWithPort: (uint16_t)  port  

Return the loopback address for this machine associated with the given port.

Parameters:
port the port to use at the loopback address
Returns:
the address

+ (OLInternetAddress*) loopbackWithService: (const char *)  service  

Return the loopback address for this machine associated with the given service.

Parameters:
service the service to use at the loopback address
Returns:
the address

- (uint16_t) port  

Return the port.

Returns:
the port

Reimplemented in OLInternet4Address, and OLInternet6Address.

+ (BOOL) preferIPv6Addresses  

Return whether the system prefers to use IPv6 addresses.

Returns:
YES if IPv6 addresses are preferred, NO otherwise

+ (void) setPreferIPv6Addresses: (BOOL)  state  

Set whether the system should prefer IPv6 addresses.

Parameters:
state should be YES if IPv6 addresses are preferred, NO otherwise

- (int) socketType  

Return the type of socket with which this address may be used.

This value is a platform-dependent number that will correspond to a defined value such as SOCK_STREAM or SOCK_DGRAM.

See also:
- socketType (OLSocket)
Returns:
the type of socket


Member Data Documentation

- (char*) canonicalName [protected]

The canonical name.

- (int) socketType [protected]

The type of socket for which this address is suitable.


The documentation for this class was generated from the following file:
ObjectiveLibGenerated Sun Apr 22 15:18:41 2007, © 2004-2007 Will Mason
SourceForge.net Logo