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 NOGLOBUS 00030 #ifndef GSSAPI_H_ 00031 typedef void * gss_cred_id_t; 00032 typedef void * gss_ctx_id_t; 00033 #endif 00034 #else 00035 #include <gssapi.h> 00036 #endif 00037 00038 #include <openssl/x509.h> 00039 #include <time.h> 00040 00041 #include "newformat.h" 00042 00043 /*#include "voms_api.h"*/ 00044 00047 struct data { 00048 char *group; 00049 char *role; 00050 char *cap; 00051 }; 00052 00053 struct attribute { 00054 const char *name; 00055 const char *value; 00056 const char *qualifier; 00057 }; 00058 00059 struct contactdata { 00062 char *nick; 00063 char *host; 00064 char *contact; 00065 char *vo; 00066 int port; 00067 char *reserved; 00068 int version; 00069 }; 00070 00074 #define TYPE_NODATA 0 00075 #define TYPE_STD 1 00076 #define TYPE_CUSTOM 2 00079 struct voms { 00080 int siglen; 00081 char *signature; 00082 char *user; 00083 char *userca; 00084 char *server; 00085 char *serverca; 00086 char *voname; 00087 char *uri; 00088 char *date1; 00089 char *date2; 00090 int type; 00091 struct data **std; 00092 char *custom; 00093 int datalen; 00094 int version; 00095 char **fqan; 00096 char *serial; 00098 /* Fields below this line are reserved. */ 00099 AC *ac; 00100 X509 *holder; 00101 }; 00102 00103 00104 #define RECURSE_CHAIN 0 00105 #define RECURSE_NONE 1 00106 00107 #define VERIFY_FULL 0xffffffff 00108 #define VERIFY_NONE 0x00000000 00109 #define VERIFY_DATE 0x00000001 00110 #define VERIFY_NOTARGET 0x00000002 00111 #define VERIFY_KEY 0x00000004 00112 #define VERIFY_SIGN 0x00000008 00113 #define VERIFY_ORDER 0x00000010 00114 #define VERIFY_ID 0x00000020 00115 #define VERIFY_CERTLIST 0x00000040 00116 00119 #define VERR_NONE 0 00120 #define VERR_NOSOCKET 1 00121 #define VERR_NOIDENT 2 00122 #define VERR_COMM 3 00123 #define VERR_PARAM 4 00124 #define VERR_NOEXT 5 00125 #define VERR_NOINIT 6 00126 #define VERR_TIME 7 00127 #define VERR_IDCHECK 8 00129 #define VERR_EXTRAINFO 9 00130 #define VERR_FORMAT 10 00131 #define VERR_NODATA 11 00132 #define VERR_PARSE 12 00133 #define VERR_DIR 13 00134 #define VERR_SIGN 14 00135 #define VERR_SERVER 15 00136 #define VERR_MEM 16 00137 #define VERR_VERIFY 17 00138 #define VERR_TYPE 18 00139 #define VERR_ORDER 19 00140 #define VERR_SERVERCODE 20 00141 #define VERR_NOTAVAIL 21 00143 struct vomsdata { 00144 char *cdir; 00145 char *vdir; 00146 struct voms **data; 00149 char *workvo; 00151 char *extra_data; 00160 int volen; 00161 int extralen; 00162 /* Fields below this line are reserved. */ 00163 struct vomsdata *real; 00164 }; 00165 00166 extern struct contactdata **VOMS_FindByAlias(struct vomsdata *vd, char *alias, 00167 char *system, char *user, 00168 int *error); 00186 extern struct contactdata **VOMS_FindByVO(struct vomsdata *vd, char *vo, 00187 char *system, char *user, 00188 int *error); 00206 extern void VOMS_DeleteContacts(struct contactdata **list); 00210 extern struct vomsdata *VOMS_Init(char *voms, char *cert); 00224 extern struct voms *VOMS_Copy(struct voms *v, int *error); 00232 extern struct vomsdata *VOMS_CopyAll(struct vomsdata *vd, int *error); 00240 extern void VOMS_Delete(struct voms *v); 00243 extern int VOMS_AddTarget(struct vomsdata *vd, char *target, int *error); 00248 extern void VOMS_FreeTargets(struct vomsdata *vd, int *error); 00252 extern char *VOMS_ListTargets(struct vomsdata *vd, int *error); /*< Gets the list of targets for the AC. 00253 \param vd The vomsdata structure. 00254 \param error RETURN PARAMETER: qualifies the error message. */ 00255 00256 extern int VOMS_SetVerificationType(int type, struct vomsdata *vd, int *error); /* Sets the verification type. 00257 \param type. The verification type. 00258 \param vd The vomsdata structure. 00259 \param error RETURN PARAMETER: qualifies the error message. */ 00260 00261 extern int VOMS_SetLifetime(int length, struct vomsdata *vd, 00262 int *error); 00269 extern void VOMS_Destroy(struct vomsdata *vd); 00272 extern int VOMS_ResetOrder(struct vomsdata *vd, int *error); 00278 extern int VOMS_Ordering(char *order, struct vomsdata *vd, int *error); 00288 extern int VOMS_Contact(char *hostname, int port, char *servsubject, 00289 char *command, struct vomsdata *vd, int *error); 00302 extern int VOMS_ContactRaw(char *hostname, int port, char *servsubject, 00303 char *command, void **data, int *datalen, int *version, 00304 struct vomsdata *vd, int *error); 00319 extern int VOMS_Retrieve(X509 *cert, STACK_OF(X509) *chain, int how, 00320 struct vomsdata *vd, int *error); 00332 extern int VOMS_Import(char *buffer, int buflen, struct vomsdata *vd, int *error); 00343 extern int VOMS_Export(char **buffer, int *buflen, struct vomsdata *vd, int *error); 00350 extern struct voms *VOMS_DefaultData(struct vomsdata *vd, int *error); 00358 extern char *VOMS_ErrorMessage(struct vomsdata *vd, int error, char *buffer, int len); 00368 extern int VOMS_RetrieveEXT(X509_EXTENSION *ext, struct vomsdata *vd, int *error); 00374 extern int VOMS_RetrieveFromCred(gss_cred_id_t cred, int how, struct vomsdata *vd, int *error); 00381 extern int VOMS_RetrieveFromFile(FILE *file, int how, struct vomsdata *vd, int *error); 00388 extern int VOMS_RetrieveFromCtx(gss_ctx_id_t ctx, int how, struct vomsdata *vd, int *error); 00395 extern int VOMS_RetrieveFromProxy(int how, struct vomsdata *vd, int *error); 00401 extern int VOMS_GetAttributeSourcesNumber(struct voms *v, struct vomsdata *vd, int *error); 00402 extern int VOMS_GetAttributeSourceHandle(struct voms *v, int num, struct vomsdata *vd, int *error); 00403 extern const char *VOMS_GetAttributeGrantor(struct voms *v, int handle, struct vomsdata *vd, int *error); 00404 extern int VOMS_GetAttributesNumber(struct voms *v, int handle, struct vomsdata *vd, int *error); 00405 extern int VOMS_GetAttribute(struct voms *v, int handle, int num, struct attribute *at, struct vomsdata *vd, int *error); 00406 00407 extern struct vomsdata *VOMS_Duplicate(struct vomsdata *vd); 00408 extern AC *VOMS_GetAC(struct voms *v); 00409 00410 extern int getMajorVersionNumber(void); 00411 extern int getMinorVersionNumber(void); 00412 extern int getPatchVersionNumber(void); 00413 00414 extern int VOMS_SetVerificationTime(time_t verificationtime, struct vomsdata *vd, int *error); 00415 extern char **VOMS_GetTargetsList(struct voms *v, struct vomsdata *vd, int *error); 00416 extern void VOMS_FreeTargetsList(char **); 00417 00418 extern int VOMS_SetTimeout(int t, struct vomsdata *vd, int *error); 00419 #endif 00420 00421