merge master code to build iotivity
[platform/upstream/iotivity.git] / resource / csdk / security / include / internal / amaclresource.h
1 //******************************************************************
2 //
3 // Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef IOTVT_SRM_AMACLR_H
22 #define IOTVT_SRM_AMACLR_H
23
24 /**
25  * @file
26  *
27  * This file contains the APIs for the /oic/sec/amacl resource is an ACL structure that
28  * specifies which resources will use an Access Manager Service (AMS) to resolve access decisions.
29  * It dynamically obtains an ACL using an AMS.
30  */
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /**
37  * Initialize Amacl resource by loading data from persistent storage.
38  *
39  * @retval  OC_STACK_OK for Success, otherwise some error value
40  */
41 OCStackResult InitAmaclResource();
42
43 /**
44  * Perform cleanup for Amacl resources.
45  *
46  * @retval  none
47  */
48 void DeInitAmaclResource();
49
50 /**
51  * This method is used by PolicyEngine to retrieve Amacl for a Subject.
52  *
53  * @param subjectId ID of the subject for which Amacl is required.
54  * @param savePtr is used internally by @ref GetAmaclResourceData to maintain index between
55  *                successive calls for same subjectId.
56  *
57  * @retval  reference to @ref OicSecAmacl_t if Amacl is found, else NULL
58  *
59  * @note On the first call to @ref GetAmaclResourceData, savePtr should point to NULL
60  */
61 const OicSecAmacl_t* GetAmaclResourceData(const OicUuid_t* subjectId, OicSecAmacl_t **savePtr);
62
63 /**
64  * This function converts Amacl data into JSON format.
65  * Caller needs to invoke 'free' when done using
66  * returned string.
67  * @param Amacl  instance of OicSecAmacl_t structure.
68  *
69  * @retval  pointer to Amacl in json format.
70  */
71 char* BinToAmaclJSON(const OicSecAmacl_t * amacl);
72
73 #ifdef __cplusplus
74 }
75 #endif
76
77 #endif //IOTVT_SRM_AMACLR_H
78
79