Loading...
Searching...
No Matches
client.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024-2026 Carl Seifert
3 * SPDX-FileCopyrightText: 2024-2026 TU Dresden
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
9#include <stdbool.h>
10#include <stdint.h>
11
12#include "xfa.h"
13#include "ztimer.h"
14#include "event.h"
15
17#include "net/unicoap/message.h"
20
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36/* MARK: - Customizing request behavior */
60
65
66
70typedef struct {
75
81 uint32_t timeout_ms;
83
84
85/* MARK: - Sending a request */
118typedef int (*unicoap_response_callback_t)(const unicoap_message_t* response,
119 const unicoap_aux_t* aux, int error, void* arg);
120
149 unicoap_destination_t* destination,
153
180 unicoap_destination_t* destination,
184
229 unicoap_destination_t* destination,
230 unicoap_message_t* response,
233 unicoap_aux_t* aux); /* end of section */ /* end of group */
236
237/* MARK: - Cancellation */
246
260 /* end of section */ /* end of group */
263
264#ifdef __cplusplus
265}
266#endif
Constants used in CoAP such as option numbers and message codes.
int unicoap_cancel_request(int refno)
Cancels request with reference number.
int unicoap_send_request_async(unicoap_message_t *request, unicoap_destination_t *destination, unicoap_response_callback_t callback, unicoap_request_parameters_t *parameters, unicoap_request_flags_t flags)
Sends a request asynchronously.
int(* unicoap_response_callback_t)(const unicoap_message_t *response, const unicoap_aux_t *aux, int error, void *arg)
Response or error callback.
Definition client.h:118
int unicoap_send_request_sync(unicoap_message_t *request, unicoap_destination_t *destination, unicoap_response_callback_t callback, unicoap_request_parameters_t *parameters, unicoap_request_flags_t flags)
Sends a request synchronously.
int unicoap_send_request_sync_copy(unicoap_message_t *request, unicoap_destination_t *destination, unicoap_message_t *response, unicoap_request_parameters_t *parameters, unicoap_request_flags_t flags, unicoap_aux_t *aux)
Sends a request synchronously and copies the request to the given buffer.
void unicoap_print_request_flags(unicoap_request_flags_t flags)
Prints request flags.
unicoap_request_flags_t
Flags for enabling advanced features in client exchanges.
Definition client.h:47
@ UNICOAP_REQUEST_FLAG_RELIABLE
Sets the type of the message to confirmable (CON), if the endpoint uses a non-reliable transport such...
Definition client.h:58
CoAP Message API.
Auxiliary exchange information.
Definition transport.h:808
A type abstracting over CoAP resource identifiers.
Definition transport.h:421
Generic CoAP message.
Definition message.h:72
Additional parameters to customize request behavior.
Definition client.h:70
uint32_t timeout_ms
Response timeout in milliseconds.
Definition client.h:81
void * callback_arg
Opaque argument passed to callback both in success and failure cases.
Definition client.h:74
CoAP transport protocol abstraction layer.
Utility macros for unicoap
Cross File Arrays.
ztimer API