Added a test application for the PF_RING api.
diff --git a/Makefile b/Makefile
index 38d9044..144f797 100644
--- a/Makefile
+++ b/Makefile
@@ -1,31 +1,44 @@
 PACKAGE_NAME=PF_RING-5.6.0
 
+KERNEL_CROSS:=$(TARGET_CROSS)
 
-uninstall:
-	echo installing pf_ring irina
+PF_RING_MAKEOPTS= ARCH="$(KERNEL_ARCH)" \
+		CROSS_COMPILE="$(TARGET_CROSS)" \
+		CC="$(TARGET_CROSS)gcc" \
+		LD="$(TARGET_CROSS)ld" \
+		AR="$(TARGET_CROSS)ar" \
+		RANLIB="$(TARGET_CROSS)ranlib" \
+		MACHINE="mips" \
+		TOOLPREFIX="$(CCACHE) $(TARGET_CROSS)" \
+		TOOLPATH="$(TARGET_PATH)" \
+		KERNELPATH="$(LINUX_DIR)"
 
+clean:
+	echo uninstalling the pf_ring kernel module
+	cd $(PACKAGE_NAME)/kernel && $(MAKE) $(LINUX_MAKE_FLAGS) V=1 M=`pwd` clean
+	#echo uninstalling the pf_ring library
+	#cd $(PACKAGE_NAME)/userland/lib && $(MAKE) $(PF_RING_MAKEOPTS) clean
 
 kernel:
 	# Installing the Linux kernel module
-	cd $(PACKAGE_NAME)/kernel && \
-	$(MAKE) V=1
+	cd $(PACKAGE_NAME)/kernel && $(MAKE) $(LINUX_MAKE_FLAGS) pf_ring_dd
 
 libs:
 	# Installing PF_RING library and lipbcap
 	cd $(PACKAGE_NAME)/userland/lib && \
-	echo calea $(PWD) && \
-	ls -l && \
-	./configure --target=mipsel-linux --host=mipsel-linux --build=x86_64-unknown-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc && \
-	$(MAKE) V=1 && \
-	$(MAKE) install V=1 
-	#cd ../libpcap
-	#./configure --target=mipsel-linux
-	#./configure
-	#$(MAKE) V=1
+	$(PF_RING_MAKEOPTS) ./configure --target=mipsel-linux --host=mipsel-linux --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc && \
+	$(MAKE) $(PF_RING_MAKEOPTS) V=1 && \
+	cd ../libpcap && \
+	$(PF_RING_MAKEOPTS) ./configure --with-pcap=null --target=mipsel-linux --host=mipsel-linux --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc && \
+	$(MAKE) $(PF_RING_MAKEOPTS) V=1
 
 examples:
-	cd $(PACKAGE_NAME)/userland/exampes
-	$(MAKE) V=1
+	cd $(PACKAGE_NAME)/userland/examples && $(MAKE) $(PF_RING_MAKEOPTS) V=1
 
-install: kernel libs
-	echo installing pf_ring irina
+test:
+	cd $(PACKAGE_NAME)/userland/test && $(MAKE) $(PF_RING_MAKEOPTS) V=1
+
+install: kernel libs test
+	echo "Installing packages"
+	cd $(PACKAGE_NAME)/userland/lib && \
+	$(MAKE) $(PF_RING_MAKEOPTS) install V=1
diff --git a/PF_RING-5.6.0/kernel/Makefile b/PF_RING-5.6.0/kernel/Makefile
index e7fc45b..2fd59f3 100644
--- a/PF_RING-5.6.0/kernel/Makefile
+++ b/PF_RING-5.6.0/kernel/Makefile
@@ -1,18 +1,6 @@
-#
-# (C) 2009-10 - Luca Deri <deri@ntop.org>
-#
-
 obj-m := pf_ring.o
 
-ifneq (, $(shell which svnversion))
-SVNDEF := -DSVN_REV="\"$(shell svnversion -n .)\""
-endif
-
-ifeq (,$(BUILD_KERNEL))
-BUILD_KERNEL=$(shell uname -r)
-endif
-
-EXTRA_CFLAGS += -I$(PWD) $(SVNDEF)
+EXTRA_CFLAGS += -I$(PWD) -I$(PWD)/linux
 
 HERE=$(PWD)
 
@@ -20,7 +8,9 @@
 INSTDIR := $(DESTDIR)/lib/modules/$(BUILD_KERNEL)/kernel/net/pf_ring
 TARGETDIR := $(DESTDIR)/usr/src/$(BUILD_KERNEL)/include/linux/
 
