Imported Upstream version 1.1.0
[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] peer  target device to establish direct-pairing.\r
47  * @param[in] pmSel  selected pairing method.\r
48  * @param[in] pinNumber  secret value for dtls connection.\r
49  * @param[in] resultCallback  result event callback.\r
50  *\r
51  * @return OC_STACK_OK on success otherwise error.\r
52  */\r
53 OCStackResult DPDirectPairing(OCDirectPairingDev_t* peer, OicSecPrm_t pmSel, char *pinNumber,\r
54                                                      OCDirectPairingResultCB resultCallback);\r
55 \r
56 /**\r
57  * This function returns discovered devices list in direct-pairing discovery\r
58  * Caller must NOT free returned constant pointer\r
59  *\r
60  * @return OCDirectPairingDev_t pointer on success otherwise NULL.\r
61  */\r
62 const OCDirectPairingDev_t* DPGetDiscoveredDevices();\r
63 \r
64 /**\r
65  * This function returns paired devices list until now\r
66  * Caller must NOT free returned constant pointer\r
67  *\r
68  * @return OCDirectPairingDev_t pointer on success otherwise NULL.\r
69  */\r
70 const OCDirectPairingDev_t* DPGetPairedDevices();\r
71 \r
72 /**\r
73  * This function delete both discovered devices and paired devices list\r
74  *\r
75  */\r
76 void DPDeleteLists();\r
77 \r
78 #ifdef __cplusplus\r
79 }\r
80 #endif\r
81 #endif //_DIRECT_PAIRING_H_\r
82 \r