wrap CAcloseSslConnectionFreeEndpoint method with __TIZEN__ flag
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caraadapter.h
1 //*****************************************************************
2 //
3 // Copyright 2015 Intel Mobile Communications GmbH 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 caraadapter.h
23  * This file contains the APIs for IP Adapter.
24  */
25 #ifndef CA_RA_ADAPTER_H_
26 #define CA_RA_ADAPTER_H_
27
28 #include "cacommon.h"
29 #include "caadapterinterface.h"
30 #include "cainterface.h"
31 #include "cathreadpool.h"
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38
39 /**
40  * API to initialize RA Interface.
41  * @param[in] registerCallback      Callback to register RA interfaces to
42  *                                   Connectivity Abstraction Layer.
43  * @param[in] networkPacketCallback Callback to notify request and
44  *                                   response messages from server(s)
45  *                                   started at Connectivity Abstraction Layer.
46  * @param[in] netCallback           Callback to notify the network
47  *                                   additions to Connectivity Abstraction
48  *                                   Layer.
49  * @param[in] handle                Threadpool Handle.
50  * @return  ::CA_STATUS_OK or Appropriate error code.
51  */
52 CAResult_t CAInitializeRA(CARegisterConnectivityCallback registerCallback,
53                           CANetworkPacketReceivedCallback networkPacketCallback,
54                           CAAdapterChangeCallback netCallback,
55                           ca_thread_pool_t handle);
56
57
58 /**
59  * Start RA Interface adapter.
60  * @return  ::CA_STATUS_OK or Appropriate error code.
61  */
62 CAResult_t CAStartRA();
63
64 /**
65  * Sends data to the endpoint using the adapter connectivity.
66  * @param[in]   endpoint    Remote Endpoint information (like ipaddress, port,
67  *                           reference uri and transport type) to which
68  *                           the unicast data has to be sent.
69  * @param[in]   data        Data which is required to be sent.
70  * @param[in]   dataLen     Size of data to be sent.
71  * @param[in]   dataType    Data type which is REQUEST or RESPONSE.
72  * @note dataLen must be > 0.
73  * @return The number of bytes sent on the network, or -1 upon error.
74  */
75 int32_t CASendRAUnicastData(const CAEndpoint_t *endpoint, const void *data,
76                             uint32_t dataLen, CADataType_t dataType);
77
78 /**
79  * Get RA Connectivity network information.
80  * @param[out]   info        Local connectivity information structures.
81  * @note info is allocated in this API and should be freed by the caller.
82  * @param[out]   size        Number of local connectivity structures.
83  * @return  ::CA_STATUS_OK or Appropriate error code.
84  */
85 CAResult_t CAGetRAInterfaceInformation(CAEndpoint_t **info, uint32_t *size);
86
87 /**
88  * Stops RA server and de-register XMPP callback listeners.
89  * @return  ::CA_STATUS_OK or Appropriate error code.
90  */
91 CAResult_t CAStopRA();
92
93 /**
94  * Terminate the RA connectivity adapter.
95  * Configuration information will be deleted from further use.
96  */
97 void CATerminateRA();
98
99 /**
100  * Set Remote Access information for XMPP Client.
101  * @param[in]   caraInfo            remote access info.
102  *
103  * @return  ::CA_STATUS_OK.
104  */
105 CAResult_t CASetRAInfo(const CARAInfo_t *caraInfo);
106
107 /**
108  * These functions are not applicable to Remote Access adapter.
109  */
110 int32_t CASendRAMulticastData(const CAEndpoint_t *endpoint,
111                               const void *data, uint32_t dataLen, CADataType_t dataType);
112
113 /**
114  * Start listening server for receiving search requests.
115  * @return  ::CA_NOT_SUPPORTED.
116  */
117 CAResult_t CAStartRAListeningServer();
118
119 /**
120  * Stops listening server from receiving search requests.
121  * @return  ::CA_NOT_SUPPORTED.
122  */
123 CAResult_t CAStopRAListeningServer();
124
125 /**
126  * Start discovery servers for receiving advertisements.
127  * @return  ::CA_NOT_SUPPORTED.
128  */
129 CAResult_t CAStartRADiscoveryServer();
130
131 /**
132  * Read Synchronous API callback.
133  * @return  ::CA_NOT_SUPPORTED.
134  */
135 CAResult_t CAReadRAData();
136
137 #ifdef __cplusplus
138 } /* extern "C" */
139 #endif
140
141 #endif  //CA_RA_ADAPTER_H_