Modifying version number for building on tizen 3.0
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / cawifiadapter.h
1 /******************************************************************
2  *
3  * Copyright 2014 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  * @file cawifiadapter.h
23  * @brief This file contains the APIs for WiFi Adapter.
24  */
25 #ifndef __CA_WIFI_ADAPTER_H__
26 #define __CA_WIFI_ADAPTER_H__
27
28 #include "cacommon.h"
29 #include "caadapterinterface.h"
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 /**
37  * @brief API to initialize WiFi Interface.
38  * @param registerCallback [IN] To register WIFI interfaces to Connectivity Abstraction Layer
39  * @param reqRespCallback [IN] sending responses and discovery messages from unicast , multicast servers
40  * @param netCallback [IN] Intimate the network additions to Connectivity Abstraction Layer.
41  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
42  */
43 CAResult_t CAInitializeWifi(CARegisterConnectivityCallback registerCallback,
44         CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
45
46 /**
47  * @brief Start WiFi Interface adapter.
48  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
49  */
50 CAResult_t CAStartWIFI();
51
52 /**
53  * @brief Starting listening server for receiving multicast search requests
54  * Transport Specific Behavior:
55  *   WIFI Starts Multicast Server on  all available IPs and prefixed port number and as per OIC Specification.
56  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
57  */
58 CAResult_t CAStartWIFIListeningServer();
59
60 /**
61  * @brief for starting discovery servers for receiving multicast advertisements
62  * Transport Specific Behavior:
63  *   WIFI Starts Start multicast server on all available IPs and prefixed port number as per OIC Specification
64  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
65  */
66 CAResult_t CAStartWIFIDiscoveryServer();
67
68 /**
69  * @brief Sends data to the endpoint using the adapter connectivity.
70  * Note: length must be > 0.
71  * @param   endpoint    [IN]    Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
72  *                              which the unicast data has to be sent.
73  * @param   data        [IN]    Data which required to be sent.
74  * @param   dataLen     [IN]    Size of data to be sent.
75  * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
76  */
77 uint32_t CASendWIFIUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
78
79 /**
80  * @brief Sends Multicast data to the endpoint using the WIFI connectivity.
81  * Note: length must be > 0.
82  * @param   data        [IN]    Data which required to be sent.
83  * @param   dataLen     [IN]    Size of data to be sent.
84  * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
85  */
86 uint32_t CASendWIFIMulticastData(void* data, uint32_t dataLen);
87
88 /**
89  * @brief Starts notification server on WIFI adapters.
90  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
91  */
92 CAResult_t CAStartWIFINotifyRecvServers();
93
94 /**
95  * @brief Send notification information.
96  * Note: length must be > 0.
97  * @param   endpoint    [IN]    Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
98  *                              which the unicast data has to be sent.
99  * @param   data        [IN]    Data which required to be sent.
100  * @param   dataLen     [IN]    Size of data to be sent.
101  * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
102  */
103 uint32_t CASendWIFINotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
104 /**
105  * @brief Get WIFI Connectivity network information
106  * @param   info        [OUT]   Local connectivity information structures
107  * @param   size        [OUT]   Number of local connectivity structures.
108  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
109  */
110 CAResult_t CAGetWIFIInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
111
112 /**
113  * @brief Read Synchronous API callback.
114  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
115  */
116 CAResult_t CAReadWIFIData();
117
118 /**
119  * @brief Stopping the adapters and close socket connections
120  *   WIFI Stops all multicast and unicast servers and close sockets.
121  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
122  */
123 CAResult_t CAStopWIFI();
124
125 /**
126  * @brief Terminate the WIFI connectivity adapter.
127  * Configuration information will be deleted from further use
128  */
129 void CATerminateWIfI();
130
131 #ifdef __cplusplus
132 } /* extern "C" */
133 #endif
134
135 #endif//#ifndef __CA_WIFI_ADAPTER_H__