******************************************************************/
/**
- * @file caretransmission.h
- * @brief This file contains common function for retransmission messages.
+ * @file
+ * This file contains common function for retransmission messages.
*/
-#ifndef __CA_RETRANSMISSION_H_
-#define __CA_RETRANSMISSION_H_
+#ifndef CA_RETRANSMISSION_H_
+#define CA_RETRANSMISSION_H_
#include <stdint.h>
-#include "uthreadpool.h"
-#include "umutex.h"
+#include "cathreadpool.h"
+#include "camutex.h"
#include "uarraylist.h"
#include "cacommon.h"
-/** CA_ETHERNET, CA_WIFI, CA_EDR, CA_LE **/
-#define DEFAULT_RETRANSMISSION_TYPE (CA_ETHERNET | CA_WIFI | CA_EDR | CA_LE)
+/** IP, EDR, LE. **/
+#define DEFAULT_RETRANSMISSION_TYPE (CA_ADAPTER_IP | \
+ CA_ADAPTER_RFCOMM_BTEDR | \
+ CA_ADAPTER_GATT_BTLE)
-/** default ACK time is 2 sec.(CoAP) **/
+/** default ACK time is 2 sec(CoAP). **/
#define DEFAULT_ACK_TIMEOUT_SEC 2
-/** default max retransmission trying count is 4.(CoAP) **/
-#define DEFAULT_MAX_RETRANSMIT 4
+/** default max retransmission trying count is 4(CoAP). **/
+#define DEFAULT_RETRANSMISSION_COUNT 4
/** check period is 1 sec. **/
#define RETRANSMISSION_CHECK_PERIOD_SEC 1
-/** retransmission data send method type**/
-typedef CAResult_t (*CADataSendMethod_t)(const CARemoteEndpoint_t *endpoint, const void *pdu,
+/** retransmission data send method type. **/
+typedef CAResult_t (*CADataSendMethod_t)(const CAEndpoint_t *endpoint,
+ const void *pdu,
uint32_t size);
-/** retransmission timeout callback type**/
-typedef void (*CATimeoutCallback_t)(const CARemoteEndpoint_t *endpoint, const void *pdu,
+/** retransmission timeout callback type. **/
+typedef void (*CATimeoutCallback_t)(const CAEndpoint_t *endpoint,
+ const void *pdu,
uint32_t size);
typedef struct
{
- /** retransmission support connectivity type **/
- CAConnectivityType_t supportType;
+ /** retransmission support transport type. **/
+ CATransportAdapter_t supportType;
- /** retransmission trying count **/
+ /** retransmission trying count. **/
uint8_t tryingCount;
} CARetransmissionConfig_t;
typedef struct
{
- /** Thread pool of the thread started **/
- u_thread_pool_t threadPool;
+ /** Thread pool of the thread started. **/
+ ca_thread_pool_t threadPool;
- /** mutex for synchronization **/
- u_mutex threadMutex;
+ /** mutex for synchronization. **/
+ ca_mutex threadMutex;
- /** conditional mutex for synchronization **/
- u_cond threadCond;
+ /** conditional mutex for synchronization. **/
+ ca_cond threadCond;
- /** send method for retransmission data **/
+ /** send method for retransmission data. **/
CADataSendMethod_t dataSendMethod;
- /** callback function for retransmit timeout **/
+ /** callback function for retransmit timeout. **/
CATimeoutCallback_t timeoutCallback;
- /** retransmission configure data **/
+ /** retransmission configure data. **/
CARetransmissionConfig_t config;
- /** Variable to inform the thread to stop **/
+ /** Variable to inform the thread to stop. **/
bool isStop;
/** array list on which the thread is operating. **/
#endif
/**
- * @brief Initializes the retransmission context
- * @param context [IN] context for retransmission
- * @param handle [IN] thread pool handle
- * @param retransmissionSendMethod [IN] function to be called for retransmission
- * @param timeoutCallback [IN] callback for retransmit timeout
- * @param config [IN] configuration for retransmission.
+ * Initializes the retransmission context.
+ * @param[in] context context for retransmission.
+ * @param[in] handle thread pool handle.
+ * @param[in] retransmissionSendMethod function to be called for retransmission.
+ * @param[in] timeoutCallback callback for retransmit timeout.
+ * @param[in] config configuration for retransmission.
* if NULL is coming, it will set default values.
- * @return CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h)
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
*/
-CAResult_t CARetransmissionInitialize(CARetransmission_t *context, u_thread_pool_t handle,
+CAResult_t CARetransmissionInitialize(CARetransmission_t *context,
+ ca_thread_pool_t handle,
CADataSendMethod_t retransmissionSendMethod,
CATimeoutCallback_t timeoutCallback,
CARetransmissionConfig_t* config);
/**
- * @brief Starting the retransmission context
- * @param context [IN] context for retransmission
- * @return CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h)
+ * Starting the retransmission context.
+ * @param[in] context context for retransmission.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
*/
CAResult_t CARetransmissionStart(CARetransmission_t *context);
/**
- * @brief Pass the sent pdu data. if retransmission process need, internal thread will wake up and
- * process the retransmission data
- * @param context [IN] context for retransmission
- * @param endpoint [IN] endpoint information
- * @param pdu [IN] sent pdu binary data
- * @param size [IN] sent pdu binary data size
- * @return CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h)
+ * Pass the sent pdu data. if retransmission process need, internal thread will wake up and
+ * process the retransmission data.
+ * @param[in] context context for retransmission.
+ * @param[in] endpoint endpoint information.
+ * @param[in] pdu sent pdu binary data.
+ * @param[in] size sent pdu binary data size.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
*/
CAResult_t CARetransmissionSentData(CARetransmission_t* context,
- const CARemoteEndpoint_t* endpoint, const void* pdu,
- uint32_t size);
+ const CAEndpoint_t* endpoint,
+ const void* pdu, uint32_t size);
/**
- * @brief Pass the received pdu data. if received pdu is ACK data for the retransmission CON data,
- * the specified CON data will remove on retransmission list.
- * @param context [IN] context for retransmission
- * @param endpoint [IN] endpoint information
- * @param pdu [IN] received pdu binary data
- * @param size [IN] received pdu binary data size
- * @param retransmissionPdu [OUT] pdu data of the request for reset and ack
- * @return CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h)
+ * Pass the received pdu data. if received pdu is ACK data for the retransmission CON data,
+ * the specified CON data will remove on retransmission list.
+ * @param[in] context context for retransmission.
+ * @param[in] endpoint endpoint information.
+ * @param[in] pdu received pdu binary data.
+ * @param[in] size received pdu binary data size.
+ * @param[out] retransmissionPdu pdu data of the request for reset and ack.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
*/
CAResult_t CARetransmissionReceivedData(CARetransmission_t *context,
- const CARemoteEndpoint_t *endpoint, const void *pdu,
+ const CAEndpoint_t *endpoint, const void *pdu,
uint32_t size, void **retransmissionPdu);
/**
- * @brief Stopping the retransmission context
- * @param context [IN] context for retransmission
- * @return CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h)
+ * Stopping the retransmission context.
+ * @param[in] context context for retransmission.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
*/
CAResult_t CARetransmissionStop(CARetransmission_t *context);
/**
- * @brief Terminating the retransmission context
- * @param context [IN] context for retransmission
- * @return CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h)
+ * Terminating the retransmission context.
+ * @param[in] context context for retransmission.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
*/
CAResult_t CARetransmissionDestroy(CARetransmission_t *context);
+/**
+ * Invoke Retransmission according to TimedAction Response.
+ * @param[in] threadValue context for retransmission.
+ */
+void CARetransmissionBaseRoutine(void *threadValue);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
-#endif // __CA_RETRANSMISSION_H_
+#endif /* CA_RETRANSMISSION_H_ */