Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/java/net/Inet6Address.c
38829 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_cachedscopeidID;40jfieldID ia6_scopeidsetID;41jfieldID ia6_scopeifnameID;42jmethodID ia6_ctrID;4344static int ia6_initialized = 0;4546/*47* Class: java_net_Inet6Address48* Method: init49* Signature: ()V50*/51JNIEXPORT void JNICALL52Java_java_net_Inet6Address_init(JNIEnv *env, jclass cls) {53if (!ia6_initialized) {54jclass ia6h_class;55jclass c = (*env)->FindClass(env, "java/net/Inet6Address");56CHECK_NULL(c);57ia6_class = (*env)->NewGlobalRef(env, c);58CHECK_NULL(ia6_class);59ia6h_class = (*env)->FindClass(env, "java/net/Inet6Address$Inet6AddressHolder");60CHECK_NULL(ia6h_class);61ia6_holder6ID = (*env)->GetFieldID(env, ia6_class, "holder6", "Ljava/net/Inet6Address$Inet6AddressHolder;");62CHECK_NULL(ia6_holder6ID);63ia6_ipaddressID = (*env)->GetFieldID(env, ia6h_class, "ipaddress", "[B");64CHECK_NULL(ia6_ipaddressID);65ia6_scopeidID = (*env)->GetFieldID(env, ia6h_class, "scope_id", "I");66CHECK_NULL(ia6_scopeidID);67ia6_cachedscopeidID = (*env)->GetFieldID(env, ia6_class, "cached_scope_id", "I");68CHECK_NULL(ia6_cachedscopeidID);69ia6_scopeidsetID = (*env)->GetFieldID(env, ia6h_class, "scope_id_set", "Z");70CHECK_NULL(ia6_scopeidsetID);71ia6_scopeifnameID = (*env)->GetFieldID(env, ia6h_class, "scope_ifname", "Ljava/net/NetworkInterface;");72CHECK_NULL(ia6_scopeifnameID);73ia6_ctrID = (*env)->GetMethodID(env, ia6_class, "<init>", "()V");74CHECK_NULL(ia6_ctrID);75ia6_initialized = 1;76}77}787980