coap_debug.c File Reference

Data logging functions for debugging purpose (CoAP) More...

#include "core/net.h"
#include "coap/coap_client.h"
#include "coap/coap_server.h"
#include "coap/coap_debug.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   COAP_TRACE_LEVEL
 

Functions

error_t coapDumpMessage (const void *message, size_t length)
 Dump CoAP message for debugging purpose. More...
 
error_t coapDumpMessageHeader (const uint8_t *p, size_t length, size_t *consumed)
 Dump CoAP message header. More...
 
error_t coapDumpOptions (const uint8_t *p, size_t length, size_t *consumed)
 Dump the list of CoAP options. More...
 
error_t coapDumpOption (const CoapOption *option)
 Dump CoAP option. More...
 
const char_tcoapGetParamName (uint_t value, const CoapParamName *paramList, size_t paramListLen)
 Convert a parameter to string representation. More...
 

Variables

const CoapParamName coapTypeList []
 
const CoapParamName coapCodeList []
 
const CoapParamName coapObserveList []
 
const CoapParamName coapContentFormatList []
 

Detailed Description

Data logging functions for debugging purpose (CoAP)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file coap_debug.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   COAP_TRACE_LEVEL

Definition at line 32 of file coap_debug.c.

Function Documentation

◆ coapDumpMessage()

error_t coapDumpMessage ( const void *  message,
size_t  length 
)

Dump CoAP message for debugging purpose.

Parameters
[in]messagePointer to the CoAP message
[in]lengthLength of the message, in bytes
Returns
Error code

Definition at line 122 of file coap_debug.c.

◆ coapDumpMessageHeader()

error_t coapDumpMessageHeader ( const uint8_t *  p,
size_t  length,
size_t *  consumed 
)

Dump CoAP message header.

Parameters
[in]pInput stream where to read the CoAP message header
[in]lengthNumber of bytes available in the input stream
[out]consumedTotal number of bytes that have been consumed
Returns
Error code

Definition at line 182 of file coap_debug.c.

◆ coapDumpOption()

error_t coapDumpOption ( const CoapOption option)

Dump CoAP option.

Parameters
[out]optionCoAP option content
Returns
Error code

Definition at line 288 of file coap_debug.c.

◆ coapDumpOptions()

error_t coapDumpOptions ( const uint8_t *  p,
size_t  length,
size_t *  consumed 
)

Dump the list of CoAP options.

Parameters
[in]pInput stream where to read the CoAP options
[in]lengthNumber of bytes available in the input stream
[out]consumedTotal number of bytes that have been consumed
Returns
Error code

Definition at line 234 of file coap_debug.c.

◆ coapGetParamName()

const char_t* coapGetParamName ( uint_t  value,
const CoapParamName paramList,
size_t  paramListLen 
)

Convert a parameter to string representation.

Parameters
[in]valueParameter value
[in]paramListList of acceptable parameters
[in]paramListLenNumber of entries in the list
Returns
NULL-terminated string describing the parameter

Definition at line 402 of file coap_debug.c.

Variable Documentation

◆ coapCodeList

const CoapParamName coapCodeList[]

Definition at line 54 of file coap_debug.c.

◆ coapContentFormatList

const CoapParamName coapContentFormatList[]
Initial value:
=
{
{COAP_CONTENT_FORMAT_APP_LINK_FORMAT, "application/link-format"},
{COAP_CONTENT_FORMAT_APP_XML, "application/xml"},
{COAP_CONTENT_FORMAT_APP_OCTET_STREAM, "application/octet-stream"},
{COAP_CONTENT_FORMAT_APP_EXI, "application/exi"},
{COAP_CONTENT_FORMAT_APP_JSON, "application/json"}
}

Definition at line 104 of file coap_debug.c.

◆ coapObserveList

const CoapParamName coapObserveList[]
Initial value:
=
{
{COAP_OBSERVE_REGISTER, "Register"},
{COAP_OBSERVE_DEREGISTER, "Deregister"}
}

Definition at line 97 of file coap_debug.c.

◆ coapTypeList

const CoapParamName coapTypeList[]
Initial value:
=
{
{COAP_TYPE_CON, "CON"},
{COAP_TYPE_NON, "NON"},
{COAP_TYPE_ACK, "ACK"},
{COAP_TYPE_RST, "RST"}
}

Definition at line 45 of file coap_debug.c.

@ COAP_CONTENT_FORMAT_APP_OCTET_STREAM
Definition: coap_option.h:153
@ COAP_OBSERVE_REGISTER
Definition: coap_option.h:136
@ COAP_CONTENT_FORMAT_APP_LINK_FORMAT
Definition: coap_option.h:151
@ COAP_CONTENT_FORMAT_APP_JSON
Definition: coap_option.h:155
@ COAP_TYPE_ACK
Acknowledgment message.
Definition: coap_common.h:91
@ COAP_OBSERVE_DEREGISTER
Definition: coap_option.h:137
@ COAP_CONTENT_FORMAT_APP_EXI
Definition: coap_option.h:154
@ COAP_TYPE_CON
Confirmable message.
Definition: coap_common.h:89
@ COAP_CONTENT_FORMAT_APP_XML
Definition: coap_option.h:152
@ COAP_TYPE_RST
Reset message.
Definition: coap_common.h:92
@ COAP_CONTENT_FORMAT_TEXT_PLAIN
Definition: coap_option.h:147
@ COAP_TYPE_NON
Non-confirmable message.
Definition: coap_common.h:90