X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Finc%2Fcaipinterface.h;h=62eb0fdd9eeae30c3ae7a4ac97501fc675dc22fe;hb=refs%2Ftags%2Fsubmit%2Ftizen_4.0%2F20171010.021147;hp=6a71f28e2766e3259b184b510a114b9177e29bf6;hpb=752db8ac38907b7a408c7b23adb02b8a39223e45;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/inc/caipinterface.h b/resource/csdk/connectivity/inc/caipinterface.h index 6a71f28..62eb0fd 100644 --- a/resource/csdk/connectivity/inc/caipinterface.h +++ b/resource/csdk/connectivity/inc/caipinterface.h @@ -50,14 +50,15 @@ typedef enum /** * Callback to be notified on reception of any data from remote OIC devices. * - * @param[in] endpoint network endpoint description. + * @param[in] sep network endpoint description. * @param[in] data Data received from remote OIC device. * @param[in] dataLength Length of data in bytes. + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). * @pre Callback must be registered using CAIPSetPacketReceiveCallback(). */ -typedef void (*CAIPPacketReceivedCallback)(const CAEndpoint_t *endpoint, - const void *data, - uint32_t dataLength); +typedef CAResult_t (*CAIPPacketReceivedCallback)(const CASecureEndpoint_t *sep, + const void *data, + uint32_t dataLength); /** * Callback to notify error in the IP adapter. @@ -72,13 +73,6 @@ typedef void (*CAIPErrorHandleCallback)(const CAEndpoint_t *endpoint, const void uint32_t dataLength, CAResult_t result); /** - * Callback to be notified when exception occures on multicast/unicast server. - * @param type Type of server(#CAAdapterServerType_t). - * @pre Callback must be registered using CAIPSetExceptionCallback(). - */ -typedef void (*CAIPExceptionCallback)(CAAdapterServerType_t type); - -/** * Start IP server. * * @param threadPool Thread pool for managing Unicast/Multicast server threads. @@ -94,23 +88,38 @@ CAResult_t CAIPStartServer(const ca_thread_pool_t threadPool); #endif /** + * Close IP socket. + */ +void CADeInitializeIPGlobals(); + +/** * Stop IP server. */ void CAIPStopServer(); /** - * Set this callback for receiving data packets from peer devices. + * Starts receiving the multicast traffic. * - * @param[in] callback Callback to be notified on reception of unicast/multicast data packets. + * This will be used in case sleepy device wants to start back receiving the multicast + * traffic. */ -void CAIPSetPacketReceiveCallback(CAIPPacketReceivedCallback callback); +CAResult_t CAIPStartListenServer(); + +/** + * Stops the multicast traffic. + * + * This is to be used by the sleeping device to stop receiving multicast traffic. + * Once this is set no multicast traffic will be received. Device can still receive + * the unicast traffic. + */ +CAResult_t CAIPStopListenServer(); /** - * Set this callback for receiving exception notifications. + * Set this callback for receiving data packets from peer devices. * - * @param[in] callback Callback to be notified on exception on running servers. + * @param[in] callback Callback to be notified on reception of unicast/multicast data packets. */ -void CAIPSetExceptionCallback(CAIPExceptionCallback callback); +void CAIPSetPacketReceiveCallback(CAIPPacketReceivedCallback callback); /** * Set socket description for sending unicast UDP data. @@ -154,31 +163,47 @@ void CAIPPullData(); #define CA_COAP 5683 #define CA_SECURE_COAP 5684 -#define INTERFACE_NAME_MAX 16 - -typedef struct -{ - char name[INTERFACE_NAME_MAX]; - uint32_t index; - uint32_t flags; - uint16_t family; - uint32_t ipv4addr; /**< used for IPv4 only. */ -} CAInterface_t; /** - * Get a list of CAInterface_t items. + * Let the network monitor update the polling interval. + * @param [in] current polling interval * - * @return List of CAInterface_t items. + * @return desired polling interval */ -u_arraylist_t *CAIPGetInterfaceInformation(int desiredIndex); +int CAGetPollingInterval(int interval); /** * Set callback for error handling. * - * @param[in] ipErrorCallback callback to notify error to the ipadapter. + * @param[in] errorHandleCallback callback to notify error to the ipadapter. + */ +void CAIPSetErrorHandler(CAIPErrorHandleCallback errorHandleCallback); + +/** + * Set udp 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). */ -void CAIPSetErrorHandleCallback(CAIPErrorHandleCallback ipErrorCallback); +CAResult_t CAIPSetMulticastTTL(size_t ttl); +/** + * Get udp 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 CAIPGetMulticastTTL(size_t *ttl); + +/** + * Create multicast socket to receive multicast message from remote device. + */ +void CreateMulticastSocket(); + +/** + * Close multicast socket to stop receiving multicast message. + */ +void CloseMulticastSocket(); #ifdef __cplusplus } #endif