Path: blob/master/src/java.security.jgss/share/native/libj2gss/NativeUtil.h
41149 views
/*1* Copyright (c) 2005, 2019, 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 <jni.h>26#include <stdlib.h>27#include <string.h>28#include <inttypes.h>29#include "gssapi.h"3031#ifndef _Included_NATIVE_Util32#define _Included_NATIVE_Util33#ifdef __cplusplus34extern "C" {35#endif36extern jint getJavaTime(OM_uint32);37extern OM_uint32 getGSSTime(jint);38extern void checkStatus(JNIEnv *, jobject, OM_uint32, OM_uint32, char*);39extern jint checkTime(OM_uint32);40extern void throwOutOfMemoryError(JNIEnv *, const char*);41extern void initGSSBuffer(JNIEnv *, jbyteArray, gss_buffer_t);42extern void resetGSSBuffer(gss_buffer_t);4344extern gss_OID newGSSOID(JNIEnv *, jobject);45extern void deleteGSSOID(gss_OID);46extern gss_OID_set newGSSOIDSet(gss_OID);47extern void deleteGSSOIDSet(gss_OID_set);4849extern jbyteArray getJavaBuffer(JNIEnv *, gss_buffer_t);50extern jstring getJavaString(JNIEnv *, gss_buffer_t);51extern jobject getJavaOID(JNIEnv *, gss_OID);52extern jobjectArray getJavaOIDArray(JNIEnv *, gss_OID_set);5354extern jstring getMinorMessage(JNIEnv *, jobject, OM_uint32);55extern int sameMech(gss_OID, gss_OID);5657extern int JGSS_DEBUG;5859extern jclass CLS_Object;60extern jclass CLS_GSSNameElement;61extern jclass CLS_GSSCredElement;62extern jclass CLS_NativeGSSContext;63extern jmethodID MID_MessageProp_getPrivacy;64extern jmethodID MID_MessageProp_getQOP;65extern jmethodID MID_MessageProp_setPrivacy;66extern jmethodID MID_MessageProp_setQOP;67extern jmethodID MID_MessageProp_setSupplementaryStates;68extern jmethodID MID_ChannelBinding_getInitiatorAddr;69extern jmethodID MID_ChannelBinding_getAcceptorAddr;70extern jmethodID MID_ChannelBinding_getAppData;71extern jmethodID MID_InetAddress_getAddr;72extern jmethodID MID_GSSNameElement_ctor;73extern jmethodID MID_GSSCredElement_ctor;74extern jmethodID MID_NativeGSSContext_ctor;75extern jfieldID FID_GSSLibStub_pMech;76extern jfieldID FID_NativeGSSContext_pContext;77extern jfieldID FID_NativeGSSContext_srcName;78extern jfieldID FID_NativeGSSContext_targetName;79extern jfieldID FID_NativeGSSContext_isInitiator;80extern jfieldID FID_NativeGSSContext_isEstablished;81extern jfieldID FID_NativeGSSContext_delegatedCred;82extern jfieldID FID_NativeGSSContext_flags;83extern jfieldID FID_NativeGSSContext_lifetime;84extern jfieldID FID_NativeGSSContext_actualMech;85#define TRACE0(s) { if (JGSS_DEBUG) { printf("[GSSLibStub:%d] %s\n", __LINE__, s); fflush(stdout); }}86#define TRACE1(s, p1) { if (JGSS_DEBUG) { printf("[GSSLibStub:%d] "s"\n", __LINE__, p1); fflush(stdout); }}87#define TRACE2(s, p1, p2) { if (JGSS_DEBUG) { printf("[GSSLibStub:%d] "s"\n", __LINE__, p1, p2); fflush(stdout); }}88#define TRACE3(s, p1, p2, p3) { if (JGSS_DEBUG) { printf("[GSSLibStub:%d] "s"\n", __LINE__, p1, p2, p3); fflush(stdout); }}899091#ifdef __cplusplus92}93#endif94#endif959697