• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

argus/xacml.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) Members of the EGEE Collaboration. 2006-2010.
00003  * See http://www.eu-egee.org/partners/ for details on the copyright holders.
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /* 
00019  * Argus PEP client API
00020  *
00021  * $Id$
00022  * @author Valery Tschopp <valery.tschopp@switch.ch>
00023  * @version 1.0
00024  */
00025 #ifndef _PEP_XACML_H_
00026 #define _PEP_XACML_H_
00027 
00028 #ifdef  __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 #include <stddef.h> /* size_t */
00033 
00043 /*
00044  * PEP XACML model functions return codes
00045  */
00046 #define PEP_XACML_OK     1 
00047 /* WARN: PEP_XACML_ERROR should be size_t (unsigned int) compatible! */
00048 #define PEP_XACML_ERROR  0 
00051 /*
00052  * XACML Data-types identifiers (XACML 2.0, Appendix B.3)
00053  */
00054 static const char XACML_DATATYPE_X500NAME[]= "urn:oasis:names:tc:xacml:1.0:data-type:x500Name"; 
00055 static const char XACML_DATATYPE_RFC822NAME[]= "urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name"; 
00056 static const char XACML_DATATYPE_IPADDRESS[]= "urn:oasis:names:tc:xacml:1.0:data-type:ipAddress"; 
00057 static const char XACML_DATATYPE_DNSNAME[]= "urn:oasis:names:tc:xacml:1.0:data-type:dnsName"; 
00058 static const char XACML_DATATYPE_STRING[]= "http://www.w3.org/2001/XMLSchema#string"; 
00059 static const char XACML_DATATYPE_BOOLEAN[]= "http://www.w3.org/2001/XMLSchema#boolean"; 
00060 static const char XACML_DATATYPE_INTEGER[]= "http://www.w3.org/2001/XMLSchema#integer"; 
00061 static const char XACML_DATATYPE_DOUBLE[]= "http://www.w3.org/2001/XMLSchema#double"; 
00062 static const char XACML_DATATYPE_TIME[]= "http://www.w3.org/2001/XMLSchema#time"; 
00063 static const char XACML_DATATYPE_DATE[]= "http://www.w3.org/2001/XMLSchema#date"; 
00064 static const char XACML_DATATYPE_DATETIME[]= "http://www.w3.org/2001/XMLSchema#dateTime"; 
00065 static const char XACML_DATATYPE_ANYURI[]= "http://www.w3.org/2001/XMLSchema#anyURI"; 
00066 static const char XACML_DATATYPE_HEXBINARY[]= "http://www.w3.org/2001/XMLSchema#hexBinary"; 
00067 static const char XACML_DATATYPE_BASE64BINARY[]= "http://www.w3.org/2001/XMLSchema#base64Binary"; 
00068 static const char XACML_DATATYPE_DAY_TIME_DURATION[]= "http://www.w3.org/TR/2002/WD-xquery-operators-20020816#dayTimeDuration"; 
00069 static const char XACML_DATATYPE_YEAR_MONTH_DURATION[]= "http://www.w3.org/TR/2002/WD-xquery-operators-20020816#yearMonthDuration"; 
00075 typedef struct xacml_attribute xacml_attribute_t;
00076 
00082 xacml_attribute_t * xacml_attribute_create(const char * id);
00083 
00090 int xacml_attribute_setid(xacml_attribute_t * attr, const char * id);
00091 
00097 const char * xacml_attribute_getid(const xacml_attribute_t * attr);
00098 
00105 int xacml_attribute_setdatatype(xacml_attribute_t * attr, const char * datatype);
00106 
00112 const char * xacml_attribute_getdatatype(const xacml_attribute_t * attr);
00113 
00120 int xacml_attribute_setissuer(xacml_attribute_t * attr, const char * issuer);
00121 
00127 const char * xacml_attribute_getissuer(const xacml_attribute_t * attr);
00128 
00135 int xacml_attribute_addvalue(xacml_attribute_t * attr, const char *value);
00136 
00143 size_t xacml_attribute_values_length(const xacml_attribute_t * attr);
00144 
00152 const char * xacml_attribute_getvalue(const xacml_attribute_t * attr,int value_idx);
00153 
00160 void xacml_attribute_delete(xacml_attribute_t * attr);
00161 
00167 xacml_attribute_t * xacml_attribute_clone(const xacml_attribute_t * attr);
00168 
00173 typedef struct xacml_subject xacml_subject_t;
00174 
00175 /*
00176  * PEP XACML Subject/Attribute identifiers and Subject/\@SubjectCategory values (XACML 2.0, Appendix B)
00177  */
00178 static const char XACML_SUBJECT_ID[]= "urn:oasis:names:tc:xacml:1.0:subject:subject-id"; 
00179 static const char XACML_SUBJECT_ID_QUALIFIER[]= "urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier"; 
00180 static const char XACML_SUBJECT_KEY_INFO[]= "urn:oasis:names:tc:xacml:1.0:subject:key-info"; 
00181 static const char XACML_SUBJECT_CATEGORY_ACCESS[]= "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"; 
00182 static const char XACML_SUBJECT_CATEGORY_INTERMEDIARY[]= "urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject"; 
00183 static const char XACML_SUBJECT_CATEGORY_RECIPIENT[]= "urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject"; 
00184 static const char XACML_SUBJECT_CATEGORY_CODEBASE[]= "urn:oasis:names:tc:xacml:1.0:subject-category:codebase"; 
00185 static const char XACML_SUBJECT_CATEGORY_REQUESTING_MACHINE[]= "urn:oasis:names:tc:xacml:1.0:subject-category:requesting-machine"; 
00191 xacml_subject_t * xacml_subject_create(void);
00192 
00204 int xacml_subject_setcategory(xacml_subject_t * subject, const char * category);
00205 
00211 const char * xacml_subject_getcategory(const xacml_subject_t * subject);
00212 
00220 int xacml_subject_addattribute(xacml_subject_t * subject, xacml_attribute_t * attr);
00221 
00228 size_t xacml_subject_attributes_length(const xacml_subject_t * subject);
00229 
00237 xacml_attribute_t * xacml_subject_getattribute(const xacml_subject_t * subject, int attr_idx);
00238 
00245 void xacml_subject_delete(xacml_subject_t * subject);
00246 
00247 
00252 typedef struct xacml_resource xacml_resource_t;
00253 
00254 /*
00255  * XACML Resource/Attribute Identifiers (XACML 2.0, Appendix B)
00256  */
00257 static const char XACML_RESOURCE_ID[]= "urn:oasis:names:tc:xacml:1.0:resource:resource-id"; 
00263 xacml_resource_t * xacml_resource_create(void);
00264 
00271 int xacml_resource_setcontent(xacml_resource_t * resource, const char * content);
00272 
00278 const char * xacml_resource_getcontent(const xacml_resource_t * resource);
00279 
00286 int xacml_resource_addattribute(xacml_resource_t * resource, xacml_attribute_t * attr);
00287 
00293 size_t xacml_resource_attributes_length(const xacml_resource_t * resource);
00294 
00302 xacml_attribute_t * xacml_resource_getattribute(const xacml_resource_t * resource, int attr_idx);
00303 
00308 void xacml_resource_delete(xacml_resource_t * resource);
00309 
00310 
00315 typedef struct xacml_action xacml_action_t;
00316 
00317 /*
00318  * XACML Action/Attribute Identifiers (XACML 2.0, Appendix B)
00319  */
00320 static const char XACML_ACTION_ID[]= "urn:oasis:names:tc:xacml:1.0:action:action-id"; 
00326 xacml_action_t * xacml_action_create(void);
00327 
00334 int xacml_action_addattribute(xacml_action_t * action, xacml_attribute_t * attr);
00335 
00341 size_t xacml_action_attributes_length(const xacml_action_t * action);
00342 
00350 xacml_attribute_t * xacml_action_getattribute(const xacml_action_t * action, int attr_idx);
00351 
00356 void xacml_action_delete(xacml_action_t * action);
00357 
00358 
00363 typedef struct xacml_environment xacml_environment_t;
00364 
00365 /*
00366  * PEP XACML Environment/Attribute identifiers (XACML 2.0, Appendix B)
00367  */
00368 static const char XACML_ENVIRONMENT_CURRENT_TIME[]= "urn:oasis:names:tc:xacml:1.0:environment:current-time"; 
00369 static const char XACML_ENVIRONMENT_CURRENT_DATE[]= "urn:oasis:names:tc:xacml:1.0:environment:current-date"; 
00370 static const char XACML_ENVIRONMENT_CURRENT_DATETIME[]= "urn:oasis:names:tc:xacml:1.0:environment:current-dateTime"; 
00376 xacml_environment_t * xacml_environment_create(void);
00377 
00384 int xacml_environment_addattribute(xacml_environment_t * env, xacml_attribute_t * attr);
00385 
00391 size_t xacml_environment_attributes_length(const xacml_environment_t * env);
00392 
00400 xacml_attribute_t * xacml_environment_getattribute(const xacml_environment_t * env, int attr_idx);
00401 
00406 void xacml_environment_delete(xacml_environment_t * env);
00407 
00408 
00413 typedef struct xacml_request xacml_request_t;
00414 
00419 xacml_request_t * xacml_request_create(void);
00420 
00427 int xacml_request_addsubject(xacml_request_t * request, xacml_subject_t * subject);
00428 
00434 size_t xacml_request_subjects_length(const xacml_request_t * request);
00435 
00443 xacml_subject_t * xacml_request_getsubject(const xacml_request_t * request, int subject_idx);
00444 
00451 int xacml_request_addresource(xacml_request_t * request, xacml_resource_t * resource);
00452 
00458 size_t xacml_request_resources_length(const xacml_request_t * request);
00459 
00467 xacml_resource_t * xacml_request_getresource(const xacml_request_t * request, int resource_idx);
00468 
00475 int xacml_request_setaction(xacml_request_t * request, xacml_action_t * action);
00476 
00482 xacml_action_t * xacml_request_getaction(const xacml_request_t * request);
00483 
00490 int xacml_request_setenvironment(xacml_request_t * request, xacml_environment_t * env);
00491 
00497 xacml_environment_t * xacml_request_getenvironment(const xacml_request_t * request);
00498 
00503 void xacml_request_delete(xacml_request_t * request);
00504 
00505 
00510 typedef struct xacml_statuscode xacml_statuscode_t;
00511 
00512 /*
00513  * PEP XACML StatusCode/\@Value values (XACML 2.0, B.9)
00514  */
00515 static const char XACML_STATUSCODE_OK[]= "urn:oasis:names:tc:xacml:1.0:status:ok"; 
00516 static const char XACML_STATUSCODE_MISSINGATTRIBUTE[]= "urn:oasis:names:tc:xacml:1.0:status:missing-attribute"; 
00517 static const char XACML_STATUSCODE_SYNTAXERROR[]= "urn:oasis:names:tc:xacml:1.0:status:syntax-error"; 
00518 static const char XACML_STATUSCODE_PROCESSINGERROR[]= "urn:oasis:names:tc:xacml:1.0:status:processing-error"; 
00525 xacml_statuscode_t * xacml_statuscode_create(const char * value);
00526 
00537 int xacml_statuscode_setvalue(xacml_statuscode_t * statuscode, const char * value);
00538 
00548 const char * xacml_statuscode_getvalue(const xacml_statuscode_t * statuscode);
00549 
00555 xacml_statuscode_t * xacml_statuscode_getsubcode(const xacml_statuscode_t * statuscode);
00556 
00563 int xacml_statuscode_setsubcode(xacml_statuscode_t * statuscode, xacml_statuscode_t * subcode);
00564 
00569 void xacml_statuscode_delete(xacml_statuscode_t * statuscode);
00570 
00575 typedef struct xacml_status xacml_status_t;
00576 
00582 xacml_status_t * xacml_status_create(const char * message);
00583 
00590 int xacml_status_setmessage(xacml_status_t * status, const char * message);
00591 
00597 const char * xacml_status_getmessage(const xacml_status_t * status);
00598 
00604 xacml_statuscode_t * xacml_status_getcode(const xacml_status_t * status);
00605 
00612 int xacml_status_setcode(xacml_status_t * status, xacml_statuscode_t * statuscode);
00613 
00618 void xacml_status_delete(xacml_status_t * status);
00619 
00624 typedef struct xacml_attributeassignment xacml_attributeassignment_t;
00625 
00631 xacml_attributeassignment_t * xacml_attributeassignment_create(const char * id);
00632 
00639 int xacml_attributeassignment_setid(xacml_attributeassignment_t * attr, const char * id);
00640 
00646 const char * xacml_attributeassignment_getid(const xacml_attributeassignment_t * attr);
00647 
00654 int xacml_attributeassignment_setdatatype(xacml_attributeassignment_t * attr, const char * datatype);
00655 
00661 const char * xacml_attributeassignment_getdatatype(const xacml_attributeassignment_t * attr);
00662 
00670 size_t xacml_attributeassignment_values_length(const xacml_attributeassignment_t * attr);
00671 
00678 const char * xacml_attributeassignment_getvalue(const xacml_attributeassignment_t * attr, ...);
00679 
00680 
00689 int xacml_attributeassignment_addvalue(xacml_attributeassignment_t * attr, const char *value);
00690 
00697 int xacml_attributeassignment_setvalue(xacml_attributeassignment_t * attr, const char *value);
00698 
00703 void xacml_attributeassignment_delete(xacml_attributeassignment_t * attr);
00704 
00708 typedef enum xacml_fulfillon {
00709     XACML_FULFILLON_DENY = 0, 
00710     XACML_FULFILLON_PERMIT 
00711 } xacml_fulfillon_t;
00712 
00717 typedef struct xacml_obligation xacml_obligation_t;
00718 
00719 
00725 xacml_obligation_t * xacml_obligation_create(const char * id);
00726 
00733 int xacml_obligation_setid(xacml_obligation_t * obligation, const char * id);
00734 
00740 const char * xacml_obligation_getid(const xacml_obligation_t * obligation);
00741 
00748 xacml_fulfillon_t xacml_obligation_getfulfillon(const xacml_obligation_t * obligation);
00749 
00757 int xacml_obligation_setfulfillon(xacml_obligation_t * obligation, xacml_fulfillon_t fulfillon);
00758 
00765 int xacml_obligation_addattributeassignment(xacml_obligation_t * obligation, xacml_attributeassignment_t * attr);
00766 
00773 size_t xacml_obligation_attributeassignments_length(const xacml_obligation_t * obligation);
00774 
00782 xacml_attributeassignment_t * xacml_obligation_getattributeassignment(const xacml_obligation_t * obligation,int attr_idx);
00783 
00788 void xacml_obligation_delete(xacml_obligation_t * obligation);
00789 
00793 typedef enum xacml_decision {
00794     XACML_DECISION_DENY = 0, 
00795     XACML_DECISION_PERMIT, 
00796     XACML_DECISION_INDETERMINATE, 
00797     XACML_DECISION_NOT_APPLICABLE 
00798 } xacml_decision_t;
00799 
00804 typedef struct xacml_result xacml_result_t;
00805 
00810 xacml_result_t * xacml_result_create(void);
00811 
00818 xacml_decision_t xacml_result_getdecision(const xacml_result_t * result);
00819 
00827 int xacml_result_setdecision(xacml_result_t * result, xacml_decision_t decision);
00828 
00834 const char * xacml_result_getresourceid(const xacml_result_t * result);
00835 
00842 int xacml_result_setresourceid(xacml_result_t * result, const char * resourceid);
00843 
00850 xacml_status_t * xacml_result_getstatus(const xacml_result_t * result);
00851 
00859 int xacml_result_setstatus(xacml_result_t * result, xacml_status_t * status);
00860 
00867 int xacml_result_addobligation(xacml_result_t * result, xacml_obligation_t * obligation);
00868 
00875 size_t xacml_result_obligations_length(const xacml_result_t * result);
00876 
00883 xacml_obligation_t * xacml_result_getobligation(const xacml_result_t * result, int obligation_idx);
00884 
00892 int xacml_result_removeobligation(xacml_result_t * result, int obligation_idx);
00893 
00898 void xacml_result_delete(xacml_result_t * result);
00899 
00904 typedef struct xacml_response xacml_response_t;
00905 
00910 xacml_response_t * xacml_response_create(void);
00911 
00919 int xacml_response_setrequest(xacml_response_t * response, xacml_request_t * request);
00920 
00926 xacml_request_t * xacml_response_getrequest(const xacml_response_t * response);
00927 
00934 xacml_request_t * xacml_response_relinquishrequest(xacml_response_t * response);
00935 
00942 int xacml_response_addresult(xacml_response_t * response, xacml_result_t * result);
00943 
00950 size_t xacml_response_results_length(const xacml_response_t * response);
00951 
00958 xacml_result_t * xacml_response_getresult(const xacml_response_t * response, int result_idx);
00959 
00964 void xacml_response_delete(xacml_response_t * response);
00965 
00968 #ifdef  __cplusplus
00969 }
00970 #endif
00971 
00972 #endif

Generated on Fri May 9 2014 13:15:11 for Argus PEP client API by  doxygen 1.7.1