blob: dab7590e091f4b9853f1d4643bfde5262a253ef8 [file] [log] [blame]
Elliott Hughes1c039d72011-05-04 16:04:04 -07001/*
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
Elliott Hughes5d930ca2014-04-23 17:53:37 -070017package android.system;
Elliott Hughes1c039d72011-05-04 16:04:04 -070018
19import java.net.InetAddress;
Elliott Hughesfe77f812014-04-29 17:59:30 -070020import libcore.util.Objects;
Elliott Hughes1c039d72011-05-04 16:04:04 -070021
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[].
Elliott Hughes5d930ca2014-04-23 17:53:37 -070027 *
28 * @hide
Elliott Hughes1c039d72011-05-04 16:04:04 -070029 */
30public final class StructAddrinfo {
Tobias Thierer87231672017-10-18 14:15:38 +010031 /** Flags describing the kind of lookup to be done. (Such as AI_ADDRCONFIG.) */
32 public int ai_flags;
Elliott Hughes1c039d72011-05-04 16:04:04 -070033
Tobias Thierer87231672017-10-18 14:15:38 +010034 /** Desired address family for results. (Such as AF_INET6 for IPv6. AF_UNSPEC means "any".) */
35 public int ai_family;
Elliott Hughes1c039d72011-05-04 16:04:04 -070036
Tobias Thierer87231672017-10-18 14:15:38 +010037 /** Socket type. (Such as SOCK_DGRAM. 0 means "any".) */
38 public int ai_socktype;
Elliott Hughes1c039d72011-05-04 16:04:04 -070039
Tobias Thierer87231672017-10-18 14:15:38 +010040 /** Protocol. (Such as IPPROTO_IPV6 IPv6. 0 means "any".) */
41 public int ai_protocol;
Elliott Hughes1c039d72011-05-04 16:04:04 -070042
Tobias Thierer87231672017-10-18 14:15:38 +010043 /** Address length. (Not useful in Java.) */
44 // public int ai_addrlen;
Elliott Hughes1c039d72011-05-04 16:04:04 -070045
Tobias Thierer87231672017-10-18 14:15:38 +010046 /** Address. */
47 public InetAddress ai_addr;
Elliott Hughes1c039d72011-05-04 16:04:04 -070048
Tobias Thierer87231672017-10-18 14:15:38 +010049 /** Canonical name of service location (if AI_CANONNAME provided in ai_flags). */
50 // public String ai_canonname;
Elliott Hughes1c039d72011-05-04 16:04:04 -070051
Tobias Thierer87231672017-10-18 14:15:38 +010052 /** Next element in linked list. */
53 public StructAddrinfo ai_next;
Elliott Hughesfe77f812014-04-29 17:59:30 -070054
Tobias Thierer87231672017-10-18 14:15:38 +010055 @Override public String toString() {
56 return Objects.toString(this);
57 }
Elliott Hughes1c039d72011-05-04 16:04:04 -070058}