netsniff-ng: fix --bind-cpu option in example command line
[netsniff-ng-new.git] / trafgen_dev.h
blob720c63061359c081577961cb50e76e0baf5c064a
1 #ifndef TRAFGEN_DEV_H
2 #define TRAFGEN_DEV_H
4 #include <stdbool.h>
5 #include <inttypes.h>
7 #include "pcap_io.h"
9 enum dev_io_mode_t {
10 DEV_IO_IN = 1 << 0,
11 DEV_IO_OUT = 1 << 1,
14 struct dev_io_ops;
16 struct dev_io {
17 int fd;
18 char *name;
19 int ifindex;
20 int dev_type;
21 uint32_t link_type;
22 uint32_t pcap_magic;
23 bool is_initialized;
24 enum pcap_mode pcap_mode;
26 const struct pcap_file_ops *pcap_ops;
27 const struct dev_io_ops *ops;
30 struct dev_io_ops {
31 int(*open) (struct dev_io *dev, const char *name, enum dev_io_mode_t mode);
32 int(*write) (struct dev_io *dev, const uint8_t *buf, size_t len);
33 int(*read) (struct dev_io *dev, uint8_t *buf, size_t len, struct timespec *tstamp);
34 void(*close) (struct dev_io *dev);
37 extern struct dev_io *dev_io_open(const char *name, enum dev_io_mode_t mode);
38 extern int dev_io_write(struct dev_io *dev, const uint8_t *buf, size_t len);
39 extern int dev_io_read(struct dev_io *dev, uint8_t *buf, size_t len,
40 struct timespec *tstamp);
41 extern int dev_io_ifindex_get(struct dev_io *dev);
42 extern int dev_io_fd_get(struct dev_io *dev);
43 extern const char *dev_io_name_get(struct dev_io *dev);
44 extern void dev_io_link_type_set(struct dev_io *dev, int link_type);
45 extern bool dev_io_is_netdev(struct dev_io *dev);
46 extern bool dev_io_is_pcap(struct dev_io *dev);
47 extern void dev_io_close(struct dev_io *dev);
49 #endif /* TRAFGEN_DEV_H */