Loading...
Searching...
No Matches
layer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Koen Zandberg <koen@bergzand.net>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for more
6 * details.
7 */
8
19#ifndef NET_NETDEV_LAYER_H
20#define NET_NETDEV_LAYER_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include "net/netdev.h"
27#include "assert.h"
28
37static inline netdev_t *netdev_add_layer(netdev_t *top, netdev_t *dev)
38{
39 assert(top);
40 assert(dev);
41 dev->lower = top;
42 top->context = dev;
43 return dev;
44}
45
56
66
79
97int netdev_recv_pass(netdev_t *dev, void *buf, size_t len, void *info);
98
113int netdev_get_pass(netdev_t *dev, netopt_t opt, void *value, size_t max_len);
114
129int netdev_set_pass(netdev_t *dev, netopt_t opt, const void *value, size_t value_len);
130
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif /* NET_NETDEV_LAYER_H */
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:137
Definitions low-level network driver interface.
netdev_event_t
Possible event types that are send from the device driver to the upper layer.
Definition netdev.h:235
netopt_t
Global list of configuration options available throughout the network stack, e.g.
Definition netopt.h:45
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:37
event structure
Definition event.h:148
iolist structure definition
Definition iolist.h:39
Structure to hold driver state.
Definition netdev.h:362
void * context
ptr to network stack context
Definition netdev.h:365