libcoap 4.3.5-develop-72190a8
|
Internal layer I/O functions. More...
#include "coap_internal.h"
Go to the source code of this file.
Data Structures | |
struct | coap_layer_func_t |
Typedefs | |
typedef ssize_t(* | coap_layer_read_t) (coap_session_t *session, uint8_t *data, size_t datalen) |
Function read interface for layer data receiving. | |
typedef ssize_t(* | coap_layer_write_t) (coap_session_t *session, const uint8_t *data, size_t datalen) |
Function write interface for layer data sending. | |
typedef void(* | coap_layer_establish_t) (coap_session_t *session) |
Function establish interface for layer establish handling. | |
typedef void(* | coap_layer_close_t) (coap_session_t *session) |
Function close interface for layer closing. | |
Enumerations | |
enum | coap_layer_t { COAP_LAYER_SESSION , COAP_LAYER_WS , COAP_LAYER_TLS , COAP_LAYER_LAST } |
Variables | |
coap_layer_func_t | coap_layers_coap [COAP_PROTO_LAST][COAP_LAYER_LAST] |
Internal layer I/O functions.
Definition in file coap_layers_internal.h.
typedef void(* coap_layer_close_t) (coap_session_t *session) |
Function close interface for layer closing.
When this layer is properly closed, then the next layer must get called by calling session->lfunc[this_layer].l_close(session) (or done at any point when layer is closed).
session | Session being closed. |
Definition at line 104 of file coap_layers_internal.h.
typedef void(* coap_layer_establish_t) (coap_session_t *session) |
Function establish interface for layer establish handling.
If this layer is properly established on invocation, then the next layer must get called by calling session->lfunc[this_layer].l_establish(session) (or done at any point when layer is established). If the establishment of a layer fails, then coap_session_disconnected_lkd(session, COAP_NACK_xxx_LAYER_FAILED) must be called.
session | Session being established |
Definition at line 92 of file coap_layers_internal.h.
typedef ssize_t(* coap_layer_read_t) (coap_session_t *session, uint8_t *data, size_t datalen) |
Function read interface for layer data receiving.
If a called lower layer returned value is 0 or less, this must get passed back to the caller.
If the layer function consumes all the data (i.e. to handle the protocol layer requirements), then the function must return 0 to indicate no data.
Otherwise data must get updated (limited by datalen) and the number of bytes available returned.
Note: If the number of returned bytes is less that read in, then COAP_SOCKET_CAN_READ must be dropped from session->sock.flags.
session | Session to receive data on. |
data | The data to receive. |
datalen | The maximum length of data . |
Definition at line 52 of file coap_layers_internal.h.
typedef ssize_t(* coap_layer_write_t) (coap_session_t *session, const uint8_t *data, size_t datalen) |
Function write interface for layer data sending.
If a called lower layer returned value is 0 or less, this must get passed back to the caller.
If the layer function cannot transmit any data (congestion control etc.), then the function must return 0 to indicate no data sent.
It is possible that not all the data is sent (congestion control etc.), and bytes written is less that datalen.
Note: If the number of returned bytes is less that to be written, COAP_SOCKET_WANT_WRITE must be added to session->sock.flags.
session | Session to receive data on. |
data | The data to write out. |
datalen | The maximum length of data . |
Definition at line 77 of file coap_layers_internal.h.
enum coap_layer_t |
Enumerator | |
---|---|
COAP_LAYER_SESSION | |
COAP_LAYER_WS | |
COAP_LAYER_TLS | |
COAP_LAYER_LAST |
Definition at line 22 of file coap_layers_internal.h.
|
extern |
Definition at line 39 of file coap_layers.c.