X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Finc%2Fcaipinterface.h;h=62eb0fdd9eeae30c3ae7a4ac97501fc675dc22fe;hb=7f00f942c39b7bc27c7eeecf213a239c3fe4173c;hp=7aeb3912ed049775dcecde4641a54bee927c6bb4;hpb=c7947c2aac0d24b278b7198c3f45e4bc1a70482e;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/inc/caipinterface.h b/resource/csdk/connectivity/inc/caipinterface.h index 7aeb391..62eb0fd 100644 --- a/resource/csdk/connectivity/inc/caipinterface.h +++ b/resource/csdk/connectivity/inc/caipinterface.h @@ -53,11 +53,12 @@ typedef enum * @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 CASecureEndpoint_t *sep, - 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,33 +163,9 @@ 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. - * - * @return List of CAInterface_t items. - */ -u_arraylist_t *CAIPGetInterfaceInformation(int desiredIndex); - -/** - * @brief Find a new network interface. - * - * @return Description of interface (or NULL if no change) - */ -CAInterface_t *CAFindInterfaceChange(); /** - * @brief Let the network monitor update the polling interval. + * Let the network monitor update the polling interval. * @param [in] current polling interval * * @return desired polling interval @@ -188,31 +173,37 @@ CAInterface_t *CAFindInterfaceChange(); int CAGetPollingInterval(int interval); /** - * @brief Tell the IP server an interface has been added. + * Set callback for error handling. + * + * @param[in] errorHandleCallback callback to notify error to the ipadapter. */ -void CAWakeUpForChange(); +void CAIPSetErrorHandler(CAIPErrorHandleCallback errorHandleCallback); /** - * Start network monitor. + * 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 Appropriate error code. + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ -CAResult_t CAIPStartNetworkMonitor(); +CAResult_t CAIPSetMulticastTTL(size_t ttl); /** - * Stops network monitor. + * 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 Appropriate error code. + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ -CAResult_t CAIPStopNetworkMonitor(); +CAResult_t CAIPGetMulticastTTL(size_t *ttl); /** - * @brief Set callback for error handling. - * - * @param[in] ipErrorCallback callback to notify error to the ipadapter. + * Create multicast socket to receive multicast message from remote device. */ -void CAIPSetErrorHandleCallback(CAIPErrorHandleCallback ipErrorCallback); +void CreateMulticastSocket(); +/** + * Close multicast socket to stop receiving multicast message. + */ +void CloseMulticastSocket(); #ifdef __cplusplus } #endif