diff --git a/main.cpp b/main.cpp index 04c8cc6..ba38f38 100755 --- a/main.cpp +++ b/main.cpp @@ -972,7 +972,6 @@ void sigint_cb(struct ev_loop *l, ev_signal *w, int revents) int main(int argc, char *argv[]) { - init_pcap(); int i=0; char errbuf[PCAP_ERRBUF_SIZE]; diff --git a/makefile b/makefile index 6a797e0..a560cf6 100755 --- a/makefile +++ b/makefile @@ -32,6 +32,14 @@ cygwin:git_version rm -f ${NAME} ${cc_local} -o ${NAME} -I. ${SOURCES} pcap_wrapper.cpp ${FLAGS} -lrt -ggdb -static -O2 -D_GNU_SOURCE +linux:git_version + rm -f ${NAME} + ${cc_local} -o ${NAME} -I. ${SOURCES} ${PCAP} ${LIBNET} ${FLAGS} -lrt -ggdb -static -O2 + +linux_nolibnet:git_version + rm -f ${NAME} + ${cc_local} -o ${NAME} -I. ${SOURCES} ${PCAP} ${FLAGS} -lrt -ggdb -static -O2 -DNO_LIBNET + mac:git_version rm -f ${NAME} ${cc_local} -o ${NAME} -I. ${SOURCES} ${FLAGS} -ggdb -O2 diff --git a/pcap_wrapper.cpp b/pcap_wrapper.cpp index 6602e8e..f4ccee5 100644 --- a/pcap_wrapper.cpp +++ b/pcap_wrapper.cpp @@ -31,6 +31,15 @@ char* (*pcap_lookupdev)(char *); int (*pcap_findalldevs)(pcap_if_t **, char *); +struct init_pcap_t +{ + init_pcap_t() + { + init_pcap(); + } + +}do_it; + int init_pcap() { HMODULE wpcap=LoadLibrary("wpcap.dll");