| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 * contributor license agreements. See the NOTICE file distributed with | |
| 4 * this work for additional information regarding copyright ownership. | |
| 5 * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 * (the "License"); you may not use this file except in compliance with | |
| 7 * the License. You may obtain a copy of the License at | |
| 8 * | |
| 9 * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 * | |
| 11 * Unless required by applicable law or agreed to in writing, software | |
| 12 * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 * See the License for the specific language governing permissions and | |
| 15 * limitations under the License. | |
| 16 */ | |
| 17 | |
| 18 package org.apache.tomcat.jni; | |
| 19 | |
| 20 /** Address | |
| 21 * | |
| 22 * @author Mladen Turk | |
| 23 */ | |
| 24 public class Address { | |
| 25 | |
| 26 public static final String APR_ANYADDR = "0.0.0.0"; | |
| 27 /** | |
| 28 * Fill the Sockaddr class from apr_sockaddr_t | |
| 29 * @param info Sockaddr class to fill | |
| 30 * @param sa Structure pointer | |
| 31 */ | |
| 32 public static native boolean fill(Sockaddr info, long sa); | |
| 33 | |
| 34 /** | |
| 35 * Create the Sockaddr object from apr_sockaddr_t | |
| 36 * @param sa Structure pointer | |
| 37 */ | |
| 38 public static native Sockaddr getInfo(long sa); | |
| 39 | |
| 40 /** | |
| 41 * Create apr_sockaddr_t from hostname, address family, and port. | |
| 42 * @param hostname The hostname or numeric address string to resolve/parse,
or | |
| 43 * NULL to build an address that corresponds to 0.0.0.0 or :: | |
| 44 * @param family The address family to use, or APR_UNSPEC if the system shou
ld | |
| 45 * decide. | |
| 46 * @param port The port number. | |
| 47 * @param flags Special processing flags: | |
| 48 * <PRE> | |
| 49 * APR_IPV4_ADDR_OK first query for IPv4 addresses; only look | |
| 50 * for IPv6 addresses if the first query fai
led; | |
| 51 * only valid if family is APR_UNSPEC and ho
stname | |
| 52 * isn't NULL; mutually exclusive with | |
| 53 * APR_IPV6_ADDR_OK | |
| 54 * APR_IPV6_ADDR_OK first query for IPv6 addresses; only look | |
| 55 * for IPv4 addresses if the first query fai
led; | |
| 56 * only valid if family is APR_UNSPEC and ho
stname | |
| 57 * isn't NULL and APR_HAVE_IPV6; mutually ex
clusive | |
| 58 * with APR_IPV4_ADDR_OK | |
| 59 * </PRE> | |
| 60 * @param p The pool for the apr_sockaddr_t and associated storage. | |
| 61 * @return The new apr_sockaddr_t. | |
| 62 */ | |
| 63 public static native long info(String hostname, int family, | |
| 64 int port, int flags, long p) | |
| 65 throws Exception; | |
| 66 /** | |
| 67 * Look up the host name from an apr_sockaddr_t. | |
| 68 * @param sa The apr_sockaddr_t. | |
| 69 * @param flags Special processing flags. | |
| 70 * @return The hostname. | |
| 71 */ | |
| 72 public static native String getnameinfo(long sa, int flags); | |
| 73 | |
| 74 /** | |
| 75 * Return the IP address (in numeric address string format) in | |
| 76 * an APR socket address. APR will allocate storage for the IP address | |
| 77 * string from the pool of the apr_sockaddr_t. | |
| 78 * @param sa The socket address to reference. | |
| 79 * @return The IP address. | |
| 80 */ | |
| 81 public static native String getip(long sa); | |
| 82 | |
| 83 /** | |
| 84 * Given an apr_sockaddr_t and a service name, set the port for the service | |
| 85 * @param sockaddr The apr_sockaddr_t that will have its port set | |
| 86 * @param servname The name of the service you wish to use | |
| 87 * @return APR status code. | |
| 88 */ | |
| 89 public static native int getservbyname(long sockaddr, String servname); | |
| 90 | |
| 91 /** | |
| 92 * Return an apr_sockaddr_t from an apr_socket_t | |
| 93 * @param which Which interface do we want the apr_sockaddr_t for? | |
| 94 * @param sock The socket to use | |
| 95 * @return The returned apr_sockaddr_t. | |
| 96 */ | |
| 97 public static native long get(int which, long sock) | |
| 98 throws Exception; | |
| 99 | |
| 100 /** | |
| 101 * See if the IP addresses in two APR socket addresses are | |
| 102 * equivalent. Appropriate logic is present for comparing | |
| 103 * IPv4-mapped IPv6 addresses with IPv4 addresses. | |
| 104 * | |
| 105 * @param a One of the APR socket addresses. | |
| 106 * @param b The other APR socket address. | |
| 107 * The return value will be True if the addresses | |
| 108 * are equivalent. | |
| 109 */ | |
| 110 public static native boolean equal(long a, long b); | |
| 111 | |
| 112 } | |
| OLD | NEW |