src/java.security.jgss/unix/native/libj2gss/NativeFunc.h
changeset 49697 59c4713c5d21
parent 49696 508e9f6632fd
parent 49683 fcff2daa6b1e
child 49698 4c0c018a953f
equal deleted inserted replaced
49696:508e9f6632fd 49697:59c4713c5d21
     1 /*
       
     2  * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 #ifndef NATIVE_FUNC_H
       
    27 #define NATIVE_FUNC_H
       
    28 
       
    29 #include "gssapi.h"
       
    30 
       
    31 #ifndef TRUE
       
    32 #define TRUE    1
       
    33 #endif
       
    34 
       
    35 #ifndef FALSE
       
    36 #define FALSE   0
       
    37 #endif
       
    38 
       
    39 char* loadNative(const char *libName);
       
    40 
       
    41 /* function pointer definitions */
       
    42 typedef OM_uint32 (*RELEASE_NAME_FN_PTR)
       
    43                                 (OM_uint32 *minor_status,
       
    44                                 gss_name_t *name);
       
    45 
       
    46 typedef OM_uint32 (*IMPORT_NAME_FN_PTR)
       
    47                                 (OM_uint32 *minor_status,
       
    48                                 gss_buffer_t input_name_buffer,
       
    49                                 gss_OID input_name_type,
       
    50                                 gss_name_t *output_name);
       
    51 
       
    52 typedef OM_uint32 (*COMPARE_NAME_FN_PTR)
       
    53                                 (OM_uint32 *minor_status,
       
    54                                 gss_name_t name1,
       
    55                                 gss_name_t name2,
       
    56                                 int *name_equal);
       
    57 
       
    58 typedef OM_uint32 (*CANONICALIZE_NAME_FN_PTR)
       
    59                                 (OM_uint32 *minor_status,
       
    60                                 gss_name_t input_name,
       
    61                                 gss_OID mech_type,
       
    62                                 gss_name_t *output_name);
       
    63 
       
    64 typedef OM_uint32 (*EXPORT_NAME_FN_PTR)
       
    65                                 (OM_uint32 *minor_status,
       
    66                                 gss_name_t input_name,
       
    67                                 gss_buffer_t exported_name);
       
    68 
       
    69 typedef OM_uint32 (*DISPLAY_NAME_FN_PTR)
       
    70                                 (OM_uint32 *minor_status,
       
    71                                 gss_name_t input_name,
       
    72                                 gss_buffer_t output_name_buffer,
       
    73                                 gss_OID *output_name_type);
       
    74 
       
    75 typedef OM_uint32 (*ACQUIRE_CRED_FN_PTR)
       
    76                                 (OM_uint32 *minor_status,
       
    77                                 gss_name_t desired_name,
       
    78                                 OM_uint32 time_req,
       
    79                                 gss_OID_set desired_mech,
       
    80                                 gss_cred_usage_t cred_usage,
       
    81                                 gss_cred_id_t *output_cred_handle,
       
    82                                 gss_OID_set *actual_mechs,
       
    83                                 OM_uint32 *time_rec);
       
    84 
       
    85 typedef OM_uint32 (*RELEASE_CRED_FN_PTR)
       
    86                                 (OM_uint32 *minor_status,
       
    87                                 gss_cred_id_t *cred_handle);
       
    88 
       
    89 typedef OM_uint32 (*INQUIRE_CRED_FN_PTR)
       
    90                                 (OM_uint32 *minor_status,
       
    91                                 gss_cred_id_t cred_handle,
       
    92                                 gss_name_t *name,
       
    93                                 OM_uint32 *lifetime,
       
    94                                 gss_cred_usage_t *cred_usage,
       
    95                                 gss_OID_set *mechanisms);
       
    96 
       
    97 typedef OM_uint32 (*IMPORT_SEC_CONTEXT_FN_PTR)
       
    98                                 (OM_uint32 *minor_status,
       
    99                                 gss_buffer_t interprocess_token,
       
   100                                 gss_ctx_id_t *context_handle);
       
   101 
       
   102 typedef OM_uint32 (*INIT_SEC_CONTEXT_FN_PTR)
       
   103                                 (OM_uint32 *minor_status,
       
   104                                 gss_cred_id_t initiator_cred_handle,
       
   105                                 gss_ctx_id_t *context_handle,
       
   106                                 gss_name_t *target_name,
       
   107                                 gss_OID mech_type,
       
   108                                 OM_uint32 req_flags,
       
   109                                 OM_uint32 time_req,
       
   110                                 gss_channel_bindings_t input_chan_bindings,
       
   111                                 gss_buffer_t input_token,
       
   112                                 gss_OID *actual_mech_type,
       
   113                                 gss_buffer_t output_token,
       
   114                                 OM_uint32 *ret_flags,
       
   115                                 OM_uint32 *time_rec);
       
   116 
       
   117 typedef OM_uint32 (*ACCEPT_SEC_CONTEXT_FN_PTR)
       
   118                                 (OM_uint32 *minor_status,
       
   119                                 gss_ctx_id_t *context_handle,
       
   120                                 gss_cred_id_t acceptor_cred_handle,
       
   121                                 gss_buffer_t input_token,
       
   122                                 gss_channel_bindings_t input_chan_bindings,
       
   123                                 gss_name_t *src_name,
       
   124                                 gss_OID *mech_type,
       
   125                                 gss_buffer_t output_token,
       
   126                                 OM_uint32 *ret_flags,
       
   127                                 OM_uint32 *time_rec,
       
   128                                 gss_cred_id_t *delegated_cred_handle);
       
   129 
       
   130 typedef OM_uint32 (*INQUIRE_CONTEXT_FN_PTR)
       
   131                                 (OM_uint32 *minor_status,
       
   132                                 gss_ctx_id_t context_handle,
       
   133                                 gss_name_t *src_name,
       
   134                                 gss_name_t *targ_name,
       
   135                                 OM_uint32 *lifetime_rec,
       
   136                                 gss_OID *mech_type,
       
   137                                 OM_uint32 *ctx_flags,
       
   138                                 int *locally_initiated,
       
   139                                 int *open);
       
   140 
       
   141 typedef OM_uint32 (*DELETE_SEC_CONTEXT_FN_PTR)
       
   142                                 (OM_uint32 *minor_status,
       
   143                                 gss_ctx_id_t *context_handle,
       
   144                                 gss_buffer_t output_token);
       
   145 
       
   146 typedef OM_uint32 (*CONTEXT_TIME_FN_PTR)
       
   147                                 (OM_uint32 *minor_status,
       
   148                                 gss_ctx_id_t *context_handle,
       
   149                                 OM_uint32 *time_rec);
       
   150 
       
   151 typedef OM_uint32 (*WRAP_SIZE_LIMIT_FN_PTR)
       
   152                                 (OM_uint32 *minor_status,
       
   153                                 gss_ctx_id_t context_handle,
       
   154                                 int conf_req_flag,
       
   155                                 gss_qop_t qop_req,
       
   156                                 OM_uint32 req_output_size,
       
   157                                 OM_uint32 *max_input_size);
       
   158 
       
   159 typedef OM_uint32 (*EXPORT_SEC_CONTEXT_FN_PTR)
       
   160                                 (OM_uint32 *minor_status,
       
   161                                 gss_ctx_id_t *context_handle,
       
   162                                 gss_buffer_t interprocess_token);
       
   163 
       
   164 typedef OM_uint32 (*GET_MIC_FN_PTR)
       
   165                                 (OM_uint32 *minor_status,
       
   166                                 gss_ctx_id_t context_handle,
       
   167                                 gss_qop_t qop_req,
       
   168                                 gss_buffer_t message_buffer,
       
   169                                 gss_buffer_t msg_token);
       
   170 
       
   171 typedef OM_uint32 (*VERIFY_MIC_FN_PTR)
       
   172                                 (OM_uint32 *minor_status,
       
   173                                 gss_ctx_id_t context_handle,
       
   174                                 gss_buffer_t message_buffer,
       
   175                                 gss_buffer_t token_buffer,
       
   176                                 gss_qop_t *qop_state);
       
   177 
       
   178 typedef OM_uint32 (*WRAP_FN_PTR)
       
   179                                 (OM_uint32 *minor_status,
       
   180                                 gss_ctx_id_t context_handle,
       
   181                                 int conf_req_flag,
       
   182                                 gss_qop_t qop_req,
       
   183                                 gss_buffer_t input_message_buffer,
       
   184                                 int *conf_state,
       
   185                                 gss_buffer_t output_message_buffer);
       
   186 
       
   187 typedef OM_uint32 (*UNWRAP_FN_PTR)
       
   188                                 (OM_uint32 *minor_status,
       
   189                                 gss_ctx_id_t context_handle,
       
   190                                 gss_buffer_t input_message_buffer,
       
   191                                 gss_buffer_t output_message_buffer,
       
   192                                 int *conf_state,
       
   193                                 gss_qop_t *qop_state);
       
   194 
       
   195 typedef OM_uint32 (*INDICATE_MECHS_FN_PTR)
       
   196                                 (OM_uint32 *minor_status,
       
   197                                 gss_OID_set *mech_set);
       
   198 
       
   199 typedef OM_uint32 (*INQUIRE_NAMES_FOR_MECH_FN_PTR)
       
   200                                 (OM_uint32 *minor_status,
       
   201                                 const gss_OID mechanism,
       
   202                                 gss_OID_set *name_types);
       
   203 
       
   204 typedef OM_uint32 (*ADD_OID_SET_MEMBER_FN_PTR)
       
   205                                 (OM_uint32 *minor_status,
       
   206                                 gss_OID member_oid,
       
   207                                 gss_OID_set *oid_set);
       
   208 
       
   209 typedef OM_uint32 (*DISPLAY_STATUS_FN_PTR)
       
   210                                 (OM_uint32 *minor_status,
       
   211                                 OM_uint32 status_value,
       
   212                                 int status_type,
       
   213                                 gss_OID mech_type,
       
   214                                 OM_uint32 *message_context,
       
   215                                 gss_buffer_t status_string);
       
   216 
       
   217 typedef OM_uint32 (*CREATE_EMPTY_OID_SET_FN_PTR)
       
   218                                 (OM_uint32 *minor_status,
       
   219                                 gss_OID_set *oid_set);
       
   220 
       
   221 typedef OM_uint32 (*RELEASE_OID_SET_FN_PTR)
       
   222                                 (OM_uint32 *minor_status,
       
   223                                 gss_OID_set *set);
       
   224 
       
   225 typedef OM_uint32 (*RELEASE_BUFFER_FN_PTR)
       
   226                                 (OM_uint32 *minor_status,
       
   227                                 gss_buffer_t buffer);
       
   228 
       
   229 
       
   230 /* dynamically resolved functions from gss library */
       
   231 
       
   232 typedef struct GSS_FUNCTION_TABLE {
       
   233     gss_OID_set                         mechs;
       
   234     RELEASE_NAME_FN_PTR                 releaseName;
       
   235     IMPORT_NAME_FN_PTR                  importName;
       
   236     COMPARE_NAME_FN_PTR                 compareName;
       
   237     CANONICALIZE_NAME_FN_PTR            canonicalizeName;
       
   238     EXPORT_NAME_FN_PTR                  exportName;
       
   239     DISPLAY_NAME_FN_PTR                 displayName;
       
   240     ACQUIRE_CRED_FN_PTR                 acquireCred;
       
   241     RELEASE_CRED_FN_PTR                 releaseCred;
       
   242     INQUIRE_CRED_FN_PTR                 inquireCred;
       
   243     IMPORT_SEC_CONTEXT_FN_PTR           importSecContext;
       
   244     INIT_SEC_CONTEXT_FN_PTR             initSecContext;
       
   245     ACCEPT_SEC_CONTEXT_FN_PTR           acceptSecContext;
       
   246     INQUIRE_CONTEXT_FN_PTR              inquireContext;
       
   247     DELETE_SEC_CONTEXT_FN_PTR           deleteSecContext;
       
   248     CONTEXT_TIME_FN_PTR                 contextTime;
       
   249     WRAP_SIZE_LIMIT_FN_PTR              wrapSizeLimit;
       
   250     EXPORT_SEC_CONTEXT_FN_PTR           exportSecContext;
       
   251     GET_MIC_FN_PTR                      getMic;
       
   252     VERIFY_MIC_FN_PTR                   verifyMic;
       
   253     WRAP_FN_PTR                         wrap;
       
   254     UNWRAP_FN_PTR                       unwrap;
       
   255     INDICATE_MECHS_FN_PTR               indicateMechs;
       
   256     INQUIRE_NAMES_FOR_MECH_FN_PTR       inquireNamesForMech;
       
   257     ADD_OID_SET_MEMBER_FN_PTR           addOidSetMember;
       
   258     DISPLAY_STATUS_FN_PTR               displayStatus;
       
   259     CREATE_EMPTY_OID_SET_FN_PTR         createEmptyOidSet;
       
   260     RELEASE_OID_SET_FN_PTR              releaseOidSet;
       
   261     RELEASE_BUFFER_FN_PTR               releaseBuffer;
       
   262 
       
   263 } GSS_FUNCTION_TABLE;
       
   264 
       
   265 typedef GSS_FUNCTION_TABLE *GSS_FUNCTION_TABLE_PTR;
       
   266 
       
   267 /* global GSS function table */
       
   268 GSS_FUNCTION_TABLE_PTR ftab;
       
   269 
       
   270 #endif