0N/A/*
2362N/A * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#ifndef NETWORK_INTERFACE_H
0N/A#define NETWORK_INTERFACE_H
0N/A
449N/A#include <iphlpapi.h>
0N/A#include "net_util.h"
0N/A
0N/A/*
0N/A * Structures used when enumerating interfaces and addresses
0N/A */
0N/Atypedef struct _netaddr {
0N/A SOCKETADDRESS addr; /* IPv4 or IPv6 address */
0N/A SOCKETADDRESS brdcast;
0N/A short mask;
0N/A struct _netaddr *next;
0N/A} netaddr;
0N/A
0N/Atypedef struct _netif {
0N/A char *name;
0N/A char *displayName;
0N/A DWORD dwIndex; /* Internal index */
0N/A DWORD ifType; /* Interface type */
0N/A int index; /* Friendly index */
0N/A struct _netif *next;
0N/A
0N/A /* Following fields used on Windows XP when IPv6 is used only */
0N/A jboolean hasIpv6Address; /* true when following fields valid */
0N/A jboolean dNameIsUnicode; /* Display Name is Unicode */
0N/A int naddrs; /* Number of addrs */
0N/A DWORD ipv6Index;
0N/A struct _netaddr *addrs; /* addr list for interfaces */
0N/A} netif;
0N/A
0N/Aextern void free_netif(netif *netifP);
0N/Aextern void free_netaddr(netaddr *netaddrP);
0N/A
0N/A/* various JNI ids */
0N/Aextern jclass ni_class; /* NetworkInterface */
0N/A
0N/Aextern jmethodID ni_ctor; /* NetworkInterface() */
0N/A
0N/Aextern jfieldID ni_indexID; /* NetworkInterface.index */
0N/Aextern jfieldID ni_addrsID; /* NetworkInterface.addrs */
0N/Aextern jfieldID ni_bindsID; /* NetworkInterface.bindings */
0N/Aextern jfieldID ni_nameID; /* NetworkInterface.name */
0N/Aextern jfieldID ni_displayNameID; /* NetworkInterface.displayName */
0N/Aextern jfieldID ni_childsID; /* NetworkInterface.childs */
0N/A
0N/Aextern jclass ni_iacls; /* InetAddress */
0N/A
0N/Aextern jclass ni_ia4cls; /* Inet4Address */
0N/Aextern jmethodID ni_ia4Ctor; /* Inet4Address() */
0N/A
0N/Aextern jclass ni_ia6cls; /* Inet6Address */
0N/Aextern jmethodID ni_ia6ctrID; /* Inet6Address() */
0N/Aextern jfieldID ni_ia6ipaddressID;
0N/Aextern jfieldID ni_ia6ipaddressID;
0N/A
0N/Aextern jclass ni_ibcls; /* InterfaceAddress */
0N/Aextern jmethodID ni_ibctrID; /* InterfaceAddress() */
0N/Aextern jfieldID ni_ibaddressID; /* InterfaceAddress.address */
0N/Aextern jfieldID ni_ibbroadcastID; /* InterfaceAddress.broadcast */
0N/Aextern jfieldID ni_ibmaskID; /* InterfaceAddress.maskLength */
0N/A
3877N/Aint enumInterfaces(JNIEnv *env, netif **netifPP);
0N/A
0N/A#endif