libcoap 4.3.2rc2

coap_layers_internal.h
Go to the documentation of this file.
1/*
2 * coap_layers_internal.h -- Internal layer functions for libcoap
3 *
4 * Copyright (C) 2023 Jon Shallow <supjps-libcoap@jpshallow.com>
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * This file is part of the CoAP library libcoap. Please see README for terms
9 * of use.
10 */
11
17#ifndef COAP_LAYERS_INTERNAL_H_
18#define COAP_LAYERS_INTERNAL_H_
19
20#include "coap_internal.h"
21
22 typedef enum {
23 COAP_LAYER_SESSION,
24 COAP_LAYER_WS,
25 COAP_LAYER_TLS,
26 COAP_LAYER_LAST
27} coap_layer_t;
28
52 typedef ssize_t (*coap_layer_read_t)(coap_session_t *session,
53 uint8_t *data, size_t datalen);
54
77 typedef ssize_t (*coap_layer_write_t)(coap_session_t *session,
78 const uint8_t *data, size_t datalen);
92 typedef void (*coap_layer_establish_t)(coap_session_t *session);
93
104 typedef void (*coap_layer_close_t)(coap_session_t *session);
105
106 typedef struct {
107 coap_layer_read_t l_read; /* Get data from next layer (TCP) */
108 coap_layer_write_t l_write; /* Output data to next layer */
109 coap_layer_establish_t l_establish; /* Layer establish */
110 coap_layer_close_t l_close; /* Connection close */
111} coap_layer_func_t;
112
113 extern coap_layer_func_t coap_layers_coap[COAP_PROTO_LAST][COAP_LAYER_LAST];
114
115#endif /* COAP_LAYERS_INTERNAL_H_ */
coap_internal.h
Pulls together all the internal only header files.
coap_layer_close_t
void(* coap_layer_close_t)(coap_session_t *session)
Function close interface for layer closing.
Definition: coap_layers_internal.h:104
coap_layer_read_t
ssize_t(* coap_layer_read_t)(coap_session_t *session, uint8_t *data, size_t datalen)
Function read interface for layer data receiving.
Definition: coap_layers_internal.h:52
coap_layer_write_t
ssize_t(* coap_layer_write_t)(coap_session_t *session, const uint8_t *data, size_t datalen)
Function write interface for layer data sending.
Definition: coap_layers_internal.h:77
coap_layers_coap
coap_layer_func_t coap_layers_coap[COAP_PROTO_LAST][COAP_LAYER_LAST]
Definition: coap_layers.c:39
coap_layer_establish_t
void(* coap_layer_establish_t)(coap_session_t *session)
Function establish interface for layer establish handling.
Definition: coap_layers_internal.h:92
coap_layer_t
coap_layer_t
Definition: coap_layers_internal.h:22
COAP_LAYER_LAST
@ COAP_LAYER_LAST
Definition: coap_layers_internal.h:26
COAP_LAYER_SESSION
@ COAP_LAYER_SESSION
Definition: coap_layers_internal.h:23
COAP_LAYER_WS
@ COAP_LAYER_WS
Definition: coap_layers_internal.h:24
COAP_LAYER_TLS
@ COAP_LAYER_TLS
Definition: coap_layers_internal.h:25
COAP_PROTO_LAST
@ COAP_PROTO_LAST
Definition: coap_pdu.h:312
coap_layer_func_t
Definition: coap_layers_internal.h:106
coap_layer_func_t::l_read
coap_layer_read_t l_read
Definition: coap_layers_internal.h:107
coap_layer_func_t::l_write
coap_layer_write_t l_write
Definition: coap_layers_internal.h:108
coap_layer_func_t::l_establish
coap_layer_establish_t l_establish
Definition: coap_layers_internal.h:109
coap_layer_func_t::l_close
coap_layer_close_t l_close
Definition: coap_layers_internal.h:110
coap_session_t
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
Definition: coap_session_internal.h:68