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 SECURITYRESOURCEMANAGER_H_
22 #define SECURITYRESOURCEMANAGER_H_
24 #include "securevirtualresourcetypes.h"
31 * @brief Register Persistent storage callback.
32 * @param persistentStorageHandler [IN] Pointers to open, read, write, close & unlink handlers.
34 * OC_STACK_OK - No errors; Success
35 * OC_STACK_INVALID_PARAM - Invalid parameter
37 OCStackResult SRMRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler);
40 * @brief Get Persistent storage handler pointer.
42 * The pointer to Persistent Storage callback handler
44 OCPersistentStorage* SRMGetPersistentStorageHandler();
47 * @brief Register request and response callbacks.
48 * Requests and responses are delivered in these callbacks.
49 * @param reqHandler [IN] Request handler callback ( for GET,PUT ..etc)
50 * @param respHandler [IN] Response handler callback.
51 * @param errHandler [IN] Error handler callback.
53 * OC_STACK_OK - No errors; Success
54 * OC_STACK_INVALID_PARAM - Invalid parameter
56 OCStackResult SRMRegisterHandler(CARequestCallback reqHandler,
57 CAResponseCallback respHandler,
58 CAErrorCallback errHandler);
61 * @brief Initialize all secure resources ( /oic/sec/cred, /oic/sec/acl, /oic/sec/pstat etc).
62 * @return OC_STACK_OK for Success, otherwise some error value
64 OCStackResult SRMInitSecureResources();
67 * @brief Perform cleanup for secure resources ( /oic/sec/cred, /oic/sec/acl, /oic/sec/pstat etc).
70 void SRMDeInitSecureResources();
73 * @brief Initialize Policy Engine context.
74 * @return OC_STACK_OK for Success, otherwise some error value.
76 OCStackResult SRMInitPolicyEngine();
79 * @brief Cleanup Policy Engine context.
82 void SRMDeInitPolicyEngine();
85 * @brief Provisioning API response callback.
86 * @param object[IN] endpoint instance.
87 * @param responseInfo[IN] instance of CAResponseInfo_t structure.
88 * @return true if received response is for provisioning API false otherwise.
90 typedef bool (*SPResponseCallback) (const CAEndpoint_t *object,
91 const CAResponseInfo_t *responseInfo);
94 * @brief function to register provisoning API's response callback.
95 * @param respHandler response handler callback.
97 void SRMRegisterProvisioningResponseHandler(SPResponseCallback respHandler);
100 * @brief Check the security resource URI.
101 * @param uri [IN] Pointers to security resource URI.
102 * @return true if the URI is one of security resources, otherwise false.
104 bool SRMIsSecurityResourceURI(const char* uri);
107 * @brief Sends Response
108 * @param resposeVal SRMAccessResponse_t value
111 void SRMSendResponse(SRMAccessResponse_t responseVal);
118 #endif /* SECURITYRESOURCEMANAGER_H_ */