Corrected @file tags and restored 'Files' section.
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / cawifiethernetadapter.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
23  *
24  * This file contains the APIs for WiFi/Ethernet Adapter.
25  */
26
27 #ifndef __CA_WIFI_ETHERNET_ADAPTER_H__
28 #define __CA_WIFI_ETHERNET_ADAPTER_H__
29
30 #include "cacommon.h"
31 #include "caadapterinterface.h"
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38 /**
39  * @brief API to initialize WiFi Interface.
40  * @param registerCallback to register WIFI interfaces to things communication
41  * @param reqRespCallback for sending responses and discovery messages from unicast , multicast servers
42  * @param netCallback to intimate the network additions to things communication
43  * @return Error Code
44  */
45 CAResult_t CAInitializeWifi(CARegisterConnectivityCallback registerCallback,
46         CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
47
48 /**
49  * @brief API to Start WiFi Interface.
50  * @return Error Code
51  */
52 CAResult_t CAStartWIFI();
53
54 /**
55  * @brief starting listening server
56  * Transport Specific Behaviour
57  *       IP :- Start Multicast Server on  all available IPs and prefixed port number and as per OIC Specification.
58  * @return Error Code CAResult_t.
59  */
60 CAResult_t CAStartWIFIListeningServer();
61
62 /**
63  * @brief for starting discovery servers.
64  * Transport Specific Behaviour
65  *       IP :- Start Multicast Server on all available IPs and prefixed port number as per OIC Specification.
66  * @return CAResult_t.
67  * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
68  */
69 CAResult_t CAStartWIFIDiscoveryServer();
70
71 /**
72  * @brief Send Multicast Data interface API callback.
73  * Note: length must be > 0
74  * @param endpoint - Endpoint information (like ipaddress , port, reference uri and connectivity type) to which the multicast data has to be sent.
75  * @param data - void pointer data which will be sent via client
76  * @param dataLen - size of data to be sent
77  * @return - Will return the number of bytes sent on the network. Return value equal to zero indicates error.
78  */
79 uint32_t CASendWIFIUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
80
81 /**
82  * @brief API to send data to a group of remote addresses.
83  * @param endpoint - Endpoint information (like ipaddress , port, reference uri and connectivity type) to which the multicast data has to be sent.
84  * @param data - void pointer data which will be sent via client
85  * @param dataLen - size of data to be sent
86  * @return - size of data sent or -1 on error
87  */
88 uint32_t CASendWIFIMulticastData(void* data, uint32_t dataLen);
89
90 /**
91  * @brief Start Notification Server interface API callback.
92  *
93  * @return CAResult_t.
94  * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
95  */
96 CAResult_t CAStartWIFINotifyRecvServers();
97
98 /**
99  * @brief Send Notification Data interface API callback.
100  * Note: length must be > 0
101  * @param endpoint - remote endpoint having endpoint details
102  *  @param data - data to be sent
103  *  @param dataLen - length of data to be sent
104  *  @return Will return the number of bytes sent on the network. Return value equal to zero indicates error.
105  */
106 uint32_t CASendWIFINotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
107 /**
108  * @brief Get Network Information
109  *
110  * @return CAResult_t.
111  * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
112  */
113 CAResult_t CAGetWIFIInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
114
115 /**
116  * @brief Read Synchronous API callback.
117  * @return Error Code CAResult_t.
118  * @return CAResult_t.
119  * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
120  */
121 CAResult_t CAReadWIFIData();
122
123 /**
124  * @brief API to Stop WiFi Interface.
125  * @return CAResult_t
126  */
127 CAResult_t CAStopWIFI();
128
129 /**
130  * @brief API to terminate WiFi Interface.
131  * @return none.
132  */
133 void CATerminateWifi();
134
135 #ifdef __cplusplus
136 } /* extern "C" */
137 #endif
138
139 #endif