Added `instance' argument.

1999-11-28  Martin Baulig  <martin@home-of-linux.org>

	* include/glibtop/interfaces.h (glibtop_get_interface_names):
	Added `instance' argument.
This commit is contained in:
Martin Baulig
1999-11-28 17:53:34 +00:00
committed by Martin Baulig
parent 776b6965fb
commit 53f9d03e30
10 changed files with 56 additions and 20 deletions

View File

@@ -1,3 +1,8 @@
1999-11-28 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/interfaces.h (glibtop_get_interface_names):
Added `instance' argument.
1999-11-28 Martin Baulig <martin@home-of-linux.org>
* lib/lib.pl: We now have a new, more extensible client/server

View File

@@ -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)

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);