X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Finc%2Fcaadapterinterface.h;h=f9999a8e30e83e84a60ead94772c54bb7cb23e43;hb=7f00f942c39b7bc27c7eeecf213a239c3fe4173c;hp=4a9dbf8936e3b9afb60982e13b2d569a08fe3fb4;hpb=88df85f0c20992acba7c96a85a1007916923b448;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/inc/caadapterinterface.h b/resource/csdk/connectivity/inc/caadapterinterface.h index 4a9dbf8..f9999a8 100644 --- a/resource/csdk/connectivity/inc/caadapterinterface.h +++ b/resource/csdk/connectivity/inc/caadapterinterface.h @@ -1,6 +1,6 @@ -/****************************************************************** +/* ***************************************************************** * - * Copyright 2014 Samsung Electronics All Rights Reserved. + * Copyright 2015 Samsung Electronics All Rights Reserved. * * * @@ -19,11 +19,13 @@ ******************************************************************/ /** - * @file caadapterinterface.h - * @brief This file contains the APIs for adapters to be implemented + * @file + * + * This file contains the APIs for adapters to be implemented. */ -#ifndef __CA_ADAPTER_INTERFACE_H_ -#define __CA_ADAPTER_INTERFACE_H_ + +#ifndef CA_ADAPTER_INTERFACE_H_ +#define CA_ADAPTER_INTERFACE_H_ #include "cacommon.h" @@ -33,75 +35,95 @@ extern "C" #endif /** - * @brief Starting connectivity adapters and each adapter have transport specific behavior. + * Starting connectivity adapters and each adapter have transport specific behavior. * Transport Specific Behavior: * WIFI/ETH connectivity Starts unicast server on all available IPs and defined * port number as per specification. * EDR will not start any specific servers. * LE will not start any specific servers. - * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h) + * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED + * ERROR CODES (::CAResult_t error codes in cacommon.h). */ typedef CAResult_t (*CAAdapterStart)(); /** - * @brief Starting listening server for receiving multicast search requests + * Starting listening server for receiving multicast search requests * Transport Specific Behavior: * WIFI/ETH Starts multicast server on all available IPs and defined * port number and as per specification. * EDR Starts RFCOMM Server with prefixed UUID as per specification. * LE Start GATT Server with prefixed UUID and Characteristics as per OIC Specification. - * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h) + * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED + * ERROR CODES (::CAResult_t error codes in cacommon.h). */ typedef CAResult_t (*CAAdapterStartListeningServer)(); /** - * @brief for starting discovery servers for receiving multicast advertisements + * Stopping listening server to not receive multicast search requests + * Transport Specific Behavior: + * WIFI/ETH Stops multicast server on all available IPs. This is required for the + * thin device that call this function once all local resources are pushed to the + * resource directory. + * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED + * ERROR CODES (::CAResult_t error codes in cacommon.h). + */ +typedef CAResult_t (*CAAdapterStopListeningServer)(); + +/** + * for starting discovery servers for receiving multicast advertisements * Transport Specific Behavior: * WIFI/ETH Starts multicast server on all available IPs and defined port * number as per OIC Specification. * EDR Starts RFCOMM Server with prefixed UUID as per OIC Specification. * LE Starts GATT Server with prefixed UUID and Characteristics as per OIC Specification. - * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h) + * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED + * ERROR CODES (::CAResult_t error codes in cacommon.h). */ typedef CAResult_t (*CAAdapterStartDiscoveryServer)(); /** - * @brief Sends data to the endpoint using the adapter connectivity. + * Sends data to the endpoint using the adapter connectivity. * Note: length must be > 0. - * @param endpoint [IN] Remote Endpoint information (like ipaddress , port, + * @param[in] endpoint Remote Endpoint information (like ipaddress , port, * reference uri and connectivity type) to which the unicast data has to be sent. - * @param data [IN] Data which required to be sent. - * @param dataLen [IN] Size of data to be sent. - * @return - The number of bytes sent on the network. Return value equal to zero indicates error. + * @param[in] data Data which required to be sent. + * @param[in] dataLen Size of data to be sent. + * @param[in] dataType Data type which is REQUEST or RESPONSE. + * @return The number of bytes sent on the network. Return value equal to -1 indicates error. */ -typedef uint32_t (*CAAdapterSendUnitcastData)(const CARemoteEndpoint_t *endpoint, void *data, - uint32_t dataLen); +typedef int32_t (*CAAdapterSendUnicastData)(const CAEndpoint_t *endpoint, + const void *data, uint32_t dataLen, + CADataType_t dataType); /** - * @brief Sends Multicast data to the endpoint using the adapter connectivity. + * Sends Multicast data to the endpoint using the adapter connectivity. * Note: length must be > 0. - * @param data [IN] Data which required to be sent. - * @param dataLen [IN] Size of data to be sent. - * @return - The number of bytes sent on the network. Return value equal to zero indicates error. + * @param[in] endpoint Remote Endpoint information (like ipaddress , port, + * @param[in] data Data which required to be sent. + * @param[in] dataLen Size of data to be sent. + * @param[in] dataType Data type which is REQUEST or RESPONSE. + * @return The number of bytes sent on the network. Return value equal to -1 indicates error. */ -typedef uint32_t (*CAAdapterSendMulticastData)(void *data, uint32_t dataLen); +typedef int32_t (*CAAdapterSendMulticastData)(const CAEndpoint_t *endpoint, + const void *data, uint32_t dataLen, + CADataType_t dataType); /** - * @brief Get Network Information - * @param info [OUT] Local connectivity information structures - * @param size [OUT] Number of local connectivity structures. - * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h) + * Get Network Information. + * @param[out] info Local connectivity information structures + * @param[out] size Number of local connectivity structures. + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ -typedef CAResult_t (*CAAdapterGetNetworkInfo)(CALocalConnectivity_t **info, uint32_t *size); +typedef CAResult_t (*CAAdapterGetNetworkInfo)(CAEndpoint_t **info, uint32_t *size); /** - * @brief Read Synchronous API callback. - * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h) + * Read Synchronous API callback. + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ typedef CAResult_t (*CAAdapterReadData)(); /** - * @brief Stopping the adapters and close socket connections + * Stopping the adapters and close socket connections. * Transport Specific Behavior: * WIFI/ETH Stops all listening servers and close sockets. * EDR Stops all RFCOMM servers and close sockets. @@ -111,59 +133,85 @@ typedef CAResult_t (*CAAdapterReadData)(); typedef CAResult_t (*CAAdapterStop)(); /** - * @brief Terminate the connectivity adapter.Configuration information will be deleted from - * further use + * Terminate the connectivity adapter.Configuration information will be deleted from + * further use. Freeing Memory of threadpool and mutexs and cleanup will be done. */ typedef void (*CAAdapterTerminate)(); /** - * @brief Connectivity handler information for adapter + * Connectivity handler information for adapter. */ typedef struct { - /** Start Transport specific functions*/ + /** Start Transport specific functions. */ CAAdapterStart startAdapter; - /** Listening Server function address*/ + + /** Listening Server function address. */ CAAdapterStartListeningServer startListenServer; - /** Discovery Server function address **/ - CAAdapterStartDiscoveryServer startDiscoverServer; - /** Unicast data function address**/ - CAAdapterSendUnitcastData sendData; - /** Multicast data function address**/ + + /** Stops receiving the multicast traffic. */ + CAAdapterStopListeningServer stopListenServer; + + /** Discovery Server function address. **/ + CAAdapterStartDiscoveryServer startDiscoveryServer; + + /** Unicast data function address. **/ + CAAdapterSendUnicastData sendData; + + /** Multicast data function address. **/ CAAdapterSendMulticastData sendDataToAll; - /** Get Networking information **/ + + /** Get Networking information. **/ CAAdapterGetNetworkInfo GetnetInfo; - /** Read Data function address**/ + + /** Read Data function address. **/ CAAdapterReadData readData; - /** Stop Transport specific functions*/ + + /** Stop Transport specific functions. */ CAAdapterStop stopAdapter; - /** Terminate function address stored in this pointer**/ + + /** Terminate function address stored in this pointer. **/ CAAdapterTerminate terminate; + /** Type of transport adapter. **/ + CATransportAdapter_t cType; } CAConnectivityHandler_t; /** - * @brief This will be used during the registration of adapters call backs to the common logic - * @see CAConnectivityHandler_t , CAConnectivityType_t + * This will be used during the registration of adapters call backs to the common logic. + * @see ::CAConnectivityHandler_t + */ +typedef void (*CARegisterConnectivityCallback)(CAConnectivityHandler_t handler); + +/** + * This will be used during the receive of network requests and response. + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). + * @see SendUnicastData(), SendMulticastData() */ -typedef void (*CARegisterConnectivityCallback)(CAConnectivityHandler_t handler, - CAConnectivityType_t cType); +typedef CAResult_t (*CANetworkPacketReceivedCallback)(const CASecureEndpoint_t *sep, + const void *data, size_t dataLen); /** - * @brief This will be used during the recive of network requests and response. - * @see SendUnitcastData(), SendMulticastData() + * This will be used to notify network changes to the connectivity common logic layer. */ -typedef void (*CANetworkPacketReceivedCallback)(CARemoteEndpoint_t *endPoint, void *data, - uint32_t dataLen); +typedef void (*CAAdapterChangeCallback)(CATransportAdapter_t adapter, CANetworkStatus_t status); /** - * @brief This will be used to intimate network changes to the connectivity common logic layer - * @see SendUnitcastData(), SendMulticastData() + * This will be used to notify connection changes to the connectivity common logic layer. */ -typedef void (*CANetworkChangeCallback)(CALocalConnectivity_t *info, CANetworkStatus_t status); +typedef void (*CAConnectionChangeCallback)(const CAEndpoint_t *info, bool isConnected); + +/** + * This will be used to notify error result to the connectivity common logic layer. + */ +typedef void (*CAErrorHandleCallback)(const CAEndpoint_t *endpoint, + const void *data, size_t dataLen, + CAResult_t result); #ifdef __cplusplus } /* extern "C" */ #endif -#endif // __CA_ADAPTER_INTERFACE_H_ +#endif /* CA_ADAPTER_INTERFACE_H_ */ + +