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.
19 #include <arpa/inet.h>
27 #include <sys/socket.h>
28 #include <sys/ioctl.h>
30 #include <sys/resource.h>
31 #include <sys/epoll.h>
32 #include <sys/syscall.h>
33 #include <asm/unistd.h>
35 #include <linux/socket.h>
36 #include <linux/types.h>
37 #include <linux/if_ether.h>
38 #include <linux/if_packet.h>
39 #include <linux/sockios.h>
40 #include <netinet/tcp.h>
41 #include <netinet/udp.h>
50 void set_epoll_descriptor(int fd_epoll
, int action
, int fd_toadd
, int events
)
53 struct epoll_event ev
;
55 memset(&ev
, 0, sizeof(ev
));
57 ev
.data
.fd
= fd_toadd
;
59 ret
= epoll_ctl(fd_epoll
, action
, fd_toadd
, &ev
);
61 panic("Cannot add socket for epoll!\n");
64 int set_epoll_descriptor2(int fd_epoll
, int action
, int fd_toadd
, int events
)
66 struct epoll_event ev
;
68 memset(&ev
, 0, sizeof(ev
));
70 ev
.data
.fd
= fd_toadd
;
72 return epoll_ctl(fd_epoll
, action
, fd_toadd
, &ev
);