1 //******************************************************************
3 // Copyright 2015 Samsung Electronics 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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
33 #define OC_RSRVD_ES_RES_TYPE_COL "oic.wk.col"
34 #define OC_RSRVD_ES_INTERFACE "if"
35 #define OC_RSRVD_ES_RES_TYPE "rt"
39 #define OIC_STRING_MAX_VALUE 256
40 #define MAX_WEBLINKLEN 3
41 #define NUM_WIFIMODE 10
42 #define NUM_CONNECT_TYPE 3
45 * Attributes used to form a proper easysetup conforming JSON message.
47 #define OC_RSRVD_ES_PROVSTATUS "ps"
48 #define OC_RSRVD_ES_LAST_ERRORCODE "lec"
49 #define OC_RSRVD_ES_LINKS "links"
50 #define OC_RSRVD_ES_SUPPORTEDWIFIMODE "swmt"
51 #define OC_RSRVD_ES_SUPPORTEDWIFIFREQ "swf"
52 #define OC_RSRVD_ES_SSID "tnn"
53 #define OC_RSRVD_ES_CRED "cd"
54 #define OC_RSRVD_ES_AUTHTYPE "wat"
55 #define OC_RSRVD_ES_ENCTYPE "wet"
56 #define OC_RSRVD_ES_AUTHCODE "ac"
57 #define OC_RSRVD_ES_ACCESSTOKEN "at"
58 #define OC_RSRVD_ES_ACCESSTOKEN_TYPE "att"
59 #define OC_RSRVD_ES_AUTHPROVIDER "apn"
60 #define OC_RSRVD_ES_CISERVER "cis"
61 #define OC_RSRVD_ES_SERVERID "sid"
62 #define OC_RSRVD_ES_DEVNAME "dn"
63 #define OC_RSRVD_ES_HREF "href"
64 #define OC_RSRVD_ES_CONNECT "cn"
67 * Easysetup defined resoruce types and uris.
69 #define OC_RSRVD_ES_RES_TYPE_EASYSETUP "oic.r.easysetup"
70 #define OC_RSRVD_ES_URI_EASYSETUP "/EasySetupResURI"
71 #define OC_RSRVD_ES_RES_TYPE_WIFICONF "oic.r.wificonf"
72 #define OC_RSRVD_ES_URI_WIFICONF "/WiFiConfResURI"
73 #define OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF "oic.r.coapcloudconf"
74 #define OC_RSRVD_ES_URI_COAPCLOUDCONF "/CoapCloudConfResURI"
75 #define OC_RSRVD_ES_RES_TYPE_DEVCONF "oic.r.devconf"
76 #define OC_RSRVD_ES_URI_DEVCONF "/DevConfResURI"
80 * @brief Supported WIFI frequency like 2.4G and 5G
84 WIFI_24G = 0, /**< 2.4G **/
86 WIFI_BOTH, /**< 2.4G and 5G **/
87 WIFI_FREQ_NONE /**< EOF **/
91 * @brief Supported WIFI mode like 802.11g and 802.11n
95 WIFI_11A = 0, /**< 802.11a **/
96 WIFI_11B, /**< 802.11b **/
97 WIFI_11G, /**< 802.11g **/
98 WIFI_11N, /**< 802.11n **/
99 WIFI_11AC, /**< 802.11ac **/
105 * @brief WIFI Authentication tlype of the Enroller
109 NONE_AUTH = 0, /**< NO authentication **/
111 WPA_PSK, /**< WPA-PSK **/
112 WPA2_PSK, /**< WPA2-PSK **/
113 FT_PSK /**< FT-PSK **/
117 * @brief WIFI encryption type of the Enroller
121 NONE_ENC = 0, /**< NO encryption **/
122 WEP_64, /**< WEP-64 **/
123 WEP_128, /**< WEP-128**/
126 TKIP_AES /**< TKIP-AES **/
130 * @brief OAuth Access Token Types. "bearer" and "mac" types are supported.
134 NONE_OAUTH_TOKENTYPE = 0,
135 OAUTH_TOKENTYPE_BEARER,
140 * @brief A target configuration type to be connected (or executed)
144 ES_CONNECT_NONE = 0, /**< Init value **/
145 ES_CONNECT_WIFI = 1, /**< WiFi Conf resource **/
146 ES_CONNECT_COAPCLOUD = 2 /**< Coap Cloud Conf resource **/
150 * @brief A result of Easy Setup
155 * Provisioning succeeds.
160 * Secure resource is discovered.
162 ES_SECURE_RESOURCE_IS_DISCOVERED = 1,
165 * Enrollee discovery fails in cloud provisioning
167 ES_ENROLLEE_DISCOVERY_FAILURE = 11,
170 * Valid GET or POST request fails for some reason.
171 * This failure may happen when it failed to receive any response from Enrollee by a timeout threshold
173 ES_COMMUNICATION_ERROR,
176 * Security opertion is not supported because Mediator is built as unsecured mode.
178 ES_SEC_OPERATION_IS_NOT_SUPPORTED,
181 * Security resource discovery fails due to loss of discovery packet or absence of the resource in a network
183 ES_SECURE_RESOURCE_DISCOVERY_FAILURE,
186 * Ownership transfer fails due to one of unexpected reasons.
187 * E.g. A packet loss even with retransmission happens during ownership transfer.
188 * E.g. Mediator's owned status is 'unowned'
189 * E.g. A user confirmation for random pin-based or certificate-based OT fails
191 ES_OWNERSHIP_TRANSFER_FAILURE = 20,
194 * Ownership transfer which is cert-based method fails due to user confirmation is denied.
196 ES_USER_DENIED_CONFIRMATION_REQ,
199 * Ownership transfer which is cert-based method fails due to wrong certificate.
201 ES_AUTHENTICATION_FAILURE_WITH_WRONG_CERT,
204 * Ownership transfer which is random-pin method fails due to wrong pin.
206 ES_AUTHENTICATION_FAILURE_WITH_WRONG_PIN,
209 * Ownership information is not synchronized between Mediator and Enrollee.
210 * e.g. A mediator's PDM DB has an ownership information to the found enrollee
211 * but it is actually owned by other mediator.
212 * That can happen where the found enrollee is reset and performed in easy setup without any inform to the first mediator.
213 * e.g. A list of owned devices managed in mediator's PMD db has no element for the found enrollee.
214 * That can happen where only mediator is reset without any inform to the enrollee.
215 * To proceed an ownership transfer to the enrollee, it needs to reset the enrollee's SVR DB for its owner, i.e. the mediator
217 ES_OWNERSHIP_IS_NOT_SYNCHRONIZED,
220 * MOT is not supported at the target Enrollee device.
222 * @note This ESResult values will be returned ONLY IF a mediator is a first owner to an Enrollee.
223 * @note If the mediator gets this values, it means OT has been successfully done
224 * (or already took an ownership, before), but failed MOT configuration.
226 ES_MOT_NOT_SUPPORTED = 30,
229 * MOT enabling is failed.
231 * @note This ESResult values will be returned ONLY IF a mediator is a first owner to an Enrollee.
232 * @note If the mediator gets this values, it means OT has been successfully done
233 * (or already took an ownership, before), but failed MOT configuration.
235 ES_MOT_ENABLING_FAILURE,
238 * MOT method selection is failed
240 * @note This ESResult values will be returned ONLY IF a mediator is a first owner to an Enrollee.
241 * @note If the mediator gets this values, it means OT has been successfully done
242 * (or already took an ownership, before), but failed MOT configuration.
244 ES_MOT_METHOD_SELECTION_FAILURE,
247 * A provisioning of Pre-configured pin number for MOT is failed
249 * @note This ESResult values will be returned ONLY IF a mediator is a first owner to an Enrollee.
250 * @note If the mediator gets this values, it means OT has been successfully done
251 * (or already took an ownership, before), but failed MOT configuration.
253 ES_PRE_CONFIG_PIN_PROVISIONING_FAILURE,
256 * ACL provisioning fails in cloud provisioning.
257 * It could be that UUID format of cloud server is wrong.
258 * Or any response for the provisioning request is not arrived at Mediator
260 ES_ACL_PROVISIONING_FAILURE = 40,
263 * Cert. provisioning fails in cloud provisioning.
264 * It could be that you put a wrong cred ID of which the corresponding certificate does not exist in SVR DB.
265 * Or any response for the provisioning request is not arrived at Mediator
267 ES_CERT_PROVISIONING_FAILURE,
270 * Provisioning fails for some reason.
277 * @brief Indicate which resource is created in Enrollee
281 ES_WIFICONF_RESOURCE = 0x01,
282 ES_COAPCLOUDCONF_RESOURCE = 0x02,
283 ES_DEVCONF_RESOURCE = 0x04
287 * @brief Indicate enrollee and provisioning status. Provisioning status is shown in "provisioning
288 * status" property in easysetup resource.
293 * Default state of the device
298 * Status indicating being connecting to target network
300 ES_STATE_CONNECTING_TO_ENROLLER,
303 * Status indicating successful conection to target network
305 ES_STATE_CONNECTED_TO_ENROLLER,
308 * Status indicating connection failure to target network
310 ES_STATE_FAILED_TO_CONNECT_TO_ENROLLER,
313 * Status indicating being registering to cloud
315 ES_STATE_REGISTERING_TO_CLOUD,
318 * Status indicating successful registration to cloud
320 ES_STATE_REGISTERED_TO_CLOUD,
323 * Status indicating registeration failure to cloud
325 ES_STATE_FAILED_TO_REGISTER_TO_CLOUD,
328 * Status indicating being publishing resources to cloud
330 ES_STATE_PUBLISHING_RESOURCES_TO_CLOUD,
333 * Status indicating successful resource publish to cloud
335 ES_STATE_PUBLISHED_RESOURCES_TO_CLOUD,
338 * Status indicating resource publish failure to cloud
340 ES_STATE_FAILED_TO_PUBLISH_RESOURCES_TO_CLOUD,
343 * Status indicating aborted provisioning by enrollee
345 ES_STATE_ABORTED_PROVISIONING_BY_ENROLLEE,
348 * End of Easy setup status
351 } ESEnrolleeState, ProvStatus;
354 * @brief Indicate last error code to describe a reason of error during easy setup.
361 ES_ERRCODE_NO_ERROR = 0,
364 * Error Code that given WiFi's SSID is not found
366 ES_ERRCODE_SSID_NOT_FOUND,
369 * Error Code that given WiFi's Password is wrong
374 * Error Code that IP address is not allocated
376 ES_ERRCODE_IP_NOT_ALLOCATED,
379 * Error Code that there is no Internet connection
381 ES_ERRCODE_NO_INTERNETCONNECTION,
384 * Error Code that Timeout occured
389 * Error Code that cloud server is not reachable due to wrong URL of cloud server, for example.
391 ES_ERRCODE_FAILED_TO_ACCESS_CLOUD_SERVER,
394 * Error Code that no response is arrived from cloud server
396 ES_ERRCODE_NO_RESPONSE_FROM_CLOUD_SERVER,
399 * Error Code that a delivered authcode is not valid.
401 ES_ERRCODE_INVALID_AUTHCODE,
404 * Error Code that a given access token is not valid due to its expiration, for example.
406 ES_ERRCODE_INVALID_ACCESSTOKEN,
409 * Error Code that a refresh of expired access token is failed due to some reasons.
411 ES_ERRCODE_FAILED_TO_REFRESH_ACCESSTOKEN,
414 * Error Code that a target device is not discovered in cloud server
416 ES_ERRCODE_FAILED_TO_FIND_REGISTERED_DEVICE_IN_CLOUD,
419 * Error Code that a target user does not exist in cloud server.
421 ES_ERRCODE_FAILED_TO_FIND_REGISTERED_USER_IN_CLOUD,
424 * Error Code that an enrollee can not connect to a target WiFi AP because the AP resides in
425 * an unsupported WiFi frequency.
427 ES_ERRCODE_UNSUPPORTED_WIFI_FREQUENCY,
430 * Error Code that Unknown error occured
432 ES_ERRCODE_UNKNOWN = 255
439 #endif //ES_COMMON_H_