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
9#pragma once
10
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include "net/netdev.h"
26#include "assert.h"
27
36static inline netdev_t *netdev_add_layer(netdev_t *top, netdev_t *dev)
37{
38 assert(top);
39 assert(dev);
40 dev->lower = top;
41 top->context = dev;
42 return dev;
43}
44
55
65
78
96int netdev_recv_pass(netdev_t *dev, void *buf, size_t len, void *info);
97
112int netdev_get_pass(netdev_t *dev, netopt_t opt, void *value, size_t max_len);
113
128int netdev_set_pass(netdev_t *dev, netopt_t opt, const void *value, size_t value_len);
129
137
138#ifdef __cplusplus
139}
140#endif
141
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:135
Definitions low-level network driver interface.
struct netdev netdev_t
Forward declaration for netdev struct.
Definition netdev.h:288
netdev_event_t
Possible event types that are send from the device driver to the upper layer.
Definition netdev.h:234
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:36
event structure
Definition event.h:145
iolist structure definition
Definition iolist.h:38
void * context
ptr to network stack context
Definition netdev.h:367