#include <coap/coap.h>
#include "cathreadpool.h"
-#include "camutex.h"
+#include "octhread.h"
#include "uarraylist.h"
#include "cacommon.h"
#include "caprotocolmessage.h"
u_arraylist_t *dataList;
/** data list mutex for synchronization. **/
- ca_mutex blockDataListMutex;
+ oc_mutex blockDataListMutex;
/** sender mutex for synchronization. **/
- ca_mutex blockDataSenderMutex;
+ oc_mutex blockDataSenderMutex;
} CABlockWiseContext_t;
/**
coap_block_t block1; /**< block1 option. */
coap_block_t block2; /**< block2 option. */
uint16_t type; /**< block option type. */
- CABlockDataID_t* blockDataId; /**< ID set of CABlockData. */
+ CABlockDataID_t* blockDataId; /**< ID set of CABlockData. */
CAData_t *sentData; /**< sent request or response data information. */
CAPayload_t payload; /**< payload buffer. */
size_t payloadLength; /**< the total payload length to be received. */
size_t receivedPayloadLen; /**< currently received payload length. */
+ uint64_t ttl; /** The TTL for this blockData. */
} CABlockData_t;
/**
* Update the block data from block-wise transfer list.
* @param[in] blockID ID set of CABlockData.
* @param[in] sendData New block date should be sent.
- * @return CABlockData_t structure.
+ * @return CAData structure.
*/
CABlockData_t *CAUpdateDataSetFromBlockDataList(const CABlockDataID_t *blockID,
const CAData_t *sendData);
CAResult_t CARemoveBlockDataFromListWithSeed(const CAToken_t token, uint8_t tokenLength,
uint16_t portNumber);
+/**
+ * Reset TTL for a blockData.
+ *
+ * @param[in] blockID ID set of CABlockData.
+ */
+void CAResetBlockDataTTL(const CABlockDataID_t *blockID);
+
+/**
+ * Checks if the blockData is past its time to live and deletes it if timed-out.
+ */
+void CACheckAndDeleteTimedOutBlockData();
#ifdef __cplusplus
} /* extern "C" */
#endif