• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 libcore.util.Objects;
20 
21 import java.net.InetAddress;
22 
23 /**
24  * Information returned by {@link Os#getifaddrs}. Loosely corresponds to C's
25  * {@code struct ifaddrs} from {@code <ifaddrs.h>}.
26  *
27  * @hide
28  */
29 public final class StructIfaddrs {
30     public final String ifa_name;
31     public final int ifa_flags;
32     public final InetAddress ifa_addr;
33     public final InetAddress ifa_netmask;
34     public final InetAddress ifa_broadaddr;
35     public final byte[] hwaddr;
36 
37     /**
38      * Constructs an instance with the given field values.
39      */
StructIfaddrs(String ifa_name, int ifa_flags, InetAddress ifa_addr, InetAddress ifa_netmask, InetAddress ifa_broadaddr, byte[] hwaddr)40     public StructIfaddrs(String ifa_name, int ifa_flags, InetAddress ifa_addr, InetAddress ifa_netmask,
41                          InetAddress ifa_broadaddr, byte[] hwaddr) {
42         this.ifa_name = ifa_name;
43         this.ifa_flags = ifa_flags;
44         this.ifa_addr = ifa_addr;
45         this.ifa_netmask = ifa_netmask;
46         this.ifa_broadaddr = ifa_broadaddr;
47         this.hwaddr = hwaddr;
48     }
49 
toString()50     @Override public String toString() {
51         return Objects.toString(this);
52     }
53 }
54