Loading...
Searching...
No Matches
layer.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Koen Zandberg <koen@bergzand.net>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#include "net/netdev.h"
23#include "assert.h"
24
33static inline netdev_t *netdev_add_layer(netdev_t *top, netdev_t *dev)
34{
35 assert(top);
36 assert(dev);
37 dev->lower = top;
38 top->context = dev;
39 return dev;
40}
41
52
62
75
93int netdev_recv_pass(netdev_t *dev, void *buf, size_t len, void *info);
94
109int netdev_get_pass(netdev_t *dev, netopt_t opt, void *value, size_t max_len);
110
125int netdev_set_pass(netdev_t *dev, netopt_t opt, const void *value, size_t value_len);
126
134
135#ifdef __cplusplus
136}
137#endif
138
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:143
Definitions low-level network driver interface.
struct netdev netdev_t
Forward declaration for netdev struct.
Definition netdev.h:285
netdev_event_t
Possible event types that are send from the device driver to the upper layer.
Definition netdev.h:231
netopt_t
Global list of configuration options available throughout the network stack, e.g.
Definition netopt.h:44
struct iolist iolist_t
iolist forward declaration
Definition iolist.h:33
int netdev_init_pass(netdev_t *dev)
Passthrough init function.
void netdev_event_cb_pass(netdev_t *dev, netdev_event_t event)
Passthrough event callback function.
void netdev_isr_pass(netdev_t *dev)
Passthrough isr function.
int netdev_send_pass(netdev_t *dev, const iolist_t *iolist)
Passthrough send function.
int netdev_recv_pass(netdev_t *dev, void *buf, size_t len, void *info)
Passthrough recv function.
int netdev_set_pass(netdev_t *dev, netopt_t opt, const void *value, size_t value_len)
Passthrough set function.
int netdev_get_pass(netdev_t *dev, netopt_t opt, void *value, size_t max_len)
Passthrough get function.
static netdev_t * netdev_add_layer(netdev_t *top, netdev_t *dev)
Add a netdev layer to the netdev layer stack.
Definition layer.h:33
event structure
Definition event.h:145
iolist structure definition
Definition iolist.h:38
void * context
ptr to network stack context
Definition netdev.h:365