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
25 * Reads the database from PS
27 * @note Caller of this method MUST use OICFree() method to release memory
28 * referenced by the data argument.
30 * @param databaseName is the name of the database to access through persistent storage.
31 * @param resourceName is the name of the field for which file content are read.
32 * if the value is NULL it will send the content of the whole file.
33 * @param data is the pointer to the file contents read from the database.
34 * @param size is the size of the file contents read.
36 * @return ::OC_STACK_OK for Success, otherwise some error value
38 OCStackResult ReadDatabaseFromPS(const char *databaseName, const char *resourceName, uint8_t **data, size_t *size);
41 * This method updates the database in PS
43 * @param databaseName is the name of the database to access through persistent storage.
44 * @param resourceName is the name of the resource that will be updated.
45 * @param payload is the pointer to memory where the CBOR payload is located.
46 * @param size is the size of the CBOR payload.
48 * @return ::OC_STACK_OK for Success, otherwise some error value
50 OCStackResult UpdateResourceInPS(const char *databaseName, const char *resourceName, const uint8_t *payload, size_t size);
53 * Reads the Secure Virtual Database from PS into dynamically allocated
56 * @note Caller of this method MUST use OICFree() method to release memory
57 * referenced by return value.
59 * @return char * reference to memory buffer containing SVR database.
61 char * GetSVRDatabase();
64 * Reads the Secure Virtual Database from PS
66 * @note Caller of this method MUST use OICFree() method to release memory
67 * referenced by return value.
69 * @param resourceName is the name of the field for which file content are read.
70 * if the value is NULL it will send the content of the whole file.
71 * @param data is the pointer to the file contents read from the database.
72 * @param size is the size of the file contents read.
74 * @return ::OC_STACK_OK for Success, otherwise some error value
76 OCStackResult GetSecureVirtualDatabaseFromPS(const char *resourceName, uint8_t **data, size_t *size);
79 * This method updates the Secure Virtual Database in PS
81 * @param resourceName is the name of the secure resource that will be updated.
82 * @param payload is the pointer to memory where the CBOR payload is located.
83 * @param size is the size of the CBOR payload.
85 * @return ::OC_STACK_OK for Success, otherwise some error value
87 OCStackResult UpdateSecureResourceInPS(const char *resourceName, const uint8_t *payload, size_t size);
90 * This method resets the secure resources according to the reset profile.
92 * @return ::OC_STACK_OK for Success, otherwise some error value
94 OCStackResult ResetSecureResourceInPS(void);
97 * This method creates the reset profile from the persistent storage.
98 * The reset profile is the copy of the initial state of SVR resources
99 * when secure resources are initiated at first.
100 * In remote reset, the SVR will be reset according to the reset profile.
102 * @return ::OC_STACK_OK for Success, otherwise some error value
104 OCStackResult CreateResetProfile(void);
106 #endif //IOTVT_SRM_PSI_H