Fixed build issue by adding Builder contructor with const args
[platform/upstream/iotivity.git] / resource / csdk / security / include / internal / security_internals.h
1 #ifndef IOTVT_SRM_SECURITY_INTERNALS_H
2 #define IOTVT_SRM_SECURITY_INTERNALS_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 OicSecAcl_t* CBORPayloadToAcl(const uint8_t *payload, const size_t size);
9
10 void DeleteACLList(OicSecAcl_t* acl);
11
12 /**
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.
17  */
18 OCStackResult  GetDefaultACL(OicSecAcl_t** defaultAcl);
19
20 /**
21  * This internal method is the entity handler for ACL resources and
22  * will handle REST request (GET/PUT/POST/DEL) for them.
23  */
24 OCEntityHandlerResult ACLEntityHandler(OCEntityHandlerFlag flag,
25             OCEntityHandlerRequest * ehRequest, void* callbackParameter);
26
27 OCStackResult SetDefaultACL(OicSecAcl_t *acl);
28
29 /**
30  * Converts CBOR payload to SVC.
31  *
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.
35  *
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.
38  */
39 OCStackResult CBORPayloadToSVC(const uint8_t *cborPayload, size_t size, OicSecSvc_t **svc);
40
41 /**
42  * Deletes the passed initialized reference to @ref OicSecSvc_t.
43  *
44  * @param svc is the reference to be deleted.
45  */
46 void DeleteSVCList(OicSecSvc_t* svc);
47
48 /**
49  * Create PSTAT resource after default PSTAT initialization is done.
50  */
51 OCStackResult CreatePstatResource();
52
53 /**
54  * This internal method is the entity handler for PSTAT resources and
55  * will handle REST request (GET/PUT/POST/DEL) for them.
56  */
57 OCEntityHandlerResult PstatEntityHandler(OCEntityHandlerFlag flag,
58                                          OCEntityHandlerRequest * ehRequest);
59
60 /**
61  * Converts CBOR payload to AMACL.
62  *
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.
67  */
68 OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t cborSize,
69                                  OicSecAmacl_t **amacl);
70
71 /**
72  * This internal method is the entity handler for Cred resources
73  * to handle REST request (PUT/POST/DEL)
74  */
75 OCEntityHandlerResult CredEntityHandler(OCEntityHandlerFlag flag,
76                                         OCEntityHandlerRequest * ehRequest,
77                                         void* callbackParameter);
78
79 /**
80  * This internal method is used to create '/oic/sec/Cred' resource.
81  */
82 OCStackResult CreateCredResource();
83
84 /**
85  * This function converts from CBOR format into credential structure .
86  * Caller needs to invoke 'free' for allocated structure.
87  *
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.
92  *
93  * @return ::OC_STACK_OK if conversion is successful, else ::OC_STACK_ERROR if unsuccessful.
94  */
95 OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
96                                 OicSecCred_t **secCred);
97
98 /**
99  * This internal method is used to create '/oic/sec/doxm' resource.
100  */
101 OCStackResult CreateDoxmResource();
102
103 /**
104  * This internal method is the entity handler for DOXM resources.
105  */
106 OCEntityHandlerResult DoxmEntityHandler(OCEntityHandlerFlag flag,
107                                         OCEntityHandlerRequest * ehRequest,
108                                         void* callbackParam);
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif //IOTVT_SRM_SECURITY_INTERNALS_H