Security code comments which are doxygen compliant
[platform/upstream/iotivity.git] / resource / csdk / security / include / internal / doxmresource.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_DOXM_H
22 #define IOTVT_SRM_DOXM_H
23
24 #include "octypes.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /**
31  * Initialize DOXM resource by loading data from persistent storage.
32  *
33  * @return ::OC_STACK_OK for Success, otherwise some error value.
34  */
35 OCStackResult InitDoxmResource();
36
37 /**
38  * Perform cleanup for DOXM resources.
39  *
40  * @return ::OC_STACK_OK for Success, otherwise some error value.
41  */
42 OCStackResult DeInitDoxmResource();
43
44 /**
45  * This method is used by SRM to retrieve DOXM resource data..
46  *
47  * @return reference to @ref OicSecDoxm_t, binary format of Doxm resource data.
48  */
49 const OicSecDoxm_t* GetDoxmResourceData();
50
51 /**
52  * This method converts JSON DOXM into binary DOXM.
53  * The JSON DOXM can be from persistent database or
54  * or received as PUT/POST request.
55  *
56  * @param jsonStr is a doxm data in json string.
57  *
58  * @note Caller needs to invoke OCFree after done using the return pointer.
59  *
60  * @return pointer to @ref OicSecDoxm_t.
61  */
62 OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr);
63
64 /**
65  * This method converts DOXM data into JSON format.
66  * Caller needs to invoke 'free' when finished done using
67  * return string.
68  *
69  * @param[in] doxm  Pointer to OicSecDoxm_t.
70  * @note Caller needs to invoke OCFree after done using the return pointer.
71  *
72  * @return pointer to the json string.
73  */
74 char * BinToDoxmJSON(const OicSecDoxm_t * doxm);
75
76 /**
77  * This method returns the SRM device ID for this device.
78  *
79  * @return ::OC_STACK_OK for Success, otherwise some error value.
80  */
81 OCStackResult GetDoxmDeviceID(OicUuid_t *deviceID);
82
83 /**
84  * Gets the OicUuid_t value for the owner of this device.
85  *
86  * @return ::OC_STACK_OK if devOwner is a valid UUID, otherwise ::OC_STACK_ERROR.
87  */
88 OCStackResult GetDoxmDevOwnerId(OicUuid_t *devOwner);
89
90 /** This function deallocates the memory for OicSecDoxm_t .
91  *
92  * @param doxm is the pointer to @ref OicSecDoxm_t.
93  */
94 void DeleteDoxmBinData(OicSecDoxm_t* doxm);
95
96 /**
97  * Function to restore doxm resurce to initial status.
98  * This function will use in case of error while ownership transfer
99  */
100 void RestoreDoxmToInitState();
101
102 #ifdef __cplusplus
103 }
104 #endif
105
106 #endif //IOTVT_SRM_DOXMR_H