Loading...
Searching...
No Matches
coap_layers_internal.h
Go to the documentation of this file.
/*
* coap_layers_internal.h -- Internal layer functions for libcoap
*
* Copyright (C) 2023 Jon Shallow <supjps-libcoap@jpshallow.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#ifndef COAP_LAYERS_INTERNAL_H_
#define COAP_LAYERS_INTERNAL_H_
#include "coap_internal.h"
typedef enum {
COAP_LAYER_SESSION,
COAP_LAYER_WS,
COAP_LAYER_TLS,
COAP_LAYER_LAST
} coap_layer_t;
typedef ssize_t (*coap_layer_read_t)(coap_session_t *session,
uint8_t *data, size_t datalen);
typedef ssize_t (*coap_layer_write_t)(coap_session_t *session,
const uint8_t *data, size_t datalen);
typedef void (*coap_layer_establish_t)(coap_session_t *session);
typedef void (*coap_layer_close_t)(coap_session_t *session);
typedef struct {
coap_layer_read_t l_read; /* Get data from next layer (TCP) */
coap_layer_write_t l_write; /* Output data to next layer */
coap_layer_establish_t l_establish; /* Layer establish */
coap_layer_close_t l_close; /* Connection close */
} coap_layer_func_t;
extern coap_layer_func_t coap_layers_coap[COAP_PROTO_LAST][COAP_LAYER_LAST];
#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