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);
46 * API to request CRED information to resource.
48 * @param[in] selectedDeviceInfo Selected target device.
49 * @param[in] resultCallback callback provided by API user, callback will be called when
50 * provisioning request recieves a response from resource server.
51 * @return OC_STACK_OK in case of success and other value otherwise.
53 OCStackResult SRPGetCredResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
54 OCProvisionResultCB resultCallback);
57 * API to request ACL information to resource.
59 * @param[in] selectedDeviceInfo Selected target device.
60 * @param[in] resultCallback callback provided by API user, callback will be called when
61 * provisioning request recieves a response from resource server.
62 * @return OC_STACK_OK in case of success and other value otherwise.
64 OCStackResult SRPGetACLResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
65 OCProvisionResultCB resultCallback);
69 * API to send CRL information to resource.
71 * @param[in] selectedDeviceInfo Selected target device.
72 * @param[in] crl CRL to provision.
73 * @param[in] resultCallback callback provided by API user, callback will be called when
74 * provisioning request recieves a response from resource server.
75 * @return OC_STACK_OK in case of success and other value otherwise.
77 OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
78 OicSecCrl_t *crl, OCProvisionResultCB resultCallback);
79 #endif // __WITH_X509__
81 * API to send Direct-Pairing Configuration to a device.
83 * @param[in] selectedDeviceInfo Selected target device.
84 * @param[in] pconf PCONF pointer.
85 * @param[in] resultCallback callback provided by API user, callback will be called when
86 * provisioning request recieves a response from resource server.
87 * @return OC_STACK_OK in case of success and other value otherwise.
89 OCStackResult SRPProvisionDirectPairing(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
90 OicSecPconf_t *pconf, OCProvisionResultCB resultCallback);
93 * API to send Direct-Pairing Configuration to a device.
95 * @param[in] selectedDeviceInfo Selected target device.
96 * @param[in] pconf PCONF pointer.
97 * @param[in] resultCallback callback provided by API user, callback will be called when
98 * provisioning request recieves a response from resource server.
99 * @return OC_STACK_OK in case of success and other value otherwise.
101 OCStackResult SRPProvisionDirectPairing(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
102 OicSecPconf_t *pconf, OCProvisionResultCB resultCallback);
105 * API to provision credential to devices.
107 * @param[in] type Type of credentials to be provisioned to the device.
108 * @param[in] pDev1 Pointer to PMOwnedDeviceInfo_t instance,respresenting resource to be provsioned.
109 @param[in] pDev2 Pointer to PMOwnedDeviceInfo_t instance,respresenting resource to be provsioned.
110 * @param[in] resultCallback callback provided by API user, callback will be called when
111 * provisioning request recieves a response from first resource server.
112 * @return OC_STACK_OK in case of success and other value otherwise.
114 OCStackResult SRPProvisionCredentials(void *ctx,OicSecCredType_t type, size_t keySize,
115 const OCProvisionDev_t *pDev1,
116 const OCProvisionDev_t *pDev2,
117 OCProvisionResultCB resultCallback);
120 * Function to unlink devices.
121 * This function will remove the credential & relationship between the two devices.
123 * @param[in] ctx Application context would be returned in result callback
124 * @param[in] pTargetDev1 first device information to be unlinked.
125 * @param[in] pTargetDev2 second device information to be unlinked.
126 * @param[in] resultCallback callback provided by API user, callback will be called when
127 * device unlink is finished.
128 * when there is an error, this user callback is called immediately.
129 * @return OC_STACK_OK in case of success and other value otherwise.
131 OCStackResult SRPUnlinkDevices(void* ctx,
132 const OCProvisionDev_t* pTargetDev1,
133 const OCProvisionDev_t* pTargetDev2,
134 OCProvisionResultCB resultCallback);
137 * Function to device revocation.
138 * This function will remove credential of target device from all devices in subnet.
140 * @param[in] ctx Application context would be returned in result callback
141 * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)
142 * @param[in] pTargetDev Device information to be revoked.
143 * @param[in] resultCallback callback provided by API user, callback will be called when
144 * credential revocation is finished.
145 * when there is an error, this user callback is called immediately.
146 * @return OC_STACK_OK in case of success and other value otherwise.
147 * If OC_STACK_OK is returned, the caller of this API should wait for callback.
148 * OC_STACK_CONTINUE means operation is success but no request is need to be initiated.
150 OCStackResult SRPRemoveDevice(void* ctx,
151 unsigned short waitTimeForOwnedDeviceDiscovery,
152 const OCProvisionDev_t* pTargetDev,
153 OCProvisionResultCB resultCallback);
158 #endif //SRP_SECURERESOURCEPROVIDER_H