1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.system;
18 
19 import java.net.InetAddress;
20 import libcore.util.Objects;
21 
22 /**
23  * Information returned/taken by getaddrinfo(3). Corresponds to C's {@code struct addrinfo} from
24  * <a href="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/netdb.h.html">&lt;netdb.h&gt;</a>
25  *
26  * TODO: we currently only _take_ a StructAddrinfo; getaddrinfo returns an InetAddress[].
27  *
28  * @hide
29  */
30 public final class StructAddrinfo {
31   /** Flags describing the kind of lookup to be done. (Such as AI_ADDRCONFIG.) */
32   public int ai_flags;
33 
34   /** Desired address family for results. (Such as AF_INET6 for IPv6. AF_UNSPEC means "any".) */
35   public int ai_family;
36 
37   /** Socket type. (Such as SOCK_DGRAM. 0 means "any".) */
38   public int ai_socktype;
39 
40   /** Protocol. (Such as IPPROTO_IPV6 IPv6. 0 means "any".) */
41   public int ai_protocol;
42 
43   /** Address length. (Not useful in Java.) */
44   // public int ai_addrlen;
45 
46   /** Address. */
47   public InetAddress ai_addr;
48 
49   /** Canonical name of service location (if AI_CANONNAME provided in ai_flags). */
50   // public String ai_canonname;
51 
52   /** Next element in linked list. */
53   public StructAddrinfo ai_next;
54 
toString()55   @Override public String toString() {
56     return Objects.toString(this);
57   }
58 }
59