Imported Upstream version 1.1.1
[platform/upstream/iotivity.git] / resource / csdk / security / include / internal / directpairing.h
1 /* *****************************************************************\r
2  *\r
3  * Copyright 2016 Samsung Electronics All Rights Reserved.\r
4  *\r
5  *\r
6  *\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *     http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  *\r
19  * *****************************************************************/\r
20 \r
21 #ifndef _DIRECT_PAIRING_H_\r
22 #define _DIRECT_PAIRING_H_\r
23 \r
24 #include <stdbool.h>\r
25 #include "ocstack.h"\r
26 #include "pmtypes.h"\r
27 #include "securevirtualresourcetypes.h"\r
28 \r
29 #ifdef __cplusplus\r
30 extern "C"\r
31 {\r
32 #endif\r
33 \r
34 /**\r
35  * Discover direct-pairing devices in the same IP subnet. .\r
36  *\r
37  * @param[in] waittime  Timeout in seconds.\r
38  *\r
39  * @return OC_STACK_OK on success otherwise error.\r
40  */\r
41 OCStackResult DPDeviceDiscovery(unsigned short waittime);\r
42 \r
43 /**\r
44  * Start direct-pairing processes.\r
45  *\r
46  * @param[in] ctx  user context passed back with resultCallback.\r
47  * @param[in] peer  target device to establish direct-pairing.\r
48  * @param[in] pmSel  selected pairing method.\r
49  * @param[in] pinNumber  secret value for dtls connection.\r
50  * @param[in] resultCallback  result event callback.\r
51  *\r
52  * @return OC_STACK_OK on success otherwise error.\r
53  */\r
54 OCStackResult DPDirectPairing(void *ctx, OCDirectPairingDev_t* peer, OicSecPrm_t pmSel,\r
55                                 char *pinNumber, OCDirectPairingResultCB resultCallback);\r
56 \r
57 /**\r
58  * This function returns discovered devices list in direct-pairing discovery\r
59  * Caller must NOT free returned constant pointer\r
60  *\r
61  * @return OCDirectPairingDev_t pointer on success otherwise NULL.\r
62  */\r
63 const OCDirectPairingDev_t* DPGetDiscoveredDevices();\r
64 \r
65 /**\r
66  * This function returns paired devices list until now\r
67  * Caller must NOT free returned constant pointer\r
68  *\r
69  * @return OCDirectPairingDev_t pointer on success otherwise NULL.\r
70  */\r
71 const OCDirectPairingDev_t* DPGetPairedDevices();\r
72 \r
73 /**\r
74  * This function delete both discovered devices and paired devices list\r
75  *\r
76  */\r
77 void DPDeleteLists();\r
78 \r
79 #ifdef __cplusplus\r
80 }\r
81 #endif\r
82 #endif //_DIRECT_PAIRING_H_\r
83 \r