blob: cc891eaba9fc640da8c043b4acc62be6d7c5f5b5 [file] [log] [blame]
/*
* snmp_vars.linux.h - kludge header file for Linux build of snmp_vars.c
*
*
*/
/***********************************************************
Copyright 1988, 1989, 1990 by Carnegie Mellon University
Copyright 1989 TGV, Incorporated
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU and TGV not be used
in advertising or publicity pertaining to distribution of the software
without specific, written prior permission.
CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
/*
* additions, fixes and enhancements for Linux by Erik Schoenfelder
* (schoenfr@ibr.cs.tu-bs.de) 1994/1995.
* Ported to UCD by Jennifer Bray of Origin (jbray@origin-at.co.uk) 1997
*/
#ifdef linux
# include <time.h>
# include <linux/tasks.h>
# include <utmp.h>
# include <dirent.h>
# include <sys/stat.h>
# include <sys/vfs.h>
# include <unistd.h>
# include <ctype.h>
# include <stdlib.h>
# include <pwd.h>
# include <sys/time.h>
/*
* this struct ifnet is cloned from the generic type and somewhat modified.
* it will not work for other un*x'es...
*/
struct ifnet {
char *if_name; /* name, e.g. ``en'' or ``lo'' */
short if_unit; /* sub-unit for lower level driver */
short if_mtu; /* maximum transmission unit */
short if_flags; /* up/down, broadcast, etc. */
int if_metric; /* routing metric (external only) */
char if_hwaddr [6]; /* ethernet address */
int if_type; /* interface type: 1=generic,
28=slip, ether=6, loopback=24 */
int if_speed; /* interface speed: in bits/sec */
struct sockaddr if_addr; /* interface's address */
struct sockaddr ifu_broadaddr; /* broadcast address */
struct sockaddr ia_subnetmask; /* interface's mask */
struct ifqueue {
int ifq_len;
int ifq_drops;
} if_snd; /* output queue */
int if_ipackets; /* packets received on interface */
int if_ierrors; /* input errors on interface */
int if_opackets; /* packets sent on interface */
int if_oerrors; /* output errors on interface */
int if_collisions; /* collisions on csma interfaces */
/* end statistics */
struct ifnet *if_next;
};
/*
* arp struct to pass flags, hw-addr and ip-addr in bsd manner:
*/
struct arptab {
int at_flags;
char at_enaddr [6];
struct in_addr at_iaddr;
};
/* in case its missing: */
#ifndef ATF_PERM
# define ATF_PERM 0x04
#endif /* ATF_PERM */
#ifndef ATF_COM
# define ATF_COM 0x02
#endif /* ATF_COM */
/*
* networking statistics:
*/
/*
* (the structs are from /usr/src/linux/net/inet/snmp.h)
*/
struct ip_mib
{
unsigned long IpForwarding;
unsigned long IpDefaultTTL;
unsigned long IpInReceives;
unsigned long IpInHdrErrors;
unsigned long IpInAddrErrors;
unsigned long IpForwDatagrams;
unsigned long IpInUnknownProtos;
unsigned long IpInDiscards;
unsigned long IpInDelivers;
unsigned long IpOutRequests;
unsigned long IpOutDiscards;
unsigned long IpOutNoRoutes;
unsigned long IpReasmTimeout;
unsigned long IpReasmReqds;
unsigned long IpReasmOKs;
unsigned long IpReasmFails;
unsigned long IpFragOKs;
unsigned long IpFragFails;
unsigned long IpFragCreates;
};
struct icmp_mib
{
unsigned long IcmpInMsgs;
unsigned long IcmpInErrors;
unsigned long IcmpInDestUnreachs;
unsigned long IcmpInTimeExcds;
unsigned long IcmpInParmProbs;
unsigned long IcmpInSrcQuenchs;
unsigned long IcmpInRedirects;
unsigned long IcmpInEchos;
unsigned long IcmpInEchoReps;
unsigned long IcmpInTimestamps;
unsigned long IcmpInTimestampReps;
unsigned long IcmpInAddrMasks;
unsigned long IcmpInAddrMaskReps;
unsigned long IcmpOutMsgs;
unsigned long IcmpOutErrors;
unsigned long IcmpOutDestUnreachs;
unsigned long IcmpOutTimeExcds;
unsigned long IcmpOutParmProbs;
unsigned long IcmpOutSrcQuenchs;
unsigned long IcmpOutRedirects;
unsigned long IcmpOutEchos;
unsigned long IcmpOutEchoReps;
unsigned long IcmpOutTimestamps;
unsigned long IcmpOutTimestampReps;
unsigned long IcmpOutAddrMasks;
unsigned long IcmpOutAddrMaskReps;
};
struct tcp_mib
{
unsigned long TcpRtoAlgorithm;
unsigned long TcpRtoMin;
unsigned long TcpRtoMax;
unsigned long TcpMaxConn;
unsigned long TcpActiveOpens;
unsigned long TcpPassiveOpens;
unsigned long TcpAttemptFails;
unsigned long TcpEstabResets;
unsigned long TcpCurrEstab;
unsigned long TcpInSegs;
unsigned long TcpOutSegs;
unsigned long TcpRetransSegs;
};
struct udp_mib
{
unsigned long UdpInDatagrams;
unsigned long UdpNoPorts;
unsigned long UdpInErrors;
unsigned long UdpOutDatagrams;
};
/* ugly mapping of `struct tcpstat' -> `struct tcp_mib' (but what the heck): */
#define tcpstat tcp_mib
#define tcps_connattempt TcpActiveOpens
#define tcps_accepts TcpPassiveOpens
#define tcps_conndrops TcpAttemptFails
#define tcps_drops TcpEstabResets
#define tcps_rcvtotal TcpInSegs
#define tcps_sndtotal TcpOutSegs
#define tcps_sndrexmitpack TcpRetransSegs
struct inpcb {
struct inpcb *inp_next; /* pointers to other pcb's */
struct in_addr inp_faddr; /* foreign host table entry */
u_short inp_fport; /* foreign port */
struct in_addr inp_laddr; /* local host table entry */
u_short inp_lport; /* local port */
int inp_state;
int uid; /* owner of the connection */
};
struct arpcom {
char ac_enaddr [6];
};
#endif /* linux */