X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fsecurity%2Finclude%2Finternal%2Faclresource.h;h=0172ae4612d6789bec655efba3ea6a773cfa04d3;hb=refs%2Ftags%2Ftizen_4.0.m2_release;hp=5f1ac9de3148bead40aa2af7226edbac1dba5347;hpb=945944cb3ff5efaccd03e8efa23199e58bd59ded;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/security/include/internal/aclresource.h b/resource/csdk/security/include/internal/aclresource.h index 5f1ac9d..0172ae4 100644 --- a/resource/csdk/security/include/internal/aclresource.h +++ b/resource/csdk/security/include/internal/aclresource.h @@ -47,9 +47,9 @@ OCStackResult DeInitACLResource(); * * @note On the first call to @ref GetACLResourceData, savePtr should point to NULL. * - * @return reference to @ref OicSecAcl_t if ACL is found, else NULL. + * @return reference to @ref OicSecAce_t if ACE is found, else NULL. */ -const OicSecAcl_t* GetACLResourceData(const OicUuid_t* subjectId, OicSecAcl_t **savePtr); +const OicSecAce_t* GetACLResourceData(const OicUuid_t* subjectId, OicSecAce_t **savePtr); /** * This function converts ACL data into CBOR format. @@ -62,6 +62,33 @@ const OicSecAcl_t* GetACLResourceData(const OicUuid_t* subjectId, OicSecAcl_t ** */ OCStackResult AclToCBORPayload(const OicSecAcl_t * acl, uint8_t **outPayload, size_t *size); +#ifdef MULTIPLE_OWNER +/** + * Function to check the ACL access of SubOwner + * + * @param[in] uuid SubOwner's UUID + * @param[in] cborPayload CBOR payload of ACL + * @param[in] size Byte length of cborPayload + * + * @return ::true for valid access, otherwise invalid access + */ +bool IsValidAclAccessForSubOwner(const OicUuid_t* uuid, const uint8_t *cborPayload, const size_t size); +#endif //MULTIPLE_OWNER + + +/** + * This method removes ACE for the subject and resource from the ACL + * + * @param subject of the ACE + * @param resource of the ACE + * + * @return + * ::OC_STACK_RESOURCE_DELETED on success + * ::OC_STACK_NO_RESOURCE on failure to find the appropriate ACE + * ::OC_STACK_INVALID_PARAM on invalid parameter + */ +OCStackResult RemoveACE(const OicUuid_t * subject, const char * resource); + /** * This function deletes ACL data. * @@ -70,22 +97,56 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t * acl, uint8_t **outPayload, si void DeleteACLList(OicSecAcl_t* acl); /** - * This function installs a new ACL. + * This function frees OicSecRsrc_t object's fields and object itself. + * + * @param rsrc instance of @ref OicSecRsrc_t structure to be deleted. + */ +void FreeRsrc(OicSecRsrc_t *rsrc); + +/** + * Internal function to duplicate the ACE instance. + * + * @param ace instance of @ref OicSecAce_t structure to be duplicated. + * @return reference to @ref OicSecAce_t if ACE was successfully duplicated. + */ +OicSecAce_t* DuplicateACE(const OicSecAce_t* ace); + + +/** + * This function check the duplication with pre-installed ACL and installs only new ACEs. + * + * @param acl acl to install. + * + * @return ::OC_STACK_OK for Success, otherwise some error value + */ +OCStackResult InstallACL(const OicSecAcl_t* acl); + +/** + * This function appends a new ACL. * * @param payload cbor value representing a new ACL. * @param size of the cbor payload. * * @return ::OC_STACK_OK for Success, otherwise some error value */ -OCStackResult InstallNewACL(const uint8_t* payload, const size_t size); +OCStackResult AppendACL(const uint8_t* payload, const size_t size); + +/** + * This function appends a new ACL. + * + * @param acl new acl to append. + * + * @return ::OC_STACK_OK for Success, otherwise some error value + */ +OCStackResult AppendACL2(const OicSecAcl_t* acl); /** - * This function updates default ACL which is required for ownership transfer. + * This function updates default ACE which is required for ownership transfer. * This function should be invoked after OTM is complete to prevent anonymous user access. * * @retval OC_STACK_OK for Success, otherwise some error value */ -OCStackResult UpdateDefaultSecProvACL(); +OCStackResult UpdateDefaultSecProvACE(); /** * Internal function to update resource owner @@ -105,6 +166,24 @@ OCStackResult SetAclRownerId(const OicUuid_t* newROwner); */ OCStackResult GetAclRownerId(OicUuid_t *rowneruuid); +/** + * This function converts CBOR data into ACL. + * + * @param cborPayload is the pointer to cbor payload to parse. + * @param size of the cbor payload. + * + * @return ::acl instance of @ref OicSecAcl_t structure or NULL if error occurs + */ +OicSecAcl_t* CBORPayloadToAcl2(const uint8_t *cborPayload, const size_t size); + +/** + * This function prints ACL to stdin + * For debug purposes only + * + * @param acl acl to print + */ +void printACL(const OicSecAcl_t* acl); + #ifdef __cplusplus } #endif