Path: blob/master/src/java.base/share/native/libnet/Inet6Address.c
41149 views
/*1* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include <string.h>2627#include "java_net_Inet6Address.h"28#include "net_util.h"2930/************************************************************************31* Inet6Address32*/3334jclass ia6_class;35jfieldID ia6_holder6ID;3637jfieldID ia6_ipaddressID;38jfieldID ia6_scopeidID;39jfieldID ia6_scopeidsetID;40jfieldID ia6_scopeifnameID;41jmethodID ia6_ctrID;4243static int ia6_initialized = 0;4445/*46* Class: java_net_Inet6Address47* Method: init48* Signature: ()V49*/50JNIEXPORT void JNICALL51Java_java_net_Inet6Address_init(JNIEnv *env, jclass cls) {52if (!ia6_initialized) {53jclass ia6h_class;54jclass c = (*env)->FindClass(env, "java/net/Inet6Address");55CHECK_NULL(c);56ia6_class = (*env)->NewGlobalRef(env, c);57CHECK_NULL(ia6_class);58ia6h_class = (*env)->FindClass(env, "java/net/Inet6Address$Inet6AddressHolder");59CHECK_NULL(ia6h_class);60ia6_holder6ID = (*env)->GetFieldID(env, ia6_class, "holder6", "Ljava/net/Inet6Address$Inet6AddressHolder;");61CHECK_NULL(ia6_holder6ID);62ia6_ipaddressID = (*env)->GetFieldID(env, ia6h_class, "ipaddress", "[B");63CHECK_NULL(ia6_ipaddressID);64ia6_scopeidID = (*env)->GetFieldID(env, ia6h_class, "scope_id", "I");65CHECK_NULL(ia6_scopeidID);66ia6_scopeidsetID = (*env)->GetFieldID(env, ia6h_class, "scope_id_set", "Z");67CHECK_NULL(ia6_scopeidsetID);68ia6_scopeifnameID = (*env)->GetFieldID(env, ia6h_class, "scope_ifname", "Ljava/net/NetworkInterface;");69CHECK_NULL(ia6_scopeifnameID);70ia6_ctrID = (*env)->GetMethodID(env, ia6_class, "<init>", "()V");71CHECK_NULL(ia6_ctrID);72ia6_initialized = 1;73}74}757677