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 #if !(defined(GSSAPI_H_) || defined(_GSSAPI_H) || defined(_GSSAPI_H_))
35 typedef void * gss_cred_id_t;
36 typedef void * gss_ctx_id_t;
37 #endif
38 
39 #include <openssl/x509.h>
40 #include <time.h>
41 
42 #include "newformat.h"
43 
44 /*#include "voms_api.h"*/
45 
48 struct data {
49  char *group;
50  char *role;
51  char *cap;
52 };
53 
54 struct attribute {
55  const char *name;
56  const char *value;
57  const char *qualifier;
58 };
59 
60 struct contactdata {
63  char *nick;
64  char *host;
65  char *contact;
66  char *vo;
67  int port;
68  char *reserved;
69  int version;
70 };
71 
75 #define TYPE_NODATA 0
76 #define TYPE_STD 1
77 #define TYPE_CUSTOM 2
80 struct voms {
81  int siglen;
82  char *signature;
83  char *user;
84  char *userca;
85  char *server;
86  char *serverca;
87  char *voname;
88  char *uri;
89  char *date1;
90  char *date2;
91  int type;
92  struct data **std;
93  char *custom;
94  int datalen;
95  int version;
96  char **fqan;
97  char *serial;
99  /* Fields below this line are reserved. */
100  AC *ac;
101  X509 *holder;
102 };
103 
104 
105 #define RECURSE_CHAIN 0
106 #define RECURSE_NONE 1
107 
108 #define VERIFY_FULL 0xffffffff
109 #define VERIFY_NONE 0x00000000
110 #define VERIFY_DATE 0x00000001
111 #define VERIFY_NOTARGET 0x00000002
112 #define VERIFY_KEY 0x00000004
113 #define VERIFY_SIGN 0x00000008
114 #define VERIFY_ORDER 0x00000010
115 #define VERIFY_ID 0x00000020
116 #define VERIFY_CERTLIST 0x00000040
117 
120 #define VERR_NONE 0
121 #define VERR_NOSOCKET 1
122 #define VERR_NOIDENT 2
123 #define VERR_COMM 3
124 #define VERR_PARAM 4
125 #define VERR_NOEXT 5
126 #define VERR_NOINIT 6
127 #define VERR_TIME 7
128 #define VERR_IDCHECK 8
130 #define VERR_EXTRAINFO 9
131 #define VERR_FORMAT 10
132 #define VERR_NODATA 11
133 #define VERR_PARSE 12
134 #define VERR_DIR 13
135 #define VERR_SIGN 14
136 #define VERR_SERVER 15
137 #define VERR_MEM 16
138 #define VERR_VERIFY 17
139 #define VERR_TYPE 18
140 #define VERR_ORDER 19
141 #define VERR_SERVERCODE 20
142 #define VERR_NOTAVAIL 21
144 struct vomsdata {
145  char *cdir;
146  char *vdir;
147  struct voms **data;
150  char *workvo;
152  char *extra_data;
161  int volen;
162  int extralen;
163  /* Fields below this line are reserved. */
164  struct vomsdata *real;
165 };
166 
167 extern struct contactdata **VOMS_FindByAlias(struct vomsdata *vd, char *alias,
168  char *system, char *user,
169  int *error);
187 extern struct contactdata **VOMS_FindByVO(struct vomsdata *vd, char *vo,
188  char *system, char *user,
189  int *error);
207 extern void VOMS_DeleteContacts(struct contactdata **list);
211 extern struct vomsdata *VOMS_Init(char *voms, char *cert);
225 extern struct voms *VOMS_Copy(struct voms *v, int *error);
233 extern struct vomsdata *VOMS_CopyAll(struct vomsdata *vd, int *error);
241 extern void VOMS_Delete(struct voms *v);
244 extern int VOMS_AddTarget(struct vomsdata *vd, char *target, int *error);
249 extern void VOMS_FreeTargets(struct vomsdata *vd, int *error);
253 extern char *VOMS_ListTargets(struct vomsdata *vd, int *error); /*< Gets the list of targets for the AC.
254  \param vd The vomsdata structure.
255  \param error RETURN PARAMETER: qualifies the error message. */
256 
257 extern int VOMS_SetVerificationType(int type, struct vomsdata *vd, int *error); /* Sets the verification type.
258  \param type. The verification type.
259  \param vd The vomsdata structure.
260  \param error RETURN PARAMETER: qualifies the error message. */
261 
262 extern int VOMS_SetLifetime(int length, struct vomsdata *vd,
263  int *error);
270 extern void VOMS_Destroy(struct vomsdata *vd);
273 extern int VOMS_ResetOrder(struct vomsdata *vd, int *error);
279 extern int VOMS_Ordering(char *order, struct vomsdata *vd, int *error);
289 extern int VOMS_Contact(char *hostname, int port, char *servsubject,
290  char *command, struct vomsdata *vd, int *error);
303 extern int VOMS_ContactRaw(char *hostname, int port, char *servsubject,
304  char *command, void **data, int *datalen, int *version,
305  struct vomsdata *vd, int *error);
320 extern int VOMS_Retrieve(X509 *cert, STACK_OF(X509) *chain, int how,
321  struct vomsdata *vd, int *error);
333 extern int VOMS_Import(char *buffer, int buflen, struct vomsdata *vd, int *error);
344 extern int VOMS_Export(char **buffer, int *buflen, struct vomsdata *vd, int *error);
351 extern struct voms *VOMS_DefaultData(struct vomsdata *vd, int *error);
359 extern char *VOMS_ErrorMessage(struct vomsdata *vd, int error, char *buffer, int len);
369 extern int VOMS_RetrieveEXT(X509_EXTENSION *ext, struct vomsdata *vd, int *error);
375 extern int VOMS_RetrieveFromCred(gss_cred_id_t cred, int how, struct vomsdata *vd, int *error);
382 extern int VOMS_RetrieveFromFile(FILE *file, int how, struct vomsdata *vd, int *error);
389 extern int VOMS_RetrieveFromCtx(gss_ctx_id_t ctx, int how, struct vomsdata *vd, int *error);
396 extern int VOMS_RetrieveFromProxy(int how, struct vomsdata *vd, int *error);
402 extern int VOMS_RetrieveFromAC(AC*ac, struct vomsdata *vd, int *error);
408 extern int VOMS_GetAttributeSourcesNumber(struct voms *v, struct vomsdata *vd, int *error);
409 extern int VOMS_GetAttributeSourceHandle(struct voms *v, int num, struct vomsdata *vd, int *error);
410 extern const char *VOMS_GetAttributeGrantor(struct voms *v, int handle, struct vomsdata *vd, int *error);
411 extern int VOMS_GetAttributesNumber(struct voms *v, int handle, struct vomsdata *vd, int *error);
412 extern int VOMS_GetAttribute(struct voms *v, int handle, int num, struct attribute *at, struct vomsdata *vd, int *error);
413 
414 extern struct vomsdata *VOMS_Duplicate(struct vomsdata *vd);
415 extern AC *VOMS_GetAC(struct voms *v);
416 
417 extern int getMajorVersionNumber(void);
418 extern int getMinorVersionNumber(void);
419 extern int getPatchVersionNumber(void);
420 
421 extern int VOMS_SetVerificationTime(time_t verificationtime, struct vomsdata *vd, int *error);
422 extern char **VOMS_GetTargetsList(struct voms *v, struct vomsdata *vd, int *error);
423 extern void VOMS_FreeTargetsList(char **);
424 
425 extern int VOMS_SetTimeout(int t, struct vomsdata *vd, int *error);
426 extern int VOMS_LoadCredentials(X509 *cert, EVP_PKEY *pkey, STACK_OF(X509)* chain, struct vomsdata *vd, int *error);
427 
428 #ifdef __cplusplus
429 }
430 #endif
431 
432 #endif
433 
434 
VOMS_FreeTargetsList
void VOMS_FreeTargetsList(char **)
vomsdata::data
struct voms ** data
Definition: voms_apic.h:147
vomsdata::vdir
char * vdir
Definition: voms_apic.h:146
VOMS_GetAttributesNumber
int VOMS_GetAttributesNumber(struct voms *v, int handle, struct vomsdata *vd, int *error)
VOMS_Copy
struct voms * VOMS_Copy(struct voms *v, int *error)
VOMS_AddTarget
int VOMS_AddTarget(struct vomsdata *vd, char *target, int *error)
vomsdata
Definition: voms_apic.h:144
VOMS_SetLifetime
int VOMS_SetLifetime(int length, struct vomsdata *vd, int *error)
voms::user
char * user
Definition: voms_apic.h:83
vomsdata::extra_data
char * extra_data
Definition: voms_apic.h:152
VOMS_DefaultData
struct voms * VOMS_DefaultData(struct vomsdata *vd, int *error)
VOMS_ListTargets
char * VOMS_ListTargets(struct vomsdata *vd, int *error)
voms::voname
char * voname
Definition: voms_apic.h:87
voms::date1
char * date1
Definition: voms_apic.h:89
VOMS_DeleteContacts
void VOMS_DeleteContacts(struct contactdata **list)
VOMS_RetrieveFromProxy
int VOMS_RetrieveFromProxy(int how, struct vomsdata *vd, int *error)
contactdata::version
int version
Definition: voms_apic.h:69
voms::fqan
char ** fqan
Definition: voms_apic.h:96
data
User's characteristics: can be repeated.
Definition: voms_apic.h:48
contactdata::port
int port
Definition: voms_apic.h:67
VOMS_RetrieveFromCred
int VOMS_RetrieveFromCred(gss_cred_id_t cred, int how, struct vomsdata *vd, int *error)
VOMS_Ordering
int VOMS_Ordering(char *order, struct vomsdata *vd, int *error)
contactdata::nick
char * nick
Definition: voms_apic.h:63
voms::holder
X509 * holder
Definition: voms_apic.h:101
gss_cred_id_t
void * gss_cred_id_t
Definition: voms_apic.h:35
VOMS_GetTargetsList
char ** VOMS_GetTargetsList(struct voms *v, struct vomsdata *vd, int *error)
voms::ac
AC * ac
Definition: voms_apic.h:100
VOMS_RetrieveFromFile
int VOMS_RetrieveFromFile(FILE *file, int how, struct vomsdata *vd, int *error)
VOMS_RetrieveFromCtx
int VOMS_RetrieveFromCtx(gss_ctx_id_t ctx, int how, struct vomsdata *vd, int *error)
getMajorVersionNumber
int getMajorVersionNumber(void)
VOMS_Init
struct vomsdata * VOMS_Init(char *voms, char *cert)
vomsdata::workvo
char * workvo
Definition: voms_apic.h:150
VOMS_Duplicate
struct vomsdata * VOMS_Duplicate(struct vomsdata *vd)
contactdata::contact
char * contact
Definition: voms_apic.h:65
contactdata::vo
char * vo
Definition: voms_apic.h:66
voms::siglen
int siglen
Definition: voms_apic.h:81
voms::serial
char * serial
Definition: voms_apic.h:97
VOMS_Import
int VOMS_Import(char *buffer, int buflen, struct vomsdata *vd, int *error)
VOMS_GetAC
AC * VOMS_GetAC(struct voms *v)
VOMS_FindByAlias
struct contactdata ** VOMS_FindByAlias(struct vomsdata *vd, char *alias, char *system, char *user, int *error)
voms::serverca
char * serverca
Definition: voms_apic.h:86
VOMS_Retrieve
int VOMS_Retrieve(X509 *cert, STACK_OF(X509) *chain, int how, struct vomsdata *vd, int *error)
voms::server
char * server
Definition: voms_apic.h:85
data::group
char * group
Definition: voms_apic.h:49
vomsdata::real
struct vomsdata * real
Definition: voms_apic.h:164
VOMS_SetVerificationTime
int VOMS_SetVerificationTime(time_t verificationtime, struct vomsdata *vd, int *error)
voms
Definition: voms_apic.h:80
VOMS_FindByVO
struct contactdata ** VOMS_FindByVO(struct vomsdata *vd, char *vo, char *system, char *user, int *error)
voms::userca
char * userca
Definition: voms_apic.h:84
attribute::name
const char * name
Definition: voms_apic.h:55
voms::version
int version
Definition: voms_apic.h:95
VOMS_SetVerificationType
int VOMS_SetVerificationType(int type, struct vomsdata *vd, int *error)
voms::type
int type
Definition: voms_apic.h:91
voms::date2
char * date2
Definition: voms_apic.h:90
VOMS_Contact
int VOMS_Contact(char *hostname, int port, char *servsubject, char *command, struct vomsdata *vd, int *error)
gss_ctx_id_t
void * gss_ctx_id_t
Definition: voms_apic.h:36
attribute::qualifier
const char * qualifier
Definition: voms_apic.h:57
vomsdata::cdir
char * cdir
Definition: voms_apic.h:145
contactdata::reserved
char * reserved
Definition: voms_apic.h:68
contactdata::host
char * host
Definition: voms_apic.h:64
voms::std
struct data ** std
Definition: voms_apic.h:92
VOMS_CopyAll
struct vomsdata * VOMS_CopyAll(struct vomsdata *vd, int *error)
getMinorVersionNumber
int getMinorVersionNumber(void)
VOMS_GetAttributeSourceHandle
int VOMS_GetAttributeSourceHandle(struct voms *v, int num, struct vomsdata *vd, int *error)
vomsdata::extralen
int extralen
Definition: voms_apic.h:162
VOMS_ErrorMessage
char * VOMS_ErrorMessage(struct vomsdata *vd, int error, char *buffer, int len)
voms::datalen
int datalen
Definition: voms_apic.h:94
voms::custom
char * custom
Definition: voms_apic.h:93
VOMS_RetrieveFromAC
int VOMS_RetrieveFromAC(AC *ac, struct vomsdata *vd, int *error)
voms::signature
char * signature
Definition: voms_apic.h:82
attribute
Definition: voms_apic.h:54
VOMS_Export
int VOMS_Export(char **buffer, int *buflen, struct vomsdata *vd, int *error)
VOMS_GetAttributeGrantor
const char * VOMS_GetAttributeGrantor(struct voms *v, int handle, struct vomsdata *vd, int *error)
VOMS_Destroy
void VOMS_Destroy(struct vomsdata *vd)
vomsdata::volen
int volen
Definition: voms_apic.h:161
VOMS_LoadCredentials
int VOMS_LoadCredentials(X509 *cert, EVP_PKEY *pkey, STACK_OF(X509) *chain, struct vomsdata *vd, int *error)
VOMS_GetAttribute
int VOMS_GetAttribute(struct voms *v, int handle, int num, struct attribute *at, struct vomsdata *vd, int *error)
attribute::value
const char * value
Definition: voms_apic.h:56
data::role
char * role
Definition: voms_apic.h:50
VOMS_SetTimeout
int VOMS_SetTimeout(int t, struct vomsdata *vd, int *error)
data::cap
char * cap
Definition: voms_apic.h:51
VOMS_ContactRaw
int VOMS_ContactRaw(char *hostname, int port, char *servsubject, char *command, void **data, int *datalen, int *version, struct vomsdata *vd, int *error)
voms::uri
char * uri
Definition: voms_apic.h:88
VOMS_FreeTargets
void VOMS_FreeTargets(struct vomsdata *vd, int *error)
contactdata
The type of data returned.
Definition: voms_apic.h:60
VOMS_GetAttributeSourcesNumber
int VOMS_GetAttributeSourcesNumber(struct voms *v, struct vomsdata *vd, int *error)
VOMS_RetrieveEXT
int VOMS_RetrieveEXT(X509_EXTENSION *ext, struct vomsdata *vd, int *error)
getPatchVersionNumber
int getPatchVersionNumber(void)
VOMS_Delete
void VOMS_Delete(struct voms *v)
VOMS_ResetOrder
int VOMS_ResetOrder(struct vomsdata *vd, int *error)