diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2003-12-06 07:51:49 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2003-12-06 07:51:49 +0800 |
commit | 152b8689fa4dce172d9a791efa363631a686a898 (patch) | |
tree | 0c2ce54e75810dd0ee6ac94672c7545fba6fe7c8 /net/gnome-netstatus | |
parent | 173d2a5ad36bc6133eb7523b3692101e991d7e0f (diff) | |
download | marcuscom-ports-152b8689fa4dce172d9a791efa363631a686a898.tar marcuscom-ports-152b8689fa4dce172d9a791efa363631a686a898.tar.gz marcuscom-ports-152b8689fa4dce172d9a791efa363631a686a898.tar.bz2 marcuscom-ports-152b8689fa4dce172d9a791efa363631a686a898.tar.lz marcuscom-ports-152b8689fa4dce172d9a791efa363631a686a898.tar.xz marcuscom-ports-152b8689fa4dce172d9a791efa363631a686a898.tar.zst marcuscom-ports-152b8689fa4dce172d9a791efa363631a686a898.zip |
Add gnomenetstatus, an applet that shows various interface byte and packet
statistics. Note: this applet may require more FreeBSD work.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@1399 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'net/gnome-netstatus')
-rw-r--r-- | net/gnome-netstatus/Makefile | 27 | ||||
-rw-r--r-- | net/gnome-netstatus/distinfo | 1 | ||||
-rw-r--r-- | net/gnome-netstatus/files/patch-configure | 10 | ||||
-rw-r--r-- | net/gnome-netstatus/files/patch-src_netstatus-iface.c | 45 | ||||
-rw-r--r-- | net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c | 157 | ||||
-rw-r--r-- | net/gnome-netstatus/pkg-descr | 2 | ||||
-rw-r--r-- | net/gnome-netstatus/pkg-plist | 40 |
7 files changed, 282 insertions, 0 deletions
diff --git a/net/gnome-netstatus/Makefile b/net/gnome-netstatus/Makefile new file mode 100644 index 000000000..b7b8ddc66 --- /dev/null +++ b/net/gnome-netstatus/Makefile @@ -0,0 +1,27 @@ +# New ports collection makefile for: gnomenetstatus +# Date Created: 05 December 2003 +# Whom: Joe Marcus Clarke <marcus@FreeBSD.org> +# +# $FreeBSD$ +# + +PORTNAME= gnomenetstatus +PORTVERSION= 0.12 +CATEGORIES= net gnome +MASTER_SITES= ${MASTER_SITE_GNOME} +MASTER_SITE_SUBDIR= sources/gnome-netstatus/0.12 +DISTNAME= gnome-netstatus-${PORTVERSION} +DIST_SUBDIR= gnome2 + +MAINTAINER= gnome@FreeBSD.org +COMMENT= A GNOME applet that shows network status + +USE_X_PREFIX= yes +USE_BZIP2= yes +USE_GNOME= gnomehack gnomeprefix libgnome +USE_GMAKE= yes +USE_LIBTOOL= yes +CONFIGURE_ARGS= CPPFLAGS="-I${LOCALBASE}/include" \ + LDFLAGS="-L${LOCALBASE}/lib" + +.include <bsd.port.mk> diff --git a/net/gnome-netstatus/distinfo b/net/gnome-netstatus/distinfo new file mode 100644 index 000000000..f355b4b3f --- /dev/null +++ b/net/gnome-netstatus/distinfo @@ -0,0 +1 @@ +MD5 (gnome2/gnome-netstatus-0.12.tar.bz2) = 9977c8fddaaa335c86772da56a591112 diff --git a/net/gnome-netstatus/files/patch-configure b/net/gnome-netstatus/files/patch-configure new file mode 100644 index 000000000..f195f07b4 --- /dev/null +++ b/net/gnome-netstatus/files/patch-configure @@ -0,0 +1,10 @@ +--- configure.orig Wed Dec 11 18:31:51 2002 ++++ configure Thu Dec 12 12:07:17 2002 +@@ -7414,6 +7414,7 @@ + + # This can be used to rebuild libtool when needed + LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" ++$ac_aux_dir/ltconfig $LIBTOOL_DEPS + + # Always use our own libtool. + LIBTOOL='$(SHELL) $(top_builddir)/libtool' diff --git a/net/gnome-netstatus/files/patch-src_netstatus-iface.c b/net/gnome-netstatus/files/patch-src_netstatus-iface.c new file mode 100644 index 000000000..7b42c2436 --- /dev/null +++ b/net/gnome-netstatus/files/patch-src_netstatus-iface.c @@ -0,0 +1,45 @@ +--- src/netstatus-iface.c.orig Fri Dec 5 18:27:45 2003 ++++ src/netstatus-iface.c Fri Dec 5 18:35:36 2003 +@@ -32,9 +32,12 @@ + + #include <libgnome/gnome-i18n.h> + ++#include <sys/types.h> ++#include <sys/socket.h> + #include <sys/ioctl.h> + #include <net/if.h> + #include <net/if_arp.h> ++#include <netinet/in.h> + #include <arpa/inet.h> + #include <errno.h> + #include <unistd.h> +@@ -646,7 +649,11 @@ + strncpy (if_req.ifr_name, iface->priv->name, IF_NAMESIZE - 1); + if_req.ifr_name [IF_NAMESIZE - 1] = '\0'; + if (mask && ioctl (fd, SIOCGIFNETMASK, &if_req) == 0) ++#if !defined(__FreeBSD__) + *mask = g_strdup (inet_ntoa (((struct sockaddr_in *) &if_req.ifr_netmask)->sin_addr)); ++#else ++ *mask = g_strdup (inet_ntoa (((struct sockaddr_in *) &if_req.ifr_addr)->sin_addr)); ++#endif + + close (fd); + +@@ -925,6 +932,7 @@ + char **hw_addr) + + { ++#ifdef SIOCGIFHWADDR + static struct HwType *hw_type = NULL; + struct ifreq if_req; + int fd; +@@ -973,6 +981,9 @@ + *hw_addr = hw_type->print_hw_addr (if_req.ifr_hwaddr.sa_data); + + return hw_type; ++#else ++ return NULL; ++#endif + } + + gboolean diff --git a/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c b/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c new file mode 100644 index 000000000..cb070768a --- /dev/null +++ b/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c @@ -0,0 +1,157 @@ +--- src/netstatus-sysdeps.c.orig Mon Jun 9 13:18:04 2003 ++++ src/netstatus-sysdeps.c Fri Dec 5 18:47:38 2003 +@@ -31,6 +31,8 @@ + #include <glib.h> + #include <libgnome/gnome-i18n.h> + ++#if !defined(__FreeBSD__) ++ + static inline char * + parse_iface_name (const char *buf) + { +@@ -206,3 +208,145 @@ + + return error_message; + } ++ ++#else ++ ++static inline void ++parse_header (char *buf, ++ int *prx_idx, ++ int *ptx_idx, ++ int *brx_idx, ++ int *btx_idx) ++{ ++ char *p; ++ int i; ++ ++ *prx_idx = *ptx_idx = -1; ++ *brx_idx = *btx_idx = -1; ++ ++ p = strtok (buf, " "); ++ for (i = 0; p; i++, p = strtok (NULL, " ")) ++ { ++ if (!strcmp (p, "Ipkts")) ++ { ++ *prx_idx = i; ++ } ++ else if (!strcmp (p, "Ibytes")) ++ { ++ *brx_idx = i; ++ } ++ else if (!strcmp (p, "Opkts")) ++ { ++ *ptx_idx = i; ++ } ++ else if (!strcmp (p, "Obytes")) ++ { ++ *btx_idx = i; ++ } ++ } ++} ++ ++static inline int ++parse_stats (char *buf, ++ int prx_idx, ++ int ptx_idx, ++ long *in_packets, ++ long *out_packets, ++ int brx_idx, ++ int btx_idx, ++ long *in_bytes, ++ long *out_bytes) ++{ ++ char *p; ++ int i; ++ ++ p = strtok (buf, " "); ++ for (i = 0; p; i++, p = strtok (NULL, " ")) ++ { ++ if (i == prx_idx) ++ *in_packets = g_ascii_strtoull (p, NULL, 10); ++ if (i == ptx_idx) ++ *out_packets = g_ascii_strtoull (p, NULL, 10); ++ if (i == brx_idx) ++ *in_bytes = g_ascii_strtoull (p, NULL, 10); ++ if (i == btx_idx) ++ *out_bytes = g_ascii_strtoull (p, NULL, 10); ++ } ++ ++ if (i <= prx_idx || i <= ptx_idx || i <= brx_idx || i <=btx_idx) ++ return FALSE; ++ ++ return TRUE; ++} ++ ++char * ++netstatus_sysdeps_read_iface_statistics (const char *iface, ++ long *in_packets, ++ long *out_packets, ++ long *in_bytes, ++ long *out_bytes) ++{ ++ gchar *buf; ++ gchar cmd[512]; ++ gchar **command_line; ++ int prx_idx, ptx_idx; ++ int brx_idx, btx_idx; ++ char *error_message = NULL; ++ gchar *dir = g_get_current_dir (); ++ gint pout; ++ GIOChannel *channel; ++ GError *err = NULL; ++ ++ *in_packets = -1; ++ *out_packets = -1; ++ *in_bytes = -1; ++ *out_bytes = -1; ++ ++ g_snprintf (cmd, sizeof(cmd), "/usr/bin/netstat -I %s -b -f inet", ++ iface); ++ command_line = g_strsplit (cmd, " ", -1); ++ ++ if (g_spawn_async_with_pipes (dir, command_line, NULL, ++ G_SPAWN_FILE_AND_ARGV_ZERO, NULL, ++ NULL, NULL, NULL, &pout, ++ NULL, &err)) { ++ g_strfreev (command_line); ++ channel = g_io_channel_unix_new (pout); ++ g_io_channel_read_line (channel, &buf, NULL, NULL, NULL); ++ ++ parse_header (buf, &prx_idx, &ptx_idx, &brx_idx, &btx_idx); ++ if (prx_idx == -1 || ptx_idx == -1 || ++ brx_idx == -1 || btx_idx == -1) ++ return g_strdup ("Could not parse netstat output. Unknown format."); ++ ++ g_io_channel_read_line (channel, &buf, NULL, NULL, NULL); ++ ++ if (!parse_stats (buf, prx_idx, ptx_idx, in_packets, out_packets, ++ brx_idx, btx_idx, in_bytes, out_bytes)) ++ { ++ if (error_message) ++ g_free (error_message); ++ error_message = g_strdup_printf (_("Could not parse interface statistics from '%s'. " ++ "prx_idx = %d; ptx_idx = %d; brx_idx = %d; btx_idx = %d;"), ++ buf, prx_idx, ptx_idx, brx_idx, btx_idx); ++ } ++ ++ if ((*in_packets == -1 || *out_packets == -1 || *in_bytes == -1 || *out_bytes == -1) && !error_message) ++ error_message = g_strdup_printf ("Could not obtain information on interface '%s' from netstat", iface); ++ ++ g_io_channel_unref (channel); ++ g_io_channel_shutdown (channel, TRUE, NULL); ++ } ++ else { ++ if (error_message) ++ g_free (error_message); ++ error_message = g_strdup_printf ("Error running /usr/bin/netstat for '%s': %s", iface, ++ err->message); ++ g_error_free (err); ++ } ++ ++ g_free (dir); ++ ++ return error_message; ++} ++#endif diff --git a/net/gnome-netstatus/pkg-descr b/net/gnome-netstatus/pkg-descr new file mode 100644 index 000000000..85e70885c --- /dev/null +++ b/net/gnome-netstatus/pkg-descr @@ -0,0 +1,2 @@ +Gnome-netstatus is an applet which provides information about a network +interface on your panel. diff --git a/net/gnome-netstatus/pkg-plist b/net/gnome-netstatus/pkg-plist new file mode 100644 index 000000000..e8b096d6e --- /dev/null +++ b/net/gnome-netstatus/pkg-plist @@ -0,0 +1,40 @@ +etc/gconf/gconf.xml.defaults/apps/netstatus_applet/%gconf.xml +etc/gconf/gconf.xml.defaults/schemas/apps/netstatus_applet/%gconf.xml +etc/gconf/gconf.xml.defaults/schemas/apps/netstatus_applet/prefs/%gconf.xml +etc/gconf/schemas/netstatus.schemas +libdata/bonobo/servers/GNOME_NetstatusApplet_Factory.server +libexec/gnome-netstatus-applet +share/gnome/gnome-2.0/ui/GNOME_NetstatusApplet.xml +share/gnome/gnome-netstatus/gnome-netstatus.glade +share/gnome/icons/gnome-netstatus/gnome-netstatus-disconn.png +share/gnome/icons/gnome-netstatus/gnome-netstatus-error.png +share/gnome/icons/gnome-netstatus/gnome-netstatus-idle.png +share/gnome/icons/gnome-netstatus/gnome-netstatus-rx.png +share/gnome/icons/gnome-netstatus/gnome-netstatus-tx.png +share/gnome/icons/gnome-netstatus/gnome-netstatus-txrx.png +share/gnome/pixmaps/gnome-netstatus-tx.png +share/locale/az/LC_MESSAGES/gnome-netstatus.mo +share/locale/cs/LC_MESSAGES/gnome-netstatus.mo +share/locale/de/LC_MESSAGES/gnome-netstatus.mo +share/locale/el/LC_MESSAGES/gnome-netstatus.mo +share/locale/es/LC_MESSAGES/gnome-netstatus.mo +share/locale/fr/LC_MESSAGES/gnome-netstatus.mo +share/locale/it/LC_MESSAGES/gnome-netstatus.mo +share/locale/ja/LC_MESSAGES/gnome-netstatus.mo +share/locale/ms/LC_MESSAGES/gnome-netstatus.mo +share/locale/nl/LC_MESSAGES/gnome-netstatus.mo +share/locale/pl/LC_MESSAGES/gnome-netstatus.mo +share/locale/pt/LC_MESSAGES/gnome-netstatus.mo +share/locale/ru/LC_MESSAGES/gnome-netstatus.mo +share/locale/sr/LC_MESSAGES/gnome-netstatus.mo +share/locale/sr@Latn/LC_MESSAGES/gnome-netstatus.mo +share/locale/sv/LC_MESSAGES/gnome-netstatus.mo +share/locale/tr/LC_MESSAGES/gnome-netstatus.mo +share/locale/vi/LC_MESSAGES/gnome-netstatus.mo +share/locale/wa/LC_MESSAGES/gnome-netstatus.mo +share/locale/zh_CN/LC_MESSAGES/gnome-netstatus.mo +@dirrm share/gnome/icons/gnome-netstatus +@dirrm share/gnome/gnome-netstatus +@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/netstatus_applet/prefs +@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/netstatus_applet +@dirrm etc/gconf/gconf.xml.defaults/apps/netstatus_applet |