CoAP message formatting and parsing. More...
Go to the source code of this file.
Data Structures | |
struct | CoapMessage |
CoAP message. More... | |
Macros | |
#define | COAP_MAX_MSG_SIZE 1152 |
Detailed Description
CoAP message formatting and parsing.
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.
- Version
- 2.4.4
Definition in file coap_message.h.
Macro Definition Documentation
◆ COAP_MAX_MSG_SIZE
#define COAP_MAX_MSG_SIZE 1152 |
Definition at line 40 of file coap_message.h.
Function Documentation
◆ coapCompareToken()
bool_t coapCompareToken | ( | const CoapMessageHeader * | header1, |
const CoapMessageHeader * | header2 | ||
) |
Token comparison.
- Parameters
-
[in] header1 Pointer to the first CoAP message header [in] header2 Pointer to the second CoAP message header
- Returns
- TRUE if the tokens match, else FALSE
Definition at line 547 of file coap_message.c.
◆ coapGetCode()
error_t coapGetCode | ( | const CoapMessage * | message, |
CoapCode * | code | ||
) |
Get method or response code.
- Parameters
-
[in] message Pointer to the CoAP message [out] code Method or response code
- Returns
- Error code
Definition at line 226 of file coap_message.c.
◆ coapGetPayload()
error_t coapGetPayload | ( | const CoapMessage * | message, |
const uint8_t ** | payload, | ||
size_t * | payloadLen | ||
) |
Get CoAP message payload.
- Parameters
-
[in] message Pointer to the CoAP message [out] payload Pointer to the first byte of the payload [out] payloadLen Length of the payload, in bytes
- Returns
- Error code
Definition at line 324 of file coap_message.c.
◆ coapGetType()
error_t coapGetType | ( | const CoapMessage * | message, |
CoapMessageType * | type | ||
) |
Get message type.
- Parameters
-
[in] message Pointer to the CoAP message [out] type Message type
- Returns
- Error code
Definition at line 176 of file coap_message.c.
◆ coapParseMessage()
error_t coapParseMessage | ( | const CoapMessage * | message | ) |
Parse CoAP message.
- Parameters
-
[in] message Pointer to the CoAP message
- Returns
- Error code
Definition at line 51 of file coap_message.c.
◆ coapParseMessageHeader()
error_t coapParseMessageHeader | ( | const uint8_t * | p, |
size_t | length, | ||
size_t * | consumed | ||
) |
Parse CoAP message header.
- Parameters
-
[in] p Input stream where to read the CoAP message header [in] length Number of bytes available in the input stream [out] consumed Total number of bytes that have been consumed
- Returns
- Error code
Definition at line 112 of file coap_message.c.
◆ coapReadPayload()
error_t coapReadPayload | ( | CoapMessage * | message, |
void * | data, | ||
size_t | size, | ||
size_t * | length | ||
) |
Read payload data.
- Parameters
-
[in] message Pointer to the CoAP message [out] data Buffer into which received data will be placed [in] size Maximum number of bytes that can be received [out] length Number of bytes that have been received
- Returns
- Error code
Definition at line 468 of file coap_message.c.
◆ coapSetCode()
error_t coapSetCode | ( | CoapMessage * | message, |
CoapCode | code | ||
) |
Set method or response code.
- Parameters
-
[in] message Pointer to the CoAP message [in] code Method or response code
- Returns
- Error code
Definition at line 201 of file coap_message.c.
◆ coapSetPayload()
error_t coapSetPayload | ( | CoapMessage * | message, |
const void * | payload, | ||
size_t | payloadLen | ||
) |
Set CoAP message payload.
- Parameters
-
[in] message Pointer to the CoAP message [out] payload Pointer to payload data [out] payloadLen Length of the payload, in bytes
- Returns
- Error code
Definition at line 252 of file coap_message.c.
◆ coapSetType()
error_t coapSetType | ( | CoapMessage * | message, |
CoapMessageType | type | ||
) |
Set message type.
- Parameters
-
[in] message Pointer to the CoAP message [in] type Message type (Confirmable or Non-confirmable)
- Returns
- Error code
Definition at line 151 of file coap_message.c.
◆ coapWritePayload()
error_t coapWritePayload | ( | CoapMessage * | message, |
const void * | data, | ||
size_t | length | ||
) |
Write payload data.
- Parameters
-
[in] message Pointer to the CoAP message [in] data Pointer to a buffer containing the data to be written [in] length Number of bytes to written
- Returns
- Error code
Definition at line 386 of file coap_message.c.