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_DOXM_H
22 #define IOTVT_SRM_DOXM_H
31 * Initialize DOXM resource by loading data from persistent storage.
33 * @retval OC_STACK_OK for Success, otherwise some error value
35 OCStackResult InitDoxmResource();
38 * Perform cleanup for DOXM resources.
40 * @retval OC_STACK_OK for Success, otherwise some error value
42 OCStackResult DeInitDoxmResource();
45 * This method is used by SRM to retrieve DOXM resource data..
47 * @retval reference to @ref OicSecDoxm_t, binary format of Doxm resource data
49 const OicSecDoxm_t* GetDoxmResourceData();
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.
56 * @param[in] jsonStr doxm data in json string.
57 * @param[in] isIncResName if resource name is included into payload, it is true.
58 * @return pointer to OicSecDoxm_t.
60 * @note Caller needs to invoke OCFree after done
61 * using the return pointer
63 OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr, const bool isIncResName);
66 * This method converts DOXM data into JSON format.
67 * Caller needs to invoke 'free' when finished done using
70 * @param[in] doxm Pointer to OicSecDoxm_t.
71 * @param[in] isIncResName Decide whether or not to include the resource name in output.
72 * @return pointer to json string.
74 * @note Caller needs to invoke OCFree after done
75 * using the return pointer
77 char * BinToDoxmJSON(const OicSecDoxm_t * doxm, const bool isIncResName);
80 * This method returns the SRM device ID for this device.
82 * @retval OC_STACK_OK for Success, otherwise some error value
84 OCStackResult GetDoxmDeviceID(OicUuid_t *deviceID);
87 * @brief Gets the OicUuid_t value for the owner of this device.
89 * @return OC_STACK_OK if devOwner is a valid UUID, otherwise OC_STACK_ERROR.
91 OCStackResult GetDoxmDevOwnerId(OicUuid_t *devOwner);
93 /** This function deallocates the memory for OicSecDoxm_t .
95 * @param[in] doxm Pointer to OicSecDoxm_t.
97 void DeleteDoxmBinData(OicSecDoxm_t* doxm);
104 #endif //IOTVT_SRM_DOXMR_H