Resolved tizen build issue regarding ip network
[platform/upstream/iotivity.git] / service / easy-setup / mediator / csdk / inc / provisioning.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 __ES_PROVISIONING_HANDLER_H_
22 #define __ES_PROVISIONING_HANDLER_H_
23
24 #include "octypes.h"
25
26 #include "logger.h"
27 #include "ocstack.h"
28 #include "escommon.h"
29
30 //-----------------------------------------------------------------------------
31 // Defines
32 //-----------------------------------------------------------------------------
33 #define EASY_SETUP_DEFAULT_CONTEXT_VALUE 0x99
34
35 /**
36  * List of methods that can be inititated from the client
37  */
38 OCStackResult InitProvisioningHandler();
39
40 OCStackResult TerminateProvisioningHandler();
41
42 OCStackResult GetProvisioningStatus(OCQualityOfService qos, const char *query,
43         const OCDevAddr *destination);
44
45 OCStackResult StartProvisioningProcess(const ProvConfig *netInfo,
46         WiFiOnboadingConnection *onboardConn, OCProvisioningStatusCB provisioningStatusCallback,
47         char *findResQuery);
48
49 void StopProvisioningProcess();
50
51 /**
52  * Internal worker functions.
53  */
54 OCStackResult TriggerNetworkConnection(OCQualityOfService qos, const char *query,
55         const char *resUri, OCDevAddr *destination, int /*pauseBeforeStart*/);
56
57 OCStackApplicationResult TriggerNetworkConnectionResponse(void *ctx, OCDoHandle handle,
58         OCClientResponse *clientResponse);
59
60 OCStackApplicationResult ProvisionEnrolleeResponse(void *ctx, OCDoHandle handle,
61         OCClientResponse *clientResponse);
62
63 OCStackResult ProvisionEnrollee(OCQualityOfService qos, const char *query, const char *resUri,
64         OCDevAddr *destination, int pauseBeforeStart);
65
66 OCStackApplicationResult GetProvisioningStatusResponse(void *ctx, OCDoHandle handle,
67         OCClientResponse *clientResponse);
68
69 OCStackResult InvokeOCDoResource(const char *query, OCMethod method, const OCDevAddr *dest,
70         OCQualityOfService qos, OCClientResponseHandler cb, OCRepPayload *payload,
71         OCHeaderOption *options, uint8_t numOptions);
72
73 OCStackApplicationResult FindProvisioningResourceResponse(void *ctx, OCDoHandle handle,
74         OCClientResponse *clientResponse);
75
76 void *FindProvisioningResource(void *data);
77
78 ProvisioningInfo *PrepareProvisioingStatusCB(OCClientResponse *clientResponse,
79         ProvStatus provStatus);
80
81 /**
82  * Internal Util functions.
83  */
84 void LogProvisioningResponse(OCRepPayloadValue * val);
85
86 bool ConfigEnrolleeObject(const ProvConfig *netInfo, WiFiOnboadingConnection *onboardConn);
87
88 bool ClearMemory();
89
90 void SuccessCallback(OCClientResponse * clientResponse);
91
92 void ErrorCallback(ProvStatus status);
93
94 bool ValidateEnrolleeResponse(OCClientResponse * clientResponse);
95
96 bool ValidateFindResourceResponse(OCClientResponse * clientResponse);
97
98 bool ValidateEnrolleeBasicResponse(OCClientResponse * clientResponse);
99
100 ProvisioningInfo *GetCallbackObjectOnSuccess(OCClientResponse *clientResponse,
101         ProvStatus provStatus);
102
103 ProvisioningInfo *GetCallbackObjectOnError(ProvStatus status);
104
105 ProvisioningInfo *CreateCallBackObject();
106
107 bool ResetProgress();
108
109 bool SetProgress(OCProvisioningStatusCB provisioningStatusCallback);
110
111 bool InProgress();
112
113 bool ValidateEasySetupParams(const ProvConfig *netInfo, WiFiOnboadingConnection *onboardConn,
114         OCProvisioningStatusCB provisioningStatusCallback);
115
116 bool IsSetupStopped();
117
118 #endif //__ES_PROVISIONING_HANDLER_H_
119