1 /* *****************************************************************
3 * Copyright 2016 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 * *****************************************************************/
20 #ifndef OC_CLOUD_WRAPPER_H
21 #define OC_CLOUD_WRAPPER_H
23 #include "occloudprovisioning.h"
26 * Certificate-Issue request function
28 * @param[in] endPoint cloud host and port
29 * @param[in] callback result callback
30 * @return OCStackResult application result
32 OCStackResult OCWrapperCertificateIssueRequest(const OCDevAddr *endPoint, OCCloudResponseCB callback);
35 * CRL GET request function
37 * @param[in] endPoint cloud host and port
38 * @param[in] callback result callback
39 * @return OCStackResult application result
41 OCStackResult OCWrapperGetCRL(const OCDevAddr *endPoint, OCCloudResponseCB callback);
44 * CRL POST request function (with Serial Numbers list to revoke)
46 * @param[in] endPoint cloud host and port
47 * @param[in] callback result callback
48 * @return OCStackResult application result
50 OCStackResult OCWrapperPostCRL(const OCDevAddr *endPoint, OCCloudResponseCB callback);
53 * ACL id retrieve by device id
55 * @param[in] endPoint cloud host and port
56 * @param[in] callback result callback
57 * @return OCStackResult application result
59 OCStackResult OCWrapperAclIdGetByDevice(const OCDevAddr *endPoint, OCCloudResponseCB callback);
64 * @param[in] endPoint cloud host and port
65 * @param[in] callback result callback
66 * @return OCStackResult application result
68 OCStackResult OCWrapperAclIdCreate(const OCDevAddr *endPoint, OCCloudResponseCB callback);
73 * @param[in] endPoint cloud host and port
74 * @param[in] callback result callback
75 * @return OCStackResult application result
77 OCStackResult OCWrapperAclIdDelete(const OCDevAddr *endPoint, OCCloudResponseCB callback);
80 * ACL individual get info
82 * @param[in] endPoint cloud host and port
83 * @param[in] callback result callback
84 * @return OCStackResult application result
86 OCStackResult OCWrapperAclIndividualGetInfo(const OCDevAddr *endPoint, OCCloudResponseCB callback);
89 * ACL individual update ACE
91 * @param[in] endPoint cloud host and port
92 * @param[in] callback result callback
93 * @return OCStackResult application result
95 OCStackResult OCWrapperAclIndividualUpdateAce(const OCDevAddr *endPoint, OCCloudResponseCB callback);
98 * ACL individual update. Replaces an existing ACE with a new one
100 * @param[in] endPoint cloud host and port
101 * @param[in] callback result callback
102 * @return OCStackResult application result
105 OCStackResult OCWrapperAclIndividualUpdate(const OCDevAddr *endPoint, OCCloudResponseCB callback);
108 * ACL individual delete
110 * @param[in] endPoint cloud host and port
111 * @param[in] callback result callback
112 * @return OCStackResult application result
114 OCStackResult OCWrapperAclIndividualDelete(const OCDevAddr *endPoint, OCCloudResponseCB callback);
117 * ACL individual delete ACE
119 * @param[in] endPoint cloud host and port
120 * @param[in] callback result callback
121 * @return OCStackResult application result
123 OCStackResult OCWrapperAclIndividualDeleteAce(const OCDevAddr *endPoint, OCCloudResponseCB callback);
126 * ACL post group request function
128 * @param[in] endPoint cloud host and port
129 * @param[in] callback result callback
130 * @return OCStackResult application result
132 OCStackResult OCWrapperAclCreateGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
135 * ACL get group request function
137 * @param[in] endPoint cloud host and port
138 * @param[in] callback result callback
139 * @return OCStackResult application result
141 OCStackResult OCWrapperAclFindMyGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
144 * ACL delete group request function
146 * @param[in] endPoint cloud host and port
147 * @param[in] callback result callback
148 * @return OCStackResult application result
150 OCStackResult OCWrapperAclDeleteGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
153 * ACL join to invited group request function
155 * @param[in] endPoint cloud host and port
156 * @param[in] callback result callback
157 * @return OCStackResult application result
159 OCStackResult OCWrapperAclJoinToInvitedGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
162 * ACL observe group request function
164 * @param[in] endPoint cloud host and port
165 * @param[in] callback result callback
166 * @return OCStackResult application result
168 OCStackResult OCWrapperAclObserveGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
171 * ACL share device into group request function
173 * @param[in] endPoint cloud host and port
174 * @param[in] callback result callback
175 * @return OCStackResult application result
177 OCStackResult OCWrapperAclShareDeviceIntoGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
180 * ACL delete device from group request function
182 * @param[in] endPoint cloud host and port
183 * @param[in] callback result callback
184 * @return OCStackResult application result
186 OCStackResult OCWrapperAclDeleteDeviceFromGroup(const OCDevAddr *endPoint, OCCloudResponseCB callback);
189 * ACL get group info request function
191 * @param[in] endPoint cloud host and port
192 * @param[in] callback result callback
193 * @return OCStackResult application result
195 OCStackResult OCWrapperAclGroupGetInfo(const OCDevAddr *endPoint, OCCloudResponseCB callback);
198 * ACL invite user to group request function
200 * @param[in] endPoint cloud host and port
201 * @param[in] callback result callback
202 * @return OCStackResult application result
204 OCStackResult OCWrapperAclInviteUser(const OCDevAddr *endPoint, OCCloudResponseCB callback);
207 * ACL get invitation request function
209 * @param[in] endPoint cloud host and port
210 * @param[in] callback result callback
211 * @return OCStackResult application result
213 OCStackResult OCWrapperAclGetInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
216 * ACL delete invitation request function (by receiver)
218 * @param[in] endPoint cloud host and port
219 * @param[in] callback result callback
220 * @return OCStackResult application result
222 OCStackResult OCWrapperAclDeleteInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
225 * ACL cancel invitation request function (by sender)
227 * @param[in] endPoint cloud host and port
228 * @param[in] callback result callback
229 * @return OCStackResult application result
231 OCStackResult OCWrapperAclCancelInvitation(const OCDevAddr *endPoint, OCCloudResponseCB callback);
234 * ACL check that given request can be applied to resource
236 * @param[in] endPoint cloud host and port
237 * @param[in] callback result callback
238 * @return OCStackResult application result
240 OCStackResult OCWrapperAclPolicyCheck(const OCDevAddr *endPoint, OCCloudResponseCB callback);
243 * Read user input (expect string value)
245 * @param[out] item string item to fill
246 * @param[in] length max allowed string length
247 * @param[in] description item description
248 * @param[in] example item example
250 void readString(char* item, int length, const char* description, const char* example);
253 * Read user input (expect integer value)
255 * @param[out] item integer item to fill
256 * @param[in] description item description
257 * @param[in] example item example
259 void readInteger(int* item, const char* description, const char* example);
262 * Copies whole binary file to out variable
264 * @param[in] list array of strings structure
265 * @param[out] out byte array to fill
266 * @return negative error code
268 int readFile(const char *name, OCByteString *out);
271 * Print array of strings
273 * @param[in] list array of strings
275 void printStringArray(stringArray_t *list);
278 * Print invitation response
280 * @param[in] in invitation response
282 void printInviteResponse(inviteResponse_t *in);
285 * Clear invitation response
287 * @param[in] in invitation response
289 void clearInviteResponse(inviteResponse_t *in);
291 #endif //OC_CLOUD_WRAPPER_H