diff --git a/ChangeLog b/ChangeLog index 2087bb45..4317dd13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +1999-11-28 Martin Baulig + + * include/glibtop/interfaces.h (glibtop_get_interface_names): + Added `instance' argument. + 1999-11-28 Martin Baulig * lib/lib.pl: We now have a new, more extensible client/server diff --git a/features.def b/features.def index e6e5c386..8006c9bd 100644 --- a/features.def +++ b/features.def @@ -19,5 +19,5 @@ glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid) glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs) retval|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string(mount_dir) retval|netload|ulong(if_flags,mtu,subnet,address,packets_in,packets_out,packets_total,bytes_in,bytes_out,bytes_total,errors_in,errors_out,errors_total,collisions)|string(interface) -char *|interface_names|ulong(size)|unsigned(interface,number,strategy) +char *|interface_names|ulong(size)|unsigned(interface,number,instance,strategy) retval|ppp|ulong(state,bytes_in,bytes_out)|ushort(device) diff --git a/include/glibtop/interfaces.h b/include/glibtop/interfaces.h index 015b50b5..0b2b596c 100644 --- a/include/glibtop/interfaces.h +++ b/include/glibtop/interfaces.h @@ -38,21 +38,45 @@ BEGIN_LIBGTOP_DECLS typedef struct _glibtop_interface_names glibtop_interface_names; -typedef enum _glibtop_protocol glibtop_protocol; typedef enum _glibtop_interface glibtop_interface; +typedef enum _glibtop_transport glibtop_transport; +typedef enum _glibtop_protocol glibtop_protocol; enum _glibtop_protocol { GLIBTOP_NETLOAD_DEFAULT = 0, - GLIBTOP_NETLOAD_IPV4, - GLIBTOP_NETLOAD_IPV6, - GLIBTOP_NETLOAD_IPX, + GLIBTOP_NETLOAD_ICMP, + GLIBTOP_NETLOAD_TCP, + GLIBTOP_NETLOAD_UDP, +}; + +enum _glibtop_transport { + GLIBTOP_TRANSPORT_DEFAULT = 0, + GLIBTOP_TRANSPORT_OTHER, + GLIBTOP_TRANSPORT_IPV4, + GLIBTOP_TRANSPORT_IPV6, + GLIBTOP_TRANSPORT_IPX, + GLIBTOP_TRANSPORT_X25, + GLIBTOP_TRANSPORT_DECNET, + GLIBTOP_TRANSPORT_APPLETALK, + GLIBTOP_TRANSPORT_NETBEUI, }; enum _glibtop_interface { GLIBTOP_INTERFACE_ALL = 0, - GLIBTOP_INTERFACE_ETHERNET, - GLIBTOP_INTERFACE_LOOPBACK, + GLIBTOP_INTERFACE_OTHER, + /* Network interfaces */ + GLIBTOP_INTERFACE_ETHERNET = 101, + GLIBTOP_INTERFACE_FDDI, + GLIBTOP_INTERFACE_FRAME_RELAY, + GLIBTOP_INTERFACE_TOKEN_RING, + GLIBTOP_INTERFACE_ARCNET, + GLIBTOP_INTERFACE_ATM, + /* Dummy interfaces */ + GLIBTOP_INTERFACE_LOOPBACK = 501, GLIBTOP_INTERFACE_DUMMY, + /* Dialup interfaces */ + GLIBTOP_INTERFACE_PARA = 801, + GLIBTOP_INTERFACE_SLIP, GLIBTOP_INTERFACE_PPP, GLIBTOP_INTERFACE_ISDN }; @@ -69,7 +93,7 @@ struct _glibtop_interface_names size; /* GLIBTOP_INTERFACES_SIZE */ }; -#define glibtop_get_interface_names(buf, interface,number,strategy) glibtop_get_interface_names_l(glibtop_global_server, buf, interface, number, strategy) +#define glibtop_get_interface_names(buf,interface,number,instance,strategy) glibtop_get_interface_names_l (glibtop_global_server, buf, interface, number, instance, strategy) #if GLIBTOP_SUID_INTERFACE_NAMES #define glibtop_get_interface_names_r glibtop_get_interface_names_p @@ -77,14 +101,14 @@ struct _glibtop_interface_names #define glibtop_get_interface_names_r glibtop_get_interface_names_s #endif -char *glibtop_get_interface_names_l (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, unsigned strategy); +char *glibtop_get_interface_names_l (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, unsigned instance, unsigned strategy); #if GLIBTOP_SUID_INTERFACE_NAMES int glibtop_init_interface_names_p (glibtop *server); -char *glibtop_get_interface_names_p (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, unsigned strategy); +char *glibtop_get_interface_names_p (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, unsigned instance, unsigned strategy); #else int glibtop_init_interface_names_s (glibtop *server); -char *glibtop_get_interface_names_s (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, unsigned strategy); +char *glibtop_get_interface_names_s (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, unsigned instance, unsigned strategy); #endif #ifdef GLIBTOP_NAMES diff --git a/src/daemon/main.c b/src/daemon/main.c index 7ef7af10..db16269c 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -48,6 +48,7 @@ handle_parent_connection (int s) u_int64_t interface G_GNUC_UNUSED; u_int64_t number G_GNUC_UNUSED; + u_int64_t instance G_GNUC_UNUSED; u_int64_t strategy G_GNUC_UNUSED; glibtop_send_version (glibtop_global_server, s); @@ -240,11 +241,14 @@ handle_parent_connection (int s) memcpy (&interface, parameter, sizeof (u_int64_t)); memcpy (&number, parameter + sizeof (u_int64_t), sizeof (u_int64_t)); - memcpy (&strategy, parameter + 2 * sizeof (u_int64_t), + memcpy (&instance, parameter + 2 * sizeof (u_int64_t), + sizeof (u_int64_t)); + memcpy (&strategy, parameter + 3 * sizeof (u_int64_t), sizeof (u_int64_t)); ptr = glibtop_get_interface_names_l (server, &resp->u.data.interface_names, - interface, number, strategy); + interface, number, instance, + strategy); do_output (s, resp, _offset_data (interface_names), ptr ? resp->u.data.interface_names.size+1 : 0, ptr, (ptr != NULL) ? 0 : -1); diff --git a/src/daemon/slave.c b/src/daemon/slave.c index f25adebc..82bee6e9 100644 --- a/src/daemon/slave.c +++ b/src/daemon/slave.c @@ -33,6 +33,7 @@ handle_slave_connection (int input, int output) u_int64_t interface G_GNUC_UNUSED; u_int64_t number G_GNUC_UNUSED; + u_int64_t instance G_GNUC_UNUSED; u_int64_t strategy G_GNUC_UNUSED; unsigned short max_len G_GNUC_UNUSED; @@ -118,11 +119,13 @@ handle_slave_connection (int input, int output) memcpy (&interface, parameter, sizeof (u_int64_t)); memcpy (&number, parameter + sizeof (u_int64_t), sizeof (u_int64_t)); - memcpy (&strategy, parameter + 2 * sizeof (u_int64_t), + memcpy (&instance, parameter + 2 * sizeof (u_int64_t), + sizeof (u_int64_t)); + memcpy (&strategy, parameter + 3 * sizeof (u_int64_t), sizeof (u_int64_t)); ptr = glibtop_get_proc_args_p (server, &resp->u.data.interface_names, - interface, number, strategy); + interface, number, instance, strategy); do_output (output, resp, _offset_data (interface_names), ptr ? resp->u.data.interface_names.size+1 : 0, ptr, (ptr != NULL) ? 0 : -1); diff --git a/sysdeps/freebsd/interfaces.c b/sysdeps/freebsd/interfaces.c index 6874bfcf..3d468970 100644 --- a/sysdeps/freebsd/interfaces.c +++ b/sysdeps/freebsd/interfaces.c @@ -44,7 +44,7 @@ glibtop_init_interface_names_p (glibtop *server) char * glibtop_get_interface_names_p (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, - unsigned strategy) + unsigned instance, unsigned strategy) { glibtop_init_s (&server, GLIBTOP_SYSDEPS_INTERFACE_NAMES, 0); diff --git a/sysdeps/linux/interfaces.c b/sysdeps/linux/interfaces.c index b8091833..3102e7a1 100644 --- a/sysdeps/linux/interfaces.c +++ b/sysdeps/linux/interfaces.c @@ -44,7 +44,7 @@ glibtop_init_interface_names_s (glibtop *server) char * glibtop_get_interface_names_s (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, - unsigned strategy) + unsigned instance, unsigned strategy) { glibtop_init_s (&server, GLIBTOP_SYSDEPS_INTERFACE_NAMES, 0); diff --git a/sysdeps/solaris/interfaces.c b/sysdeps/solaris/interfaces.c index b8091833..3102e7a1 100644 --- a/sysdeps/solaris/interfaces.c +++ b/sysdeps/solaris/interfaces.c @@ -44,7 +44,7 @@ glibtop_init_interface_names_s (glibtop *server) char * glibtop_get_interface_names_s (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, - unsigned strategy) + unsigned instance, unsigned strategy) { glibtop_init_s (&server, GLIBTOP_SYSDEPS_INTERFACE_NAMES, 0); diff --git a/sysdeps/stub/interfaces.c b/sysdeps/stub/interfaces.c index b8091833..3102e7a1 100644 --- a/sysdeps/stub/interfaces.c +++ b/sysdeps/stub/interfaces.c @@ -44,7 +44,7 @@ glibtop_init_interface_names_s (glibtop *server) char * glibtop_get_interface_names_s (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, - unsigned strategy) + unsigned instance, unsigned strategy) { glibtop_init_s (&server, GLIBTOP_SYSDEPS_INTERFACE_NAMES, 0); diff --git a/sysdeps/stub_suid/interfaces.c b/sysdeps/stub_suid/interfaces.c index 6874bfcf..3d468970 100644 --- a/sysdeps/stub_suid/interfaces.c +++ b/sysdeps/stub_suid/interfaces.c @@ -44,7 +44,7 @@ glibtop_init_interface_names_p (glibtop *server) char * glibtop_get_interface_names_p (glibtop *server, glibtop_interface_names *buf, unsigned interface, unsigned number, - unsigned strategy) + unsigned instance, unsigned strategy) { glibtop_init_s (&server, GLIBTOP_SYSDEPS_INTERFACE_NAMES, 0);