--- web10g-userland-2.0.7/util/C/Makefile.in	2013-06-27 00:58:55.000000000 +1000
+++ web10g-userland-2.0.7-mod/util/C/Makefile.in	2013-11-21 10:42:53.367151344 +1100
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.12.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -54,9 +53,11 @@
 bin_PROGRAMS = web10g-deltavars$(EXEEXT) web10g-listconninfo$(EXEEXT) \
 	web10g-listconns$(EXEEXT) web10g-readvars$(EXEEXT) \
 	web10g-record_read$(EXEEXT) web10g-record_write$(EXEEXT) \
-	web10g-watchvars$(EXEEXT) web10g-writevar$(EXEEXT)
+	web10g-watchvars$(EXEEXT) web10g-writevar$(EXEEXT) \
+	web10g-logger$(EXEEXT)
 subdir = util/C
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/build-aux/depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/build-aux/libtool.m4 \
 	$(top_srcdir)/build-aux/ltoptions.m4 \
@@ -82,6 +83,9 @@
 am_web10g_listconns_OBJECTS = web10g-listconns.$(OBJEXT)
 web10g_listconns_OBJECTS = $(am_web10g_listconns_OBJECTS)
 web10g_listconns_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_web10g_logger_OBJECTS = web10g-logger.$(OBJEXT)
+web10g_logger_OBJECTS = $(am_web10g_logger_OBJECTS)
+web10g_logger_DEPENDENCIES = $(am__DEPENDENCIES_1)
 am_web10g_readvars_OBJECTS = web10g-readvars.$(OBJEXT)
 web10g_readvars_OBJECTS = $(am_web10g_readvars_OBJECTS)
 web10g_readvars_DEPENDENCIES = $(am__DEPENDENCIES_1)
@@ -111,14 +115,15 @@
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(web10g_deltavars_SOURCES) $(web10g_listconninfo_SOURCES) \
-	$(web10g_listconns_SOURCES) $(web10g_readvars_SOURCES) \
-	$(web10g_record_read_SOURCES) $(web10g_record_write_SOURCES) \
-	$(web10g_watchvars_SOURCES) $(web10g_writevar_SOURCES)
-DIST_SOURCES = $(web10g_deltavars_SOURCES) \
-	$(web10g_listconninfo_SOURCES) $(web10g_listconns_SOURCES) \
+	$(web10g_listconns_SOURCES) $(web10g_logger_SOURCES) \
 	$(web10g_readvars_SOURCES) $(web10g_record_read_SOURCES) \
 	$(web10g_record_write_SOURCES) $(web10g_watchvars_SOURCES) \
 	$(web10g_writevar_SOURCES)