-all: Makefile pf_ring.c linux/pf_ring.h
+all: pf_ring_dd install
+
+pf_ring_dd: Makefile pf_ring.c linux/pf_ring.h
 	@if test "$(USER)" = "root"; then \
 		echo "********** WARNING WARNING WARNING **********"; \
 		echo "*"; \
@@ -29,11 +19,11 @@
 		echo "*"; \
 		echo "*********************************************"; \
 	fi
-	make -C /lib/modules/$(BUILD_KERNEL)/build SUBDIRS=$(HERE) EXTRA_CFLAGS='$(EXTRA_CFLAGS)' modules
+	make -C $(LINUX_DIR) SUBDIRS=$(PWD) EXTRA_CFLAGS='$(EXTRA_CFLAGS)' M=`pwd` modules
 	cd plugins; make
 
 clean:
-	make -C /lib/modules/$(BUILD_KERNEL)/build SUBDIRS=$(HERE) clean
+	make -C $(LINUX_DIR) SUBDIRS=$(PWD) clean
 	\rm -f *~ Module.symvers  Module.markers  modules.order *#
 
 install:
@@ -43,6 +33,3 @@
 	@if test -d ${TARGETDIR}; then \
 		cp linux/pf_ring.h ${TARGETDIR}; \
 	fi
-ifeq (,$(DESTDIR))
-	/sbin/depmod $(BUILD_KERNEL)
-endif
diff --git a/PF_RING-5.6.0/kernel/plugins/Makefile b/PF_RING-5.6.0/kernel/plugins/Makefile
index 12f9427..33aa379 100644
--- a/PF_RING-5.6.0/kernel/plugins/Makefile
+++ b/PF_RING-5.6.0/kernel/plugins/Makefile
@@ -4,7 +4,7 @@
 KBUILD_EXTRA_SYMBOLS := $(PWD)/../Module.symvers
 
 all:
-	make -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(PWD) modules
+	make -C $(LINUX_DIR) SUBDIRS=$(PWD) modules
 
 clean:
-	make -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(PWD) clean
+	make -C $(LINUX_DIR) SUBDIRS=$(PWD) clean
diff --git a/PF_RING-5.6.0/kernel/plugins/dummy_plugin.c b/PF_RING-5.6.0/kernel/plugins/dummy_plugin.c
index 1278833..9b9a9e4 100644
--- a/PF_RING-5.6.0/kernel/plugins/dummy_plugin.c
+++ b/PF_RING-5.6.0/kernel/plugins/dummy_plugin.c
@@ -69,7 +69,7 @@
 
 static struct pfring_plugin_registration reg;
 
-/* #define DEBUG */
+#define DEBUG
 
 /* ************************************ */
 
@@ -145,7 +145,8 @@
 
     if(hdr->extended_hdr.parsed_pkt.l3_proto != rule_filter->protocol)
       return(0); /* no match */
-  }
+  } else
+    printk("rule filter is null, will return 1");
 
   return(1); /* Ok */
 }
diff --git a/PF_RING-5.6.0/userland/examples/pfcount.c b/PF_RING-5.6.0/userland/examples/pfcount.c
index db417b5..25f4357 100644
--- a/PF_RING-5.6.0/userland/examples/pfcount.c
+++ b/PF_RING-5.6.0/userland/examples/pfcount.c
@@ -41,7 +41,6 @@
 #include <time.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
-#include <monetary.h>
 #include <locale.h>
 
 #ifdef ENABLE_BPF
diff --git a/PF_RING-5.6.0/userland/examples/pfcount_aggregator.c b/PF_RING-5.6.0/userland/examples/pfcount_aggregator.c
index b44632e..8d2f1c1 100644
--- a/PF_RING-5.6.0/userland/examples/pfcount_aggregator.c
+++ b/PF_RING-5.6.0/userland/examples/pfcount_aggregator.c
@@ -42,7 +42,6 @@
 #include <time.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
-#include <monetary.h>
 #include <locale.h>
 
 #include "pfring.h"
diff --git a/PF_RING-5.6.0/userland/lib/Makefile.in b/PF_RING-5.6.0/userland/lib/Makefile.in
index 9d3f90b..ea5aa76 100644
--- a/PF_RING-5.6.0/userland/lib/Makefile.in
+++ b/PF_RING-5.6.0/userland/lib/Makefile.in
@@ -66,24 +66,24 @@
 
 ${STATICLIB}: Makefile @ZERO_DEP@ @DNA_DEP@ @VIRTUAL_DEP@ ${OBJS} pfring.h ${RING_H}
 	@echo "=*= making library $@ =*="
