org.apache.tomcat.jni

Class Address

public class Address extends Object

Address

Version: $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $

Author: Mladen Turk

Field Summary
static StringAPR_ANYADDR
Method Summary
static booleanequal(long a, long b)
See if the IP addresses in two APR socket addresses are equivalent.
static booleanfill(Sockaddr info, long sa)
Fill the Sockaddr class from apr_sockaddr_t
static longget(int which, long sock)
Return an apr_sockaddr_t from an apr_socket_t
static Stringgetip(long sa)
Return the IP address (in numeric address string format) in an APR socket address.
static SockaddrgetInfo(long sa)
Create the Sockaddr object from apr_sockaddr_t
static Stringgetnameinfo(long sa, int flags)
Look up the host name from an apr_sockaddr_t.
static intgetservbyname(long sockaddr, String servname)
Given an apr_sockaddr_t and a service name, set the port for the service
static longinfo(String hostname, int family, int port, int flags, long p)
Create apr_sockaddr_t from hostname, address family, and port.

Field Detail

APR_ANYADDR

public static String APR_ANYADDR

Method Detail

equal

public static boolean equal(long a, long b)
See if the IP addresses in two APR socket addresses are equivalent. Appropriate logic is present for comparing IPv4-mapped IPv6 addresses with IPv4 addresses.

Parameters: a One of the APR socket addresses. b The other APR socket address. The return value will be True if the addresses are equivalent.

fill

public static boolean fill(Sockaddr info, long sa)
Fill the Sockaddr class from apr_sockaddr_t

Parameters: info Sockaddr class to fill sa Structure pointer

get

public static long get(int which, long sock)
Return an apr_sockaddr_t from an apr_socket_t

Parameters: which Which interface do we want the apr_sockaddr_t for? sock The socket to use

Returns: The returned apr_sockaddr_t.

getip

public static String getip(long sa)
Return the IP address (in numeric address string format) in an APR socket address. APR will allocate storage for the IP address string from the pool of the apr_sockaddr_t.

Parameters: sa The socket address to reference.

Returns: The IP address.

getInfo

public static Sockaddr getInfo(long sa)
Create the Sockaddr object from apr_sockaddr_t

Parameters: sa Structure pointer

getnameinfo

public static String getnameinfo(long sa, int flags)
Look up the host name from an apr_sockaddr_t.

Parameters: sa The apr_sockaddr_t. flags Special processing flags.

Returns: The hostname.

getservbyname

public static int getservbyname(long sockaddr, String servname)
Given an apr_sockaddr_t and a service name, set the port for the service

Parameters: sockaddr The apr_sockaddr_t that will have its port set servname The name of the service you wish to use

Returns: APR status code.

info

public static long info(String hostname, int family, int port, int flags, long p)
Create apr_sockaddr_t from hostname, address family, and port.

Parameters: hostname The hostname or numeric address string to resolve/parse, or NULL to build an address that corresponds to 0.0.0.0 or :: family The address family to use, or APR_UNSPEC if the system should decide. port The port number. flags Special processing flags:

       APR_IPV4_ADDR_OK          first query for IPv4 addresses; only look
                                 for IPv6 addresses if the first query failed;
                                 only valid if family is APR_UNSPEC and hostname
                                 isn't NULL; mutually exclusive with
                                 APR_IPV6_ADDR_OK
       APR_IPV6_ADDR_OK          first query for IPv6 addresses; only look
                                 for IPv4 addresses if the first query failed;
                                 only valid if family is APR_UNSPEC and hostname
                                 isn't NULL and APR_HAVE_IPV6; mutually exclusive
                                 with APR_IPV4_ADDR_OK
 
p The pool for the apr_sockaddr_t and associated storage.

Returns: The new apr_sockaddr_t.

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.