ifpps: fix iface stat parsing if uppercase
[netsniff-ng-new.git] / trafgen_dev.h
blobbcb88f3650afc7823c6adc91ebacdccdf691c670
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;
15 struct packet;
17 struct dev_io {
18 int fd;
19 char *name;
20 char *trans;
21 int ifindex;
22 int dev_type;
23 uint32_t link_type;
24 uint32_t pcap_magic;
25 bool is_initialized;
26 enum pcap_mode pcap_mode;
27 enum dev_io_mode_t mode;
28 size_t buf_len;
29 uint8_t *buf;
31 const struct pcap_file_ops *pcap_ops;
32 const struct dev_io_ops *ops;
35 struct dev_io_ops {
36 int(*open) (struct dev_io *dev, const char *name, enum dev_io_mode_t mode);
37 int(*write) (struct dev_io *dev, struct packet *pkt);
38 struct packet *(*read) (struct dev_io *dev);
39 int(*set_link_type) (struct dev_io *dev, int link_type);
40 void(*close) (struct dev_io *dev);
43 extern struct dev_io *dev_io_create(const char *name, enum dev_io_mode_t mode);
44 extern void dev_io_open(struct dev_io *dev);
45 extern int dev_io_write(struct dev_io *dev, struct packet *pkt);
46 extern struct packet *dev_io_read(struct dev_io *dev);
47 extern int dev_io_ifindex_get(struct dev_io *dev);
48 extern int dev_io_fd_get(struct dev_io *dev);
49 extern const char *dev_io_name_get(struct dev_io *dev);
50 extern int dev_io_link_type_set(struct dev_io *dev, int link_type);
51 extern bool dev_io_is_netdev(struct dev_io *dev);
52 extern bool dev_io_is_pcap(struct dev_io *dev);
53 extern void dev_io_close(struct dev_io *dev);
55 #endif /* TRAFGEN_DEV_H */