2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2009, 2010 Daniel Borkmann.
4 * Copyright 2009, 2010 Emmanuel Roullit.
5 * Subject to the GPL, version 2.
14 #include <sys/socket.h>
16 #include <linux/ethtool.h>
18 #include <linux/wireless.h>
23 #include <sys/resource.h>
28 extern int af_socket(int af
);
29 extern int pf_socket(void);
30 extern int wireless_sigqual(const char *ifname
, struct iw_statistics
*stats
);
31 extern int wireless_rangemax_sigqual(const char *ifname
);
32 extern u32
wireless_bitrate(const char *ifname
);
33 extern u32
ethtool_bitrate(const char *ifname
);
34 extern u32
device_bitrate(const char *ifname
);
35 extern int ethtool_drvinf(const char *ifname
, struct ethtool_drvinfo
*drvinf
);
36 extern int ethtool_link(const char *ifname
);
37 extern int device_mtu(const char *ifname
);
38 extern int device_address(const char *ifname
, int af
, struct sockaddr_storage
*ss
);
39 extern int device_irq_number(const char *ifname
);
40 extern int device_set_irq_affinity_list(int irq
, unsigned long from
, unsigned long to
);
41 extern int device_bind_irq_to_cpu(int irq
, int cpu
);
42 extern void sock_print_net_stats(int sock
, unsigned long skipped
);
43 extern int device_ifindex(const char *ifname
);
44 extern short device_get_flags(const char *ifname
);
45 extern void device_set_flags(const char *ifname
, const short flags
);
46 extern void drop_privileges(bool enforce
, uid_t uid
, gid_t gid
);
47 extern void xlockme(void);
48 extern void xunlockme(void);
49 extern int set_nonblocking(int fd
);
50 extern int set_nonblocking_sloppy(int fd
);
51 extern int set_reuseaddr(int fd
);
52 extern void set_sock_prio(int fd
, int prio
);
53 extern void set_tcp_cork(int fd
);
54 extern void set_tcp_uncork(int fd
);
55 extern void set_udp_cork(int fd
);
56 extern void set_udp_uncork(int fd
);
57 extern void set_sock_cork(int fd
, int udp
);
58 extern void set_sock_uncork(int fd
, int udp
);
59 extern void set_tcp_nodelay(int fd
);
60 extern void set_socket_keepalive(int fd
);
61 extern int set_ipv6_only(int fd
);
62 extern void set_mtu_disc_dont(int fd
);
63 extern int get_system_socket_mem(int which
);
64 extern void set_system_socket_mem(int which
, int val
);
65 extern void register_signal(int signal
, void (*handler
)(int));
66 extern void register_signal_f(int signal
, void (*handler
)(int), int flags
);
67 extern short enter_promiscuous_mode(char *ifname
);
68 extern void leave_promiscuous_mode(char *ifname
, short oldflags
);
69 extern int device_up_and_running(char *ifname
);
70 extern void set_epoll_descriptor(int fd_epoll
, int action
, int fd_toadd
, int events
);
71 extern int set_epoll_descriptor2(int fd_epoll
, int action
, int fd_toadd
, int events
);
72 extern void cpu_affinity(int cpu
);
73 extern int set_cpu_affinity(char *str
, int inverted
);
74 extern int set_proc_prio(int prio
);
75 extern int set_sched_status(int policy
, int priority
);
76 extern void ioprio_print(void);
77 extern void set_ioprio_rt(void);
78 extern void set_ioprio_be(void);
79 extern size_t strlcpy(char *dest
, const char *src
, size_t size
);
80 extern int slprintf(char *dst
, size_t size
, const char *fmt
, ...) __check_format_printf(3, 4);
81 extern int slprintf_nocheck(char *dst
, size_t size
, const char *fmt
, ...);
82 extern noinline
void *xmemset(void *s
, int c
, size_t n
);
83 extern char *strtrim_right(char *p
, char c
);
84 extern int get_default_sched_policy(void);
85 extern int get_default_sched_prio(void);
86 extern int get_number_cpus(void);
87 extern int get_number_cpus_online(void);
88 extern int get_default_proc_prio(void);
89 extern void set_system_socket_memory(int *vals
, size_t len
);
90 extern void reset_system_socket_memory(int *vals
, size_t len
);
91 extern void set_itimer_interval_value(struct itimerval
*itimer
, unsigned long sec
,