Merge branch 'master' into easysetup & CBOR changes
[platform/upstream/iotivity.git] / service / easy-setup / sdk / mediator / inc / provisioninghandler.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
22 #ifndef __PROVISIONING_HANDLER_H_
23 #define __PROVISIONING_HANDLER_H_
24
25
26 #include "octypes.h"
27
28 #include "logger.h"
29 #include "ocstack.h"
30 #include "common.h"
31
32 //-----------------------------------------------------------------------------
33 // Defines
34 //-----------------------------------------------------------------------------
35 #define TAG "provisioninghandler"
36 #define DEFAULT_CONTEXT_VALUE 0x99
37 #ifndef MAX_LENGTH_IPv4_ADDR
38 #define MAX_LENGTH_IPv4_ADDR 16
39 #endif
40
41 //-----------------------------------------------------------------------------
42 // Typedefs
43 //-----------------------------------------------------------------------------
44
45 /**
46  * List of methods that can be inititated from the client
47  */
48 OCStackResult InitProvisioningHandler();
49
50 OCStackResult TerminateProvisioningHandler();
51
52 void listeningFunc(void*);
53
54 OCStackApplicationResult ProvisionEnrolleeResponse(void* ctx, OCDoHandle handle,
55         OCClientResponse * clientResponse);
56
57 OCStackResult ProvisionEnrollee(OCQualityOfService qos, const char* query, const char* resUri);
58
59 OCStackApplicationResult GetProvisioningStatusResponse(void* ctx,
60         OCDoHandle handle, OCClientResponse * clientResponse);
61
62 OCStackResult InvokeOCDoResource(const char* query, OCMethod method,
63         OCQualityOfService qos, OCClientResponseHandler cb,OCRepPayload * request,
64         OCHeaderOption * options, uint8_t numOptions);
65
66 OCStackResult GetProvisioningStatus(OCQualityOfService qos, const char* query);
67
68 OCStackResult StartProvisioningProcess(const EnrolleeNWProvInfo_t *netInfo,
69         OCProvisioningStatusCB provisioningStatusCallback);
70
71
72 void StopProvisioningProcess();
73
74 OCStackApplicationResult SubscribeProvPresenceCallback(void* ctx, OCDoHandle handle,
75         OCClientResponse* clientResponse);
76
77 OCStackResult SubscribeProvPresence(OCQualityOfService qos, const char* requestURI);
78
79 OCStackApplicationResult FindProvisioningResourceResponse(void* ctx,
80         OCDoHandle handle, OCClientResponse * clientResponse);
81
82 void FindProvisioningResource(void *data);
83
84 //Invoke Provisioning Status Callback
85 ProvisioningInfo* PrepareProvisioingStatusCB(OCClientResponse * clientResponse,
86             ProvStatus provStatus);
87
88 #endif
89