1 /* Copyright (C) 1998-99 Martin Baulig 2 This file is part of LibGTop 1.0. 3 4 Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. 5 6 LibGTop is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, 9 or (at your option) any later version. 10 11 LibGTop is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with LibGTop; see the file COPYING. If not, write to the 18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef __GLIBTOP_NETLOAD_H__ 23 #define __GLIBTOP_NETLOAD_H__ 24 25 #include <glibtop.h> 26 #include <glibtop/global.h> 27 28 G_BEGIN_DECLS 29 30 #define GLIBTOP_NETLOAD_IF_FLAGS 0 31 #define GLIBTOP_NETLOAD_MTU 1 32 #define GLIBTOP_NETLOAD_SUBNET 2 33 #define GLIBTOP_NETLOAD_ADDRESS 3 34 #define GLIBTOP_NETLOAD_PACKETS_IN 4 35 #define GLIBTOP_NETLOAD_PACKETS_OUT 5 36 #define GLIBTOP_NETLOAD_PACKETS_TOTAL 6 37 #define GLIBTOP_NETLOAD_BYTES_IN 7 38 #define GLIBTOP_NETLOAD_BYTES_OUT 8 39 #define GLIBTOP_NETLOAD_BYTES_TOTAL 9 40 #define GLIBTOP_NETLOAD_ERRORS_IN 10 41 #define GLIBTOP_NETLOAD_ERRORS_OUT 11 42 #define GLIBTOP_NETLOAD_ERRORS_TOTAL 12 43 #define GLIBTOP_NETLOAD_COLLISIONS 13 44 #define GLIBTOP_NETLOAD_ADDRESS6 14 45 #define GLIBTOP_NETLOAD_PREFIX6 15 46 #define GLIBTOP_NETLOAD_SCOPE6 16 47 #define GLIBTOP_NETLOAD_HWADDRESS 17 48 49 #define GLIBTOP_MAX_NETLOAD 18 50 51 typedef struct _glibtop_netload glibtop_netload; 52 53 enum { 54 GLIBTOP_IF_FLAGS_UP = 1, 55 GLIBTOP_IF_FLAGS_BROADCAST, 56 GLIBTOP_IF_FLAGS_DEBUG, 57 GLIBTOP_IF_FLAGS_LOOPBACK, 58 GLIBTOP_IF_FLAGS_POINTOPOINT, 59 GLIBTOP_IF_FLAGS_RUNNING, 60 GLIBTOP_IF_FLAGS_NOARP, 61 GLIBTOP_IF_FLAGS_PROMISC, 62 GLIBTOP_IF_FLAGS_ALLMULTI, 63 GLIBTOP_IF_FLAGS_OACTIVE, 64 GLIBTOP_IF_FLAGS_SIMPLEX, 65 GLIBTOP_IF_FLAGS_LINK0, 66 GLIBTOP_IF_FLAGS_LINK1, 67 GLIBTOP_IF_FLAGS_LINK2, 68 GLIBTOP_IF_FLAGS_ALTPHYS, 69 GLIBTOP_IF_FLAGS_MULTICAST, 70 GLIBTOP_IF_FLAGS_WIRELESS 71 }; 72 73 enum GLIBTOP_IF_IN6_SCOPE 74 { 75 GLIBTOP_IF_IN6_SCOPE_UNKNOWN = 0, 76 GLIBTOP_IF_IN6_SCOPE_LINK = 1, 77 GLIBTOP_IF_IN6_SCOPE_SITE = 2, 78 GLIBTOP_IF_IN6_SCOPE_GLOBAL = 4, 79 GLIBTOP_IF_IN6_SCOPE_HOST = 8 80 }; 81 82 struct _glibtop_netload 83 { 84 guint64 flags; 85 guint64 if_flags; /* GLIBTOP_NETLOAD_IF_FLAGS */ 86 87 guint32 mtu; /* GLIBTOP_NETLOAD_MTU */ 88 guint32 subnet; /* GLIBTOP_NETLOAD_SUBNET */ 89 guint32 address; /* GLIBTOP_NETLOAD_ADDRESS */ 90 91 guint64 packets_in; /* GLIBTOP_NETLOAD_PACKETS_IN */ 92 guint64 packets_out; /* GLIBTOP_NETLOAD_PACKETS_OUT */ 93 guint64 packets_total; /* GLIBTOP_NETLOAD_PACKETS_TOTAL*/ 94 guint64 bytes_in; /* GLIBTOP_NETLOAD_BYTES_IN */ 95 guint64 bytes_out; /* GLIBTOP_NETLOAD_BYTES_OUT */ 96 guint64 bytes_total; /* GLIBTOP_NETLOAD_BYTES_TOTAL */ 97 guint64 errors_in; /* GLIBTOP_NETLOAD_ERRORS_IN */ 98 guint64 errors_out; /* GLIBTOP_NETLOAD_ERRORS_OUT */ 99 guint64 errors_total; /* GLIBTOP_NETLOAD_ERRORS_TOTAL */ 100 guint64 collisions; /* GLIBTOP_NETLOAD_COLLISIONS */ 101 102 guint8 address6[16]; /* GLIBTOP_NETLOAD_ADDRESS6 */ 103 guint8 prefix6[16]; /* GLIBTOP_NETLOAD_PREXIF6 */ 104 guint8 scope6; /* GLIBTOP_NETLOAD_SCOPE6 */ 105 106 guint8 hwaddress[8]; /* GLIBTOP_NETLOAD_HWADDRESS */ 107 }; 108 109 void glibtop_get_netload(glibtop_netload *buf, const char *interface); 110 111 #if GLIBTOP_SUID_NETLOAD 112 #define glibtop_get_netload_r glibtop_get_netload_p 113 #else 114 #define glibtop_get_netload_r glibtop_get_netload_s 115 #endif 116 117 void glibtop_get_netload_l (glibtop *server, glibtop_netload *buf, const char *interface); 118 119 #if GLIBTOP_SUID_NETLOAD 120 void _glibtop_init_netload_p (glibtop *server); 121 void glibtop_get_netload_p (glibtop *server, glibtop_netload *buf, const char *interface); 122 #else 123 void _glibtop_init_netload_s (glibtop *server); 124 void glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, const char *interface); 125 #endif 126 127 128 G_END_DECLS 129 130 #endif 131