1 //*****************************************************************
3 // Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //****************************************************************
23 * This file contains the APIs for IP Adapter.
25 #ifndef CA_RA_ADAPTER_H_
26 #define CA_RA_ADAPTER_H_
29 #include "caadapterinterface.h"
30 #include "cainterface.h"
31 #include "cathreadpool.h"
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
49 * @param[in] handle Threadpool Handle.
50 * @return ::CA_STATUS_OK or Appropriate error code.
52 CAResult_t CAInitializeRA(CARegisterConnectivityCallback registerCallback,
53 CANetworkPacketReceivedCallback networkPacketCallback,
54 CAAdapterChangeCallback netCallback,
55 ca_thread_pool_t handle);
59 * Start RA Interface adapter.
60 * @return ::CA_STATUS_OK or Appropriate error code.
62 CAResult_t CAStartRA();
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.
75 int32_t CASendRAUnicastData(const CAEndpoint_t *endpoint, const void *data,
76 uint32_t dataLen, CADataType_t dataType);
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.
85 CAResult_t CAGetRAInterfaceInformation(CAEndpoint_t **info, uint32_t *size);
88 * Stops RA server and de-register XMPP callback listeners.
89 * @return ::CA_STATUS_OK or Appropriate error code.
91 CAResult_t CAStopRA();
94 * Terminate the RA connectivity adapter.
95 * Configuration information will be deleted from further use.
100 * Set Remote Access information for XMPP Client.
101 * @param[in] caraInfo remote access info.
103 * @return ::CA_STATUS_OK.
105 CAResult_t CASetRAInfo(const CARAInfo_t *caraInfo);
108 * These functions are not applicable to Remote Access adapter.
110 int32_t CASendRAMulticastData(const CAEndpoint_t *endpoint,
111 const void *data, uint32_t dataLen, CADataType_t dataType);
114 * Start listening server for receiving search requests.
115 * @return ::CA_NOT_SUPPORTED.
117 CAResult_t CAStartRAListeningServer();
120 * Stops listening server from receiving search requests.
121 * @return ::CA_NOT_SUPPORTED.
123 CAResult_t CAStopRAListeningServer();
126 * Start discovery servers for receiving advertisements.
127 * @return ::CA_NOT_SUPPORTED.
129 CAResult_t CAStartRADiscoveryServer();
132 * Read Synchronous API callback.
133 * @return ::CA_NOT_SUPPORTED.
135 CAResult_t CAReadRAData();
141 #endif //CA_RA_ADAPTER_H_