1 //******************************************************************
3 // Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef IOTVT_SRM_AMACLR_H
22 #define IOTVT_SRM_AMACLR_H
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.
37 * Initialize Amacl resource by loading data from persistent storage.
39 * @return ::OC_STACK_OK for Success, otherwise some error value.
41 OCStackResult InitAmaclResource();
44 * Perform cleanup for Amacl resources.
46 void DeInitAmaclResource();
49 * This method is used by PolicyEngine to retrieve amsId for the resource.
50 * If the Amacl is found for the given resource then populate the parameter
51 * amsId with Amacl resource amss id.
53 * @param resource for which AMS service is required.
54 * @param amsId of the ams service for the given resource.
56 * @return ::OC_STACK_OK, if Amacl is found for the resource, else ::OC_STACK_ERROR,
57 * if no Amacl found for the resource.
59 OCStackResult AmaclGetAmsDeviceId(const char *resource, OicUuid_t *amsId);
62 * This function converts Amacl data into CBOR format.
63 * Caller needs to invoke 'free' when done using returned string.
65 * @param amacl instance of @ref OicSecAmacl_t structure.
66 * @param cborPayload is the converted cbor value of @ref OicSecAmacl_t structure.
67 * @param cborSize is the size of the cbor payload. This value is the size of the
68 * cborPayload. It should not be NON-NULL value.
70 * @return ::OC_STACK_OK for Success. ::OC_STACK_INVALID in case of invalid parameters.
71 * ::OC_STACK_ERROR in case of error in converting to cbor.
73 OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amacl, uint8_t **cborPayload,
78 * Internal function to update resource owner
80 * @param newROwner new owner
82 * @retval ::OC_STACK_OK for Success, otherwise some error value
84 OCStackResult SetAmaclRownerId(const OicUuid_t* newROwner);
90 #endif //IOTVT_SRM_AMACLR_H