VOMS C API  1.5.0
voms_apic.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Authors: Vincenzo Ciaschini - Vincenzo.Ciaschini@cnaf.infn.it
4  *
5  * Copyright (c) Members of the EGEE Collaboration. 2004-2010.
6  * See http://www.eu-egee.org/partners/ for details on the copyright holders.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * Parts of this code may be based upon or even include verbatim pieces,
21  * originally written by other people, in which case the original header
22  * follows.
23  *
24  *********************************************************************/
25 
26 #ifndef VOMS_APIC_H
27 #define VOMS_APIC_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define NOGLOBUS
34 #ifndef GSSAPI_H_
35 
36 /*
37  * Also check against _GSSAPI_H_ as that is what the Kerberos 5 code defines and
38  * what header files on some systems look for.
39  */
40 
41 #ifndef _GSSAPI_H
42 typedef void * gss_cred_id_t;
43 typedef void * gss_ctx_id_t;
44 #endif
45 #endif
46 
47 #include <openssl/x509.h>
48 #include <time.h>
49 
50 #include "newformat.h"
51 
52 /*#include "voms_api.h"*/
53 
56 struct data {
57  char *group;
58  char *role;
59  char *cap;
60 };
61 
62 struct attribute {
63  const char *name;
64  const char *value;
65  const char *qualifier;
66 };
67 
68 struct contactdata {
71  char *nick;
72  char *host;
73  char *contact;
74  char *vo;
75  int port;
76  char *reserved;
77  int version;
78 };
79 
83 #define TYPE_NODATA 0
84 #define TYPE_STD 1
85 #define TYPE_CUSTOM 2
88 struct voms {
89  int siglen;
90  char *signature;
91  char *user;
92  char *userca;
93  char *server;
94  char *serverca;
95  char *voname;
96  char *uri;
97  char *date1;
98  char *date2;
99  int type;
100  struct data **std;
101  char *custom;
102  int datalen;
103  int version;
104  char **fqan;
105  char *serial;
107  /* Fields below this line are reserved. */
108  AC *ac;
109  X509 *holder;
110 };
111 
112 
113 #define RECURSE_CHAIN 0
114 #define RECURSE_NONE 1
115 
116 #define VERIFY_FULL 0xffffffff
117 #define VERIFY_NONE 0x00000000
118 #define VERIFY_DATE 0x00000001
119 #define VERIFY_NOTARGET 0x00000002
120 #define VERIFY_KEY 0x00000004
121 #define VERIFY_SIGN 0x00000008
122 #define VERIFY_ORDER 0x00000010
123 #define VERIFY_ID 0x00000020
124 #define VERIFY_CERTLIST 0x00000040
125 
128 #define VERR_NONE 0
129 #define VERR_NOSOCKET 1
130 #define VERR_NOIDENT 2
131 #define VERR_COMM 3
132 #define VERR_PARAM 4
133 #define VERR_NOEXT 5
134 #define VERR_NOINIT 6
135 #define VERR_TIME 7
136 #define VERR_IDCHECK 8
138 #define VERR_EXTRAINFO 9
139 #define VERR_FORMAT 10
140 #define VERR_NODATA 11
141 #define VERR_PARSE 12
142 #define VERR_DIR 13
143 #define VERR_SIGN 14
144 #define VERR_SERVER 15
145 #define VERR_MEM 16
146 #define VERR_VERIFY 17
147 #define VERR_TYPE 18
148 #define VERR_ORDER 19
149 #define VERR_SERVERCODE 20
150 #define VERR_NOTAVAIL 21
152 struct vomsdata {
153  char *cdir;
154  char *vdir;
155  struct voms **data;
158  char *workvo;
160  char *extra_data;
169  int volen;
170  int extralen;
171  /* Fields below this line are reserved. */
172  struct vomsdata *real;
173 };
174 
175 extern struct contactdata **VOMS_FindByAlias(struct vomsdata *vd, char *alias,
176  char *system, char *user,
177  int *error);
195 extern struct contactdata **VOMS_FindByVO(struct vomsdata *vd, char *vo,
196  char *system, char *user,
197  int *error);
215 extern void VOMS_DeleteContacts(struct contactdata **list);
219 extern struct vomsdata *VOMS_Init(char *voms, char *cert);
233 extern struct voms *VOMS_Copy(struct voms *v, int *error);
241 extern struct vomsdata *VOMS_CopyAll(struct vomsdata *vd, int *error);
249 extern void VOMS_Delete(struct voms *v);
252 extern int VOMS_AddTarget(struct vomsdata *vd, char *target, int *error);
257 extern void VOMS_FreeTargets(struct vomsdata *vd, int *error);
261 extern char *VOMS_ListTargets(struct vomsdata *vd, int *error); /*< Gets the list of targets for the AC.
262  \param vd The vomsdata structure.
263  \param error RETURN PARAMETER: qualifies the error message. */
264 
265 extern int VOMS_SetVerificationType(int type, struct vomsdata *vd, int *error); /* Sets the verification type.
266  \param type. The verification type.
267  \param vd The vomsdata structure.
268  \param error RETURN PARAMETER: qualifies the error message. */
269 
270 extern int VOMS_SetLifetime(int length, struct vomsdata *vd,
271  int *error);
278 extern void VOMS_Destroy(struct vomsdata *vd);
281 extern int VOMS_ResetOrder(struct vomsdata *vd, int *error);
287 extern int VOMS_Ordering(char *order, struct vomsdata *vd, int *error);
297 extern int VOMS_Contact(char *hostname, int port, char *servsubject,
298  char *command, struct vomsdata *vd, int *error);
311 extern int VOMS_ContactRaw(char *hostname, int port, char *servsubject,
312  char *command, void **data, int *datalen, int *version,
313  struct vomsdata *vd, int *error);
328 extern int VOMS_Retrieve(X509 *cert, STACK_OF(X509) *chain, int how,
329  struct vomsdata *vd, int *error);
341 extern int VOMS_Import(char *buffer, int buflen, struct vomsdata *vd, int *error);
352 extern int VOMS_Export(char **buffer, int *buflen, struct vomsdata *vd, int *error);
359 extern struct voms *VOMS_DefaultData(struct vomsdata *vd, int *error);
367 extern char *VOMS_ErrorMessage(struct vomsdata *vd, int error, char *buffer, int len);
377 extern int VOMS_RetrieveEXT(X509_EXTENSION *ext, struct vomsdata *vd, int *error);
383 extern int VOMS_RetrieveFromCred(gss_cred_id_t cred, int how, struct vomsdata *vd, int *error);
390 extern int VOMS_RetrieveFromFile(FILE *file, int how, struct vomsdata *vd, int *error);
397 extern int VOMS_RetrieveFromCtx(gss_ctx_id_t ctx, int how, struct vomsdata *vd, int *error);
404 extern int VOMS_RetrieveFromProxy(int how, struct vomsdata *vd, int *error);
410 extern int VOMS_RetrieveFromAC(AC*ac, struct vomsdata *vd, int *error);
416 extern int VOMS_GetAttributeSourcesNumber(struct voms *v, struct vomsdata *vd, int *error);
417 extern int VOMS_GetAttributeSourceHandle(struct voms *v, int num, struct vomsdata *vd, int *error);
418 extern const char *VOMS_GetAttributeGrantor(struct voms *v, int handle, struct vomsdata *vd, int *error);
419 extern int VOMS_GetAttributesNumber(struct voms *v, int handle, struct vomsdata *vd, int *error);
420 extern int VOMS_GetAttribute(struct voms *v, int handle, int num, struct attribute *at, struct vomsdata *vd, int *error);
421 
422 extern struct vomsdata *VOMS_Duplicate(struct vomsdata *vd);
423 extern AC *VOMS_GetAC(struct voms *v);
424 
425 extern int getMajorVersionNumber(void);
426 extern int getMinorVersionNumber(void);
427 extern int getPatchVersionNumber(void);
428 
429 extern int VOMS_SetVerificationTime(time_t verificationtime, struct vomsdata *vd, int *error);
430 extern char **VOMS_GetTargetsList(struct voms *v, struct vomsdata *vd, int *error);
431 extern void VOMS_FreeTargetsList(char **);
432 
433 extern int VOMS_SetTimeout(int t, struct vomsdata *vd, int *error);
434 extern int VOMS_LoadCredentials(X509 *cert, EVP_PKEY *pkey, STACK_OF(X509)* chain, struct vomsdata *vd, int *error);
435 
436 #ifdef __cplusplus
437 }
438 #endif
439 
440 #endif
441 
442 
int VOMS_Export(char **buffer, int *buflen, struct vomsdata *vd, int *error)
char * user
Definition: voms_apic.h:91
int VOMS_Contact(char *hostname, int port, char *servsubject, char *command, struct vomsdata *vd, int *error)
X509 * holder
Definition: voms_apic.h:109
AC * VOMS_GetAC(struct voms *v)
char * cap
Definition: voms_apic.h:59
char * reserved
Definition: voms_apic.h:76
int VOMS_SetVerificationType(int type, struct vomsdata *vd, int *error)
Definition: voms_apic.h:88
char ** fqan
Definition: voms_apic.h:104
int VOMS_Retrieve(X509 *cert, STACK_OF(X509)*chain, int how, struct vomsdata *vd, int *error)
char * date1
Definition: voms_apic.h:97
int VOMS_RetrieveEXT(X509_EXTENSION *ext, struct vomsdata *vd, int *error)
char ** VOMS_GetTargetsList(struct voms *v, struct vomsdata *vd, int *error)
int VOMS_ResetOrder(struct vomsdata *vd, int *error)
int VOMS_RetrieveFromFile(FILE *file, int how, struct vomsdata *vd, int *error)
char * VOMS_ErrorMessage(struct vomsdata *vd, int error, char *buffer, int len)
struct vomsdata * VOMS_CopyAll(struct vomsdata *vd, int *error)
const char * value
Definition: voms_apic.h:64
char * host
Definition: voms_apic.h:72
char * voname
Definition: voms_apic.h:95
int VOMS_SetVerificationTime(time_t verificationtime, struct vomsdata *vd, int *error)
int getMajorVersionNumber(void)
char * serial
Definition: voms_apic.h:105
int siglen
Definition: voms_apic.h:89
int VOMS_RetrieveFromAC(AC *ac, struct vomsdata *vd, int *error)
int VOMS_RetrieveFromCred(gss_cred_id_t cred, int how, struct vomsdata *vd, int *error)
int VOMS_AddTarget(struct vomsdata *vd, char *target, int *error)
const char * qualifier
Definition: voms_apic.h:65
struct voms * VOMS_Copy(struct voms *v, int *error)
The type of data returned.
Definition: voms_apic.h:68
AC * ac
Definition: voms_apic.h:108
int VOMS_GetAttributeSourcesNumber(struct voms *v, struct vomsdata *vd, int *error)
char * group
Definition: voms_apic.h:57
int VOMS_Import(char *buffer, int buflen, struct vomsdata *vd, int *error)
char * server
Definition: voms_apic.h:93
int version
Definition: voms_apic.h:103
int getPatchVersionNumber(void)
void * gss_ctx_id_t
Definition: voms_apic.h:43
void * gss_cred_id_t
Definition: voms_apic.h:42
char * userca
Definition: voms_apic.h:92
int VOMS_SetTimeout(int t, struct vomsdata *vd, int *error)
struct contactdata ** VOMS_FindByVO(struct vomsdata *vd, char *vo, char *system, char *user, int *error)
struct vomsdata * real
Definition: voms_apic.h:173
char * vo
Definition: voms_apic.h:74
char * serverca
Definition: voms_apic.h:94
struct contactdata ** VOMS_FindByAlias(struct vomsdata *vd, char *alias, char *system, char *user, int *error)
int VOMS_RetrieveFromProxy(int how, struct vomsdata *vd, int *error)
void VOMS_FreeTargets(struct vomsdata *vd, int *error)
void VOMS_Destroy(struct vomsdata *vd)
int VOMS_LoadCredentials(X509 *cert, EVP_PKEY *pkey, STACK_OF(X509)*chain, struct vomsdata *vd, int *error)
char * VOMS_ListTargets(struct vomsdata *vd, int *error)
char * signature
Definition: voms_apic.h:90
int VOMS_RetrieveFromCtx(gss_ctx_id_t ctx, int how, struct vomsdata *vd, int *error)
void VOMS_Delete(struct voms *v)
char * nick
Definition: voms_apic.h:71
int VOMS_Ordering(char *order, struct vomsdata *vd, int *error)
int VOMS_GetAttribute(struct voms *v, int handle, int num, struct attribute *at, struct vomsdata *vd, int *error)
char * date2
Definition: voms_apic.h:98
int type
Definition: voms_apic.h:99
struct data ** std
Definition: voms_apic.h:100
char * contact
Definition: voms_apic.h:73
int getMinorVersionNumber(void)
struct vomsdata * VOMS_Init(char *voms, char *cert)
int version
Definition: voms_apic.h:77
int VOMS_GetAttributesNumber(struct voms *v, int handle, struct vomsdata *vd, int *error)
char * custom
Definition: voms_apic.h:101
struct vomsdata * VOMS_Duplicate(struct vomsdata *vd)
struct voms * VOMS_DefaultData(struct vomsdata *vd, int *error)
int VOMS_GetAttributeSourceHandle(struct voms *v, int num, struct vomsdata *vd, int *error)
int VOMS_ContactRaw(char *hostname, int port, char *servsubject, char *command, void **data, int *datalen, int *version, struct vomsdata *vd, int *error)
const char * VOMS_GetAttributeGrantor(struct voms *v, int handle, struct vomsdata *vd, int *error)
char * uri
Definition: voms_apic.h:96
int datalen
Definition: voms_apic.h:102
const char * name
Definition: voms_apic.h:63
void VOMS_DeleteContacts(struct contactdata **list)
User's characteristics: can be repeated.
Definition: voms_apic.h:56
void VOMS_FreeTargetsList(char **)
int VOMS_SetLifetime(int length, struct vomsdata *vd, int *error)
char * role
Definition: voms_apic.h:58