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 00036 /* 00037 * Also check against _GSSAPI_H_ as that is what the Kerberos 5 code defines and 00038 * what header files on some systems look for. 00039 */ 00040 00041 #ifndef _GSSAPI_H 00042 typedef void * gss_cred_id_t; 00043 typedef void * gss_ctx_id_t; 00044 #endif 00045 #endif 00046 00047 #include <openssl/x509.h> 00048 #include <time.h> 00049 00050 #include "newformat.h" 00051 00052 /*#include "voms_api.h"*/ 00053 00056 struct data { 00057 char *group; 00058 char *role; 00059 char *cap; 00060 }; 00061 00062 struct attribute { 00063 const char *name; 00064 const char *value; 00065 const char *qualifier; 00066 }; 00067 00068 struct contactdata { 00071 char *nick; 00072 char *host; 00073 char *contact; 00074 char *vo; 00075 int port; 00076 char *reserved; 00077 int version; 00078 }; 00079 00083 #define TYPE_NODATA 0 00084 #define TYPE_STD 1 00085 #define TYPE_CUSTOM 2 00088 struct voms { 00089 int siglen; 00090 char *signature; 00091 char *user; 00092 char *userca; 00093 char *server; 00094 char *serverca; 00095 char *voname; 00096 char *uri; 00097 char *date1; 00098 char *date2; 00099 int type; 00100 struct data **std; 00101 char *custom; 00102 int datalen; 00103 int version; 00104 char **fqan; 00105 char *serial; 00107 /* Fields below this line are reserved. */ 00108 AC *ac; 00109 X509 *holder; 00110 }; 00111 00112 00113 #define RECURSE_CHAIN 0 00114 #define RECURSE_NONE 1 00115 00116 #define VERIFY_FULL 0xffffffff 00117 #define VERIFY_NONE 0x00000000 00118 #define VERIFY_DATE 0x00000001 00119 #define VERIFY_NOTARGET 0x00000002 00120 #define VERIFY_KEY 0x00000004 00121 #define VERIFY_SIGN 0x00000008 00122 #define VERIFY_ORDER 0x00000010 00123 #define VERIFY_ID 0x00000020 00124 #define VERIFY_CERTLIST 0x00000040 00125 00128 #define VERR_NONE 0 00129 #define VERR_NOSOCKET 1 00130 #define VERR_NOIDENT 2 00131 #define VERR_COMM 3 00132 #define VERR_PARAM 4 00133 #define VERR_NOEXT 5 00134 #define VERR_NOINIT 6 00135 #define VERR_TIME 7 00136 #define VERR_IDCHECK 8 00138 #define VERR_EXTRAINFO 9 00139 #define VERR_FORMAT 10 00140 #define VERR_NODATA 11 00141 #define VERR_PARSE 12 00142 #define VERR_DIR 13 00143 #define VERR_SIGN 14 00144 #define VERR_SERVER 15 00145 #define VERR_MEM 16 00146 #define VERR_VERIFY 17 00147 #define VERR_TYPE 18 00148 #define VERR_ORDER 19 00149 #define VERR_SERVERCODE 20 00150 #define VERR_NOTAVAIL 21 00152 struct vomsdata { 00153 char *cdir; 00154 char *vdir; 00155 struct voms **data; 00158 char *workvo; 00160 char *extra_data; 00169 int volen; 00170 int extralen; 00171 /* Fields below this line are reserved. */ 00172 struct vomsdata *real; 00173 }; 00174 00175 extern struct contactdata **VOMS_FindByAlias(struct vomsdata *vd, char *alias, 00176 char *system, char *user, 00177 int *error); 00195 extern struct contactdata **VOMS_FindByVO(struct vomsdata *vd, char *vo, 00196 char *system, char *user, 00197 int *error); 00215 extern void VOMS_DeleteContacts(struct contactdata **list); 00219 extern struct vomsdata *VOMS_Init(char *voms, char *cert); 00233 extern struct voms *VOMS_Copy(struct voms *v, int *error); 00241 extern struct vomsdata *VOMS_CopyAll(struct vomsdata *vd, int *error); 00249 extern void VOMS_Delete(struct voms *v); 00252 extern int VOMS_AddTarget(struct vomsdata *vd, char *target, int *error); 00257 extern void VOMS_FreeTargets(struct vomsdata *vd, int *error); 00261 extern char *VOMS_ListTargets(struct vomsdata *vd, int *error); /*< Gets the list of targets for the AC. 00262 \param vd The vomsdata structure. 00263 \param error RETURN PARAMETER: qualifies the error message. */ 00264 00265 extern int VOMS_SetVerificationType(int type, struct vomsdata *vd, int *error); /* Sets the verification type. 00266 \param type. The verification type. 00267 \param vd The vomsdata structure. 00268 \param error RETURN PARAMETER: qualifies the error message. */ 00269 00270 extern int VOMS_SetLifetime(int length, struct vomsdata *vd, 00271 int *error); 00278 extern void VOMS_Destroy(struct vomsdata *vd); 00281 extern int VOMS_ResetOrder(struct vomsdata *vd, int *error); 00287 extern int VOMS_Ordering(char *order, struct vomsdata *vd, int *error); 00297 extern int VOMS_Contact(char *hostname, int port, char *servsubject, 00298 char *command, struct vomsdata *vd, int *error); 00311 extern int VOMS_ContactRaw(char *hostname, int port, char *servsubject, 00312 char *command, void **data, int *datalen, int *version, 00313 struct vomsdata *vd, int *error); 00328 extern int VOMS_Retrieve(X509 *cert, STACK_OF(X509) *chain, int how, 00329 struct vomsdata *vd, int *error); 00341 extern int VOMS_Import(char *buffer, int buflen, struct vomsdata *vd, int *error); 00352 extern int VOMS_Export(char **buffer, int *buflen, struct vomsdata *vd, int *error); 00359 extern struct voms *VOMS_DefaultData(struct vomsdata *vd, int *error); 00367 extern char *VOMS_ErrorMessage(struct vomsdata *vd, int error, char *buffer, int len); 00377 extern int VOMS_RetrieveEXT(X509_EXTENSION *ext, struct vomsdata *vd, int *error); 00383 extern int VOMS_RetrieveFromCred(gss_cred_id_t cred, int how, struct vomsdata *vd, int *error); 00390 extern int VOMS_RetrieveFromFile(FILE *file, int how, struct vomsdata *vd, int *error); 00397 extern int VOMS_RetrieveFromCtx(gss_ctx_id_t ctx, int how, struct vomsdata *vd, int *error); 00404 extern int VOMS_RetrieveFromProxy(int how, struct vomsdata *vd, int *error); 00410 extern int VOMS_RetrieveFromAC(AC*ac, struct vomsdata *vd, int *error); 00416 extern int VOMS_GetAttributeSourcesNumber(struct voms *v, struct vomsdata *vd, int *error); 00417 extern int VOMS_GetAttributeSourceHandle(struct voms *v, int num, struct vomsdata *vd, int *error); 00418 extern const char *VOMS_GetAttributeGrantor(struct voms *v, int handle, struct vomsdata *vd, int *error); 00419 extern int VOMS_GetAttributesNumber(struct voms *v, int handle, struct vomsdata *vd, int *error); 00420 extern int VOMS_GetAttribute(struct voms *v, int handle, int num, struct attribute *at, struct vomsdata *vd, int *error); 00421 00422 extern struct vomsdata *VOMS_Duplicate(struct vomsdata *vd); 00423 extern AC *VOMS_GetAC(struct voms *v); 00424 00425 extern int getMajorVersionNumber(void); 00426 extern int getMinorVersionNumber(void); 00427 extern int getPatchVersionNumber(void); 00428 00429 extern int VOMS_SetVerificationTime(time_t verificationtime, struct vomsdata *vd, int *error); 00430 extern char **VOMS_GetTargetsList(struct voms *v, struct vomsdata *vd, int *error); 00431 extern void VOMS_FreeTargetsList(char **); 00432 00433 extern int VOMS_SetTimeout(int t, struct vomsdata *vd, int *error); 00434 extern int VOMS_LoadCredentials(X509 *cert, EVP_PKEY *pkey, STACK_OF(X509)* chain, struct vomsdata *vd, int *error); 00435 00436 #ifdef __cplusplus 00437 } 00438 #endif 00439 00440 #endif 00441 00442