13#ifndef ZEPHYR_INCLUDE_NET_CAPTURE_H_
14#define ZEPHYR_INCLUDE_NET_CAPTURE_H_
36struct net_capture_interface_api {
40 int (*cleanup)(
const struct device *dev);
43 int (*enable)(
const struct device *dev,
struct net_if *iface);
46 int (*disable)(
const struct device *dev);
73int net_capture_setup(
const char *remote_addr,
const char *my_local_addr,
const char *peer_addr,
74 const struct device **dev);
89#if defined(CONFIG_NET_CAPTURE)
90 const struct net_capture_interface_api *api =
91 (
const struct net_capture_interface_api *)dev->
api;
93 return api->cleanup(dev);
115#if defined(CONFIG_NET_CAPTURE)
116 const struct net_capture_interface_api *api =
117 (
const struct net_capture_interface_api *)dev->
api;
119 return api->enable(dev, iface);
138#if defined(CONFIG_NET_CAPTURE)
139 const struct net_capture_interface_api *api;
149 api = (
const struct net_capture_interface_api *)dev->
api;
151 return api->is_enabled(dev);
168#if defined(CONFIG_NET_CAPTURE)
169 const struct net_capture_interface_api *api =
170 (
const struct net_capture_interface_api *)dev->
api;
172 return api->disable(dev);
191static inline int net_capture_send(
const struct device *dev,
struct net_if *iface,
194#if defined(CONFIG_NET_CAPTURE)
195 const struct net_capture_interface_api *api =
196 (
const struct net_capture_interface_api *)dev->
api;
198 return api->send(dev, iface, pkt);
215#if defined(CONFIG_NET_CAPTURE)
216void net_capture_pkt(
struct net_if *iface,
struct net_pkt *pkt);
218static inline void net_capture_pkt(
struct net_if *iface,
struct net_pkt *pkt)
236#if defined(CONFIG_NET_CAPTURE)
237int net_capture_pkt_with_status(
struct net_if *iface,
struct net_pkt *pkt);
239static inline int net_capture_pkt_with_status(
struct net_if *iface,
struct net_pkt *pkt)
251enum net_capture_packet_type {
253 NET_CAPTURE_BROADCAST,
254 NET_CAPTURE_MULTICAST,
255 NET_CAPTURE_OTHERHOST,
256 NET_CAPTURE_OUTGOING,
259#define NET_CAPTURE_LL_ADDRLEN 8
262struct net_capture_cooked {
268 uint8_t addr[NET_CAPTURE_LL_ADDRLEN];
281#if defined(CONFIG_NET_CAPTURE_COOKED_MODE)
282int net_capture_cooked_setup(
struct net_capture_cooked *ctx,
287static inline int net_capture_cooked_setup(
struct net_capture_cooked *ctx,
315#if defined(CONFIG_NET_CAPTURE_COOKED_MODE)
316void net_capture_data(
struct net_capture_cooked *ctx,
318 enum net_capture_packet_type type,
321static inline void net_capture_data(
struct net_capture_cooked *ctx,
323 enum net_capture_packet_type type,
334struct net_capture_info {
335 const struct device *capture_dev;
336 struct net_if *capture_iface;
337 struct net_if *tunnel_iface;
350typedef void (*net_capture_cb_t)(
struct net_capture_info *info,
void *
user_data);
361#if defined(CONFIG_NET_CAPTURE)
362void net_capture_foreach(net_capture_cb_t cb,
void *
user_data);
364static inline void net_capture_foreach(net_capture_cb_t cb,
void *
user_data)
static ssize_t send(int sock, const void *buf, size_t len, int flags)
POSIX wrapper for zsock_send.
Definition socket.h:916
const struct device * device_get_binding(const char *name)
Get a device reference from its device::name field.
static int net_capture_disable(const struct device *dev)
Disable network packet capturing support.
Definition capture.h:166
static bool net_capture_is_enabled(const struct device *dev)
Is network packet capture enabled or disabled.
Definition capture.h:136
static int net_capture_cleanup(const struct device *dev)
Cleanup network packet capturing support.
Definition capture.h:87
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:113
#define ENOTSUP
Unsupported value.
Definition errno.h:114
#define bool
Definition stdbool.h:13
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:409
Network Interface structure.
Definition net_if.h:678
Network packet.
Definition net_pkt.h:67
Generic sockaddr struct.
Definition net_ip.h:385
static fdata_t data[2]
Definition test_fifo_contexts.c:15
static const intptr_t user_data[5]
Definition main.c:588