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
23 extern "C" {
24 #endif
25 
26 #include "net/netdev.h"
27 #include "assert.h"
28 
37 static 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 
55 int netdev_init_pass(netdev_t *dev);
56 
65 void netdev_isr_pass(netdev_t *dev);
66 
78 int netdev_send_pass(netdev_t *dev, const iolist_t *iolist);
79 
97 int netdev_recv_pass(netdev_t *dev, void *buf, size_t len, void *info);
98 
113 int netdev_get_pass(netdev_t *dev, netopt_t opt, void *value, size_t max_len);
114 
129 int 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 */
144 
netopt_t
netopt_t
Global list of configuration options available throughout the network stack, e.g.
Definition: netopt.h:50
netdev_isr_pass
void netdev_isr_pass(netdev_t *dev)
Passthrough isr function.
assert
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:104
netdev_event_t
netdev_event_t
Possible event types that are send from the device driver to the upper layer.
Definition: netdev.h:234
assert.h
POSIX.1-2008 compliant version of the assert macro.
event
event structure
Definition: event.h:142
netdev_add_layer
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
netdev_get_pass
int netdev_get_pass(netdev_t *dev, netopt_t opt, void *value, size_t max_len)
Passthrough get function.
netdev_recv_pass
int netdev_recv_pass(netdev_t *dev, void *buf, size_t len, void *info)
Passthrough recv function.
netdev::context
void * context
ptr to network stack context
Definition: netdev.h:305
netdev.h
Definitions low-level network driver interface.
netdev_set_pass
int netdev_set_pass(netdev_t *dev, netopt_t opt, const void *value, size_t value_len)
Passthrough set function.
netdev_init_pass
int netdev_init_pass(netdev_t *dev)
Passthrough init function.
iolist
iolist structure definition
Definition: iolist.h:39
netdev
Structure to hold driver state.
Definition: netdev.h:302
netdev_event_cb_pass
void netdev_event_cb_pass(netdev_t *dev, netdev_event_t event)
Passthrough event callback function.
netdev_send_pass
int netdev_send_pass(netdev_t *dev, const iolist_t *iolist)
Passthrough send function.