12#ifndef ZEPHYR_INCLUDE_NET_NET_L2_H_
13#define ZEPHYR_INCLUDE_NET_NET_L2_H_
82#define NET_L2_GET_NAME(_name) _net_l2_##_name
83#define NET_L2_DECLARE_PUBLIC(_name) \
84 extern const struct net_l2 NET_L2_GET_NAME(_name)
85#define NET_L2_GET_CTX_TYPE(_name) _name##_CTX_TYPE
87#ifdef CONFIG_NET_L2_VIRTUAL
88#define VIRTUAL_L2 VIRTUAL
89NET_L2_DECLARE_PUBLIC(VIRTUAL_L2);
92#ifdef CONFIG_NET_L2_DUMMY
94#define DUMMY_L2_CTX_TYPE void*
95NET_L2_DECLARE_PUBLIC(DUMMY_L2);
98#ifdef CONFIG_NET_L2_ETHERNET
99#define ETHERNET_L2 ETHERNET
100NET_L2_DECLARE_PUBLIC(ETHERNET_L2);
103#ifdef CONFIG_NET_L2_PPP
105NET_L2_DECLARE_PUBLIC(PPP_L2);
108#ifdef CONFIG_NET_L2_IEEE802154
109#define IEEE802154_L2 IEEE802154
110NET_L2_DECLARE_PUBLIC(IEEE802154_L2);
113#ifdef CONFIG_NET_L2_BT
114#define BLUETOOTH_L2 BLUETOOTH
115#define BLUETOOTH_L2_CTX_TYPE void*
116NET_L2_DECLARE_PUBLIC(BLUETOOTH_L2);
119#ifdef CONFIG_NET_L2_OPENTHREAD
120#define OPENTHREAD_L2 OPENTHREAD
121NET_L2_DECLARE_PUBLIC(OPENTHREAD_L2);
124#ifdef CONFIG_NET_L2_CANBUS_RAW
125#define CANBUS_RAW_L2 CANBUS_RAW
126#define CANBUS_RAW_L2_CTX_TYPE void*
127NET_L2_DECLARE_PUBLIC(CANBUS_RAW_L2);
130#ifdef CONFIG_NET_L2_CANBUS
131#define CANBUS_L2 CANBUS
132NET_L2_DECLARE_PUBLIC(CANBUS_L2);
135#define NET_L2_INIT(_name, _recv_fn, _send_fn, _enable_fn, _get_flags_fn) \
136 const STRUCT_SECTION_ITERABLE(net_l2, \
137 NET_L2_GET_NAME(_name)) = { \
138 .recv = (_recv_fn), \
139 .send = (_send_fn), \
140 .enable = (_enable_fn), \
141 .get_flags = (_get_flags_fn), \
144#define NET_L2_GET_DATA(name, sfx) _net_l2_data_##name##sfx
146#define NET_L2_DATA_INIT(name, sfx, ctx_type) \
147 static ctx_type NET_L2_GET_DATA(name, sfx) __used;
149typedef int (*net_l2_send_t)(
const struct device *dev,
struct net_pkt *pkt);
151static inline int net_l2_send(net_l2_send_t send_fn,
156 net_capture_pkt(
iface, pkt);
158 return send_fn(dev, pkt);
Network packet capture definitions.
net_verdict
Net Verdict.
Definition: net_core.h:97
net_l2_flags
Definition: net_l2.h:33
@ NET_L2_POINT_TO_POINT
Definition: net_l2.h:46
@ NET_L2_MULTICAST_SKIP_JOIN_SOLICIT_NODE
Definition: net_l2.h:38
@ NET_L2_PROMISC_MODE
Definition: net_l2.h:41
@ NET_L2_MULTICAST
Definition: net_l2.h:35
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
state
Definition: http_parser_state.h:30
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
Network Interface structure.
Definition: net_if.h:468
Network L2 structure.
Definition: net_l2.h:54
int(* send)(struct net_if *iface, struct net_pkt *pkt)
Definition: net_l2.h:67
enum net_verdict(* recv)(struct net_if *iface, struct net_pkt *pkt)
Definition: net_l2.h:59
enum net_l2_flags(* get_flags)(struct net_if *iface)
Definition: net_l2.h:78
int(* enable)(struct net_if *iface, bool state)
Definition: net_l2.h:73
Network packet.
Definition: net_pkt.h:62
struct net_if * iface
Definition: net_pkt.h:85