public class Address extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
APR_ANYADDR |
| Constructor and Description |
|---|
Address() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equal(long a,
long b)
See if the IP addresses in two APR socket addresses are
equivalent.
|
static boolean |
fill(Sockaddr info,
long sa)
Fill the Sockaddr class from apr_sockaddr_t
|
static long |
get(int which,
long sock)
Return an apr_sockaddr_t from an apr_socket_t
|
static Sockaddr |
getInfo(long sa)
Create the Sockaddr object from apr_sockaddr_t
|
static String |
getip(long sa)
Return the IP address (in numeric address string format) in
an APR socket address.
|
static String |
getnameinfo(long sa,
int flags)
Look up the host name from an apr_sockaddr_t.
|
static int |
getservbyname(long sockaddr,
String servname)
Given an apr_sockaddr_t and a service name, set the port for the service
|
static long |
info(String hostname,
int family,
int port,
int flags,
long p)
Create apr_sockaddr_t from hostname, address family, and port.
|
public static final String APR_ANYADDR
public static boolean fill(Sockaddr info, long sa)
info - Sockaddr class to fillsa - Structure pointertrue if the operation was successfulpublic static Sockaddr getInfo(long sa)
sa - Structure pointerpublic static long info(String hostname, int family, int port, int flags, long p) throws Exception
hostname - The hostname or numeric address string to resolve/parse, the
path of the Unix Domain Socket, 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.Exception - Operation failedpublic static String getnameinfo(long sa, int flags)
sa - The apr_sockaddr_t.flags - Special processing flags.public static String getip(long sa)
sa - The socket address to reference.public static int getservbyname(long sockaddr,
String servname)
sockaddr - The apr_sockaddr_t that will have its port setservname - The name of the service you wish to usepublic static long get(int which,
long sock)
throws Exception
which - Which interface do we want the apr_sockaddr_t for?sock - The socket to useException - An error occurredpublic static boolean equal(long a,
long b)
a - One of the APR socket addresses.b - The other APR socket address.true if the addresses are equalCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.