Add GET request handler for CRED resource
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / include / internal / secureresourceprovider.h
1 /* *****************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
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
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  * *****************************************************************/
20
21 #ifndef SRP_SECURERESOURCEPROVIDER_H
22 #define SRP_SECURERESOURCEPROVIDER_H
23
24 #include "ocstack.h"
25 #include "securevirtualresourcetypes.h"
26 #include "pmtypes.h"
27
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32
33 /**
34  * API to send ACL information to resource.
35  *
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.
41  */
42 OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
43                                         OicSecAcl_t *acl, OCProvisionResultCB resultCallback);
44
45 /**
46  * API to request CRED information to resource.
47  *
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.
52  */
53 OCStackResult SRPGetCredResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
54         OCProvisionResultCB resultCallback);
55
56 #ifdef __WITH_X509__
57 /**
58  * API to send CRL information to resource.
59  *
60  * @param[in] selectedDeviceInfo Selected target device.
61  * @param[in] crl CRL to provision.
62  * @param[in] resultCallback callback provided by API user, callback will be called when
63  *            provisioning request recieves a response from resource server.
64  * @return OC_STACK_OK in case of success and other value otherwise.
65  */
66 OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
67         OicSecCrl_t *crl, OCProvisionResultCB resultCallback);
68 #endif // __WITH_X509__
69 /**
70  * API to send Direct-Pairing Configuration to a device.
71  *
72  * @param[in] selectedDeviceInfo Selected target device.
73  * @param[in] pconf PCONF pointer.
74  * @param[in] resultCallback callback provided by API user, callback will be called when
75  *            provisioning request recieves a response from resource server.
76  * @return OC_STACK_OK in case of success and other value otherwise.
77  */
78 OCStackResult SRPProvisionDirectPairing(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
79                                         OicSecPconf_t *pconf, OCProvisionResultCB resultCallback);
80
81 /**
82  * API to send Direct-Pairing Configuration to a device.
83  *
84  * @param[in] selectedDeviceInfo Selected target device.
85  * @param[in] pconf PCONF pointer.
86  * @param[in] resultCallback callback provided by API user, callback will be called when
87  *            provisioning request recieves a response from resource server.
88  * @return OC_STACK_OK in case of success and other value otherwise.
89  */
90 OCStackResult SRPProvisionDirectPairing(void *ctx, const OCProvisionDev_t *selectedDeviceInfo,
91                                         OicSecPconf_t *pconf, OCProvisionResultCB resultCallback);
92
93 /**
94  * API to provision credential to devices.
95  *
96  * @param[in] type Type of credentials to be provisioned to the device.
97  * @param[in] pDev1 Pointer to PMOwnedDeviceInfo_t instance,respresenting resource to be provsioned.
98    @param[in] pDev2 Pointer to PMOwnedDeviceInfo_t instance,respresenting resource to be provsioned.
99  * @param[in] resultCallback callback provided by API user, callback will be called when
100  *            provisioning request recieves a response from first resource server.
101  * @return OC_STACK_OK in case of success and other value otherwise.
102  */
103 OCStackResult SRPProvisionCredentials(void *ctx,OicSecCredType_t type, size_t keySize,
104                                       const OCProvisionDev_t *pDev1,
105                                       const OCProvisionDev_t *pDev2,
106                                       OCProvisionResultCB resultCallback);
107
108 /**
109  * Function to unlink devices.
110  * This function will remove the credential & relationship between the two devices.
111  *
112  * @param[in] ctx Application context would be returned in result callback
113  * @param[in] pTargetDev1 first device information to be unlinked.
114  * @param[in] pTargetDev2 second device information to be unlinked.
115  * @param[in] resultCallback callback provided by API user, callback will be called when
116  *            device unlink is finished.
117  *            when there is an error, this user callback is called immediately.
118  * @return OC_STACK_OK in case of success and other value otherwise.
119  */
120 OCStackResult SRPUnlinkDevices(void* ctx,
121                               const OCProvisionDev_t* pTargetDev1,
122                               const OCProvisionDev_t* pTargetDev2,
123                               OCProvisionResultCB resultCallback);
124
125 /*
126  * Function to device revocation.
127  * This function will remove credential of target device from all devices in subnet.
128  *
129  * @param[in] ctx Application context would be returned in result callback
130  * @param[in] waitTimeForOwnedDeviceDiscovery Maximum wait time for owned device discovery.(seconds)
131  * @param[in] pTargetDev Device information to be revoked.
132  * @param[in] resultCallback callback provided by API user, callback will be called when
133  *            credential revocation is finished.
134  *            when there is an error, this user callback is called immediately.
135  * @return OC_STACK_OK in case of success and other value otherwise.
136  *         If OC_STACK_OK is returned, the caller of this API should wait for callback.
137  *         OC_STACK_CONTINUE means operation is success but no request is need to be initiated.
138  */
139 OCStackResult SRPRemoveDevice(void* ctx,
140                               unsigned short waitTimeForOwnedDeviceDiscovery,
141                               const OCProvisionDev_t* pTargetDev,
142                               OCProvisionResultCB resultCallback);
143
144 #ifdef __cplusplus
145 }
146 #endif
147 #endif //SRP_SECURERESOURCEPROVIDER_H