1 #ifndef IOTVT_SRM_SECURITY_INTERNALS_H
2 #define IOTVT_SRM_SECURITY_INTERNALS_H
8 OicSecAcl_t* CBORPayloadToAcl(const uint8_t *payload, const size_t size);
10 void DeleteACLList(OicSecAcl_t* acl);
13 * This internal method is to retrieve the default ACL.
14 * If SVR database in persistent storage got corrupted or
15 * is not available for some reason, a default ACL is created
16 * which allows user to initiate ACL provisioning again.
18 OCStackResult GetDefaultACL(OicSecAcl_t** defaultAcl);
21 * This internal method is the entity handler for ACL resources and
22 * will handle REST request (GET/PUT/POST/DEL) for them.
24 OCEntityHandlerResult ACLEntityHandler(OCEntityHandlerFlag flag,
25 OCEntityHandlerRequest * ehRequest, void* callbackParameter);
27 OCStackResult SetDefaultACL(OicSecAcl_t *acl);
30 * Converts CBOR payload to SVC.
32 * @param cborPayload is the svc payload cbor value that neds to be converted.
33 * @param cborSize of the cborPayload. In case size is not known, it is 0.
34 * @param svc is the value that is initialized. It is NULL in case of error.
36 * @return ::OC_STACK_OK in case successful. ::OC_STACK_INVALID_PARAM if one of
37 * the passed parameter is NULL. ::OC_STACK_ERROR in case of error.
39 OCStackResult CBORPayloadToSVC(const uint8_t *cborPayload, size_t size, OicSecSvc_t **svc);
42 * Deletes the passed initialized reference to @ref OicSecSvc_t.
44 * @param svc is the reference to be deleted.
46 void DeleteSVCList(OicSecSvc_t* svc);
49 * Create PSTAT resource after default PSTAT initialization is done.
51 OCStackResult CreatePstatResource();
54 * This internal method is the entity handler for PSTAT resources and
55 * will handle REST request (GET/PUT/POST/DEL) for them.
57 OCEntityHandlerResult PstatEntityHandler(OCEntityHandlerFlag flag,
58 OCEntityHandlerRequest * ehRequest);
61 * Converts CBOR payload to AMACL.
63 * @param cborPayload is the amacl payload cbor value that neds to be converted.
64 * @param cborSize of the cborPayload. In case size is not known, it is 0.
65 * It should be NON-NULL.
66 * @param amacl is the value that is initialized. It is NULL in case of error.
68 OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t cborSize,
69 OicSecAmacl_t **amacl);
72 * This internal method is the entity handler for Cred resources
73 * to handle REST request (PUT/POST/DEL)
75 OCEntityHandlerResult CredEntityHandler(OCEntityHandlerFlag flag,
76 OCEntityHandlerRequest * ehRequest,
77 void* callbackParameter);
80 * This internal method is used to create '/oic/sec/Cred' resource.
82 OCStackResult CreateCredResource();
85 * This function converts from CBOR format into credential structure .
86 * Caller needs to invoke 'free' for allocated structure.
88 * @param cborPayload is the CBOR value that is assigned to the structure.
89 * @param size is the size of the CBOR.
90 * @param secCred is the pointer to instance of @ref OicSecCred_t structure that will be allocated.
91 * If it fails it will return NULL.
93 * @return ::OC_STACK_OK if conversion is successful, else ::OC_STACK_ERROR if unsuccessful.
95 OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
96 OicSecCred_t **secCred);
99 * This internal method is used to create '/oic/sec/doxm' resource.
101 OCStackResult CreateDoxmResource();
104 * This internal method is the entity handler for DOXM resources.
106 OCEntityHandlerResult DoxmEntityHandler(OCEntityHandlerFlag flag,
107 OCEntityHandlerRequest * ehRequest,
108 void* callbackParam);
114 #endif //IOTVT_SRM_SECURITY_INTERNALS_H