1 /* *****************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
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 SRP_SECURERESOURCEPROVIDER_H
22 #define SRP_SECURERESOURCEPROVIDER_H
25 #include "securevirtualresourcetypes.h"
34 * API to send ACL information to resource.
36 * @param[in] selectedDeviceInfo Selected target device.
37 * @param[in] acl ACL to provision.
38 * @param[in] resultCallback callback provided by API user, callback will be called when
39 * provisioning request recieves a response from resource server.
40 * @return OC_STACK_OK in case of success and other value otherwise.
42 OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
43 OicSecAcl_t *acl, OCProvisionResultCB resultCallback);
47 * API to send CRL information to resource.
49 * @param[in] selectedDeviceInfo Selected target device.
50 * @param[in] crl CRL to provision.
51 * @param[in] resultCallback callback provided by API user, callback will be called when
52 * provisioning request recieves a response from resource server.
53 * @return OC_STACK_OK in case of success and other value otherwise.
55 OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
56 OicSecCrl_t *crl, OCProvisionResultCB resultCallback);
57 #endif // __WITH_X509__
59 * API to send Direct-Pairing Configuration to a device.
61 * @param[in] selectedDeviceInfo Selected target device.
62 * @param[in] pconf PCONF pointer.
63 * @param[in] resultCallback callback provided by API user, callback will be called when
64 * provisioning request recieves a response from resource server.
65 * @return OC_STACK_OK in case of success and other value otherwise.
67 OCStackResult SRPProvisionDirectPairing(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
68 OicSecPconf_t *pconf, OCProvisionResultCB resultCallback);
71 * API to provision credential to devices.
73 * @param[in] type Type of credentials to be provisioned to the device.
74 * @param[in] pDev1 Pointer to PMOwnedDeviceInfo_t instance,respresenting resource to be provsioned.
75 @param[in] pDev2 Pointer to PMOwnedDeviceInfo_t instance,respresenting resource to be provsioned.
76 * @param[in] resultCallback callback provided by API user, callback will be called when
77 * provisioning request recieves a response from first resource server.
78 * @return OC_STACK_OK in case of success and other value otherwise.
80 OCStackResult SRPProvisionCredentials(void *ctx,OicSecCredType_t type, size_t keySize,
81 const OCProvisionDev_t *pDev1,
82 const OCProvisionDev_t *pDev2,
83 OCProvisionResultCB resultCallback);
86 * Function to unlink devices.
87 * This function will remove the credential & relationship between the two devices.
89 * @param[in] ctx Application context would be returned in result callback
90 * @param[in] pTargetDev1 first device information to be unlinked.
91 * @param[in] pTargetDev2 second device information to be unlinked.
92 * @param[in] resultCallback callback provided by API user, callback will be called when
93 * device unlink is finished.
94 * when there is an error, this user callback is called immediately.
95 * @return OC_STACK_OK in case of success and other value otherwise.
97 OCStackResult SRPUnlinkDevices(void* ctx,
98 const OCProvisionDev_t* pTargetDev1,
99 const OCProvisionDev_t* pTargetDev2,
100 OCProvisionResultCB resultCallback);
103 * Function to device revocation.
104 * This function will remove credential of target device from all devices in subnet.
106 * @param[in] ctx Application context would be returned in result callback
107 * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)
108 * @param[in] pTargetDev Device information to be revoked.
109 * @param[in] resultCallback callback provided by API user, callback will be called when
110 * credential revocation is finished.
111 * when there is an error, this user callback is called immediately.
112 * @return OC_STACK_OK in case of success and other value otherwise.
113 * If OC_STACK_OK is returned, the caller of this API should wait for callback.
114 * OC_STACK_CONTINUE means operation is success but no request is need to be initiated.
116 OCStackResult SRPRemoveDevice(void* ctx,
117 unsigned short waitTimeForOwnedDeviceDiscovery,
118 const OCProvisionDev_t* pTargetDev,
119 OCProvisionResultCB resultCallback);
124 #endif //SRP_SECURERESOURCEPROVIDER_H