modified CA comment for doxygen.
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / cainterfacecontroller.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 common utility function for CA transport adaptors.
25  */
26
27 #ifndef CA_INTERFACE_CONTROLLER_H_
28 #define CA_INTERFACE_CONTROLLER_H_
29
30 #include "caadapterinterface.h"
31
32 #ifndef SINGLE_THREAD
33 #include "cathreadpool.h" /* for thread pool */
34 #endif
35
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40
41 #ifdef SINGLE_THREAD
42 /**
43  * Initializes different adapters based on the compilation flags.
44  */
45 void CAInitializeAdapters();
46 #else
47 /**
48  * Initializes different adapters based on the compilation flags.
49  * @param[in]   handle           thread pool handle created by message handler
50  *                               for different adapters.
51  */
52 void CAInitializeAdapters(ca_thread_pool_t handle);
53 #endif
54
55 /**
56  * Set the received packets callback for message handler.
57  * @param[in]   callback         message handler callback to receive packets
58  *                               from different adapters.
59  */
60 void CASetPacketReceivedCallback(CANetworkPacketReceivedCallback callback);
61
62 /**
63  * Set the error handler callback for message handler.
64  * @param[in]   errorCallback    error handler callback from adapters
65  */
66 void CASetErrorHandleCallback(CAErrorHandleCallback errorCallback);
67
68 /**
69  * Set the network status changed callback for message handler.
70  * @param[in]   callback         message handler network status callback
71  *                               to receive network changes.
72  */
73 void CASetNetworkChangeCallback(CANetworkChangeCallback callback);
74
75 /**
76  * Starting different connectivity adapters based on the network selection.
77  * @param[in]   transportType    interested network for starting.
78  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
79  */
80 CAResult_t CAStartAdapter(CATransportAdapter_t transportType);
81
82 /**
83  * Stopping different connectivity adapters based on the network un-selection.
84  * @param[in]   transportType    network type that want to stop.
85  */
86 void CAStopAdapter(CATransportAdapter_t transportType);
87
88 #ifdef RA_ADAPTER
89 /**
90  * Set Remote Access information for XMPP Client.
91  * @param[in]   caraInfo         remote access info..
92  *
93  * @return  CA_STATUS_OK
94  */
95 CAResult_t CASetAdapterRAInfo(const CARAInfo_t *caraInfo);
96 #endif
97
98 /**
99  * Get network information such as ipaddress and mac information.
100  * @param[out]   info           connectivity information
101  *                                  such as ipaddress and mac information.
102  * @param[out]   size           number of connectivity information structures.
103  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
104  */
105 CAResult_t CAGetNetworkInfo(CAEndpoint_t **info, uint32_t *size);
106
107 /**
108  * Sends unicast data to the remote endpoint.
109  * @param[in]   endpoint       endpoint information where the data has to be sent.
110  * @param[in]   data           data that needs to be sent.
111  * @param[in]   length         length of the data that needs to be sent.
112  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
113  */
114 CAResult_t CASendUnicastData(const CAEndpoint_t *endpoint, const void *data, uint32_t length);
115
116 /**
117  * Sends multicast data to all endpoints in the network.
118  * @param[in]   endpoint       endpoint information where the data has to be sent.
119  * @param[in]   data           data that needs to be sent.
120  * @param[in]   length         length of the data that needs to be sent.
121  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
122  */
123
124 CAResult_t CASendMulticastData(const CAEndpoint_t *endpoint, const void *data, uint32_t length);
125
126 /**
127  * Start listening servers to receive search requests from clients.
128  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
129  */
130 CAResult_t CAStartListeningServerAdapters();
131
132 /**
133  * Start discovery servers to receive advertisements from server.
134  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
135  */
136 CAResult_t CAStartDiscoveryServerAdapters();
137
138 /**
139  * Terminates the adapters which are initialized during the initialization.
140  */
141 void CATerminateAdapters();
142
143 #ifdef SINGLE_THREAD
144 /**
145  * Checks for available data and reads it.
146  * @return   ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
147  */
148 CAResult_t CAReadData();
149 #endif
150
151 #ifdef __cplusplus
152 } /* extern "C" */
153 #endif
154
155 #endif /* CA_INTERFACE_CONTROLLER_H_ */
156