1 |
tdb |
1.1 |
<?xml version="1.0"?> |
2 |
|
|
|
3 |
|
|
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
4 |
|
|
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
5 |
|
|
|
6 |
|
|
<refentry id="get_network_iface_stats"> |
7 |
|
|
|
8 |
|
|
<refentryinfo> |
9 |
tdb |
1.4 |
<date>$Date: 2004/03/11 17:35:24 $</date> |
10 |
|
|
<releaseinfo>$Id: get_network_iface_stats.xml,v 1.3 2004/03/11 17:35:24 tdb Exp $</releaseinfo> |
11 |
tdb |
1.1 |
</refentryinfo> |
12 |
|
|
|
13 |
|
|
<refmeta> |
14 |
|
|
<refentrytitle>get_network_iface_stats</refentrytitle> |
15 |
|
|
<manvolnum>3</manvolnum> |
16 |
|
|
<refmiscinfo>i-scream</refmiscinfo> |
17 |
|
|
</refmeta> |
18 |
|
|
|
19 |
|
|
<refnamediv> |
20 |
|
|
<refname>get_network_iface_stats</refname> |
21 |
|
|
<refpurpose>get network interface statistics</refpurpose> |
22 |
|
|
</refnamediv> |
23 |
|
|
|
24 |
|
|
<refsynopsisdiv> |
25 |
|
|
<funcsynopsis> |
26 |
|
|
<funcsynopsisinfo>#include <statgrab.h></funcsynopsisinfo> |
27 |
|
|
<funcprototype> |
28 |
|
|
<funcdef>network_iface_stat_t *<function>get_network_iface_stats</function></funcdef> |
29 |
|
|
<paramdef>int *<parameter>entries</parameter></paramdef> |
30 |
|
|
</funcprototype> |
31 |
|
|
</funcsynopsis> |
32 |
|
|
</refsynopsisdiv> |
33 |
|
|
|
34 |
|
|
<refsect1> |
35 |
|
|
<title>Description</title> |
36 |
|
|
<para> |
37 |
|
|
The <function>get_network_iface_stats</function> function |
38 |
|
|
takes a pointer to an int, <parameter>entries</parameter>, |
39 |
|
|
which is filled with the number of network interfaces the |
40 |
|
|
machine has. This is needed to know how many |
41 |
|
|
<structname>network_iface_stat_t</structname> structures have |
42 |
|
|
been returned. A pointer is returned to the first |
43 |
|
|
<structname>network_iface_stat_t</structname>. |
44 |
|
|
</para> |
45 |
|
|
<para> |
46 |
|
|
<function>get_network_iface_stats</function> returns statistics |
47 |
|
|
about the network interfaces in the machine. Specifically, |
48 |
|
|
it returns the speed of the interface, the duplex state, and |
49 |
|
|
whether it is currently up. |
50 |
|
|
</para> |
51 |
|
|
</refsect1> |
52 |
|
|
|
53 |
|
|
<refsect1> |
54 |
|
|
<title>Return Values</title> |
55 |
|
|
|
56 |
|
|
<para> |
57 |
|
|
The <function>get_network_iface_stats</function> returns a |
58 |
|
|
pointer to a structure of type |
59 |
|
|
<structname>network_iface_stat_t</structname>. |
60 |
|
|
</para> |
61 |
|
|
|
62 |
|
|
<programlisting> |
63 |
|
|
typedef enum{ |
64 |
|
|
FULL_DUPLEX, |
65 |
|
|
HALF_DUPLEX, |
66 |
|
|
UNKNOWN_DUPLEX |
67 |
|
|
}statgrab_duplex; |
68 |
tdb |
1.2 |
</programlisting> |
69 |
tdb |
1.1 |
|
70 |
tdb |
1.2 |
<para> |
71 |
|
|
Note: The <structfield>UNKNOWN_DUPLEX</structfield> value could mean |
72 |
|
|
that duplex hasn't been negotiated yet. |
73 |
|
|
</para> |
74 |
|
|
|
75 |
|
|
<programlisting> |
76 |
tdb |
1.1 |
typedef struct{ |
77 |
|
|
char *interface_name; |
78 |
|
|
int speed; |
79 |
|
|
statgrab_duplex dup; |
80 |
|
|
int up; |
81 |
|
|
}network_iface_stat_t; |
82 |
|
|
</programlisting> |
83 |
|
|
|
84 |
|
|
<variablelist> |
85 |
|
|
<varlistentry> |
86 |
|
|
<term> |
87 |
|
|
<structfield>interface_name</structfield> |
88 |
|
|
</term> |
89 |
|
|
<listitem> |
90 |
|
|
<para> |
91 |
|
|
The name known to the operating system. |
92 |
|
|
(eg. on linux it might be eth0) |
93 |
|
|
</para> |
94 |
|
|
</listitem> |
95 |
|
|
</varlistentry> |
96 |
|
|
<varlistentry> |
97 |
|
|
<term> |
98 |
|
|
<structfield>speed</structfield> |
99 |
|
|
</term> |
100 |
|
|
<listitem> |
101 |
|
|
<para> |
102 |
|
|
The speed of the interface, in megabits/sec. |
103 |
|
|
</para> |
104 |
|
|
</listitem> |
105 |
|
|
</varlistentry> |
106 |
|
|
<varlistentry> |
107 |
|
|
<term> |
108 |
|
|
<structfield>dup</structfield> |
109 |
|
|
</term> |
110 |
|
|
<listitem> |
111 |
|
|
<para> |
112 |
|
|
The duplex state the interface is in. See statgrab_duplex |
113 |
|
|
for permitted values. |
114 |
|
|
</para> |
115 |
|
|
</listitem> |
116 |
|
|
</varlistentry> |
117 |
|
|
<varlistentry> |
118 |
|
|
<term> |
119 |
|
|
<structfield>up</structfield> |
120 |
|
|
</term> |
121 |
|
|
<listitem> |
122 |
|
|
<para> |
123 |
|
|
Whether the interface is up. |
124 |
|
|
</para> |
125 |
|
|
</listitem> |
126 |
|
|
</varlistentry> |
127 |
|
|
</variablelist> |
128 |
|
|
</refsect1> |
129 |
|
|
|
130 |
|
|
<refsect1> |
131 |
|
|
<title>See Also</title> |
132 |
|
|
|
133 |
|
|
<simplelist type="inline"> |
134 |
|
|
<member> |
135 |
|
|
<citerefentry> |
136 |
|
|
<refentrytitle>statgrab</refentrytitle> |
137 |
|
|
<manvolnum>3</manvolnum> |
138 |
|
|
</citerefentry> |
139 |
|
|
</member> |
140 |
|
|
</simplelist> |
141 |
|
|
</refsect1> |
142 |
|
|
|
143 |
|
|
<refsect1> |
144 |
|
|
<title>Website</title> |
145 |
|
|
|
146 |
|
|
<simplelist type="vert"> |
147 |
|
|
<member> |
148 |
tdb |
1.3 |
<ulink url="http://www.i-scream.org/libstatgrab/"> |
149 |
|
|
http://www.i-scream.org/libstatgrab/ |
150 |
|
|
</ulink> |
151 |
tdb |
1.1 |
</member> |
152 |
|
|
</simplelist> |
153 |
|
|
</refsect1> |
154 |
|
|
|
155 |
|
|
</refentry> |