Debian Codegraph @

agent/mibgroup/mibII/interfaces.h

raw
1 /*
2 * Interfaces MIB group interface - interfaces.h
3 *
4 */
5 #ifndef _MIBGROUP_INTERFACES_H
6 #define _MIBGROUP_INTERFACES_H
7
8 /***********************************************************************
9 * configure macros
10 */
11 config_require(util_funcs/header_generic);
12
13 /*
14 * conflicts with the new MFD rewrite
15 */
16 config_exclude(if-mib/ifTable/ifTable);
17
18 #if !defined(WIN32) && !defined(cygwin)
19 config_require(if-mib/data_access/interface);
20 #endif
21
22 #if defined(solaris2)
23 config_require(kernel_sunos5);
24 #endif
25
26 /*
27 * need get_address in var_route for some platforms (USE_SYSCTL_IFLIST).
28 * Not sure if that can be translated into a config_arch_require, so be
29 * indiscriminate for now.
30 */
31 config_require(mibII/var_route);
32
33 /***********************************************************************
34 */
35 #ifndef USING_IF_MIB_IFTABLE_MODULE
36 #ifdef hpux11
37 #include <sys/mib.h>
38 #else
39 struct in_ifaddr;
40 struct ifnet;
41 #endif
42
43 int Interface_Scan_Get_Count(void);
44 int Interface_Index_By_Name(char *, int);
45 void Interface_Scan_Init(void);
46 #if defined(linux) || defined(sunV3)
47 struct in_ifaddr {
48 int dummy;
49 };
50 #endif
51 #if defined(hpux11)
52 int Interface_Scan_Next(short *, char *, nmapi_phystat *);
53 int Interface_Scan_NextInt(int *, char *, nmapi_phystat *);
54 #else
55 int Interface_Scan_Next(short *, char *, struct ifnet *,
56 struct in_ifaddr *);
57 int Interface_Scan_NextInt(int *, char *, struct ifnet *,
58 struct in_ifaddr *);
59 #endif
60
61 void init_interfaces(void);
62 extern FindVarMethod var_interfaces;
63 extern FindVarMethod var_ifEntry;
64
65 #endif /* USING_IF_MIB_IFTABLE_MODULE */
66
67 #define NETSNMP_IFNUMBER 0
68 #define NETSNMP_IFINDEX 1
69 #define NETSNMP_IFDESCR 2
70 #define NETSNMP_IFTYPE 3
71 #define NETSNMP_IFMTU 4
72 #define NETSNMP_IFSPEED 5
73 #define NETSNMP_IFPHYSADDRESS 6
74 #define NETSNMP_IFADMINSTATUS 7
75 #define NETSNMP_IFOPERSTATUS 8
76 #define NETSNMP_IFLASTCHANGE 9
77 #define NETSNMP_IFINOCTETS 10
78 #define NETSNMP_IFINUCASTPKTS 11
79 #define NETSNMP_IFINNUCASTPKTS 12
80 #define NETSNMP_IFINDISCARDS 13
81 #define NETSNMP_IFINERRORS 14
82 #define NETSNMP_IFINUNKNOWNPROTOS 15
83 #define NETSNMP_IFOUTOCTETS 16
84 #define NETSNMP_IFOUTUCASTPKTS 17
85 #define NETSNMP_IFOUTNUCASTPKTS 18
86 #define NETSNMP_IFOUTDISCARDS 19
87 #define NETSNMP_IFOUTERRORS 20
88 #define NETSNMP_IFOUTQLEN 21
89 #define NETSNMP_IFSPECIFIC 22
90
91 #ifdef linux
92 /*
93 * this struct ifnet is cloned from the generic type and somewhat modified.
94 * it will not work for other un*x'es...
95 */
96
97 struct ifnet {
98 char *if_name; /* name, e.g. ``en'' or ``lo'' */
99 char *if_unit; /* sub-unit for lower level driver */
100 short if_mtu; /* maximum transmission unit */
101 short if_flags; /* up/down, broadcast, etc. */
102 int if_metric; /* routing metric (external only) */
103 char if_hwaddr[6]; /* ethernet address */
104 int if_type; /* interface type: 1=generic,
105 * 28=slip, ether=6, loopback=24 */
106 u_long if_speed; /* interface speed: in bits/sec */
107
108 struct sockaddr if_addr; /* interface's address */
109 struct sockaddr ifu_broadaddr; /* broadcast address */
110 struct sockaddr ia_subnetmask; /* interface's mask */
111
112 struct ifqueue {
113 int ifq_len;
114 int ifq_drops;
115 } if_snd; /* output queue */
116 u_long if_ibytes; /* octets received on interface */
117 u_long if_ipackets; /* packets received on interface */
118 u_long if_ierrors; /* input errors on interface */
119 u_long if_iqdrops; /* input queue overruns */
120 u_long if_obytes; /* octets sent on interface */
121 u_long if_opackets; /* packets sent on interface */
122 u_long if_oerrors; /* output errors on interface */
123 u_long if_collisions; /* collisions on csma interfaces */
124 /*
125 * end statistics
126 */
127 struct ifnet *if_next;
128 };
129 #endif /* linux */
130 #endif /* _MIBGROUP_INTERFACES_H */