CoAP client. More...
#include <stdlib.h>#include "core/net.h"#include "coap/coap_client.h"#include "coap/coap_client_transport.h"#include "coap/coap_client_misc.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 | coapClientInit (CoapClientContext *context) |
| Initialize CoAP client context. More... | |
| error_t | coapClientSetTransportProtocol (CoapClientContext *context, CoapTransportProtocol transportProtocol) |
| Set the transport protocol to be used. More... | |
| error_t | coapClientRegisterDtlsInitCallback (CoapClientContext *context, CoapClientDtlsInitCallback callback) |
| Register DTLS initialization callback function. More... | |
| error_t | coapClientSetTimeout (CoapClientContext *context, systime_t timeout) |
| Set default request timeout. More... | |
| error_t | coapClientSetTokenLength (CoapClientContext *context, size_t length) |
| Set the length of the token. More... | |
| error_t | coapClientBindToInterface (CoapClientContext *context, NetInterface *interface) |
| Bind the CoAP client to a particular network interface. More... | |
| error_t | coapClientConnect (CoapClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort) |
| Establish connection with the CoAP server. More... | |
| error_t | coapClientTask (CoapClientContext *context, systime_t timeout) |
| Process CoAP client events. More... | |
| error_t | coapClientDisconnect (CoapClientContext *context) |
| Disconnect from the CoAP server. More... | |
| void | coapClientDeinit (CoapClientContext *context) |
| Release CoAP client context. More... | |
Detailed Description
CoAP client.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 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.5.4
Definition in file coap_client.c.
Macro Definition Documentation
◆ TRACE_LEVEL
| #define TRACE_LEVEL COAP_TRACE_LEVEL |
Definition at line 32 of file coap_client.c.
Function Documentation
◆ coapClientBindToInterface()
| error_t coapClientBindToInterface | ( | CoapClientContext * | context, |
| NetInterface * | interface | ||
| ) |
Bind the CoAP client to a particular network interface.
- Parameters
-
[in] context Pointer to the CoAP client context [in] interface Network interface to be used
- Returns
- Error code
Definition at line 240 of file coap_client.c.
◆ coapClientConnect()
| error_t coapClientConnect | ( | CoapClientContext * | context, |
| const IpAddr * | serverIpAddr, | ||
| uint16_t | serverPort | ||
| ) |
Establish connection with the CoAP server.
- Parameters
-
[in] context Pointer to the CoAP client context [in] serverIpAddr IP address of the CoAP server to connect to [in] serverPort UDP port number that will be used
- Returns
- Error code
Definition at line 267 of file coap_client.c.
◆ coapClientDeinit()
| void coapClientDeinit | ( | CoapClientContext * | context | ) |
Release CoAP client context.
- Parameters
-
[in] context Pointer to the CoAP client context
Definition at line 438 of file coap_client.c.
◆ coapClientDisconnect()
| error_t coapClientDisconnect | ( | CoapClientContext * | context | ) |
Disconnect from the CoAP server.
- Parameters
-
[in] context Pointer to the CoAP client context
- Returns
- Error code
Definition at line 399 of file coap_client.c.
◆ coapClientInit()
| error_t coapClientInit | ( | CoapClientContext * | context | ) |
Initialize CoAP client context.
- Parameters
-
[in] context Pointer to the CoAP client context
- Returns
- Error code
Definition at line 53 of file coap_client.c.
◆ coapClientRegisterDtlsInitCallback()
| error_t coapClientRegisterDtlsInitCallback | ( | CoapClientContext * | context, |
| CoapClientDtlsInitCallback | callback | ||
| ) |
Register DTLS initialization callback function.
- Parameters
-
[in] context Pointer to the CoAP client context [in] callback DTLS initialization callback function
- Returns
- Error code
Definition at line 158 of file coap_client.c.
◆ coapClientSetTimeout()
| error_t coapClientSetTimeout | ( | CoapClientContext * | context, |
| systime_t | timeout | ||
| ) |
Set default request timeout.
- Parameters
-
[in] context Pointer to the CoAP client context [in] timeout Timeout value, in milliseconds
- Returns
- Error code
Definition at line 186 of file coap_client.c.
◆ coapClientSetTokenLength()
| error_t coapClientSetTokenLength | ( | CoapClientContext * | context, |
| size_t | length | ||
| ) |
Set the length of the token.
- Parameters
-
[in] context Pointer to the CoAP client context [in] length Token length
- Returns
- Error code
Definition at line 211 of file coap_client.c.
◆ coapClientSetTransportProtocol()
| error_t coapClientSetTransportProtocol | ( | CoapClientContext * | context, |
| CoapTransportProtocol | transportProtocol | ||
| ) |
Set the transport protocol to be used.
- Parameters
-
[in] context Pointer to the CoAP client context [in] transportProtocol Transport protocol to be used (UDP or DTLS)
- Returns
- Error code
Definition at line 130 of file coap_client.c.
◆ coapClientTask()
| error_t coapClientTask | ( | CoapClientContext * | context, |
| systime_t | timeout | ||
| ) |
Process CoAP client events.
- Parameters
-
[in] context Pointer to the CoAP client context [in] timeout Maximum time to wait before returning
- Returns
- Error code
Definition at line 373 of file coap_client.c.
