X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Finc%2Fcablockwisetransfer.h;h=3b848ccbf32c633448596aea74df8d0c67b28336;hb=02b64e2e546d5f2bb32e0a2b216f8b3a4d345518;hp=49461f88e27e9891c530a8f73139a275b58970f0;hpb=661a651dcd7cb67f980fde28a5901d42d15a00f7;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/inc/cablockwisetransfer.h b/resource/csdk/connectivity/inc/cablockwisetransfer.h index 49461f8..3b848cc 100644 --- a/resource/csdk/connectivity/inc/cablockwisetransfer.h +++ b/resource/csdk/connectivity/inc/cablockwisetransfer.h @@ -28,12 +28,18 @@ #include -#include "coap.h" +#include #include "cathreadpool.h" #include "camutex.h" #include "uarraylist.h" #include "cacommon.h" #include "caprotocolmessage.h" +#include "camessagehandler.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /** * Callback to send block data. @@ -98,25 +104,18 @@ typedef struct typedef enum { CA_BLOCK_UNKNOWN = 0, - CA_OPTION1_ACK, - CA_OPTION1_NO_ACK_LAST_BLOCK, - CA_OPTION1_NO_ACK_BLOCK, + CA_OPTION1_RESPONSE, + CA_OPTION1_REQUEST_LAST_BLOCK, + CA_OPTION1_REQUEST_BLOCK, CA_OPTION2_FIRST_BLOCK, CA_OPTION2_LAST_BLOCK, - CA_OPTION2_ACK, - CA_OPTION2_NON, - CA_OPTION2_CON, - CA_SENT_PREVIOUS_NON_MSG, + CA_OPTION2_RESPONSE, + CA_OPTION2_REQUEST, CA_BLOCK_INCOMPLETE, CA_BLOCK_TOO_LARGE, CA_BLOCK_RECEIVED_ALREADY } CABlockState_t; -#ifdef __cplusplus -extern "C" -{ -#endif - /** * Initializes the block-wise transfer context. * @param[in] CASendThreadFunc function point to add data in send queue thread. @@ -193,12 +192,11 @@ CAResult_t CAProcessNextStep(const coap_pdu_t *pdu, const CAData_t *receivedData * send block message to remote device. * @param[in] pdu received pdu binary data. * @param[in] msgType the message type of the block. - * @param[in] status block-wise state to move next step. * @param[in] blockID ID set of CABlockData. * @return ::CASTATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ CAResult_t CASendBlockMessage(const coap_pdu_t *pdu, CAMessageType_t msgType, - uint8_t status, const CABlockDataID_t *blockID); + const CABlockDataID_t *blockID); /** * send error message to remote device. @@ -256,7 +254,7 @@ CAResult_t CASetNextBlockOption2(coap_pdu_t *pdu, const CAEndpoint_t *endpoint, * @return ::CASTATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ CAResult_t CANegotiateBlockSize(CABlockData_t *currData, coap_block_t *block, - CAMessageType_t msgType, uint16_t blockType); + const coap_pdu_t *pdu, uint16_t blockType); /** * Update the block option in block-wise transfer list. @@ -294,7 +292,7 @@ CAResult_t CAUpdateBlockOptionItems(CABlockData_t *currData, const coap_pdu_t *p * @param[out] block block option. * @return ::CASTATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ -CAResult_t CAGetMoreBitFromBlock(size_t payloadLen, coap_block_t *block); +CAResult_t CASetMoreBitFromBlock(size_t payloadLen, coap_block_t *block); /** * check the block option what kind of option have to set. @@ -329,16 +327,24 @@ CAResult_t CAAddBlockOption1(coap_pdu_t **pdu, const CAInfo_t *info, size_t data const CABlockDataID_t *blockID, coap_list_t **options); /** - * Add the block option in pdu data. - * @param[in] pdu pdu object. + * Add the block option in option list. * @param[out] block block data. * @param[in] blockType block option type. + * @param[out] options option list. * @return ::CASTATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ -CAResult_t CAAddBlockOptionImpl(coap_pdu_t *pdu, coap_block_t *block, uint8_t blockType, +CAResult_t CAAddBlockOptionImpl(coap_block_t *block, uint8_t blockType, coap_list_t **options); /** + * Add the option list in pdu data. + * @param[out] pdu pdu object. + * @param[out] options option list. + * @return ::CASTATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). + */ +CAResult_t CAAddOptionToPDU(coap_pdu_t *pdu, coap_list_t **options); + +/** * Add the size option in pdu data. * @param[in/out] pdu pdu object. * @param[in] sizeType size option type. @@ -487,6 +493,15 @@ uint8_t CAGetBlockOptionType(const CABlockDataID_t *blockID); CAData_t *CAGetDataSetFromBlockDataList(const CABlockDataID_t *blockID); /** + * 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. + */ +CABlockData_t *CAUpdateDataSetFromBlockDataList(const CABlockDataID_t *blockID, + const CAData_t *sendData); + +/** * Get token from block-wise transfer list. * @param[in] pdu received pdu binary data. * @param[in] endpoint remote endpoint information. @@ -545,12 +560,20 @@ CABlockData_t *CACreateNewBlockData(const CAData_t *sendData); CAResult_t CARemoveBlockDataFromList(const CABlockDataID_t *blockID); /** - * Check if data exist in block-wise transfer list. - * @param[in] blockID ID set of CABlockData. - * @return true or false. + * Remove all block data in block-wise transfer list. + * @return ::CASTATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ -bool CAIsBlockDataInList(const CABlockDataID_t *blockID); +CAResult_t CARemoveAllBlockDataFromList(); +/** + * Find the block data with seed info and remove it from block-wise transfer list. + * @param[in] token token of the message. + * @param[in] tokenLength token length of the message. + * @param[in] portNumber port. + * @return ::CASTATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). + */ +CAResult_t CARemoveBlockDataFromListWithSeed(const CAToken_t token, uint8_t tokenLength, + uint16_t portNumber); #ifdef __cplusplus } /* extern "C" */