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_PSI_H
22 #define IOTVT_SRM_PSI_H
27 * Reads the Secure Virtual Database from PS into dynamically allocated
30 * @note Caller of this method MUST use OCFree() method to release memory
31 * referenced by return value.
33 * @return char * reference to memory buffer containing SVR database.
35 char * GetSVRDatabase();
38 * This method is used by a entity handlers of SVR's to update
41 * @param rsrcName string denoting the SVR name ("acl", "cred", "pstat" etc).
42 * @param jsonObj JSON object containing the SVR contents.
44 * @return ::OC_STACK_OK for Success, otherwise some error value
46 OCStackResult UpdateSVRDatabase(const char* rsrcName, cJSON* jsonObj);
49 * Reads the Secure Virtual Database from PS
51 * @note Caller of this method MUST use OCFree() method to release memory
52 * referenced by return value.
54 * @param rsrcName is the name of the field for which file content are read.
55 if the value is NULL it will send the content of the whole file.
56 * @param data is the pointer to the file contents read from the database.
57 * @param size is the size to the file contents read.
59 * @return ::OC_STACK_OK for Success, otherwise some error value
61 OCStackResult GetSecureVirtualDatabaseFromPS(const char *rsrcName, uint8_t **data, size_t *size);
64 * This method converts updates the persistent storage.
66 * @param rsrcName is the name of the secure resource that will be updated.
67 * @param cborPayload is the pointer holding cbor payload.
68 * @param cborPayload is the size of the cbor payload.
70 * @return ::OC_STACK_OK for Success, otherwise some error value
72 OCStackResult UpdateSecureResourceInPS(const char* rsrcName, uint8_t* cborPayload, size_t size);
74 #endif //IOTVT_SRM_PSI_H