CoAP request handling. More...
Go to the source code of this file.
Functions | |
error_t | coapServerGetMethodCode (CoapServerContext *context, CoapCode *code) |
Get request method. More... | |
error_t | coapServerGetUriPath (CoapServerContext *context, char_t *path, size_t maxLen) |
Get Uri-Path option. More... | |
error_t | coapServerGetUriQuery (CoapServerContext *context, char_t *queryString, size_t maxLen) |
Get Uri-Query option. More... | |
error_t | coapServerGetOpaqueOption (CoapServerContext *context, uint16_t optionNum, uint_t optionIndex, const uint8_t **optionValue, size_t *optionLen) |
Read an opaque option from the CoAP request. More... | |
error_t | coapServerGetStringOption (CoapServerContext *context, uint16_t optionNum, uint_t optionIndex, const char_t **optionValue, size_t *optionLen) |
Read a string option from the CoAP request. More... | |
error_t | coapServerGetUintOption (CoapServerContext *context, uint16_t optionNum, uint_t optionIndex, uint32_t *optionValue) |
Read an uint option from the CoAP request. More... | |
error_t | coapServerGetPayload (CoapServerContext *context, const uint8_t **payload, size_t *payloadLen) |
Get request payload. More... | |
error_t | coapServerReadPayload (CoapServerContext *context, void *data, size_t size, size_t *length) |
Read request payload data. More... | |
error_t | coapServerSetResponseCode (CoapServerContext *context, CoapCode code) |
Set response method. More... | |
error_t | coapServerSetLocationPath (CoapServerContext *context, const char_t *path) |
Set Location-Path option. More... | |
error_t | coapServerSetLocationQuery (CoapServerContext *context, const char_t *queryString) |
Set Location-Query option. More... | |
error_t | coapServerSetOpaqueOption (CoapServerContext *context, uint16_t optionNum, uint_t optionIndex, const uint8_t *optionValue, size_t optionLen) |
Add an opaque option to the CoAP response. More... | |
error_t | coapServerSetStringOption (CoapServerContext *context, uint16_t optionNum, uint_t optionIndex, const char_t *optionValue) |
Add a string option to the CoAP response. More... | |
error_t | coapServerSetUintOption (CoapServerContext *context, uint16_t optionNum, uint_t optionIndex, uint32_t optionValue) |
Add a uint option to the CoAP response. More... | |
error_t | coapServerDeleteOption (CoapServerContext *context, uint16_t optionNum, uint_t optionIndex) |
Remove an option from the CoAP response. More... | |
error_t | coapServerSetPayload (CoapServerContext *context, const void *payload, size_t payloadLen) |
Set response payload. More... | |
error_t | coapServerWritePayload (CoapServerContext *context, const void *data, size_t length) |
Write payload data. More... | |
Detailed Description
CoAP request handling.
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_server_request.h.
Function Documentation
◆ coapServerDeleteOption()
error_t coapServerDeleteOption | ( | CoapServerContext * | context, |
uint16_t | optionNum, | ||
uint_t | optionIndex | ||
) |
Remove an option from the CoAP response.
- Parameters
-
[in] context Pointer to the CoAP server context [in] optionNum Option number [in] optionIndex Occurrence index (for repeatable options only)
- Returns
- Error code
Definition at line 354 of file coap_server_request.c.
◆ coapServerGetMethodCode()
error_t coapServerGetMethodCode | ( | CoapServerContext * | context, |
CoapCode * | code | ||
) |
Get request method.
- Parameters
-
[in] context Pointer to the CoAP server context [out] code Method code (GET, POST, PUT or DELETE)
- Returns
- Error code
Definition at line 50 of file coap_server_request.c.
◆ coapServerGetOpaqueOption()
error_t coapServerGetOpaqueOption | ( | CoapServerContext * | context, |
uint16_t | optionNum, | ||
uint_t | optionIndex, | ||
const uint8_t ** | optionValue, | ||
size_t * | optionLen | ||
) |
Read an opaque option from the CoAP request.
- Parameters
-
[in] context Pointer to the CoAP server context [in] optionNum Option number to search for [in] optionIndex Occurrence index (for repeatable options only) [out] optionValue Pointer to the first byte of the option value [out] optionLen Length of the option, in bytes
- Returns
- Error code
Definition at line 113 of file coap_server_request.c.
◆ coapServerGetPayload()
error_t coapServerGetPayload | ( | CoapServerContext * | context, |
const uint8_t ** | payload, | ||
size_t * | payloadLen | ||
) |
Get request payload.
- Parameters
-
[in] context Pointer to the CoAP server context [out] payload Pointer to the first byte of the payload [out] payloadLen Length of the payload, in bytes
- Returns
- Error code
Definition at line 179 of file coap_server_request.c.
◆ coapServerGetStringOption()
error_t coapServerGetStringOption | ( | CoapServerContext * | context, |
uint16_t | optionNum, | ||
uint_t | optionIndex, | ||
const char_t ** | optionValue, | ||
size_t * | optionLen | ||
) |
Read a string option from the CoAP request.
- Parameters
-
[in] context Pointer to the CoAP server context [in] optionNum Option number to search for [in] optionIndex Occurrence index (for repeatable options only) [out] optionValue Pointer to the first byte of the option value [out] optionLen Length of the option, in characters
- Returns
- Error code
Definition at line 136 of file coap_server_request.c.
◆ coapServerGetUintOption()
error_t coapServerGetUintOption | ( | CoapServerContext * | context, |
uint16_t | optionNum, | ||
uint_t | optionIndex, | ||
uint32_t * | optionValue | ||
) |
Read an uint option from the CoAP request.
- Parameters
-
[in] context Pointer to the CoAP server context [in] optionNum Option number to search for [in] optionIndex Occurrence index (for repeatable options only) [out] optionValue Option value (unsigned integer)
- Returns
- Error code
Definition at line 158 of file coap_server_request.c.
◆ coapServerGetUriPath()
error_t coapServerGetUriPath | ( | CoapServerContext * | context, |
char_t * | path, | ||
size_t | maxLen | ||
) |
Get Uri-Path option.
- Parameters
-
[in] context Pointer to the CoAP server context [out] path Pointer to the buffer where to copy the path component [in] maxLen Maximum number of characters the buffer can hold
- Returns
- Error code
Definition at line 69 of file coap_server_request.c.
◆ coapServerGetUriQuery()
error_t coapServerGetUriQuery | ( | CoapServerContext * | context, |
char_t * | queryString, | ||
size_t | maxLen | ||
) |
Get Uri-Query option.
- Parameters
-
[in] context Pointer to the CoAP server context [out] queryString Pointer to the buffer where to copy the query string [in] maxLen Maximum number of characters the buffer can hold
- Returns
- Error code
Definition at line 90 of file coap_server_request.c.
◆ coapServerReadPayload()
error_t coapServerReadPayload | ( | CoapServerContext * | context, |
void * | data, | ||
size_t | size, | ||
size_t * | length | ||
) |
Read request payload data.
- Parameters
-
[in] context Pointer to the CoAP server context [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 200 of file coap_server_request.c.
◆ coapServerSetLocationPath()
error_t coapServerSetLocationPath | ( | CoapServerContext * | context, |
const char_t * | path | ||
) |
Set Location-Path option.
- Parameters
-
[in] context Pointer to the CoAP server context [in] path NULL-terminated string that contains the path component
- Returns
- Error code
Definition at line 237 of file coap_server_request.c.
◆ coapServerSetLocationQuery()
error_t coapServerSetLocationQuery | ( | CoapServerContext * | context, |
const char_t * | queryString | ||
) |
Set Location-Query option.
- Parameters
-
[in] context Pointer to the CoAP server context [in] queryString NULL-terminated string that contains the query string
- Returns
- Error code
Definition at line 257 of file coap_server_request.c.
◆ coapServerSetOpaqueOption()
error_t coapServerSetOpaqueOption | ( | CoapServerContext * | context, |
uint16_t | optionNum, | ||
uint_t | optionIndex, | ||
const uint8_t * | optionValue, | ||
size_t | optionLen | ||
) |
Add an opaque option to the CoAP response.
- Parameters
-
[in] context Pointer to the CoAP server context [in] optionNum Option number [in] optionIndex Occurrence index (for repeatable options only) [in] optionValue Pointer to the first byte of the option value [in] optionLen Length of the option, in bytes
- Returns
- Error code
Definition at line 280 of file coap_server_request.c.
◆ coapServerSetPayload()
error_t coapServerSetPayload | ( | CoapServerContext * | context, |
const void * | payload, | ||
size_t | payloadLen | ||
) |
Set response payload.
- Parameters
-
[in] context Pointer to the CoAP server context [out] payload Pointer to request payload [out] payloadLen Length of the payload, in bytes
- Returns
- Error code
Definition at line 374 of file coap_server_request.c.
◆ coapServerSetResponseCode()
error_t coapServerSetResponseCode | ( | CoapServerContext * | context, |
CoapCode | code | ||
) |
Set response method.
- Parameters
-
[in] context Pointer to the CoAP server context [in] code Response code
- Returns
- Error code
Definition at line 219 of file coap_server_request.c.
◆ coapServerSetStringOption()
error_t coapServerSetStringOption | ( | CoapServerContext * | context, |
uint16_t | optionNum, | ||
uint_t | optionIndex, | ||
const char_t * | optionValue | ||
) |
Add a string option to the CoAP response.
- Parameters
-
[in] context Pointer to the CoAP server context [in] optionNum Option number [in] optionIndex Occurrence index (for repeatable options only) [in] optionValue NULL-terminated string that contains the option value
- Returns
- Error code
Definition at line 306 of file coap_server_request.c.
◆ coapServerSetUintOption()
error_t coapServerSetUintOption | ( | CoapServerContext * | context, |
uint16_t | optionNum, | ||
uint_t | optionIndex, | ||
uint32_t | optionValue | ||
) |
Add a uint option to the CoAP response.
- Parameters
-
[in] context Pointer to the CoAP server context [in] optionNum Option number [in] optionIndex Occurrence index (for repeatable options only) [in] optionValue Option value (unsigned integer)
- Returns
- Error code
Definition at line 333 of file coap_server_request.c.
◆ coapServerWritePayload()
error_t coapServerWritePayload | ( | CoapServerContext * | context, |
const void * | data, | ||
size_t | length | ||
) |
Write payload data.
- Parameters
-
[in] context Pointer to the CoAP server context [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 398 of file coap_server_request.c.