13#ifndef ZEPHYR_INCLUDE_NET_CAPTURE_H_
14#define ZEPHYR_INCLUDE_NET_CAPTURE_H_
35struct net_capture_interface_api {
39 int (*cleanup)(
const struct device *dev);
42 int (*enable)(
const struct device *dev,
struct net_if *iface);
45 int (*disable)(
const struct device *dev);
72int net_capture_setup(
const char *remote_addr,
const char *my_local_addr,
const char *peer_addr,
73 const struct device **dev);
88#if defined(CONFIG_NET_CAPTURE)
89 const struct net_capture_interface_api *api =
90 (
const struct net_capture_interface_api *)dev->
api;
92 return api->cleanup(dev);
114#if defined(CONFIG_NET_CAPTURE)
115 const struct net_capture_interface_api *api =
116 (
const struct net_capture_interface_api *)dev->
api;
118 return api->enable(dev, iface);
136#if defined(CONFIG_NET_CAPTURE)
137 const struct net_capture_interface_api *api =
138 (
const struct net_capture_interface_api *)dev->
api;
140 return api->is_enabled(dev);
157#if defined(CONFIG_NET_CAPTURE)
158 const struct net_capture_interface_api *api =
159 (
const struct net_capture_interface_api *)dev->
api;
161 return api->disable(dev);
180static inline int net_capture_send(
const struct device *dev,
struct net_if *iface,
183#if defined(CONFIG_NET_CAPTURE)
184 const struct net_capture_interface_api *api =
185 (
const struct net_capture_interface_api *)dev->
api;
187 return api->send(dev, iface, pkt);
204#if defined(CONFIG_NET_CAPTURE)
205void net_capture_pkt(
struct net_if *iface,
struct net_pkt *pkt);
207static inline void net_capture_pkt(
struct net_if *iface,
struct net_pkt *pkt)
214struct net_capture_info {
215 const struct device *capture_dev;
216 struct net_if *capture_iface;
217 struct net_if *tunnel_iface;
230typedef void (*net_capture_cb_t)(
struct net_capture_info *info,
void *user_data);
241#if defined(CONFIG_NET_CAPTURE)
242void net_capture_foreach(net_capture_cb_t cb,
void *user_data);
244static inline void net_capture_foreach(net_capture_cb_t cb,
void *user_data)
247 ARG_UNUSED(user_data);
static ssize_t send(int sock, const void *buf, size_t len, int flags)
POSIX wrapper for zsock_send.
Definition: socket.h:803
static int net_capture_disable(const struct device *dev)
Disable network packet capturing support.
Definition: capture.h:155
static bool net_capture_is_enabled(const struct device *dev)
Is network packet capture enabled or disabled.
Definition: capture.h:134
static int net_capture_cleanup(const struct device *dev)
Cleanup network packet capturing support.
Definition: capture.h:86
int net_capture_setup(const char *remote_addr, const char *my_local_addr, const char *peer_addr, const struct device **dev)
Setup network packet capturing support.
static int net_capture_enable(const struct device *dev, struct net_if *iface)
Enable network packet capturing support.
Definition: capture.h:112
#define ENOTSUP
Unsupported value.
Definition: errno.h:115
#define bool
Definition: stdbool.h:13
Runtime device structure (in ROM) per driver instance.
Definition: device.h:381
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:387
Network Interface structure.
Definition: net_if.h:595
Network packet.
Definition: net_pkt.h:63
Generic sockaddr struct.
Definition: net_ip.h:347