+DIST_SOURCES = $(web10g_deltavars_SOURCES) \
+	$(web10g_listconninfo_SOURCES) $(web10g_listconns_SOURCES) \
+	$(web10g_logger_SOURCES) $(web10g_readvars_SOURCES) \
+	$(web10g_record_read_SOURCES) $(web10g_record_write_SOURCES) \
+	$(web10g_watchvars_SOURCES) $(web10g_writevar_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -282,6 +287,8 @@
 web10g_watchvars_LDADD = $(LIBESTATS_LDADDS)
 web10g_writevar_SOURCES = web10g-writevar.c scripts.h
 web10g_writevar_LDADD = $(LIBESTATS_LDADDS)
+web10g_logger_SOURCES = web10g-logger.c scripts.h
+web10g_logger_LDADD = $(LIBESTATS_LDADDS)
 all: all-am
 
 .SUFFIXES:
@@ -295,9 +302,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign util/C/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu util/C/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign util/C/Makefile
+	  $(AUTOMAKE) --gnu util/C/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -371,6 +378,9 @@
 web10g-listconns$(EXEEXT): $(web10g_listconns_OBJECTS) $(web10g_listconns_DEPENDENCIES) $(EXTRA_web10g_listconns_DEPENDENCIES) 
 	@rm -f web10g-listconns$(EXEEXT)
 	$(LINK) $(web10g_listconns_OBJECTS) $(web10g_listconns_LDADD) $(LIBS)
+web10g-logger$(EXEEXT): $(web10g_logger_OBJECTS) $(web10g_logger_DEPENDENCIES) $(EXTRA_web10g_logger_DEPENDENCIES) 
+	@rm -f web10g-logger$(EXEEXT)
+	$(LINK) $(web10g_logger_OBJECTS) $(web10g_logger_LDADD) $(LIBS)
 web10g-readvars$(EXEEXT): $(web10g_readvars_OBJECTS) $(web10g_readvars_DEPENDENCIES) $(EXTRA_web10g_readvars_DEPENDENCIES) 
 	@rm -f web10g-readvars$(EXEEXT)
 	$(LINK) $(web10g_readvars_OBJECTS) $(web10g_readvars_LDADD) $(LIBS)
@@ -396,6 +406,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/web10g-deltavars.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/web10g-listconninfo.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/web10g-listconns.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/web10g-logger.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/web10g-readvars.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/web10g-record_read.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/web10g-record_write.Po@am__quote@
@@ -478,6 +489,20 @@
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
 
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
@@ -621,18 +646,18 @@
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic clean-libtool ctags distclean distclean-compile \
-	distclean-generic distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binPROGRAMS install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am tags uninstall uninstall-am \
-	uninstall-binPROGRAMS
+	clean-generic clean-libtool cscopelist ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-binPROGRAMS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
--- web10g-userland-2.0.7/util/C/Makefile.am	2013-06-26 04:40:08.000000000 +1000
+++ web10g-userland-2.0.7-mod/util/C/Makefile.am	2013-11-21 10:42:52.053171096 +1100
@@ -1,4 +1,4 @@
-bin_PROGRAMS = web10g-deltavars web10g-listconninfo web10g-listconns web10g-readvars web10g-record_read web10g-record_write web10g-watchvars web10g-writevar
+bin_PROGRAMS = web10g-deltavars web10g-listconninfo web10g-listconns web10g-readvars web10g-record_read web10g-record_write web10g-watchvars web10g-writevar web10g-logger
 
 LIBESTATS_LDADDS = @STRIP_BEGIN@ \
 	$(top_builddir)/lib/estats/libestats.la \
@@ -32,3 +32,6 @@
 
 web10g_writevar_SOURCES = web10g-writevar.c scripts.h
 web10g_writevar_LDADD = $(LIBESTATS_LDADDS)
+
+web10g_logger_SOURCES = web10g-logger.c scripts.h
+web10g_logger_LDADD = $(LIBESTATS_LDADDS)
--- web10g-userland-2.0.7/util/C/web10g-logger.c	1970-01-01 10:00:00.000000000 +1000
+++ web10g-userland-2.0.7-mod/util/C/web10g-logger.c	2014-03-17 16:36:15.622023943 +1100
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2013 Swinburne University of Technology 
+ *
+ * Author: Sebastian Zander (szander@swin.edu.au)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as 
+ * published by the Free Software Foundation.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+#include "scripts.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+
+void usage(void)
+{
+        printf("\n\n");
+        printf("web10g-logger [-e exclude_ip] [-i interval] [-m mask]\n");
+        printf("\n  Repeatedly list tcp_estats variables for all connections\n");
+        printf("  Optional poll interval given in seconds, e.g. the following\n");
+	printf("  command polls the variables every 100ms:\n");
+	printf("\n");
+        printf("  web10g-logger -i 0.1\n");
+	printf("\n");
+	printf("  Optional exclude_ip excludes flows from/to an IP or host name, e.g.\n");
+	printf("  the following command does not print information for flows from/to\n");
+	printf("   192.168.0.1.\n");
+	printf("\n");
+        printf("  web10g-logger -e 192.168.0.1\n");
+	printf("\n");
+        printf("  Optional mask given as a 5-tuple of hex values, e.g.\n");
+        printf("\n");
+        printf("  web10g-logger -m f,f,f,f,f\n");
+        printf("\n");
+        printf("  returns the first 4 entries of each of the MIB tables.\n");
+        printf("  (Perf, Path, Stack, App, Tune; cf. RFC 4898)\n");
+        printf("\n");
+        printf("  web10g-logger -m 0,0,0,,0\n");
+        printf("\n");
+        printf("  returns only the MIB App table, etc.\n");
+        printf("\n  The mask limits the time the kernel holds a lock on the\n");
+        printf("  socket of interest.\n");
+        printf("\n");
+}
+
+
+
+int main(int argc, char **argv)
+{
+	estats_error* err = NULL;
+        estats_nl_client* cl = NULL;
+        estats_val_data* data = NULL;
+	struct estats_connection_list* clist = NULL;
+        struct estats_connection* cp;
+        struct estats_connection_tuple_ascii asc;
+
+        int cid, i; 
+        int opt;
+
+        char *strmask = NULL;
+	struct estats_mask mask;
+        uint64_t tmpmask;
+	const char delim = ',';
+
+        mask.masks[0] = DEFAULT_PERF_MASK;
+        mask.masks[1] = DEFAULT_PATH_MASK;
+        mask.masks[2] = DEFAULT_STACK_MASK;
+        mask.masks[3] = DEFAULT_APP_MASK;
+        mask.masks[4] = DEFAULT_TUNE_MASK;
+
+	unsigned int poll_interval = 1000000;
+        char exclude_ip[64];
+
+        for (i = 0; i < MAX_TABLE; i++) {
+                mask.if_mask[i] = 0;
+        }
+
+        while ((opt = getopt(argc, argv, "e:hi:m:")) != -1) {
+                switch (opt) {
+                case 'h':
+                        usage();
+                        exit(EXIT_SUCCESS);
+                        break;
+		case 'e':
+			{
+			struct sockaddr_in sa;
+			struct addrinfo hints;
+        		struct addrinfo *result;
+			int ret;
+
+			strncpy(exclude_ip, optarg, sizeof(exclude_ip));
+
+			memset(&hints, 0, sizeof(struct addrinfo));
+           		hints.ai_family = AF_INET;    /* Allow IPv4 or IPv6 */
+           		hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
+           		hints.ai_flags = 0;
+           		hints.ai_protocol = 0;          /* Any protocol */
+
+			if ((ret = getaddrinfo(exclude_ip, NULL, &hints, &result) != 0)) {
+               			fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret));
+               			exit(EXIT_FAILURE);
+           		}
+			strcpy(exclude_ip, inet_ntoa(((struct sockaddr_in *) result->ai_addr)->sin_addr));
+			
+			freeaddrinfo(result);
+
+			if (inet_pton(AF_INET, exclude_ip, &(sa.sin_addr)) == 0) {
+				fprintf(stderr, "Exclude IP '%s' is not a valid IP address\n", exclude_ip);
+                                exit(EXIT_FAILURE);
+			}
+			}
+
+			break;
+		case 'i':
+			{
+			char *endptr;
+			double x = strtod(optarg, &endptr);
+
+           		/* check for various possible errors */
+			if (endptr == optarg) {
+               			fprintf(stderr, "Poll interval must be a floating point number\n");
+               			exit(EXIT_FAILURE);
+           		}
+			if (x > 1.0) {
+				fprintf(stderr, "Maximum poll interval is 1 second\n");
+                                exit(EXIT_FAILURE);
+			}
+			if (x < 0.001) {
+                                fprintf(stderr, "Minimum poll interval is 0.001 second (1ms)\n");
+                                exit(EXIT_FAILURE);
+                        }
+
+			poll_interval = (unsigned int) (x * 1000000);
+			}
+
+			break;
+                case 'm':
+                        strmask = strdup(optarg);
+
+                        for (i = 0; i < 5; i++) {
+                                char *strtmp;
+                                strtmp = strsep(&strmask, &delim);
+                                if (strtmp && strlen(strtmp)) {
+                                char *str;
+                                str = (str = strchr(strtmp, 'x')) ? str+1 : strtmp;
+                                if (sscanf(str, "%"PRIx64, &tmpmask) == 1) {
+                                        mask.masks[i] = tmpmask & mask.masks[i];
+                                        mask.if_mask[i] = 1;
+                                }
+                                }
+                        }
+
+                        break;
+                default:
+                        exit(EXIT_FAILURE);
+                        break;
+                }
+        }
+
+        Chk(estats_nl_client_init(&cl));
+	Chk(estats_connection_list_new(&clist));
+        Chk(estats_nl_client_set_mask(cl, &mask));
+        Chk(estats_val_data_new(&data));
+
+        while (1) {
+
+		/* active get connections */
+		Chk(estats_list_conns(clist, cl));
+
+		list_for_each(&clist->connection_head, cp, list) {
+                	struct estats_connection_tuple* ct = (struct estats_connection_tuple*) cp;
+                	Chk(estats_connection_tuple_as_strings(&asc, ct));
+
+        		Chk(estats_read_vars(data, atoi(asc.cid), cl));
+
+			if (strcmp(exclude_ip, asc.local_addr) == 0 || strcmp(exclude_ip, asc.rem_addr) == 0) {
+				continue;
+			}
+
+        		printf("%u.%06u,", data->tv.sec, data->tv.usec);
+			printf("%s,%s,%s,%s,%s,", asc.cid, asc.local_addr, asc.local_port, asc.rem_addr, asc.rem_port);
+
+        		for (i = 0; i < data->length; i++) {
+
+                		if (data->val[i].masked) continue;
+
+                		switch(estats_var_array[i].valtype) {
+                        		case ESTATS_UNSIGNED64:
+                                		printf("%"PRIu64"", data->val[i].uv64);
+                                		break;
+                        		case ESTATS_UNSIGNED32:
+                                		printf("%"PRIu32"", data->val[i].uv32);
+                                		break;
+                        		case ESTATS_SIGNED32:
+                                		printf("%"PRId32"", data->val[i].sv32);
+                                		break;
+                        		case ESTATS_UNSIGNED16:
+                                		printf("%"PRIu16"", data->val[i].uv16);
+                               		 	break;
+                        		case ESTATS_UNSIGNED8:
+                                		printf("%"PRIu8"", data->val[i].uv8);
+                                		break;
+                        		default:
+                                		break;
+                		}
+
+				if (i < data->length -1) {
+					printf(",");
+				}
+        		}
+
+			printf("\n");
+		}
+
+		usleep(poll_interval);
+        }
+
+ Cleanup:
+	estats_connection_list_free(&clist);
+	estats_val_data_free(&data);
+	estats_nl_client_destroy(&cl);
+
+	if (err != NULL) {
+		PRINT_AND_FREE(err);
+		return EXIT_FAILURE;
+	}
+
+	return EXIT_SUCCESS;
+}
