This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

openthread uri-path extraction

I am attempting to create a packet sniffer for an openthread application. I intend for it to run by sitting on the network and processing all packets with the coap_deafult_handler function (as set by otCoapSetDefaultHandler).

Is there a way to extract the Uri-Path from the header when the message is received by the packet sniffer?

If there is not would it be possible to extract any other information stored in by the message to determine what the message is and where it is from?

Thanks,

Richard

Parents
  • Thanks a lot Lukasz, I have now managed to create a packet sniffer following the example shown in core coap implementation: code shown below:

    otCoapOption* option;
    option = otCoapHeaderGetFirstOption(p_header);
    while(option != NULL)
    {
        switch (option->mNumber)
        {
            case OT_COAP_OPTION_URI_PATH:
                ;
                const uint8_t* optionValue =  option->mValue;
                NRF_LOG_INFO("Uri-Path: %s\r\n", nrf_log_push((char*) optionValue));
                break;
            default:
                break;
        }
        option = otCoapHeaderGetNextOption(p_header);
    }
    

    Many thanks,

    Richard

Reply
  • Thanks a lot Lukasz, I have now managed to create a packet sniffer following the example shown in core coap implementation: code shown below:

    otCoapOption* option;
    option = otCoapHeaderGetFirstOption(p_header);
    while(option != NULL)
    {
        switch (option->mNumber)
        {
            case OT_COAP_OPTION_URI_PATH:
                ;
                const uint8_t* optionValue =  option->mValue;
                NRF_LOG_INFO("Uri-Path: %s\r\n", nrf_log_push((char*) optionValue));
                break;
            default:
                break;
        }
        option = otCoapHeaderGetNextOption(p_header);
    }
    

    Many thanks,

    Richard

Children
No Data
Related