12#ifndef ZEPHYR_INCLUDE_NET_COAP_CLIENT_H_
13#define ZEPHYR_INCLUDE_NET_COAP_CLIENT_H_
26#define MAX_COAP_MSG_LEN (CONFIG_COAP_CLIENT_MESSAGE_HEADER_SIZE + \
27 CONFIG_COAP_CLIENT_MESSAGE_SIZE)
47 size_t offset,
const uint8_t *payload,
size_t len,
48 bool last_block,
void *user_data);
72#if defined(CONFIG_COAP_EXTENDED_OPTIONS_LEN)
86struct coap_client_internal_request {
87 uint8_t request_token[COAP_TOKEN_MAX_LEN];
98 uint8_t request_tag[COAP_TOKEN_MAX_LEN];
102 int last_response_id;
113 struct coap_client_internal_request requests[CONFIG_COAP_CLIENT_MAX_REQUESTS];
long atomic_t
Definition: atomic_types.h:15
CoAP implementation for Zephyr.
int coap_client_req(struct coap_client *client, int sock, const struct sockaddr *addr, struct coap_client_request *req, struct coap_transmission_parameters *params)
Send CoAP request.
void coap_client_cancel_requests(struct coap_client *client)
Cancel all current requests.
#define MAX_COAP_MSG_LEN
Maximum size of a CoAP message.
Definition: coap_client.h:26
int coap_client_init(struct coap_client *client, const char *info)
Initialize the CoAP client.
void(* coap_client_response_cb_t)(int16_t result_code, size_t offset, const uint8_t *payload, size_t len, bool last_block, void *user_data)
Callback for CoAP request.
Definition: coap_client.h:46
coap_method
Available request methods.
Definition: coap.h:75
coap_content_format
Set of Content-Format option values for CoAP.
Definition: coap.h:213
size_t socklen_t
Length of a socket address.
Definition: net_ip.h:168
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
__INT16_TYPE__ int16_t
Definition: stdint.h:73
Represents the current state of a block-wise transaction.
Definition: coap.h:750
Representation of extra options for the CoAP client request.
Definition: coap_client.h:69
uint16_t code
Option code.
Definition: coap_client.h:71
uint8_t value[12]
Buffer for the length.
Definition: coap_client.h:81
uint8_t len
Option len.
Definition: coap_client.h:79
Representation of a CoAP client request.
Definition: coap_client.h:53
uint8_t num_options
Number of extra options.
Definition: coap_client.h:62
size_t len
Length of the payload.
Definition: coap_client.h:59
enum coap_method method
Method of the request.
Definition: coap_client.h:54
bool confirmable
CoAP Confirmable/Non-confirmable message.
Definition: coap_client.h:55
const char * path
Path of the requested resource.
Definition: coap_client.h:56
struct coap_client_option * options
Extra options to be added to request.
Definition: coap_client.h:61
void * user_data
User provided context.
Definition: coap_client.h:63
enum coap_content_format fmt
Content format to be used.
Definition: coap_client.h:57
uint8_t * payload
User allocated buffer for send request.
Definition: coap_client.h:58
coap_client_response_cb_t cb
Callback when response received.
Definition: coap_client.h:60
Representation of a CoAP option.
Definition: coap.h:314
Representation of a CoAP Packet.
Definition: coap.h:295
Represents a request awaiting for an acknowledgment (ACK).
Definition: coap.h:352
CoAP transmission parameters.
Definition: coap.h:340
Mutex Structure.
Definition: kernel.h:2917
Generic sockaddr struct.
Definition: net_ip.h:385