+
+
+#else
+
+static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu)
+{
+ OIC_LOG(DEBUG, TAG, "CALogPDUInfo");
+
+ VERIFY_NON_NULL_VOID(data, TAG, "data");
+ VERIFY_NON_NULL_VOID(pdu, TAG, "pdu");
+ OIC_TRACE_BEGIN(%s:CALogPDUInfo, TAG);
+
+ OIC_LOG(INFO, ANALYZER_TAG, "=================================================");
+ if(SEND_TYPE_MULTICAST == data->type)
+ {
+ OIC_LOG(INFO, ANALYZER_TAG, "Is Multicast = true");
+ }
+ else
+ {
+ OIC_LOG(INFO, ANALYZER_TAG, "Is Multicast = false");
+ }
+
+ if (NULL != data->remoteEndpoint)
+ {
+ CALogAdapterTypeInfo(data->remoteEndpoint->adapter);
+ OIC_LOG_V(INFO, ANALYZER_TAG, "Address = [%s]:[%d]", data->remoteEndpoint->addr,
+ data->remoteEndpoint->port);
+ }
+
+ switch(data->dataType)
+ {
+ case CA_REQUEST_DATA:
+ OIC_LOG(INFO, ANALYZER_TAG, "Data Type = [CA_REQUEST_DATA]");
+ break;
+ case CA_RESPONSE_DATA:
+ OIC_LOG(INFO, ANALYZER_TAG, "Data Type = [CA_RESPONSE_DATA]");
+ break;
+ case CA_ERROR_DATA:
+ OIC_LOG(INFO, ANALYZER_TAG, "Data Type = [CA_ERROR_DATA]");
+ break;
+ case CA_RESPONSE_FOR_RES:
+ OIC_LOG(INFO, ANALYZER_TAG, "Data Type = [CA_RESPONSE_FOR_RES]");
+ break;
+ default:
+ OIC_LOG_V(INFO, ANALYZER_TAG, "Data Type = [%d]", data->dataType);
+ break;
+ }
+
+ const CAInfo_t *info = NULL;
+ if (NULL != data->requestInfo)
+ {
+ switch(data->requestInfo->method)
+ {
+ case CA_GET:
+ OIC_LOG(INFO, ANALYZER_TAG, "Method = [GET]");
+ break;
+ case CA_POST:
+ OIC_LOG(INFO, ANALYZER_TAG, "Method = [POST]");
+ break;
+ case CA_PUT:
+ OIC_LOG(INFO, ANALYZER_TAG, "Method = [PUT]");
+ break;
+ case CA_DELETE:
+ OIC_LOG(INFO, ANALYZER_TAG, "Method = [DELETE]");
+ break;
+ default:
+ OIC_LOG_V(INFO, ANALYZER_TAG, "Method = [%d]", data->requestInfo->method);
+ break;
+ }
+ info = &data->requestInfo->info;
+ }
+
+ if (NULL != data->responseInfo)
+ {
+ OIC_LOG_V(INFO, ANALYZER_TAG, "result code = [%d]", data->responseInfo->result);
+ info = &data->responseInfo->info;
+ }
+
+ if (pdu->transport_hdr)
+ {
+ OIC_LOG_V(INFO, ANALYZER_TAG, "Msg ID = [%d]", pdu->transport_hdr->udp.id);
+ }
+
+ if (info)
+ {
+ OIC_LOG(INFO, ANALYZER_TAG, "Coap Token");
+ OIC_LOG_BUFFER(INFO, ANALYZER_TAG, (const uint8_t *) info->token, info->tokenLength);
+ OIC_TRACE_BUFFER("OIC_CA_MSG_HANDLE:CALogPDUInfo:token",
+ (const uint8_t *) info->token, info->tokenLength);
+ OIC_LOG_V(INFO, ANALYZER_TAG, "Res URI = [%s]", info->resourceUri);
+ OIC_TRACE_MARK(%s:CALogPDUInfo:uri:%s, TAG, info->resourceUri);
+
+ if (CA_FORMAT_APPLICATION_CBOR == info->payloadFormat)
+ {
+ OIC_LOG(INFO, ANALYZER_TAG, "Payload Format = [CA_FORMAT_APPLICATION_CBOR]");
+ }
+ else
+ {
+ OIC_LOG_V(INFO, ANALYZER_TAG, "Payload Format = [%d]", info->payloadFormat);
+ }
+ }
+
+ size_t payloadLen = (pdu->data) ? (unsigned char *) pdu->hdr + pdu->length - pdu->data : 0;
+ OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Message Full Size = [%u]", pdu->length);
+ OIC_LOG(INFO, ANALYZER_TAG, "CoAP Header (+ 0xFF)");
+ OIC_LOG_BUFFER(INFO, ANALYZER_TAG, (const uint8_t *) pdu->transport_hdr,
+ pdu->length - payloadLen);
+ OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Header size = [%" PRIuPTR "]", (size_t) pdu->length - payloadLen);
+
+ OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Payload");
+ OIC_LOG_BUFFER(INFO_PRIVATE, ANALYZER_TAG, pdu->data, payloadLen);
+ OIC_LOG_V(INFO, ANALYZER_TAG, "CoAP Payload Size = [%" PRIuPTR "]", payloadLen);
+ OIC_LOG(INFO, ANALYZER_TAG, "=================================================");
+
+ // samsung log
+ CASamsungLogMessage(data, pdu);
+ OIC_TRACE_END();
+}
+
+static void CASamsungLogMessage(const CAData_t *data, const coap_pdu_t *pdu)
+{
+ OIC_LOG(INFO, TAG, "CASamsungLogMessage");
+ VERIFY_NON_NULL_VOID(data, TAG, "data");
+ VERIFY_NON_NULL_VOID(pdu, TAG, "pdu");
+ VERIFY_NON_NULL_VOID(data->remoteEndpoint, TAG, "data->remoteEndpoint");
+
+ const CAInfo_t *info = NULL;
+ if (NULL != data->requestInfo)
+ {
+ info = &data->requestInfo->info;
+ }
+
+ if (NULL != data->responseInfo)
+ {
+ info = &data->responseInfo->info;
+ }
+
+ VERIFY_NON_NULL_VOID(info, TAG, "info");
+
+ memset(g_headerBuffer, 0, MAX_LOG_BUFFER_SIZE);
+ g_headerIndex = 0;
+
+ g_headerBuffer[g_headerIndex++] = data->dataType;
+ g_headerBuffer[g_headerIndex++] = '|';
+ g_headerBuffer[g_headerIndex++] = data->remoteEndpoint->adapter;
+ g_headerBuffer[g_headerIndex++] = '|';
+ g_headerBuffer[g_headerIndex++] = data->type;
+ g_headerBuffer[g_headerIndex++] = '|';
+
+ if (NULL != data->remoteEndpoint)
+ {
+ int i = 0;
+ while (data->remoteEndpoint->addr[i])
+ {
+ g_headerBuffer[g_headerIndex++] = data->remoteEndpoint->addr[i];
+ i++;
+ }
+ g_headerBuffer[g_headerIndex++] = ':';
+ g_headerBuffer[g_headerIndex++] = (data->remoteEndpoint->port >> 8) & 0x0000ff;
+ g_headerBuffer[g_headerIndex++] = data->remoteEndpoint->port & 0x000000ff;
+ }
+
+ g_headerBuffer[g_headerIndex++] = '|';
+ if (data->requestInfo)
+ {
+ g_headerBuffer[g_headerIndex++] = data->requestInfo->method;
+ }
+ else
+ {
+ g_headerBuffer[g_headerIndex++] = 0;
+ }
+
+ g_headerBuffer[g_headerIndex++] = '|';
+ if (data->responseInfo)
+ {
+ g_headerBuffer[g_headerIndex++] = data->responseInfo->result;
+ }
+ else
+ {
+ g_headerBuffer[g_headerIndex++] = 0;
+ }
+ g_headerBuffer[g_headerIndex++] = '|';
+
+ if (pdu->transport_hdr)
+ {
+ g_headerBuffer[g_headerIndex++] = (pdu->transport_hdr->udp.id >> 8) & 0x0000ff;
+ g_headerBuffer[g_headerIndex++] = pdu->transport_hdr->udp.id & 0x000000ff;
+ }
+ else
+ {
+ g_headerBuffer[g_headerIndex++] = 0;
+ g_headerBuffer[g_headerIndex++] = 0;
+ }
+ g_headerBuffer[g_headerIndex++] = '|';
+
+ if (info->token && info->tokenLength > 0)
+ {
+ for (size_t i = 0; i < info->tokenLength; i++)
+ {
+ g_headerBuffer[g_headerIndex++] = info->token[i];
+ }
+ g_headerBuffer[g_headerIndex++] = '|';
+ }
+
+ if (info->resourceUri)
+ {
+ size_t i = 0;
+ while (info->resourceUri[i])
+ {
+ g_headerBuffer[g_headerIndex++] = info->resourceUri[i];
+ i++;
+ }
+ g_headerBuffer[g_headerIndex++] = '|';
+ }
+
+ OIC_LOG_CA_BUFFER(INFO, TAG, (uint8_t *) g_headerBuffer, g_headerIndex, 1);
+ size_t payloadLen = (unsigned char *) pdu->hdr + pdu->length - pdu->data;
+ OIC_LOG_CA_BUFFER(INFO_PRIVATE, TAG, pdu->data, payloadLen, 0);
+}
+#endif
+
+#else
+static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu)
+{
+ VERIFY_NON_NULL_VOID(pdu, TAG, "pdu");
+ (void)data;
+
+ OIC_LOG_V(DEBUG, TAG, "PDU Maker - payload : %s", pdu->data);
+ OIC_LOG_V(DEBUG, TAG, "PDU Maker - type : %d", pdu->transport_hdr->udp.type);
+ OIC_LOG_V(DEBUG, TAG, "PDU Maker - code : %d", pdu->transport_hdr->udp.code);
+ OIC_LOG(DEBUG, TAG, "PDU Maker - token :");
+ OIC_LOG_BUFFER(DEBUG, TAG, pdu->transport_hdr->udp.token,
+ pdu->transport_hdr->udp.token_length);
+}
+#endif