From 64a85d3e381b8d96f34eceff99b723ceb0c037ab Mon Sep 17 00:00:00 2001 From: Patrick Li Date: Mon, 3 Dec 2001 06:32:27 +0000 Subject: Add port net/wmnd a network monitor dockapp. PR: 31690 Submitted by: Paolo Flag Reviewed by: petef --- net/wmnd/Makefile | 37 +++++++++++ net/wmnd/distinfo | 1 + net/wmnd/files/patch-Makefile | 36 +++++++++++ net/wmnd/files/patch-src::config.h | 25 ++++++++ net/wmnd/files/patch-src::drivers.c | 120 ++++++++++++++++++++++++++++++++++++ net/wmnd/files/patch-src::drivers.h | 31 ++++++++++ net/wmnd/files/patch-src::wmnd.h | 40 ++++++++++++ net/wmnd/pkg-comment | 1 + net/wmnd/pkg-descr | 9 +++ net/wmnd/pkg-plist | 8 +++ 10 files changed, 308 insertions(+) create mode 100644 net/wmnd/Makefile create mode 100644 net/wmnd/distinfo create mode 100644 net/wmnd/files/patch-Makefile create mode 100644 net/wmnd/files/patch-src::config.h create mode 100644 net/wmnd/files/patch-src::drivers.c create mode 100644 net/wmnd/files/patch-src::drivers.h create mode 100644 net/wmnd/files/patch-src::wmnd.h create mode 100644 net/wmnd/pkg-comment create mode 100644 net/wmnd/pkg-descr create mode 100644 net/wmnd/pkg-plist (limited to 'net/wmnd') diff --git a/net/wmnd/Makefile b/net/wmnd/Makefile new file mode 100644 index 000000000000..335dd9fc4101 --- /dev/null +++ b/net/wmnd/Makefile @@ -0,0 +1,37 @@ +# New ports collection makefile for: wmnd +# Date created: 29 October 2001 +# Whom: Paolo Pisati +# +# $FreeBSD$ +# + +PORTNAME= wmnd +PORTVERSION= 0.3.3 +CATEGORIES= net +MASTER_SITES= http://www.wingeer.org/wmnd/pkg/ +DISTNAME= wmnd_${PORTVERSION} + +MAINTAINER= flag@gufi.org + +WRKSRC= ${WRKDIR}/wmnd +USE_X_PREFIX= yes +USE_GMAKE= yes + +MAN1= wmnd.1 + +do-install: + @${MKDIR} ${PREFIX}/share/examples/${PORTNAME} + @${INSTALL_PROGRAM} ${WRKSRC}/wmnd ${PREFIX}/bin + @${INSTALL_MAN} ${WRKSRC}/man/wmnd.1 ${PREFIX}/man/man1 + @${INSTALL_DATA} ${WRKSRC}/wmndrc \ + ${PREFIX}/share/examples/${PORTNAME} + +post-install: +.if !defined(NOPORTDOCS) +.for docs in CHANGELOGS DISPLAY HINTS README + @${MKDIR} ${DOCSDIR} + @${INSTALL_DATA} ${WRKSRC}/${docs} ${DOCSDIR} +.endfor +.endif + +.include diff --git a/net/wmnd/distinfo b/net/wmnd/distinfo new file mode 100644 index 000000000000..84d075f05d5e --- /dev/null +++ b/net/wmnd/distinfo @@ -0,0 +1 @@ +MD5 (wmnd_0.3.3.tar.gz) = eadd01d602e8d9ef4c5aec8125e10a49 diff --git a/net/wmnd/files/patch-Makefile b/net/wmnd/files/patch-Makefile new file mode 100644 index 000000000000..d1fcf3f59d0b --- /dev/null +++ b/net/wmnd/files/patch-Makefile @@ -0,0 +1,36 @@ +--- Makefile.orig Tue May 22 07:30:58 2001 ++++ Makefile Thu Nov 29 16:11:31 2001 +@@ -6,7 +6,6 @@ + VERSION = `sed -n "s/\#define WMND_VERSION \"\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\"/\1\\.\2\\.\\3/p" src/wmnd.h` + PRE = + +-prefix = /usr/local/ + bindir = $(prefix)/bin/ + mandir = $(prefix)/man/ + datadir = $(prefix)/share/ +@@ -14,13 +13,13 @@ + + # X11 headers location may vary on some systems + # XFree (linux etc): +-X11CFLAGS = -I/usr/X11R6/include +-X11LDFLAGS = -L/usr/X11R6/lib -lXpm -lXext -lX11 ++X11CFLAGS = -I${X11BASE}/include ++X11LDFLAGS = -L${X11BASE}/lib -lXpm -lXext -lX11 + # OpenWindows (solaris, sco unixware etc): + # X11CFLAGS = -I/usr/openwin/include + # X11LDFLAGS = -L/usr/openwin/lib -lXpm -lXext -lX11 -lsocket -lnsl + # Solaris specific (for use with kstat) +-LDFLAGS = -lkstat -lsocket -lnsl ++# LDFLAGS = -lkstat -lsocket -lnsl + + ################## + # compiler flags # +@@ -32,7 +31,7 @@ + VPATH = $(SRC):$(MAN) + + # Optimizing +-CFLAGS = -Wall -O3 -fomit-frame-pointer -fstrict-aliasing -pipe ++# CFLAGS = -Wall -O -fomit-frame-pointer -fstrict-aliasing -pipe + + # Profiling + # CFLAGS = -Wall -ansi -pg -g -O3 -pipe -D_GNU_SOURCE -DPRO diff --git a/net/wmnd/files/patch-src::config.h b/net/wmnd/files/patch-src::config.h new file mode 100644 index 000000000000..ace6c9dd51fe --- /dev/null +++ b/net/wmnd/files/patch-src::config.h @@ -0,0 +1,25 @@ +--- src/config.h.orig Fri May 18 14:06:47 2001 ++++ src/config.h Thu Nov 29 16:26:26 2001 +@@ -11,16 +11,19 @@ + /* define below if you're on a big endian architecture */ + /* #define WORDS_BIGENDIAN */ + ++/*FreeBSD dev driver*/ ++#define USE_FREEBSD_SYSCTL ++ + /* linux /proc/net/dev driver */ + /* #define USE_LINUX_PROC */ + + /* free pppd for Solaris 2.x and compatible streams ppp devices */ +-#define USE_SOLARIS_FPPPD ++//#define USE_SOLARIS_FPPPD + + /* solaris kstat driver, also works on kstat compatible OSs */ +-#define USE_SOLARIS_KSTAT ++//#define USE_SOLARIS_KSTAT + + /* dummy driver for testing purposes, it's safe to leave it defined */ +-#define USE_TESTING_DUMMY ++//#define USE_TESTING_DUMMY + + #endif diff --git a/net/wmnd/files/patch-src::drivers.c b/net/wmnd/files/patch-src::drivers.c new file mode 100644 index 000000000000..e2bf6e9155ec --- /dev/null +++ b/net/wmnd/files/patch-src::drivers.c @@ -0,0 +1,120 @@ +--- src/drivers.c.orig Tue May 22 11:11:25 2001 ++++ src/drivers.c Thu Nov 29 16:29:44 2001 +@@ -17,6 +17,117 @@ + * *_term: deallocate name, eventually drvdata and close fds + */ + ++#ifdef USE_FREEBSD_SYSCTL ++ ++/* functions prototypes */ ++int freebsd_dev_list(const char *devname, struct Devices *list) { ++ char *devn; ++ struct Devices *ndev; ++ int mib[5], len; ++ int i; ++ struct ifmibdata ifmd; ++ ++ mib[0]=CTL_NET; ++ mib[1]=PF_LINK; ++ mib[2]=NETLINK_GENERIC; ++ mib[3]=IFMIB_SYSTEM; ++ mib[4]=IFMIB_IFCOUNT; ++ ++ len=sizeof(int); ++ ++ if (sysctl(mib, 5, &freebsd_interface_count, &len ,NULL, 0)==-1) {perror("systcl failed");exit(-1);} ++ printf("freebsd_interface_count: %d\n",freebsd_interface_count); ++ ++ printf("devname: %s\n", devname); ++ if (devname != NULL) { ++ // fill in the Devices structure ++ ndev=malloc(sizeof(struct Devices)); ++ list->next=ndev; ++ // name of device ++ devn=strdup(devname); ++ ndev->name=devn; ++ // next Devices field used to create the chain ++ ndev->next=NULL; ++ // internale driver data ++ ndev->drvdata=NULL; ++ // driver number ++ ndev->drvnum=0; ++ // status indicator (0 online, 1 offline) ++ ndev->online=0; ++ // device activity start ++ ndev->devstart=time(NULL); ++ // end of initialization ++ printf("freebsd_dev_list finished ok!!!\n"); ++ return 1; ++ } ++ else { // we don't have a specific interface to monitor, so we must first retrieve the name of all available interfaces ++printf("any interface defined!\n"); ++ ++ len=sizeof(ifmd); ++ ++ for(i=1;i<=freebsd_interface_count;i++) { ++ ++ ++ if (get_ifmib_general(i, &ifmd)==-1) {perror("sysctl2");exit(-1);} ++ ++ // fill in the Devices structure ++ ndev=malloc(sizeof(struct Devices)); ++ list->next=ndev; ++ // name of device ++ devn=strdup(ifmd.ifmd_name); ++ ndev->name=devn; ++ // next Devices field used to create the chain ++ ndev->next=NULL; ++ // internale driver data ++ ndev->drvdata=NULL; ++ // driver number ++ ndev->drvnum=0; ++ // status indicator (0 online, 1 offline) ++ ndev->online=0; ++ // device activity start ++ ndev->devstart=time(NULL); ++ //update the list pointer ++ list=ndev; ++ // end of initialization ++ ++} ++ ++ return 1; ++ } ++} ++ ++int freebsd_dev_init(struct Devices *dev) { ++ printf("nothing to do here!\n"); ++ return 0; ++} ++ ++int freebsd_dev_get(struct Devices *dev, unsigned long *ip, unsigned long *op, unsigned long *ib, unsigned long *ob) { ++ struct ifmibdata ifmd; ++ int i; ++for(i=1;i<=freebsd_interface_count;i++) { ++ if(get_ifmib_general(i, &ifmd)==-1) {perror("systcl3");exit(-1);} ++ //printf("comparing devname: %s with ifmdname: %s\n",dev->name, ifmd.ifmd_name); ++ if(strcmp(dev->name,ifmd.ifmd_name)==0) { ++ //printf("interface name: %s\n",ifmd.ifmd_name); ++ //printf("ipacktes: %ld opackets: %ld\n",ifmd.ifmd_data.ifi_ipackets,ifmd.ifmd_data.ifi_opackets); ++ //printf("ibytes: %ld obytes: %ld\n",ifmd.ifmd_data.ifi_ibytes,ifmd.ifmd_data.ifi_obytes); ++ //printf("\n"); ++ *ip=ifmd.ifmd_data.ifi_ipackets; *op=ifmd.ifmd_data.ifi_opackets; ++ *ib=ifmd.ifmd_data.ifi_ibytes; *ob=ifmd.ifmd_data.ifi_obytes; ++ return 0; ++ } ++} printf("interface %s not found!\n",dev->name); exit(-1); ++ ++ return 0; ++} ++ ++void freebsd_dev_term(struct Devices *dev) { ++ printf("freebsd_dev_term: %s\n",dev->name); ++ //free(dev); ++} ++ ++#endif /*USE_FREESD_SYSCTL*/ ++ + #ifdef USE_SOLARIS_FPPPD + + /* strioclt is a support function, not previously declared */ diff --git a/net/wmnd/files/patch-src::drivers.h b/net/wmnd/files/patch-src::drivers.h new file mode 100644 index 000000000000..0dc9a46f26a2 --- /dev/null +++ b/net/wmnd/files/patch-src::drivers.h @@ -0,0 +1,31 @@ +--- src/drivers.h.orig Sun May 20 10:19:01 2001 ++++ src/drivers.h Thu Nov 29 16:33:19 2001 +@@ -32,6 +32,18 @@ + typedef void (*p_term_drv) (struct Devices * dev); + + /* driver vars */ ++#ifdef USE_FREEBSD_SYSCTL ++ ++ ++/* functions prototypes */ ++int freebsd_dev_list(const char *devname, struct Devices *list); ++int freebsd_dev_init(struct Devices *dev); ++int freebsd_dev_get(struct Devices *dev, unsigned long *ip, unsigned long *op, ++ unsigned long *ib, unsigned long *ob); ++void freebsd_dev_term(struct Devices *dev); ++ ++#endif /*USE_FREESD_SYSCTL*/ ++ + #ifdef USE_SOLARIS_FPPPD + + #include +@@ -133,6 +145,9 @@ + #endif + #ifdef USE_TESTING_DUMMY + {"testing_dummy", testing_dummy_list, testing_dummy_init, testing_dummy_get, testing_dummy_term}, ++#endif ++#ifdef USE_FREEBSD_SYSCTL ++ {"FreeBSD_sysctl", freebsd_dev_list, freebsd_dev_init, freebsd_dev_get, freebsd_dev_term}, + #endif + {NULL, NULL, NULL, NULL, NULL} + }; diff --git a/net/wmnd/files/patch-src::wmnd.h b/net/wmnd/files/patch-src::wmnd.h new file mode 100644 index 000000000000..2942e843488b --- /dev/null +++ b/net/wmnd/files/patch-src::wmnd.h @@ -0,0 +1,40 @@ +--- src/wmnd.h.orig Tue May 22 05:06:36 2001 ++++ src/wmnd.h Thu Nov 29 16:08:01 2001 +@@ -24,6 +24,37 @@ + #include + #include + ++#ifdef USE_FREEBSD_SYSCTL ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* internal structure used for freebsd-systcl */ ++ ++int freebsd_interface_count=0; ++ ++int get_ifmib_general(int row, struct ifmibdata *ifmd) { ++ ++ int name[6], len; ++ ++ len=sizeof(struct ifmibdata); ++ ++ name[0] = CTL_NET; ++ name[1] = PF_LINK; ++ name[2] = NETLINK_GENERIC; ++ name[3] = IFMIB_IFDATA; ++ name[4] = row; ++ name[5] = IFDATA_GENERAL; ++ ++ return sysctl(name, 6, ifmd, &len, NULL, 0); ++} ++ ++#endif ++ + /* + * Wmnd version number, do not modify line layout or sed will not find + * the main version number diff --git a/net/wmnd/pkg-comment b/net/wmnd/pkg-comment new file mode 100644 index 000000000000..ad97a651ae07 --- /dev/null +++ b/net/wmnd/pkg-comment @@ -0,0 +1 @@ +Improved network monitoring dock app (with tons of features) diff --git a/net/wmnd/pkg-descr b/net/wmnd/pkg-descr new file mode 100644 index 000000000000..234f0a204406 --- /dev/null +++ b/net/wmnd/pkg-descr @@ -0,0 +1,9 @@ +WMND (WindowMaker Network Devices) is a network monitoring +dock app improved and based on WMiFS 1.3b. The version 0.2 of +wmnd is almost totally written by Timecop, given the optimization +and flexibility. Enjoy! + +WWW: http://www.wingeer.org/wmnd/ + +- Paolo +flag@gufi.org diff --git a/net/wmnd/pkg-plist b/net/wmnd/pkg-plist new file mode 100644 index 000000000000..44b92e843f5f --- /dev/null +++ b/net/wmnd/pkg-plist @@ -0,0 +1,8 @@ +bin/wmnd +%%PORTDOCS%%share/doc/wmnd/CHANGELOGS +%%PORTDOCS%%share/doc/wmnd/DISPLAY +%%PORTDOCS%%share/doc/wmnd/HINTS +%%PORTDOCS%%share/doc/wmnd/README +share/examples/wmnd/wmndrc +@dirrm share/examples/wmnd +%%PORTDOCS%%@dirrm share/doc/wmnd -- cgit v1.2.3