VOMS C API
1.5.0
|
00001 /********************************************************************* 00002 * 00003 * Authors: Vincenzo Ciaschini - Vincenzo.Ciaschini@cnaf.infn.it 00004 * 00005 * Copyright (c) Members of the EGEE Collaboration. 2004-2010. 00006 * See http://www.eu-egee.org/partners/ for details on the copyright holders. 00007 * 00008 * Licensed under the Apache License, Version 2.0 (the "License"); 00009 * you may not use this file except in compliance with the License. 00010 * You may obtain a copy of the License at 00011 * 00012 * http://www.apache.org/licenses/LICENSE-2.0 00013 * 00014 * Unless required by applicable law or agreed to in writing, software 00015 * distributed under the License is distributed on an "AS IS" BASIS, 00016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00017 * See the License for the specific language governing permissions and 00018 * limitations under the License. 00019 * 00020 * Parts of this code may be based upon or even include verbatim pieces, 00021 * originally written by other people, in which case the original header 00022 * follows. 00023 * 00024 *********************************************************************/ 00025 00026 #ifndef VOMS_APIC_H 00027 #define VOMS_APIC_H 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 #define NOGLOBUS 00034 #ifndef GSSAPI_H_ 00035 typedef void * gss_cred_id_t; 00036 typedef void * gss_ctx_id_t; 00037 #endif 00038 00039 #include <openssl/x509.h> 00040 #include <time.h> 00041 00042 #include "newformat.h" 00043 00044 /*#include "voms_api.h"*/ 00045 00048 struct data { 00049 char *group; 00050 char *role; 00051 char *cap; 00052 }; 00053 00054 struct attribute { 00055 const char *name; 00056 const char *value; 00057 const char *qualifier; 00058 }; 00059 00060 struct contactdata { 00063 char *nick; 00064 char *host; 00065 char *contact; 00066 char *vo; 00067 int port; 00068 char *reserved; 00069 int version; 00070 }; 00071 00075 #define TYPE_NODATA 0 00076 #define TYPE_STD 1 00077 #define TYPE_CUSTOM 2 00080 struct voms { 00081 int siglen; 00082 char *signature; 00083 char *user; 00084 char *userca; 00085 char *server; 00086 char *serverca; 00087 char *voname; 00088 char *uri; 00089 char *date1; 00090 char *date2; 00091 int type; 00092 struct data **std; 00093 char *custom; 00094 int datalen; 00095 int version; 00096 char **fqan; 00097 char *serial; 00099 /* Fields below this line are reserved. */ 00100 AC *ac; 00101 X509 *holder; 00102 }; 00103 00104 00105 #define RECURSE_CHAIN 0 00106 #define RECURSE_NONE 1 00107 00108 #define VERIFY_FULL 0xffffffff 00109 #define VERIFY_NONE 0x00000000 00110 #define VERIFY_DATE 0x00000001 00111 #define VERIFY_NOTARGET 0x00000002 00112 #define VERIFY_KEY 0x00000004 00113 #define VERIFY_SIGN 0x00000008 00114 #define VERIFY_ORDER 0x00000010 00115 #define VERIFY_ID 0x00000020 00116 #define VERIFY_CERTLIST 0x00000040 00117 00120 #define VERR_NONE 0 00121 #define VERR_NOSOCKET 1 00122 #define VERR_NOIDENT 2 00123 #define VERR_COMM 3 00124 #define VERR_PARAM 4 00125 #define VERR_NOEXT 5 00126 #define VERR_NOINIT 6 00127 #define VERR_TIME 7 00128 #define VERR_IDCHECK 8 00130 #define VERR_EXTRAINFO 9 00131 #define VERR_FORMAT 10 00132 #define VERR_NODATA 11 00133 #define VERR_PARSE 12 00134 #define VERR_DIR 13 00135 #define VERR_SIGN 14 00136 #define VERR_SERVER 15 00137 #define VERR_MEM 16 00138 #define VERR_VERIFY 17 00139 #define VERR_TYPE 18 00140 #define VERR_ORDER 19 00141 #define VERR_SERVERCODE 20 00142 #define VERR_NOTAVAIL 21 00144 struct vomsdata { 00145 char *cdir; 00146 char *vdir; 00147 struct voms **data; 00150 char *workvo; 00152 char *extra_data; 00161 int volen; 00162 int extralen; 00163 /* Fields below this line are reserved. */ 00164 struct vomsdata *real; 00165 }; 00166 00167 extern struct contactdata **VOMS_FindByAlias(struct vomsdata *vd, char *alias, 00168 char *system, char *user, 00169 int *error); 00187 extern struct contactdata **VOMS_FindByVO(struct vomsdata *vd, char *vo, 00188 char *system, char *user, 00189 int *error); 00207 extern void VOMS_DeleteContacts(struct contactdata **list); 00211 extern struct vomsdata *VOMS_Init(char *voms, char *cert); 00225 extern struct voms *VOMS_Copy(struct voms *v, int *error); 00233 extern struct vomsdata *VOMS_CopyAll(struct vomsdata *vd, int *error); 00241 extern void VOMS_Delete(struct voms *v); 00244 extern int VOMS_AddTarget(struct vomsdata *vd, char *target, int *error); 00249 extern void VOMS_FreeTargets(struct vomsdata *vd, int *error); 00253 extern char *VOMS_ListTargets(struct vomsdata *vd, int *error); /*< Gets the list of targets for the AC. 00254 \param vd The vomsdata structure. 00255 \param error RETURN PARAMETER: qualifies the error message. */ 00256 00257 extern int VOMS_SetVerificationType(int type, struct vomsdata *vd, int *error); /* Sets the verification type. 00258 \param type. The verification type. 00259 \param vd The vomsdata structure. 00260 \param error RETURN PARAMETER: qualifies the error message. */ 00261 00262 extern int VOMS_SetLifetime(int length, struct vomsdata *vd, 00263 int *error); 00270 extern void VOMS_Destroy(struct vomsdata *vd); 00273 extern int VOMS_ResetOrder(struct vomsdata *vd, int *error); 00279 extern int VOMS_Ordering(char *order, struct vomsdata *vd, int *error); 00289 extern int VOMS_Contact(char *hostname, int port, char *servsubject, 00290 char *command, struct vomsdata *vd, int *error); 00303 extern int VOMS_ContactRaw(char *hostname, int port, char *servsubject, 00304 char *command, void **data, int *datalen, int *version, 00305 struct vomsdata *vd, int *error); 00320 extern int VOMS_Retrieve(X509 *cert, STACK_OF(X509) *chain, int how, 00321 struct vomsdata *vd, int *error); 00333 extern int VOMS_Import(char *buffer, int buflen, struct vomsdata *vd, int *error); 00344 extern int VOMS_Export(char **buffer, int *buflen, struct vomsdata *vd, int *error); 00351 extern struct voms *VOMS_DefaultData(struct vomsdata *vd, int *error); 00359 extern char *VOMS_ErrorMessage(struct vomsdata *vd, int error, char *buffer, int len); 00369 extern int VOMS_RetrieveEXT(X509_EXTENSION *ext, struct vomsdata *vd, int *error); 00375 extern int VOMS_RetrieveFromCred(gss_cred_id_t cred, int how, struct vomsdata *vd, int *error); 00382 extern int VOMS_RetrieveFromFile(FILE *file, int how, struct vomsdata *vd, int *error); 00389 extern int VOMS_RetrieveFromCtx(gss_ctx_id_t ctx, int how, struct vomsdata *vd, int *error); 00396 extern int VOMS_RetrieveFromProxy(int how, struct vomsdata *vd, int *error); 00402 extern int VOMS_RetrieveFromAC(AC*ac, struct vomsdata *vd, int *error); 00408 extern int VOMS_GetAttributeSourcesNumber(struct voms *v, struct vomsdata *vd, int *error); 00409 extern int VOMS_GetAttributeSourceHandle(struct voms *v, int num, struct vomsdata *vd, int *error); 00410 extern const char *VOMS_GetAttributeGrantor(struct voms *v, int handle, struct vomsdata *vd, int *error); 00411 extern int VOMS_GetAttributesNumber(struct voms *v, int handle, struct vomsdata *vd, int *error); 00412 extern int VOMS_GetAttribute(struct voms *v, int handle, int num, struct attribute *at, struct vomsdata *vd, int *error); 00413 00414 extern struct vomsdata *VOMS_Duplicate(struct vomsdata *vd); 00415 extern AC *VOMS_GetAC(struct voms *v); 00416 00417 extern int getMajorVersionNumber(void); 00418 extern int getMinorVersionNumber(void); 00419 extern int getPatchVersionNumber(void); 00420 00421 extern int VOMS_SetVerificationTime(time_t verificationtime, struct vomsdata *vd, int *error); 00422 extern char **VOMS_GetTargetsList(struct voms *v, struct vomsdata *vd, int *error); 00423 extern void VOMS_FreeTargetsList(char **); 00424 00425 extern int VOMS_SetTimeout(int t, struct vomsdata *vd, int *error); 00426 extern int VOMS_LoadCredentials(X509 *cert, EVP_PKEY *pkey, STACK_OF(X509)* chain, struct vomsdata *vd, int *error); 00427 00428 #ifdef __cplusplus 00429 } 00430 #endif 00431 00432 #endif 00433 00434