Argus PEP client API  2.3
xacml.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Members of the EGEE Collaboration. 2006-2010.
3  * See http://www.eu-egee.org/partners/ for details on the copyright holders.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * Argus PEP client API
20  *
21  * $Id$
22  * @author Valery Tschopp <valery.tschopp@switch.ch>
23  * @version 1.0
24  */
25 #ifndef _PEP_XACML_H_
26 #define _PEP_XACML_H_
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <stddef.h> /* size_t */
33 
43 /*
44  * PEP XACML model functions return codes
45  */
46 #define PEP_XACML_OK 1
47 /* WARN: PEP_XACML_ERROR should be size_t (unsigned int) compatible! */
48 #define PEP_XACML_ERROR 0
51 /*
52  * XACML Data-types identifiers (XACML 2.0, Appendix B.3)
53  */
54 static const char XACML_DATATYPE_X500NAME[]= "urn:oasis:names:tc:xacml:1.0:data-type:x500Name";
55 static const char XACML_DATATYPE_RFC822NAME[]= "urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name";
56 static const char XACML_DATATYPE_IPADDRESS[]= "urn:oasis:names:tc:xacml:1.0:data-type:ipAddress";
57 static const char XACML_DATATYPE_DNSNAME[]= "urn:oasis:names:tc:xacml:1.0:data-type:dnsName";
58 static const char XACML_DATATYPE_STRING[]= "http://www.w3.org/2001/XMLSchema#string";
59 static const char XACML_DATATYPE_BOOLEAN[]= "http://www.w3.org/2001/XMLSchema#boolean";
60 static const char XACML_DATATYPE_INTEGER[]= "http://www.w3.org/2001/XMLSchema#integer";
61 static const char XACML_DATATYPE_DOUBLE[]= "http://www.w3.org/2001/XMLSchema#double";
62 static const char XACML_DATATYPE_TIME[]= "http://www.w3.org/2001/XMLSchema#time";
63 static const char XACML_DATATYPE_DATE[]= "http://www.w3.org/2001/XMLSchema#date";
64 static const char XACML_DATATYPE_DATETIME[]= "http://www.w3.org/2001/XMLSchema#dateTime";
65 static const char XACML_DATATYPE_ANYURI[]= "http://www.w3.org/2001/XMLSchema#anyURI";
66 static const char XACML_DATATYPE_HEXBINARY[]= "http://www.w3.org/2001/XMLSchema#hexBinary";
67 static const char XACML_DATATYPE_BASE64BINARY[]= "http://www.w3.org/2001/XMLSchema#base64Binary";
68 static const char XACML_DATATYPE_DAY_TIME_DURATION[]= "http://www.w3.org/TR/2002/WD-xquery-operators-20020816#dayTimeDuration";
69 static const char XACML_DATATYPE_YEAR_MONTH_DURATION[]= "http://www.w3.org/TR/2002/WD-xquery-operators-20020816#yearMonthDuration";
75 typedef struct xacml_attribute xacml_attribute_t;
76 
82 xacml_attribute_t * xacml_attribute_create(const char * id);
83 
90 int xacml_attribute_setid(xacml_attribute_t * attr, const char * id);
91 
97 const char * xacml_attribute_getid(const xacml_attribute_t * attr);
98 
105 int xacml_attribute_setdatatype(xacml_attribute_t * attr, const char * datatype);
106 
112 const char * xacml_attribute_getdatatype(const xacml_attribute_t * attr);
113 
120 int xacml_attribute_setissuer(xacml_attribute_t * attr, const char * issuer);
121 
127 const char * xacml_attribute_getissuer(const xacml_attribute_t * attr);
128 
135 int xacml_attribute_addvalue(xacml_attribute_t * attr, const char *value);
136 
144 
152 const char * xacml_attribute_getvalue(const xacml_attribute_t * attr,int value_idx);
153 
161 
168 
173 typedef struct xacml_subject xacml_subject_t;
174 
175 /*
176  * PEP XACML Subject/Attribute identifiers and Subject/\@SubjectCategory values (XACML 2.0, Appendix B)
177  */
178 static const char XACML_SUBJECT_ID[]= "urn:oasis:names:tc:xacml:1.0:subject:subject-id";
179 static const char XACML_SUBJECT_ID_QUALIFIER[]= "urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier";
180 static const char XACML_SUBJECT_KEY_INFO[]= "urn:oasis:names:tc:xacml:1.0:subject:key-info";
181 static const char XACML_SUBJECT_CATEGORY_ACCESS[]= "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject";
182 static const char XACML_SUBJECT_CATEGORY_INTERMEDIARY[]= "urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject";
183 static const char XACML_SUBJECT_CATEGORY_RECIPIENT[]= "urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject";
184 static const char XACML_SUBJECT_CATEGORY_CODEBASE[]= "urn:oasis:names:tc:xacml:1.0:subject-category:codebase";
185 static const char XACML_SUBJECT_CATEGORY_REQUESTING_MACHINE[]= "urn:oasis:names:tc:xacml:1.0:subject-category:requesting-machine";
192 
204 int xacml_subject_setcategory(xacml_subject_t * subject, const char * category);
205 
211 const char * xacml_subject_getcategory(const xacml_subject_t * subject);
212 
221 
228 size_t xacml_subject_attributes_length(const xacml_subject_t * subject);
229 
237 xacml_attribute_t * xacml_subject_getattribute(const xacml_subject_t * subject, int attr_idx);
238 
245 void xacml_subject_delete(xacml_subject_t * subject);
246 
247 
252 typedef struct xacml_resource xacml_resource_t;
253 
254 /*
255  * XACML Resource/Attribute Identifiers (XACML 2.0, Appendix B)
256  */
257 static const char XACML_RESOURCE_ID[]= "urn:oasis:names:tc:xacml:1.0:resource:resource-id";
264 
271 int xacml_resource_setcontent(xacml_resource_t * resource, const char * content);
272 
278 const char * xacml_resource_getcontent(const xacml_resource_t * resource);
279 
287 
293 size_t xacml_resource_attributes_length(const xacml_resource_t * resource);
294 
302 xacml_attribute_t * xacml_resource_getattribute(const xacml_resource_t * resource, int attr_idx);
303 
308 void xacml_resource_delete(xacml_resource_t * resource);
309 
310 
315 typedef struct xacml_action xacml_action_t;
316 
317 /*
318  * XACML Action/Attribute Identifiers (XACML 2.0, Appendix B)
319  */
320 static const char XACML_ACTION_ID[]= "urn:oasis:names:tc:xacml:1.0:action:action-id";
327 
335 
341 size_t xacml_action_attributes_length(const xacml_action_t * action);
342 
350 xacml_attribute_t * xacml_action_getattribute(const xacml_action_t * action, int attr_idx);
351 
356 void xacml_action_delete(xacml_action_t * action);
357 
358 
363 typedef struct xacml_environment xacml_environment_t;
364 
365 /*
366  * PEP XACML Environment/Attribute identifiers (XACML 2.0, Appendix B)
367  */
368 static const char XACML_ENVIRONMENT_CURRENT_TIME[]= "urn:oasis:names:tc:xacml:1.0:environment:current-time";
369 static const char XACML_ENVIRONMENT_CURRENT_DATE[]= "urn:oasis:names:tc:xacml:1.0:environment:current-date";
370 static const char XACML_ENVIRONMENT_CURRENT_DATETIME[]= "urn:oasis:names:tc:xacml:1.0:environment:current-dateTime";
377 
385 
392 
401 
407 
408 
413 typedef struct xacml_request xacml_request_t;
414 
420 
428 
434 size_t xacml_request_subjects_length(const xacml_request_t * request);
435 
443 xacml_subject_t * xacml_request_getsubject(const xacml_request_t * request, int subject_idx);
444 
452 
458 size_t xacml_request_resources_length(const xacml_request_t * request);
459 
467 xacml_resource_t * xacml_request_getresource(const xacml_request_t * request, int resource_idx);
468 
476 
483 
491 
498 
503 void xacml_request_delete(xacml_request_t * request);
504 
505 
510 typedef struct xacml_statuscode xacml_statuscode_t;
511 
512 /*
513  * PEP XACML StatusCode/\@Value values (XACML 2.0, B.9)
514  */
515 static const char XACML_STATUSCODE_OK[]= "urn:oasis:names:tc:xacml:1.0:status:ok";
516 static const char XACML_STATUSCODE_MISSINGATTRIBUTE[]= "urn:oasis:names:tc:xacml:1.0:status:missing-attribute";
517 static const char XACML_STATUSCODE_SYNTAXERROR[]= "urn:oasis:names:tc:xacml:1.0:status:syntax-error";
518 static const char XACML_STATUSCODE_PROCESSINGERROR[]= "urn:oasis:names:tc:xacml:1.0:status:processing-error";
525 xacml_statuscode_t * xacml_statuscode_create(const char * value);
526 
537 int xacml_statuscode_setvalue(xacml_statuscode_t * statuscode, const char * value);
538 
548 const char * xacml_statuscode_getvalue(const xacml_statuscode_t * statuscode);
549 
556 
564 
570 
575 typedef struct xacml_status xacml_status_t;
576 
582 xacml_status_t * xacml_status_create(const char * message);
583 
590 int xacml_status_setmessage(xacml_status_t * status, const char * message);
591 
597 const char * xacml_status_getmessage(const xacml_status_t * status);
598 
605 
612 int xacml_status_setcode(xacml_status_t * status, xacml_statuscode_t * statuscode);
613 
618 void xacml_status_delete(xacml_status_t * status);
619 
624 typedef struct xacml_attributeassignment xacml_attributeassignment_t;
625 
632 
640 
647 
654 int xacml_attributeassignment_setdatatype(xacml_attributeassignment_t * attr, const char * datatype);
655 
662 
671 
679 
680 
690 
698 
704 
708 typedef enum xacml_fulfillon {
712 
717 typedef struct xacml_obligation xacml_obligation_t;
718 
719 
726 
733 int xacml_obligation_setid(xacml_obligation_t * obligation, const char * id);
734 
740 const char * xacml_obligation_getid(const xacml_obligation_t * obligation);
741 
749 
758 
766 
774 
783 
789 
793 typedef enum xacml_decision {
799 
804 typedef struct xacml_result xacml_result_t;
805 
811 
819 
828 
834 const char * xacml_result_getresourceid(const xacml_result_t * result);
835 
842 int xacml_result_setresourceid(xacml_result_t * result, const char * resourceid);
843 
851 
860 
868 
875 size_t xacml_result_obligations_length(const xacml_result_t * result);
876 
883 xacml_obligation_t * xacml_result_getobligation(const xacml_result_t * result, int obligation_idx);
884 
892 int xacml_result_removeobligation(xacml_result_t * result, int obligation_idx);
893 
898 void xacml_result_delete(xacml_result_t * result);
899 
904 typedef struct xacml_response xacml_response_t;
905 
911 
920 
927 
935 
943 
950 size_t xacml_response_results_length(const xacml_response_t * response);
951 
958 xacml_result_t * xacml_response_getresult(const xacml_response_t * response, int result_idx);
959 
964 void xacml_response_delete(xacml_response_t * response);
965 
968 #ifdef __cplusplus
969 }
970 #endif
971 
972 #endif