Argus PEP client API
2.3
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
argus
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
143
size_t
xacml_attribute_values_length
(
const
xacml_attribute_t
* attr);
144
152
const
char
*
xacml_attribute_getvalue
(
const
xacml_attribute_t
* attr,
int
value_idx);
153
160
void
xacml_attribute_delete
(
xacml_attribute_t
* attr);
161
167
xacml_attribute_t
*
xacml_attribute_clone
(
const
xacml_attribute_t
* attr);
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"
;
191
xacml_subject_t
*
xacml_subject_create
(
void
);
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
220
int
xacml_subject_addattribute
(
xacml_subject_t
* subject,
xacml_attribute_t
* attr);
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"
;
263
xacml_resource_t
*
xacml_resource_create
(
void
);
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
286
int
xacml_resource_addattribute
(
xacml_resource_t
* resource,
xacml_attribute_t
* attr);
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"
;
326
xacml_action_t
*
xacml_action_create
(
void
);
327
334
int
xacml_action_addattribute
(
xacml_action_t
* action,
xacml_attribute_t
* attr);
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"
;
376
xacml_environment_t
*
xacml_environment_create
(
void
);
377
384
int
xacml_environment_addattribute
(
xacml_environment_t
* env,
xacml_attribute_t
* attr);
385
391
size_t
xacml_environment_attributes_length
(
const
xacml_environment_t
* env);
392
400
xacml_attribute_t
*
xacml_environment_getattribute
(
const
xacml_environment_t
* env,
int
attr_idx);
401
406
void
xacml_environment_delete
(
xacml_environment_t
* env);
407
408
413
typedef
struct
xacml_request
xacml_request_t
;
414
419
xacml_request_t
*
xacml_request_create
(
void
);
420
427
int
xacml_request_addsubject
(
xacml_request_t
* request,
xacml_subject_t
* subject);
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
451
int
xacml_request_addresource
(
xacml_request_t
* request,
xacml_resource_t
* resource);
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
475
int
xacml_request_setaction
(
xacml_request_t
* request,
xacml_action_t
* action);
476
482
xacml_action_t
*
xacml_request_getaction
(
const
xacml_request_t
* request);
483
490
int
xacml_request_setenvironment
(
xacml_request_t
* request,
xacml_environment_t
* env);
491
497
xacml_environment_t
*
xacml_request_getenvironment
(
const
xacml_request_t
* request);
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
555
xacml_statuscode_t
*
xacml_statuscode_getsubcode
(
const
xacml_statuscode_t
* statuscode);
556
563
int
xacml_statuscode_setsubcode
(
xacml_statuscode_t
* statuscode,
xacml_statuscode_t
* subcode);
564
569
void
xacml_statuscode_delete
(
xacml_statuscode_t
* statuscode);
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
604
xacml_statuscode_t
*
xacml_status_getcode
(
const
xacml_status_t
* status);
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
631
xacml_attributeassignment_t
*
xacml_attributeassignment_create
(
const
char
*
id
);
632
639
int
xacml_attributeassignment_setid
(
xacml_attributeassignment_t
* attr,
const
char
*
id
);
640
646
const
char
*
xacml_attributeassignment_getid
(
const
xacml_attributeassignment_t
* attr);
647
654
int
xacml_attributeassignment_setdatatype
(
xacml_attributeassignment_t
* attr,
const
char
* datatype);
655
661
const
char
*
xacml_attributeassignment_getdatatype
(
const
xacml_attributeassignment_t
* attr);
662
670
size_t
xacml_attributeassignment_values_length
(
const
xacml_attributeassignment_t
* attr);
671
678
const
char
*
xacml_attributeassignment_getvalue
(
const
xacml_attributeassignment_t
* attr, ...);
679
680
689
int
xacml_attributeassignment_addvalue
(
xacml_attributeassignment_t
* attr,
const
char
*value);
690
697
int
xacml_attributeassignment_setvalue
(
xacml_attributeassignment_t
* attr,
const
char
*value);
698
703
void
xacml_attributeassignment_delete
(
xacml_attributeassignment_t
* attr);
704
708
typedef
enum
xacml_fulfillon
{
709
XACML_FULFILLON_DENY
= 0,
710
XACML_FULFILLON_PERMIT
711
}
xacml_fulfillon_t
;
712
717
typedef
struct
xacml_obligation
xacml_obligation_t
;
718
719
725
xacml_obligation_t
*
xacml_obligation_create
(
const
char
*
id
);
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
748
xacml_fulfillon_t
xacml_obligation_getfulfillon
(
const
xacml_obligation_t
* obligation);
749
757
int
xacml_obligation_setfulfillon
(
xacml_obligation_t
* obligation,
xacml_fulfillon_t
fulfillon);
758
765
int
xacml_obligation_addattributeassignment
(
xacml_obligation_t
* obligation,
xacml_attributeassignment_t
* attr);
766
773
size_t
xacml_obligation_attributeassignments_length
(
const
xacml_obligation_t
* obligation);
774
782
xacml_attributeassignment_t
*
xacml_obligation_getattributeassignment
(
const
xacml_obligation_t
* obligation,
int
attr_idx);
783
788
void
xacml_obligation_delete
(
xacml_obligation_t
* obligation);
789
793
typedef
enum
xacml_decision
{
794
XACML_DECISION_DENY
= 0,
795
XACML_DECISION_PERMIT
,
796
XACML_DECISION_INDETERMINATE
,
797
XACML_DECISION_NOT_APPLICABLE
798
}
xacml_decision_t
;
799
804
typedef
struct
xacml_result
xacml_result_t
;
805
810
xacml_result_t
*
xacml_result_create
(
void
);
811
818
xacml_decision_t
xacml_result_getdecision
(
const
xacml_result_t
* result);
819
827
int
xacml_result_setdecision
(
xacml_result_t
* result,
xacml_decision_t
decision);
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
850
xacml_status_t
*
xacml_result_getstatus
(
const
xacml_result_t
* result);
851
859
int
xacml_result_setstatus
(
xacml_result_t
* result,
xacml_status_t
* status);
860
867
int
xacml_result_addobligation
(
xacml_result_t
* result,
xacml_obligation_t
* obligation);
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
910
xacml_response_t
*
xacml_response_create
(
void
);
911
919
int
xacml_response_setrequest
(
xacml_response_t
* response,
xacml_request_t
* request);
920
926
xacml_request_t
*
xacml_response_getrequest
(
const
xacml_response_t
* response);
927
934
xacml_request_t
*
xacml_response_relinquishrequest
(
xacml_response_t
* response);
935
942
int
xacml_response_addresult
(
xacml_response_t
* response,
xacml_result_t
* result);
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
Generated on Fri May 9 2014 13:18:39 for Argus PEP client API by
1.8.1.2