replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / cainterfacecontroller.h
index 09be6fd..fedc1a7 100644 (file)
@@ -1,4 +1,4 @@
-/******************************************************************
+/* ****************************************************************
  *
  * Copyright 2014 Samsung Electronics All Rights Reserved.
  *
  * limitations under the License.
  *
  ******************************************************************/
-#ifndef __CA_INTERFACE_CONTROLLER_H_
-#define __CA_INTERFACE_CONTROLLER_H_
+
+/**
+ * @file
+ *
+ * This file contains common utility function for CA transport adaptors.
+ */
+
+#ifndef CA_INTERFACE_CONTROLLER_H_
+#define CA_INTERFACE_CONTROLLER_H_
 
 #include "caadapterinterface.h"
-#include "uthreadpool.h" /* for thread pool */
+#include "cainterface.h"
+#include "cautilinterface.h"
+
+#ifndef SINGLE_THREAD
+#include "cathreadpool.h" /* for thread pool */
+#endif
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
-void CAInitializeAdapters(u_thread_pool_t handle);
+#ifdef SINGLE_THREAD
+/**
+ * Initializes different adapters based on the compilation flags.
+ */
+void CAInitializeAdapters();
+#else
+/**
+ * Initializes different adapters based on the compilation flags.
+ * @param[in]   handle           thread pool handle created by message handler
+ *                               for different adapters.
+ * @param[in]   transportType    transport type to initialize.
+ */
+void CAInitializeAdapters(ca_thread_pool_t handle, CATransportAdapter_t transportType);
+#endif
 
+/**
+ * Set the received packets callback for message handler.
+ * @param[in]   callback         message handler callback to receive packets
+ *                               from different adapters.
+ */
 void CASetPacketReceivedCallback(CANetworkPacketReceivedCallback callback);
 
-void CASetNetworkChangeCallback(CANetworkChangeCallback callback);
+/**
+ * Set the error handler callback for message handler.
+ * @param[in]   errorCallback    error handler callback from adapters
+ */
+void CASetErrorHandleCallback(CAErrorHandleCallback errorCallback);
 
-void CAStartAdapter(CAConnectivityType_t connectivity);
+/**
+ * Set the network status changed callback for CAUtil.
+ * @param[in]   adapterCB       CAUtil callback to receive adapter status changes.
+ * @param[in]   connCB          CAUtil callback to receive connection status changes.
+ */
+void CASetNetworkMonitorCallbacks(CAAdapterStateChangedCB adapterCB,
+                                  CAConnectionStateChangedCB connCB);
 
-void CAStopAdapter(CAConnectivityType_t connectivity);
+/**
+ * Unset the network status changed callback for CAUtil.
+ * @param[in]   adapterCB       CAUtil callback to receive adapter status changes.
+ * @param[in]   connCB          CAUtil callback to receive connection status changes.
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAUnsetNetworkMonitorCallbacks(CAAdapterStateChangedCB adapterCB,
+                                          CAConnectionStateChangedCB connCB);
 
-CAResult_t CAGetNetworkInfo(CALocalConnectivity_t **info, uint32_t *size);
+/**
+ * Starting different connectivity adapters based on the network selection.
+ * @param[in]   transportType    interested network for starting.
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAStartAdapter(CATransportAdapter_t transportType);
 
-CAResult_t CASendUnicastData(CARemoteEndpoint_t* endpoint, void* data, uint32_t length);
+/**
+ * Stopping different connectivity adapters based on the network un-selection.
+ * @param[in]   transportType    network type that want to stop.
+ */
+void CAStopAdapter(CATransportAdapter_t transportType);
 
-CAResult_t CASendMulticastData(void *data, uint32_t length);
+#ifdef RA_ADAPTER
+/**
+ * Set Remote Access information for XMPP Client.
+ * @param[in]   caraInfo         remote access info..
+ *
+ * @return  CA_STATUS_OK
+ */
+CAResult_t CASetAdapterRAInfo(const CARAInfo_t *caraInfo);
+#endif
+
+/**
+ * Get network information such as ipaddress and mac information.
+ * @param[out]   info           connectivity information
+ *                                  such as ipaddress and mac information.
+ * @param[out]   size           number of connectivity information structures.
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAGetNetworkInfo(CAEndpoint_t **info, uint32_t *size);
+
+/**
+ * Sends unicast data to the remote endpoint.
+ * @param[in]   endpoint       endpoint information where the data has to be sent.
+ * @param[in]   data           data that needs to be sent.
+ * @param[in]   length         length of the data that needs to be sent.
+ * @param[in]   dataType       Data type which is REQUEST or RESPONSE.
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CASendUnicastData(const CAEndpoint_t *endpoint, const void *data,
+                             uint32_t length, CADataType_t dataType);
 
+/**
+ * Sends multicast data to all endpoints in the network.
+ * @param[in]   endpoint       endpoint information where the data has to be sent.
+ * @param[in]   data           data that needs to be sent.
+ * @param[in]   length         length of the data that needs to be sent.
+ * @param[in]   dataType       Data type which is REQUEST or RESPONSE.
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+
+CAResult_t CASendMulticastData(const CAEndpoint_t *endpoint, const void *data,
+                               uint32_t length, CADataType_t dataType);
+
+/**
+ * Start listening servers to receive search requests from clients.
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
 CAResult_t CAStartListeningServerAdapters();
 
+/**
+ * Stop listening servers to receive search requests from clients.
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAStopListeningServerAdapters();
+
+/**
+ * Start discovery servers to receive advertisements from server.
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
 CAResult_t CAStartDiscoveryServerAdapters();
 
+/**
+ * Terminates the adapters which are initialized during the initialization.
+ */
 void CATerminateAdapters();
 
+#ifdef SINGLE_THREAD
+/**
+ * Checks for available data and reads it.
+ * @return   ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAReadData();
+#endif
+
+#ifdef IP_ADAPTER
+/**
+ * Set multicast time to live value to control the scope of the multicasts.
+ * @param[in]  ttl         To be set to any value from 0 to 255.
+ *
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CASetMulticastTTL(size_t ttl);
+
+/**
+ * Get multicast time to live value.
+ * @param[out]  ttl        TTL pointer to get the stored multicast time to live.
+ *
+ * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAGetMulticastTTL(size_t *ttl);
+#endif
+
+#ifdef TCP_ADAPTER
+/**
+ * Disconnect TCP session.
+ * When there is no transmission for a long time.
+ * Some carrier vendor is blocking data.
+ * Thur, TCP Session is cleaned through this function.
+ * @param[in]   endpoint       endpoint information to disconnect.
+ */
+CAResult_t CADisconnectSession(const CAEndpoint_t *endpoint);
+#endif
+
+#ifdef LE_ADAPTER
+void CAStartGattServer();
+
+void CAStopGattServer();
+#endif
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
 
-#endif //#ifndef __CA_INTERFACE_CONTROLLER_H_
+#endif /* CA_INTERFACE_CONTROLLER_H_ */
+