-	ar rs $@ ${OBJS}
-	ranlib $@
+	$(AR) rs $@ ${OBJS}
+	$(RANLIB) $@
 
 ${DYNAMICLIB}: ${OBJS} @ZERO_DEP@ @DNA_DEP@ @VIRTUAL_DEP@ pfring.h ${RING_H} Makefile
 	@echo "=*= making library $@ =*="
 	${CC} ${LDFLAGS} ${OBJS} ${SYSLIBS} -o $@
 
 extract_dna_lib:
-	ar x @DNA_LIB@
+	$(AR) x @DNA_LIB@
 
 extract_zero_lib:
-	ar x @ZERO_LIB@
+	$(AR) x @ZERO_LIB@
 
 extract_virtual_lib:
-	ar x @VIRTUAL_LIB@
+	$(AR) x @VIRTUAL_LIB@
 
 extract_userspace_ring_lib:
-	ar x @USERSPACE_RING_LIB@
+	$(AR) x @USERSPACE_RING_LIB@
 
 install: install-static install-shared
 
diff --git a/PF_RING-5.6.0/userland/lib/configure b/PF_RING-5.6.0/userland/lib/configure
index b99b41b..e7bb8ce 100755
--- a/PF_RING-5.6.0/userland/lib/configure
+++ b/PF_RING-5.6.0/userland/lib/configure
@@ -3254,7 +3254,9 @@
   fi
 fi
 
-MACHINE=`uname -m`
+if test -z "$MACHINE"; then
+  MACHINE=`uname -m`
+fi
 ZERO_LIB="libs/libpfring_zero_$MACHINE$LIBARCH.a"
 DNA_LIB="libs/libpfring_dna_$MACHINE$LIBARCH.a"
 VIRTUAL_LIB="libs/libpfring_mod_virtual_$MACHINE.a"
@@ -3373,6 +3375,11 @@
 $as_echo "no" >&6; }
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking machine name" >&5
+$as_echo_n "checking machine name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $(MACHINE)" >&5
+$as_echo "$(MACHINE)" >&6; }
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Virtual support" >&5
 $as_echo_n "checking Virtual support... " >&6; }
 if test -f $VIRTUAL_LIB && test -f $VIRTUAL_HDR; then
@@ -3657,6 +3664,8 @@
 
 ac_config_files="$ac_config_files ../examples/Makefile"
 
+ac_config_files="$ac_config_files ../test/Makefile"
+
 ac_config_files="$ac_config_files ../c++/Makefile"
 
 
@@ -4365,6 +4374,7 @@
   case $ac_config_target in
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "../examples/Makefile") CONFIG_FILES="$CONFIG_FILES ../examples/Makefile" ;;
+    "../test/Makefile") CONFIG_FILES="$CONFIG_FILES ../test/Makefile" ;;
     "../c++/Makefile") CONFIG_FILES="$CONFIG_FILES ../c++/Makefile" ;;
     "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
 
diff --git a/PF_RING-5.6.0/userland/lib/configure.in b/PF_RING-5.6.0/userland/lib/configure.in
index 01791d9..08ae22e 100644
--- a/PF_RING-5.6.0/userland/lib/configure.in
+++ b/PF_RING-5.6.0/userland/lib/configure.in
@@ -30,7 +30,9 @@
   fi
 fi
 
-MACHINE=`uname -m`
+if test -z "$MACHINE"; then
+  MACHINE=`uname -m`
+fi
 ZERO_LIB="libs/libpfring_zero_$MACHINE$LIBARCH.a"
 DNA_LIB="libs/libpfring_dna_$MACHINE$LIBARCH.a"
 VIRTUAL_LIB="libs/libpfring_mod_virtual_$MACHINE.a"
@@ -80,6 +82,9 @@
   AC_MSG_RESULT(no)
 fi
 
+AC_MSG_CHECKING([machine name])
+AC_MSG_RESULT($(MACHINE))
+
 AC_MSG_CHECKING([Virtual support])
 if test -f $VIRTUAL_LIB && test -f $VIRTUAL_HDR; then
   HAVE_VIRTUAL="-D HAVE_VIRTUAL"
@@ -181,6 +186,7 @@
 
 dnl> AC_CONFIG_FILES([Makefile])
 AC_CONFIG_FILES([../examples/Makefile])
