* Create the blockId for CABlockData.
* @param[in] token token of current message.
* @param[in] tokenLength token length of current message.
+ * @param[in] addr address, must be MAX_ADDR_STR_SIZE_CA in length.
* @param[in] portNumber port.
* @return ID set of CABlockData.
*/
CABlockDataID_t* CACreateBlockDatablockId(const CAToken_t token, uint8_t tokenLength,
- uint16_t portNumber);
+ const char* addr, uint16_t portNumber);
/**
* Destroy the blockId set.
* 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] addr address, must be MAX_ADDR_STR_SIZE_CA in length.
* @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);
+ const char* addr, uint16_t portNumber);
#ifdef __cplusplus
} /* extern "C" */
CABlockDataID_t* blockDataID = CACreateBlockDatablockId(
receivedData->responseInfo->info.token,
receivedData->responseInfo->info.tokenLength,
- endpoint->port);
+ endpoint->addr, endpoint->port);
if (NULL == blockDataID || blockDataID->idLength < 1)
{
// if retransmission is timeout, callback msg will be send without token.
CABlockDataID_t* blockDataID = CACreateBlockDatablockId(
(CAToken_t)pdu->transport_hdr->udp.token,
pdu->transport_hdr->udp.token_length,
- endpoint->port);
+ endpoint->addr, endpoint->port);
if (NULL == blockDataID || blockDataID->idLength < 1)
{
OIC_LOG(ERROR, TAG, "blockId is null");
CABlockDataID_t* blockDataID = CACreateBlockDatablockId(
(CAToken_t)pdu->transport_hdr->udp.token,
pdu->transport_hdr->udp.token_length,
- endpoint->port);
+ endpoint->addr, endpoint->port);
if (NULL == blockDataID || blockDataID->idLength < 1)
{
OIC_LOG(ERROR, TAG, "blockId is null");
CABlockDataID_t* blockDataID = CACreateBlockDatablockId(
(CAToken_t)pdu->transport_hdr->udp.token,
pdu->transport_hdr->udp.token_length,
- endpoint->port);
+ endpoint->addr, endpoint->port);
if (NULL == blockDataID || blockDataID->idLength < 1)
{
OIC_LOG(ERROR, TAG, "blockId is null");
CABlockDataID_t* blockDataID = CACreateBlockDatablockId(
(CAToken_t)(*pdu)->transport_hdr->udp.token,
(*pdu)->transport_hdr->udp.token_length,
- endpoint->port);
+ endpoint->addr, endpoint->port);
if (NULL == blockDataID || blockDataID->idLength < 1)
{
OIC_LOG(ERROR, TAG, "blockId is null");
CABlockDataID_t* blockDataID = CACreateBlockDatablockId(
(CAToken_t)sendData->responseInfo->info.token,
sendData->responseInfo->info.tokenLength,
- sendData->remoteEndpoint->port);
+ sendData->remoteEndpoint->addr, sendData->remoteEndpoint->port);
if (NULL == blockDataID || blockDataID->idLength < 1)
{
OIC_LOG(ERROR, TAG, "blockId is null");
}
CABlockDataID_t* blockDataID = CACreateBlockDatablockId(token, tokenLength,
+ data->sentData->remoteEndpoint->addr,
data->sentData->remoteEndpoint->port);
if (NULL == blockDataID || blockDataID->idLength < 1)
{
}
CABlockDataID_t* CACreateBlockDatablockId(const CAToken_t token, uint8_t tokenLength,
- uint16_t portNumber)
+ const char* addr, uint16_t portNumber)
{
+ size_t addrLength = strlen(addr);
char port[PORT_LENGTH] = { 0, };
port[0] = (char) ((portNumber >> 8) & 0xFF);
port[1] = (char) (portNumber & 0xFF);
OIC_LOG(ERROR, TAG, "memory alloc has failed");
return NULL;
}
- blockDataID->idLength = tokenLength + sizeof(port);
+ blockDataID->idLength = tokenLength + sizeof(port) + addrLength;
blockDataID->id = (uint8_t *) OICMalloc(blockDataID->idLength);
if (!blockDataID->id)
{
}
memcpy(blockDataID->id + tokenLength, port, sizeof(port));
+ memcpy(blockDataID->id + tokenLength + sizeof(port), addr, addrLength);
OIC_LOG(DEBUG, TAG, "BlockID is ");
OIC_LOG_BUFFER(DEBUG, TAG, (const uint8_t *)blockDataID->id, blockDataID->idLength);
}
CAResult_t CARemoveBlockDataFromListWithSeed(const CAToken_t token, uint8_t tokenLength,
- uint16_t portNumber)
+ const char* addr, uint16_t portNumber)
{
- CABlockDataID_t* blockDataID = CACreateBlockDatablockId(token, tokenLength, portNumber);
+ CABlockDataID_t* blockDataID = CACreateBlockDatablockId(token, tokenLength, addr, portNumber);
if (NULL == blockDataID || blockDataID->idLength < 1)
{
OIC_LOG(ERROR, TAG, "blockId is null");