-CAResult_t CADetachMessageResourceUri(const CAURI_t resourceUri, const CAToken_t token,
- uint8_t tokenLength, const CAHeaderOption_t *options,
- uint8_t numOptions)
-{
- OIC_LOG(DEBUG, TAG, "IN");
- VERIFY_NON_NULL(resourceUri, TAG, "resourceUri is NULL");
- VERIFY_NON_NULL(token, TAG, "Token is NULL");
-
- // allocate & initialize
- CAData_t *data = (CAData_t *) OICCalloc(1, sizeof(CAData_t));
- CA_MEMORY_ALLOC_CHECK(data);
-
- CAAddress_t addr = {0};
- CARemoteEndpoint_t *remoteEndpoint =
- CACreateRemoteEndpointInternal(resourceUri, addr, CA_IPV4 | CA_EDR | CA_LE);
-
- // create request info
- CARequestInfo_t *reqInfo = (CARequestInfo_t *) OICCalloc(1, sizeof(CARequestInfo_t));
- CA_MEMORY_ALLOC_CHECK(reqInfo);
-
- // save request info data
- reqInfo->method = CA_GET;
- reqInfo->info.type = CA_MSG_NONCONFIRM;
-
- reqInfo->info.token = token;
- reqInfo->info.tokenLength = tokenLength;
-
- // save data
- data->type = SEND_TYPE_MULTICAST;
- data->remoteEndpoint = remoteEndpoint;
- data->requestInfo = reqInfo;
-
- data->responseInfo = NULL;
- data->options = NULL;
- data->numOptions = 0;
- CAHeaderOption_t *headerOption = NULL;
- if (NULL != options && numOptions > 0)
- {
- // copy data
- headerOption = (CAHeaderOption_t *) OICMalloc(sizeof(CAHeaderOption_t) * numOptions);
- CA_MEMORY_ALLOC_CHECK(headerOption);
- memcpy(headerOption, options, sizeof(CAHeaderOption_t) * numOptions);
-
- data->options = headerOption;
- data->numOptions = numOptions;
- }
-
- CAProcessData(data);
-
- CADestroyRemoteEndpoint(remoteEndpoint);
- OICFree(headerOption);
- OICFree(data);
- OICFree(reqInfo);
- OIC_LOG(DEBUG, TAG, "OUT");
- return CA_STATUS_OK;
-
-// memory error label.
-memory_error_exit:
-
- CADestroyRemoteEndpointInternal(remoteEndpoint);
-
- OICFree(reqInfo);
- OICFree(data);
- OIC_LOG(DEBUG, TAG, "OUT");
- return CA_MEMORY_ALLOC_FAILED;
-}
-
-void CASetRequestResponseCallbacks(CARequestCallback ReqHandler, CAResponseCallback RespHandler)