+AC_CONFIG_FILES([../test/Makefile])
 AC_CONFIG_FILES([../c++/Makefile])
 
 AC_CONFIG_HEADERS(config.h)
diff --git a/PF_RING-5.6.0/userland/test/Makefile.in b/PF_RING-5.6.0/userland/test/Makefile.in
new file mode 100644
index 0000000..6eea561
--- /dev/null
+++ b/PF_RING-5.6.0/userland/test/Makefile.in
@@ -0,0 +1,71 @@
+#
+# Makefile for the PF_RING API example programs
+#
+# Try to make both programs written on top of the
+# PF_RING library and programs originally written
+# on top of PCAP library and linked now to use
+# the version with PF_RING aware functionalities.
+#
+
+
+
+#
+# PF_RING
+#
+PFRINGDIR  = ../lib
+LIBPFRING  = ${PFRINGDIR}/libpfring.a
+
+#
+# DNA Support
+DNA_DEFINE = #-DENABLE_DNA_SUPPORT
+
+#
+# PF_RING aware libpcap
+#
+#O_FLAG     = -O2 -DHAVE_PF_RING
+#EXTRA_LIBS =
+#PCAPDIR    = ../libpcap-1.1.1-ring
+#LIBPCAP    = ${PCAPDIR}/libpcap.a  ${EXTRA_LIBS}
+#INCLUDE 		+= -I${PCAPDIR}
+
+#
+# Search directories
+#
+PFRING_KERNEL=../../kernel
+INCLUDE    = -I${PFRING_KERNEL} -I${PFRING_KERNEL}/plugins -I${PFRINGDIR}
+
+#
+# C compiler and flags
+#
+#
+# CROSS_COMPILE=arm-mv5sft-linux-gnueabi-
+#
+CC         = ${CROSS_COMPILE}gcc #--platform=native
+CFLAGS     = @CFLAGS@ ${O_FLAG} -Wall ${INCLUDE} ${DNA_DEFINE} -O2 # -g
+#CFLAGS     = @CFLAGS@ ${O_FLAG} -Wall ${INCLUDE} ${DNA_DEFINE} @HAVE_ZERO@ @HAVE_BPF@ -O2 # -g
+# LDFLAGS  =
+
+#
+# User and System libraries
+#
+LIBS       = ${LIBPFRING} @DAG_LIB@ -lpthread @SYSLIBS@ @BPF_LIB@  @SILICOM_LIBS@ @REDIS_LIB@ -lrt
+
+# How to make an object file
+%.o: %.c pfutils.c
+#	@echo "=*= making object $@ =*="
+	${CC} ${CFLAGS} -c $< -o $@
+
+#
+# Main targets
+#
+PFPROGS   = my_test
+
+TARGETS   = ${PFPROGS}
+
+all: ${TARGETS}
+
+my_test: my_test.o ${LIBPFRING}
+	${CC} ${CFLAGS} my_test.o ${LIBS} -o $@
+
+clean:
+	@rm -f ${TARGETS} *.o *~
diff --git a/PF_RING-5.6.0/userland/test/my_test.c b/PF_RING-5.6.0/userland/test/my_test.c
new file mode 100644
index 0000000..ed0ba82
--- /dev/null
+++ b/PF_RING-5.6.0/userland/test/my_test.c
@@ -0,0 +1,317 @@
+#include "pfring.h"
+#include "../../kernel/plugins/dummy_plugin.h"
+
+#include <arpa/inet.h>
+#include <net/ethernet.h>
+#include <netinet/ip.h>
+
+#include <sys/time.h>
+#include <time.h>
+#include <signal.h>
+
+pfring *pd;
+
+int timer_timeout = 2;
+int verbose = 0;
+u_int32_t pkt_cnt = 0;
+
+
+/* ************************************************************************ */
+
+static void timer_handler(int signo)
+{
+  time_t curr_time;
+  curr_time = time(NULL);
+  printf("Packet count %u after %d seconds, time is: %s",
+         pkt_cnt, timer_timeout, ctime(&curr_time));
+  pkt_cnt = 0;
+}
+
+static void set_signals(void)
+{
+  struct sigaction sa;
+  int rc;
+  memset(&sa, 0, sizeof(sa));
+  sa.sa_handler = timer_handler;
+  rc = sigaction(SIGALRM, &sa, NULL);
+  if (rc < 0) {
+    perror("sigaction failed\n");
+    exit(1);
+  }
+}
+
+/*
+ * configure timer to generate SIGALARM when fired
+ * the timer expires at every timer_timeout seconds
+ */
+static void set_timer(void)
+{
+  timer_t timerid;
+  struct sigevent sev;
+  struct itimerspec its;
+  int rc;
+
+  sev.sigev_notify = SIGEV_SIGNAL;
+  sev.sigev_signo = SIGALRM;
+  sev.sigev_value.sival_ptr = &timerid;
+  rc = timer_create(CLOCK_REALTIME, &sev, &timerid);
+  if (rc < 0) {
+    perror("timer_create failed\n");
+    exit(1);
+  }
+
+  its.it_value.tv_sec = timer_timeout;
+  its.it_value.tv_nsec = 0; /* don't need nanosec */
+  its.it_interval.tv_sec = its.it_value.tv_sec;
+  its.it_interval.tv_nsec = its.it_value.tv_nsec;
+
+  rc = timer_settime(timerid, 0, &its, NULL);
+  if (rc < 0) {
+    perror("timer_settime failed\n");
+    exit(1);
+  }
+}
+
+/* ************************************************************************ */
+/*
+ * A faster replacement for inet_ntoa().
+ */
+char* _intoa(unsigned int addr, char* buf, u_short bufLen)
+{
+  char *cp, *retStr;
+  u_int byte;
+  int n;
+
+  cp = &buf[bufLen];
+  *--cp = '\0';
+
+  n = 4;
+  do {
+    byte = addr & 0xff;
+    *--cp = byte % 10 + '0';
+    byte /= 10;
+    if (byte > 0) {
+      *--cp = byte % 10 + '0';
+      byte /= 10;
+      if (byte > 0)
+        *--cp = byte + '0';
+    }
+    *--cp = '.';
+    addr >>= 8;
+  } while (--n > 0);
+
+  /* Convert the string to lowercase */
+  retStr = (char*)(cp+1);
+
+  return(retStr);
+}
+
+/* ************************************ */
+
+char* intoa(unsigned int addr)
+{
+  static char buf[sizeof "ff:ff:ff:ff:ff:ff:255.255.255.255"];
+  return(_intoa(addr, buf, sizeof(buf)));
+}
+
+int32_t gmt2local(time_t t)
+{
+  int dt, dir;
+  struct tm *gmt, *loc;
+  struct tm sgmt;
+
+  if (t == 0) t = time(NULL);
+  gmt = &sgmt;
+  *gmt = *gmtime(&t);
+  loc = localtime(&t);
+  dt = (loc->tm_hour - gmt->tm_hour) * 60 * 60 +
+    (loc->tm_min - gmt->tm_min) * 60;
+
+  /*
+   * If the year or julian day is different, we span 00:00 GMT
+   * and must add or subtract a day. Check the year first to
+   * avoid problems when the julian day wraps.
+   */
+  dir = loc->tm_year - gmt->tm_year;
+  if (dir == 0) dir = loc->tm_yday - gmt->tm_yday;
+  dt += dir * 24 * 60 * 60;
+
+  return (dt);
+}
+
+static int32_t thiszone;
+
+/* ************************************************************************ */
+
+void processPacket(const struct pfring_pkthdr *h, u_char *p)
+{
+  struct ether_header ehdr;
+  u_short eth_type, vlan_id;
+  struct ip ip;
+  int i, s;
+  uint usec, nsec=0;
+
+  if (h->ts.tv_sec == 0) {
+    printf("should parse packet\n");
+    return;
+  }
+
+  pkt_cnt++;
+  if (verbose) {
+    printf("---------Packet received-----------\n");
+    thiszone = gmt2local(0);
+    s = (h->ts.tv_sec + thiszone) % 86400;
+    if (h->extended_hdr.timestamp_ns) {
+      usec = (h->extended_hdr.timestamp_ns / 1000) % 1000000;
+      nsec = h->extended_hdr.timestamp_ns % 1000;
+    } else {
+      usec = h->ts.tv_usec;
+    }
+    usec = h->ts.tv_usec;
+
+    printf("%02d:%02d:%02d.%06u%03u ",
+           s / 3600, (s % 3600) / 60, s % 60,
+           usec, nsec);
+
+    struct pfring_extended_pkthdr *ext_hdr = &(h->extended_hdr);
+    printf("%s if_index=%d\n",
+           ext_hdr->rx_direction ? "RX" : "TX",
+           ext_hdr->if_index);
+
+    p[ext_hdr->parsed_header_len + h->caplen] = '\0';
+    memcpy(&ehdr, p + h->extended_hdr.parsed_header_len, sizeof(struct ether_header));
+    eth_type = ntohs(ehdr.ether_type);
+
+    if(eth_type == 0x8100) {
+      printf("[eth_type: 0x%04X]\n", eth_type);
+      vlan_id = (p[14] & 15) * 256 + p[15];
+      eth_type = (p[16]) * 256 + p[17];
+      printf("[vlan %u] ", vlan_id);
+      p += 4;
+    }
+    printf("[eth_type: 0x%04X]\n", eth_type);
+    if(eth_type == 0x0800) {
+      memcpy(&ip, p + h->extended_hdr.parsed_header_len + sizeof(ehdr), sizeof(struct ip));
+      printf("[%s:%d ", intoa(ntohl(ip.ip_src.s_addr)), h->extended_hdr.parsed_pkt.l4_src_port);
+      printf("-> %s:%d]\n", intoa(ntohl(ip.ip_dst.s_addr)), h->extended_hdr.parsed_pkt.l4_dst_port);
+    }
+    else
+      printf("[not IPv4]\n");
+
+    printf("Buffer----------\n");
+    for (i = 0; i < ext_hdr->parsed_header_len + h->caplen; i++) {
+      printf("%02X ", p[i]);
+    }
+    printf("-----------------------------------------------------------\n");
+  }
+}
+
+void printHelp(void) {
+  printf("my_test\n");
+  printf("-h              [Print help]\n");
+  printf("-i <device>     [Device name]\n");
+  printf("-p <protocol>   [Dummy protocol filter (6=tcp, 17=udp, 1=icmp)]\n");
+  printf("-t <time>       [Timer timeout]\n");
+  printf("-v              [Verbose]\n");
+}
+
+
+int main(int argc, char** argv)
+{
+  char *device = NULL, c;
+  filtering_rule rule;
+  struct dummy_filter *filter;
+  u_int8_t protocol = 17 /* udp */;
+  u_int32_t version;
+  int rc;
+
+  while ((c = getopt(argc,argv,"hi:vp:t:")) != -1) {
+    switch(c) {
+    case 'h':
+      printHelp();
+      return 0;
+      break;
+    case 'i':
+      device = strdup(optarg);
+      break;
+    case 'p':
+      protocol = atoi(optarg);
+      break;
+    case 'v':
+      verbose = 1;
+      break;
+    case 't':
+      timer_timeout = atoi(optarg);
+      break;
+    }
+  }
+
+  if (!device)
+    device = "eth0";
+
+  pd = pfring_open(device, 1500, PF_RING_PROMISC | PF_RING_LONG_HEADER);
+
+  if (pd == NULL) {
+    perror("pfring_open failed");
+    return -1;
+  }
+
+  pfring_version(pd, &version);
+  printf("Using PF_RING v.%d.%d.%d\n",
+         (version & 0xFFFF0000) >> 16,
+         (version & 0x0000FF00) >> 8,
+         version & 0x000000FF);
+
+  pfring_toggle_filtering_policy(pd, 0);
+
+  memset(&rule, 0, sizeof(rule));
+
+  rule.rule_id = 5;
+  rule.rule_action = forward_packet_and_stop_rule_evaluation;
+  rule.plugin_action.plugin_id = DUMMY_PLUGIN_ID;
+  rule.extended_fields.filter_plugin_id = DUMMY_PLUGIN_ID;
+  filter = (struct dummy_filter*)rule.extended_fields.filter_plugin_data;
+  filter->protocol = protocol;  // default  udp
+
+  rc = pfring_add_filtering_rule(pd, &rule);
+  if (rc < 0) {
+    printf("pfring_add_filtering_rule() failed rc = %d\n", rc);
+    return -1;
+  }
+
+  rc = pfring_enable_ring(pd);
+  if (rc < 0) {
+    printf("pfring_enable_ring() failed rc = %d\n", rc);
+    return -1;
+  }
+
+  set_signals();
+  set_timer();
+
+  while (1) {
+    u_char *buffer;
+    struct pfring_pkthdr hdr;
+
+    rc = pfring_recv(pd, &buffer, 0, &hdr, 1);
+    switch(rc) {
+    case 0:
+      printf("No packet received\n");
+      break;
+    case 1:
+      processPacket(&hdr, buffer);
+      break;
+    default:
+      printf("Error\n");
+      break;
+    }
+  }
+
+  rc = pfring_disable_ring(pd);
+  if (rc < 0) {
+    printf("pfring_disable_ring() failed rc = %d\n", rc);
+    return -1;
+  }
+
+  pfring_close(pd);
+  return 0;
+}