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 libcore.io; 18 19 import java.net.InetAddress; 20 21 /** 22 * Information returned/taken by getaddrinfo(3). Corresponds to C's {@code struct addrinfo} from 23 * <a href="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/netdb.h.html"><netdb.h></a> 24 * 25 * TODO: we currently only _take_ a StructAddrinfo; getaddrinfo returns an InetAddress[]. 26 */ 27 public final class StructAddrinfo { 28 /** Flags describing the kind of lookup to be done. (Such as AI_ADDRCONFIG.) */ 29 public int ai_flags; 30 31 /** Desired address family for results. (Such as AF_INET6 for IPv6. AF_UNSPEC means "any".) */ 32 public int ai_family; 33 34 /** Socket type. (Such as SOCK_DGRAM. 0 means "any".) */ 35 public int ai_socktype; 36 37 /** Protocol. (Such as IPPROTO_IPV6 IPv6. 0 means "any".) */ 38 public int ai_protocol; 39 40 /** Address length. (Not useful in Java.) */ 41 // public int ai_addrlen; 42 43 /** Address. */ 44 public InetAddress ai_addr; 45 46 /** Canonical name of service location (if AI_CANONNAME provided in ai_flags). */ 47 // public String ai_canonname; 48 49 /** Next element in linked list. */ 50 public StructAddrinfo ai_next; 51 } 52