#!/bin/sh # This is `snmp2.30' (part 30 of snmp2). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `snmp2/agent/snmp_vars.c' is being continued... # touch -am 1231235999 $$.touch >/dev/null 2>&1 if test ! -f 1231235999 && test -f $$.touch; then shar_touch=touch else shar_touch=: echo echo 'WARNING: not restoring timestamps. Consider getting and' echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 1231235999 $$.touch # if test ! -r _sharseq.tmp; then echo 'Please unpack part 1 first!' exit 1 fi shar_sequence=`cat _sharseq.tmp` if test "$shar_sequence" != 30; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping snmp2/agent/snmp_vars.c' else echo 'x - continuing file snmp2/agent/snmp_vars.c' sed 's/^X//' << 'SHAR_EOF' >> 'snmp2/agent/snmp_vars.c' && X sysModel (), X vxWorksVersion, X kernelVersion ()); X X gethostname (&sysName, 128); X X bzero ((char *) &system_struct, sizeof (system_struct)); X if (-1 == intConnect(INUM_TO_IVEC(24), (VOIDFUNCPTR) handleSpurious, 0)) X { X system_struct.spuriousInts = -1; X ERROR ("Unable to attach to Spurious Interrupt vector"); X } #endif } X X #ifdef VXWORKS #define SSCLMIB 1, 3, 6, 1, 4, 1, 535 #define SSCLRT SSCLMIB, 1 #define SSCLT1 SSCLMIB, 2 #endif X #define CMUMIB 1, 3, 6, 1, 4, 1, 3 #define CMUUNIXMIB CMUMIB, 2, 2 X #define SNMPV2 1, 3, 6, 1, 6 #define SNMPV2M2M SNMPV2, 3, 2 #define SNMPV2ALARMNEXTINDEX SNMPV2M2M, 1, 1, 1 #define SNMPV2ALARMENTRY SNMPV2M2M, 1, 1, 2, 1 #define SNMPV2EVENTNEXTINDEX SNMPV2M2M, 1, 2, 1 #define SNMPV2EVENTENTRY SNMPV2M2M, 1, 2, 2, 1 #define SNMPV2EVENTNOTIFYMININT SNMPV2M2M, 1, 2, 3 #define SNMPV2EVENTNOTIFYMAXRET SNMPV2M2M, 1, 2, 4 #define SNMPV2EVENTNOTIFYENTRY SNMPV2M2M, 1, 2, 5, 1 X #define SNMPV2ALARMEVENTS SNMPV2M2M, 1, 1, 3 X #define RMONMIB 1, 3, 6, 1, 2, 1, 16 X #define HOST RMONMIB, 4 #define HOSTCONTROL HOST, 1, 1 /* hostControlEntry */ #define HOSTTAB HOST, 2, 1 /* hostEntry */ #define HOSTTIMETAB HOST, 3, 1 /* hostTimeEntry */ #define HOSTTOPN RMONMIB, 5 #define HOSTTOPNCONTROL HOSTTOPN, 1, 1 /* hostTopNControlEntry */ #define HOSTTOPNTAB HOSTTOPN, 2, 1 /* hostTopNEntry */ #define HOSTTIMETABADDRESS 1 #define HOSTTIMETABCREATIONORDER 2 #define HOSTTIMETABINDEX 3 #define HOSTTIMETABINPKTS 4 #define HOSTTIMETABOUTPKTS 5 #define HOSTTIMETABINOCTETS 6 #define HOSTTIMETABOUTOCTETS 7 #define HOSTTIMETABOUTERRORS 8 #define HOSTTIMETABOUTBCASTPKTS 9 #define HOSTTIMETABOUTMCASTPKTS 10 X #if 0 #define RMONMIB 1, 3, 6, 1, 2, 1, 16 X #define ALARM RMONMIB, 3 #define ALARMTAB ALARM, 1, 1 /* alarmEntry */ #define EVENT RMONMIB, 9 #define EVENTTAB EVENT, 1, 1 /* eventEntry */ #endif X #define PARTYMIB SNMPV2, 3, 3 #define PARTYTABLE PARTYMIB, 2, 1, 1, 1 #define CONTEXTTABLE PARTYMIB, 2, 2, 1, 1 #define ACLTABLE PARTYMIB, 2, 3, 1, 1 #define VIEWTABLE PARTYMIB, 2, 4, 1, 1 X /* various OIDs that are needed throughout the agent */ Export oid alarmVariableOid[] = {SNMPV2ALARMENTRY, ALARMTABVARIABLE}; Export int alarmVariableOidLen = sizeof(alarmVariableOid) / sizeof(oid); Export oid alarmSampleTypeOid[] = {SNMPV2ALARMENTRY, ALARMTABSAMPLETYPE}; Export int alarmSampleTypeOidLen = sizeof(alarmSampleTypeOid) / sizeof(oid); Export oid alarmValueOid[] = {SNMPV2ALARMENTRY, ALARMTABVALUE}; Export int alarmValueOidLen = sizeof(alarmValueOid) / sizeof(oid); Export oid alarmFallingThreshOid[] = {SNMPV2ALARMENTRY, ALARMTABFALLINGTHRESH}; Export int alarmFallingThreshOidLen = sizeof(alarmFallingThreshOid)/sizeof(oid); Export oid alarmRisingThreshOid[] = {SNMPV2ALARMENTRY, ALARMTABRISINGTHRESH}; Export int alarmRisingThreshOidLen = sizeof(alarmRisingThreshOid)/sizeof(oid); X Export oid sysUpTimeOid[] = {1,3,6,1,2,1,1,3,0}; Export int sysUpTimeOidLen = sizeof(sysUpTimeOid)/sizeof(oid); Export oid eventIdOid[] = {SNMPV2EVENTENTRY, EVENTTABID}; Export int eventIdOidLen = sizeof(eventIdOid)/sizeof(oid); Export oid trapRisingAlarmOid[] = {SNMPV2ALARMEVENTS, 1}; Export int trapRisingAlarmOidLen = sizeof(trapRisingAlarmOidLen)/sizeof(oid); Export oid trapFallingAlarmOid[] = {SNMPV2ALARMEVENTS, 2}; Export int trapFallingAlarmOidLen = sizeof(trapFallingAlarmOidLen)/sizeof(oid); Export oid trapObjUnavailAlarmOid[] = {SNMPV2ALARMEVENTS, 3}; Export int trapObjUnavailAlarmOidLen = sizeof(trapObjUnavailAlarmOidLen)/sizeof(oid); X X /* X * The subtree structure contains a subtree prefix which applies to X * all variables in the associated variable list. X * No subtree may be a subtree of another subtree in this list. i.e.: X * 1.2 X * 1.2.0 X */ struct subtree { X oid name[16]; /* objid prefix of subtree */ X u_char namelen; /* number of subid's in name above */ X struct variable *variables; /* pointer to variables array */ X int variables_len; /* number of entries in above array */ X int variables_width; /* sizeof each variable entry */ }; X /* X * This is a new variable structure that doesn't have as much memory X * tied up in the object identifier. It's elements have also been re-arranged X * so that the name field can be variable length. Any number of these X * structures can be created with lengths tailor made to a particular X * application. The first 5 elements of the structure must remain constant. X */ struct variable2 { X u_char magic; /* passed to function as a hint */ X char type; /* type of variable */ X u_short acl; /* access control list for variable */ X u_char *(*findVar)(); /* function that finds variable */ X u_char namelen; /* length of name below */ X oid name[2]; /* object identifier of variable */ }; X struct variable4 { X u_char magic; /* passed to function as a hint */ X char type; /* type of variable */ X u_short acl; /* access control list for variable */ X u_char *(*findVar)(); /* function that finds variable */ X u_char namelen; /* length of name below */ X oid name[4]; /* object identifier of variable */ }; X struct variable7 { X u_char magic; /* passed to function as a hint */ X char type; /* type of variable */ X u_short acl; /* access control list for variable */ X u_char *(*findVar)(); /* function that finds variable */ X u_char namelen; /* length of name below */ X oid name[7]; /* object identifier of variable */ }; X struct variable13 { X u_char magic; /* passed to function as a hint */ X char type; /* type of variable */ X u_short acl; /* access control list for variable */ X u_char *(*findVar)(); /* function that finds variable */ X u_char namelen; /* length of name below */ X oid name[13]; /* object identifier of variable */ }; X /* X * ############################################################## X * IMPORTANT NOTE: X * ############################################################## X * X * The format of the acl word in these entries has changed. It is still X * 2 bits per community, offset from the right by the index of the community. X * The leftmost two bits denotes read access, and the rightmost denotes X * write access. X * The change is that the rightmost two bits are now reserved for the object's X * max-access. This is the minimum of what makes "protocol sense" for the X * object and whether set support was implemented for that object. X * These two bits will not map to any community. The first community X * entry will map to the 3rd and 4th bits. X */ X #define MTRBIGNUMBER 1 #define MTRNSAPADDRESS 2 #define MTRBITSTRING 3 X struct variable2 demo_variables[] = { X {MTRBIGNUMBER, COUNTER64, RONLY, var_demo, 1, {1}}, X {MTRNSAPADDRESS, NSAP, RONLY, var_demo, 1, {2}}, X {MTRBITSTRING, BITSTRING, RONLY, var_demo, 1, {3}} }; X struct variable4 interface_variables[] = { X {IFNUMBER, INTEGER, RONLY, var_system, 1, {1}}, X {IFINDEX, INTEGER, RONLY, var_ifEntry, 3, {2, 1, 1}}, X {IFDESCR, STRING, RONLY, var_ifEntry, 3, {2, 1, 2}}, X {IFTYPE, INTEGER, RONLY, var_ifEntry, 3, {2, 1, 3}}, X {IFMTU, INTEGER, RONLY, var_ifEntry, 3, {2, 1, 4}}, X {IFSPEED, GAUGE, RONLY, var_ifEntry, 3, {2, 1, 5}}, X {IFPHYSADDRESS, STRING, RONLY, var_ifEntry, 3, {2, 1, 6}}, X {IFADMINSTATUS, INTEGER, RWRITE, var_ifEntry, 3, {2, 1, 7}}, X {IFOPERSTATUS, INTEGER, RONLY, var_ifEntry, 3, {2, 1, 8}}, X {IFLASTCHANGE, TIMETICKS, RONLY, var_ifEntry, 3, {2, 1, 9}}, X {IFINOCTETS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 10}}, X {IFINUCASTPKTS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 11}}, X {IFINNUCASTPKTS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 12}}, X {IFINDISCARDS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 13}}, X {IFINERRORS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 14}}, X {IFINUNKNOWNPROTOS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 15}}, X {IFOUTOCTETS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 16}}, X {IFOUTUCASTPKTS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 17}}, X {IFOUTNUCASTPKTS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 18}}, X {IFOUTDISCARDS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 19}}, X {IFOUTERRORS, COUNTER, RONLY, var_ifEntry, 3, {2, 1, 20}}, X {IFOUTQLEN, GAUGE, RONLY, var_ifEntry, 3, {2, 1, 21}} }; X struct variable2 system_variables[] = { X {VERSION_DESCR, STRING, RWRITE, var_system, 1, {1}}, X {VERSION_ID, OBJID, RONLY, var_system, 1, {2}}, X {UPTIME, TIMETICKS, RONLY, var_system, 1, {3}}, X {SYSCONTACT, STRING, RWRITE, var_system, 1, {4}}, X {SYSNAME, STRING, RWRITE, var_system, 1, {5}}, X {SYSLOCATION, STRING, RWRITE, var_system, 1, {6}}, X {SYSSERVICES, INTEGER, RONLY, var_system, 1, {7}} }; X struct variable2 at_variables[] = { X {ATIFINDEX, INTEGER, RONLY, var_atEntry, 1, {1}}, X {ATPHYSADDRESS, STRING, RONLY, var_atEntry, 1, {2}}, X {ATNETADDRESS, IPADDRESS, RONLY, var_atEntry, 1, {3}} }; X struct variable4 ip_variables[] = { X {IPFORWARDING, INTEGER, RONLY, var_ip, 1, {1 }}, X {IPDEFAULTTTL, INTEGER, RONLY, var_ip, 1, {2 }}, #ifndef sunV3 X {IPINRECEIVES, COUNTER, RONLY, var_ip, 1, {3 }}, #endif X {IPINHDRERRORS, COUNTER, RONLY, var_ip, 1, {4 }}, #ifndef sunV3 X {IPINADDRERRORS, COUNTER, RONLY, var_ip, 1, {5 }}, X {IPFORWDATAGRAMS, COUNTER, RONLY, var_ip, 1, {6 }}, #endif X {IPINUNKNOWNPROTOS, COUNTER, RONLY, var_ip, 1, {7 }}, #ifndef sunV3 X {IPINDISCARDS, COUNTER, RONLY, var_ip, 1, {8 }}, X {IPINDELIVERS, COUNTER, RONLY, var_ip, 1, {9 }}, #endif X {IPOUTREQUESTS, COUNTER, RONLY, var_ip, 1, {10 }}, X {IPOUTDISCARDS, COUNTER, RONLY, var_ip, 1, {11 }}, X {IPOUTNOROUTES, COUNTER, RONLY, var_ip, 1, {12 }}, X {IPREASMTIMEOUT, INTEGER, RONLY, var_ip, 1, {13 }}, #ifndef sunV3 X {IPREASMREQDS, COUNTER, RONLY, var_ip, 1, {14 }}, X {IPREASMOKS, COUNTER, RONLY, var_ip, 1, {15 }}, X {IPREASMFAILS, COUNTER, RONLY, var_ip, 1, {16 }}, #endif X {IPFRAGOKS, COUNTER, RONLY, var_ip, 1, {17 }}, X {IPFRAGFAILS, COUNTER, RONLY, var_ip, 1, {18 }}, X {IPFRAGCREATES, COUNTER, RONLY, var_ip, 1, {19 }}, X {IPADADDR, IPADDRESS, RONLY, var_ipAddrEntry, 3, {20, 1, 1}}, X {IPADIFINDEX, INTEGER, RONLY, var_ipAddrEntry, 3, {20, 1, 2}}, #ifndef sunV3 X {IPADNETMASK, IPADDRESS, RONLY, var_ipAddrEntry, 3, {20, 1, 3}}, #endif X {IPADBCASTADDR, INTEGER, RONLY, var_ipAddrEntry, 3, {20, 1, 4}}, X {IPROUTEDEST, IPADDRESS, RONLY, var_ipRouteEntry, 3, {21, 1, 1}}, X {IPROUTEIFINDEX, INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 2}}, X {IPROUTEMETRIC1, INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 3}}, X {IPROUTEMETRIC2, INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 4}}, X {IPROUTEMETRIC3, INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 5}}, X {IPROUTEMETRIC4, INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 6}}, X {IPROUTENEXTHOP, IPADDRESS, RONLY, var_ipRouteEntry, 3, {21, 1, 7}}, X {IPROUTETYPE, INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 8}}, X {IPROUTEPROTO, INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 9}}, X {IPROUTEAGE, INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 10}} }; X struct variable2 icmp_variables[] = { X {ICMPINMSGS, COUNTER, RONLY, var_icmp, 1, {1}}, X {ICMPINERRORS, COUNTER, RONLY, var_icmp, 1, {2}}, X {ICMPINDESTUNREACHS, COUNTER, RONLY, var_icmp, 1, {3}}, X {ICMPINTIMEEXCDS, COUNTER, RONLY, var_icmp, 1, {4}}, X {ICMPINPARMPROBS, COUNTER, RONLY, var_icmp, 1, {5}}, X {ICMPINSRCQUENCHS, COUNTER, RONLY, var_icmp, 1, {6}}, X {ICMPINREDIRECTS, COUNTER, RONLY, var_icmp, 1, {7}}, X {ICMPINECHOS, COUNTER, RONLY, var_icmp, 1, {8}}, X {ICMPINECHOREPS, COUNTER, RONLY, var_icmp, 1, {9}}, X {ICMPINTIMESTAMPS, COUNTER, RONLY, var_icmp, 1, {10}}, X {ICMPINTIMESTAMPREPS, COUNTER, RONLY, var_icmp, 1, {11}}, X {ICMPINADDRMASKS, COUNTER, RONLY, var_icmp, 1, {12}}, X {ICMPINADDRMASKREPS, COUNTER, RONLY, var_icmp, 1, {13}}, X {ICMPOUTMSGS, COUNTER, RONLY, var_icmp, 1, {14}}, X {ICMPOUTERRORS, COUNTER, RONLY, var_icmp, 1, {15}}, X {ICMPOUTDESTUNREACHS, COUNTER, RONLY, var_icmp, 1, {16}}, X {ICMPOUTTIMEEXCDS, COUNTER, RONLY, var_icmp, 1, {17}}, X {ICMPOUTPARMPROBS, COUNTER, RONLY, var_icmp, 1, {18}}, X {ICMPOUTSRCQUENCHS, COUNTER, RONLY, var_icmp, 1, {19}}, X {ICMPOUTREDIRECTS, COUNTER, RONLY, var_icmp, 1, {20}}, X {ICMPOUTECHOS, COUNTER, RONLY, var_icmp, 1, {21}}, X {ICMPOUTECHOREPS, COUNTER, RONLY, var_icmp, 1, {22}}, X {ICMPOUTTIMESTAMPS, COUNTER, RONLY, var_icmp, 1, {23}}, X {ICMPOUTTIMESTAMPREPS, COUNTER, RONLY, var_icmp, 1, {24}}, X {ICMPOUTADDRMASKS, COUNTER, RONLY, var_icmp, 1, {25}}, X {ICMPOUTADDRMASKREPS, COUNTER, RONLY, var_icmp, 1, {26}} }; X struct variable13 tcp_variables[] = { X {TCPRTOALGORITHM, INTEGER, RONLY, var_tcp, 1, {1}}, X {TCPRTOMIN, INTEGER, RONLY, var_tcp, 1, {2}}, #ifndef sunV3 X {TCPRTOMAX, INTEGER, RONLY, var_tcp, 1, {3}}, #endif X {TCPMAXCONN, INTEGER, RONLY, var_tcp, 1, {4}}, #ifndef sunV3 X {TCPACTIVEOPENS, COUNTER, RONLY, var_tcp, 1, {5}}, X {TCPPASSIVEOPENS, COUNTER, RONLY, var_tcp, 1, {6}}, X {TCPATTEMPTFAILS, COUNTER, RONLY, var_tcp, 1, {7}}, X {TCPESTABRESETS, COUNTER, RONLY, var_tcp, 1, {8}}, #endif X { TCPCURRESTAB, GAUGE, RONLY, var_tcp, 1, {9}}, #ifndef sunV3 X {TCPINSEGS, COUNTER, RONLY, var_tcp, 1, {10}}, X {TCPOUTSEGS, COUNTER, RONLY, var_tcp, 1, {11} }, X {TCPRETRANSSEGS, COUNTER, RONLY, var_tcp, 1, {12}}, #endif X {TCPCONNSTATE, INTEGER, RONLY, var_tcp, 3, {13, 1, 1}}, X {TCPCONNLOCALADDRESS, IPADDRESS, RONLY, var_tcp, 3, {13, 1, 2}}, X {TCPCONNLOCALPORT, INTEGER, RONLY, var_tcp, 3, {13, 1, 3}}, X {TCPCONNREMADDRESS, IPADDRESS, RONLY, var_tcp, 3, {13, 1, 4}}, X {TCPCONNREMPORT, INTEGER, RONLY, var_tcp, 3, {13, 1, 5}} }; X struct variable2 udp_variables[] = { X {UDPINDATAGRAMS, COUNTER, RONLY, var_udp, 1, {1}}, X {UDPNOPORTS, COUNTER, RONLY, var_udp, 1, {2}}, X {UDPINERRORS, COUNTER, RONLY, var_udp, 1, {3}}, X {UDPOUTDATAGRAMS, COUNTER, RONLY, var_udp, 1, {4}} }; X #ifdef VXWORKS X /* X * SSCL Real Time MIB X * X * These objects are part of the SSC enterprise specific MIB X * starting OID .1.3.6.1.4.1.535.1. X */ struct variable2 ssclrt_vxboot_variables[] = { X {VXBOOT_DEV, STRING, RWRITE, var_sscl_vxboot, 1, {1}}, X {VXBOOT_HOST, STRING, RWRITE, var_sscl_vxboot, 1, {2}}, X {VXBOOT_TARGET, STRING, RWRITE, var_sscl_vxboot, 1, {3}}, X {VXBOOT_EAD, STRING, RWRITE, var_sscl_vxboot, 1, {4}}, X {VXBOOT_BAD, STRING, RWRITE, var_sscl_vxboot, 1, {5}}, X {VXBOOT_HAD, STRING, RWRITE, var_sscl_vxboot, 1, {6}}, X {VXBOOT_GAD, STRING, RWRITE, var_sscl_vxboot, 1, {7}}, X {VXBOOT_BOOTFILE, STRING, RWRITE, var_sscl_vxboot, 1, {8}}, X {VXBOOT_STARTUP, STRING, RWRITE, var_sscl_vxboot, 1, {9}}, X {VXBOOT_USR, STRING, RWRITE, var_sscl_vxboot, 1, {10}}, X {VXBOOT_PASSWD, STRING, RWRITE, var_sscl_vxboot, 1, {11}}, X {VXBOOT_OTHER, STRING, RWRITE, var_sscl_vxboot, 1, {12}}, X {VXBOOT_PROCNUM, INTEGER, RWRITE, var_sscl_vxboot, 1, {13}}, X {VXBOOT_FLAGS, INTEGER, RWRITE, var_sscl_vxboot, 1, {14}} X }; X struct variable2 ssclrt_vxclock_variables[] = { X {VXCLOCK_RATE, INTEGER, RWRITE, var_sscl_vxclock, 1, {1}}, X {VXCLOCK_TICKS, INTEGER, RWRITE, var_sscl_vxclock, 1, {2}} X }; X struct variable2 ssclrt_snmpd_variables[] = { X {SNMPD_AGNT_VER, STRING, RONLY, var_sscl_snmpd, 1, {1}}, X {SNMPD_PORT_VER, STRING, RONLY, var_sscl_snmpd, 1, {2}}, X {SNMPD_PRIORITY, INTEGER, RWRITE, var_sscl_snmpd, 1, {3}} X }; X struct variable2 ssclrt_idle_variables[] = { X {IDLE_CURRENT, INTEGER, RONLY, var_sscl_idle, 1, {1}}, X {IDLE_10SEC, INTEGER, RONLY, var_sscl_idle, 1, {2}}, X {IDLE_60SEC, INTEGER, RONLY, var_sscl_idle, 1, {3}}, X {IDLE_USERSEC, INTEGER, RONLY, var_sscl_idle, 1, {4}}, X {IDLE_USERINTER, INTEGER, RWRITE, var_sscl_idle, 1, {5}}, X {IDLE_CALIB, INTEGER, RONLY, var_sscl_idle, 1, {6}}, X {IDLE_HISTSIZE, INTEGER, RONLY, var_sscl_idle, 1, {7}}, X {IDLE_HISTVALID, INTEGER, RONLY, var_sscl_idle, 1, {8}} X }; X struct variable2 ssclrt_system_variables[] = { X {SYSTEM_REBOOT, INTEGER, RWRITE, var_sscl_system, 1, {1}}, X {SYSTEM_VME, INTEGER, RWRITE, var_sscl_system, 1, {2}}, X {SYSTEM_ABORT, INTEGER, RWRITE, var_sscl_system, 1, {3}}, X {SYSTEM_SILENT, INTEGER, RWRITE, var_sscl_system, 1, {4}}, X {SYSTEM_SPURIOUS, INTEGER, RWRITE, var_sscl_system, 1, {5}} X }; X #else #ifndef sparc struct variable2 process_variables[] = { X {PROCESSSLOTINDEX, INTEGER, RONLY, var_process, 1, {1}}, X {PROCESSID, INTEGER, RONLY, var_process, 1, {2}}, X {PROCESSCOMMAND, STRING, RONLY, var_process, 1, {3}} }; #endif /* sparc */ #endif /*VXWORKS */ X /* X * Note that the name field must be larger than any name that might X * match that object. For these variable length (objid) indexes X * this might seem to be hard, but placing MAXINT in the first X * subid of the index denotes an obcenely long objid, thereby ensuring that X * none slip through. X */ struct variable2 party_variables[] = { X {PARTYINDEX, INTEGER, RONLY, var_party, 1, {2}}, X {PARTYTDOMAIN, OBJID, RWRITE, var_party, 1, {3}}, X {PARTYTADDRESS, STRING, RWRITE, var_party, 1, {4}}, X {PARTYMAXMESSAGESIZE, INTEGER, RWRITE, var_party, 1, {5}}, X {PARTYLOCAL, INTEGER, RWRITE, var_party, 1, {6}}, X {PARTYAUTHPROTOCOL, OBJID, RWRITE, var_party, 1, {7}}, X {PARTYAUTHCLOCK, UINTEGER, RWRITE, var_party, 1, {8}}, X {PARTYAUTHPRIVATE, STRING, RWRITE, var_party, 1, {9}}, X {PARTYAUTHPUBLIC, STRING, RWRITE, var_party, 1, {10}}, X {PARTYAUTHLIFETIME, INTEGER, RWRITE, var_party, 1, {11}}, X {PARTYPRIVPROTOCOL, OBJID, RWRITE, var_party, 1, {12}}, X {PARTYPRIVPRIVATE, STRING, RWRITE, var_party, 1, {13}}, X {PARTYPRIVPUBLIC, STRING, RWRITE, var_party, 1, {14}}, X {PARTYCLONEFROM, OBJID, RONLY, var_party, 1, {15}}, X {PARTYSTORAGETYPE, INTEGER, RWRITE, var_party, 1, {16}}, X {PARTYSTATUS, INTEGER, RWRITE, var_party, 1, {17}} }; X struct variable2 context_variables[] = { X {CONTEXTINDEX, INTEGER, RONLY, var_context, 1, {2}}, X {CONTEXTLOCAL, INTEGER, RONLY, var_context, 1, {3}}, X {CONTEXTVIEWINDEX, INTEGER, RONLY, var_context, 1, {4}}, X {CONTEXTLOCALENTITY, STRING, RWRITE, var_context, 1, {5}}, X {CONTEXTLOCALTIME, OBJID, RWRITE, var_context, 1, {6}}, X {CONTEXTDSTPARTYINDEX, OBJID, RWRITE, var_context, 1, {7}}, X {CONTEXTSRCPARTYINDEX, OBJID, RWRITE, var_context, 1, {8}}, X {CONTEXTPROXYCONTEXT, OBJID, RWRITE, var_context, 1, {9}}, X {CONTEXTSTORAGETYPE, INTEGER, RWRITE, var_context, 1, {10}}, X {CONTEXTSTATUS, INTEGER, RWRITE, var_context, 1, {11}} }; X /* No access for community SNMP, RW possible for Secure SNMP */ #define PRIVRW 0x0003 /* No access for community SNMP, RO possible for Secure SNMP */ #define PRIVRO 0x0002 X struct variable2 acl_variables[] = { X {ACLPRIVELEGES, INTEGER, PRIVRW, var_acl, 1, {4}}, X {ACLSTORAGETYPE, INTEGER, PRIVRW, var_acl, 1, {5}}, X {ACLSTATUS, INTEGER, PRIVRW, var_acl, 1, {6}} }; X struct variable2 view_variables[] = { X {VIEWMASK, STRING, PRIVRW, var_view, 1, {3}}, X {VIEWTYPE, INTEGER, PRIVRW, var_view, 1, {4}}, X {VIEWSTORAGETYPE, INTEGER, PRIVRW, var_view, 1, {5}}, X {VIEWSTATUS, INTEGER, PRIVRW, var_view, 1, {6}} }; X u_char *var_hosttimetab(); X struct variable2 hosttimetab_variables[] = { X {HOSTTIMETABADDRESS, STRING, RONLY, var_hosttimetab, 1, X {1 }}, X {HOSTTIMETABCREATIONORDER, INTEGER, RONLY, var_hosttimetab, 1, X {2 }}, X {HOSTTIMETABINDEX, INTEGER, RONLY, var_hosttimetab, 1, X {3 }}, X {HOSTTIMETABINPKTS, COUNTER, RONLY, var_hosttimetab, 1, X {4 }}, X {HOSTTIMETABOUTPKTS, COUNTER, RONLY, var_hosttimetab, 1, X {5 }}, X {HOSTTIMETABINOCTETS, COUNTER, RONLY, var_hosttimetab, 1, X {6 }}, X {HOSTTIMETABOUTOCTETS, COUNTER, RONLY, var_hosttimetab, 1, X {7 }}, X {HOSTTIMETABOUTERRORS, COUNTER, RONLY, var_hosttimetab, 1, X {8}}, X {HOSTTIMETABOUTBCASTPKTS, COUNTER, RONLY, var_hosttimetab, 1, X {9}}, X {HOSTTIMETABOUTMCASTPKTS, COUNTER, RONLY, var_hosttimetab, 1, X {10}} }; X struct variable2 alarmnextindex_variables[] = { X {ALARMNEXTINDEX, INTEGER, RONLY, var_alarmnextindex, 1, {0}} }; X struct variable2 alarm_variables[] = { X {ALARMTABVARIABLE, OBJID, RWRITE, var_alarmtab, 1, {2 }}, X {ALARMTABINTERVAL, INTEGER, RWRITE, var_alarmtab, 1, {3 }}, X {ALARMTABSAMPLETYPE, INTEGER, RWRITE, var_alarmtab, 1, {4 }}, X {ALARMTABVALUE, INTEGER, RONLY, var_alarmtab, 1, {5 }}, X {ALARMTABSTARTUPALARM, INTEGER, RWRITE, var_alarmtab, 1, {6 }}, X {ALARMTABRISINGTHRESH, INTEGER, RWRITE, var_alarmtab, 1, {7 }}, X {ALARMTABFALLINGTHRESH, INTEGER, RWRITE, var_alarmtab, 1, {8 }}, X {ALARMTABRISINGINDEX, INTEGER, RWRITE, var_alarmtab, 1, {9}}, X {ALARMTABFALLINGINDEX, INTEGER, RWRITE, var_alarmtab, 1, {10 }}, X {ALARMTABUNAVAILABLEINDEX, INTEGER, RWRITE, var_alarmtab, 1, {11 }}, X {ALARMTABSTATUS, INTEGER, RWRITE, var_alarmtab, 1, {12 }} }; X struct variable2 eventnextindex_variables[] = { X {EVENTNEXTINDEX, INTEGER, RONLY, var_eventnextindex, 1, {0}} }; X struct variable2 eventtab_variables[] = { X {EVENTTABID, OBJID, RWRITE, var_eventtab, 1, {2 }}, X {EVENTTABDESCRIPTION, STRING, RWRITE, var_eventtab, 1, {3 }}, X {EVENTTABEVENTS, COUNTER, RONLY, var_eventtab, 1, {4 }}, X {EVENTTABLASTTIMESENT, TIMETICKS, RONLY, var_eventtab, 1, {5 }}, X {EVENTTABSTATUS, INTEGER, RWRITE, var_eventtab, 1, {6 }} }; X struct variable2 eventmininterval_variables[] = { X {EVENTMININTERVAL, INTEGER, RONLY, var_eventnotifyvars, 1, {0}} }; X struct variable2 eventmaxretrans_variables[] = { X {EVENTMAXRETRANS, INTEGER, RONLY, var_eventnotifyvars, 1, {0}} }; X struct variable2 eventnotifytab_variables[] = { X {EVENTNOTIFYTABINTERVAL, INTEGER, RWRITE, var_eventnotifytab, 1, {1 }}, X {EVENTNOTIFYTABRETRANSMISSIONS, INTEGER, RWRITE, var_eventnotifytab, 1, {2 }}, X {EVENTNOTIFYTABLIFETIME, INTEGER, RWRITE, var_eventnotifytab, 1, {3 }}, X {EVENTNOTIFYTABSTATUS, INTEGER, RWRITE, var_eventnotifytab, 1, {4 }}, }; X struct subtree subtrees[] = { X {{MIB, 1}, 7, (struct variable *)system_variables, X sizeof(system_variables)/sizeof(*system_variables), X sizeof(*system_variables)}, X {{MIB, 2}, 7, (struct variable *)interface_variables, X sizeof(interface_variables)/sizeof(*interface_variables), X sizeof(*interface_variables)}, X {{MIB, 3, 1, 1}, 9, (struct variable *)at_variables, X sizeof(at_variables)/sizeof(*at_variables), X sizeof(*at_variables)}, X {{MIB, 4}, 7, (struct variable *)ip_variables, X sizeof(ip_variables)/sizeof(*ip_variables), X sizeof(*ip_variables)}, X {{MIB, 5}, 7, (struct variable *)icmp_variables, X sizeof(icmp_variables)/sizeof(*icmp_variables), X sizeof(*icmp_variables)}, X {{MIB, 6}, 7, (struct variable *)tcp_variables, X sizeof(tcp_variables)/sizeof(*tcp_variables), X sizeof(*tcp_variables)}, X {{MIB, 7}, 7, (struct variable *)udp_variables, X sizeof(udp_variables)/sizeof(*udp_variables), X sizeof(*udp_variables)}, #ifdef testing X {{HOSTTIMETAB}, 10, (struct variable *)hosttimetab_variables, X sizeof(hosttimetab_variables) / sizeof(*hosttimetab_variables), X sizeof(*hosttimetab_variables)}, #endif X #ifdef VXWORKS X {{SSCLRT, 1, 2, 4 }, 11, (struct variable *) ssclrt_vxboot_variables, X sizeof(ssclrt_vxboot_variables) / sizeof(*ssclrt_vxboot_variables), X sizeof(*ssclrt_vxboot_variables)}, X X {{SSCLRT, 1, 2, 5, 1}, 12, (struct variable *) ssclrt_vxclock_variables, X sizeof(ssclrt_vxclock_variables) / sizeof(*ssclrt_vxclock_variables), X sizeof(*ssclrt_vxclock_variables)}, X X {{SSCLRT, 2}, 9, (struct variable *) ssclrt_snmpd_variables, X sizeof(ssclrt_snmpd_variables) / sizeof(*ssclrt_snmpd_variables), X sizeof(*ssclrt_snmpd_variables)}, X X {{SSCLRT, 3}, 9, (struct variable *) ssclrt_idle_variables, X sizeof(ssclrt_idle_variables) / sizeof(*ssclrt_idle_variables), X sizeof(*ssclrt_idle_variables)}, X X {{SSCLRT, 4}, 9, (struct variable *) ssclrt_system_variables, X sizeof(ssclrt_system_variables) / sizeof(*ssclrt_system_variables), X sizeof(*ssclrt_system_variables)}, #endif X X {{SNMPV2ALARMNEXTINDEX}, 10, (struct variable *)alarmnextindex_variables, X sizeof(alarmnextindex_variables) / sizeof(*alarmnextindex_variables), X sizeof(*alarmnextindex_variables)}, X {{SNMPV2ALARMENTRY}, 11, (struct variable *)alarm_variables, X sizeof(alarm_variables) / sizeof(*alarm_variables), X sizeof(*alarm_variables)}, X {{SNMPV2EVENTNEXTINDEX}, 10, (struct variable *)eventnextindex_variables, X sizeof(eventnextindex_variables) / sizeof(*eventnextindex_variables), X sizeof(*eventnextindex_variables)}, X {{SNMPV2EVENTENTRY}, 11, (struct variable *)eventtab_variables, X sizeof(eventtab_variables) / sizeof(*eventtab_variables), X sizeof(*eventtab_variables)}, X {{SNMPV2EVENTNOTIFYMININT}, 10, (struct variable *)eventmininterval_variables, X sizeof(eventmininterval_variables) / sizeof(*eventmininterval_variables), X sizeof(*eventmininterval_variables)}, X {{SNMPV2EVENTNOTIFYMAXRET}, 10, (struct variable *)eventmaxretrans_variables, X sizeof(eventmaxretrans_variables) / sizeof(*eventmaxretrans_variables), X sizeof(*eventmaxretrans_variables)}, X {{SNMPV2EVENTNOTIFYENTRY}, 11, (struct variable *)eventnotifytab_variables, X sizeof(eventnotifytab_variables) / sizeof(*eventnotifytab_variables), X sizeof(*eventnotifytab_variables)}, X {{PARTYTABLE}, 11, (struct variable *)party_variables, X sizeof(party_variables)/sizeof(*party_variables), X sizeof(*party_variables)}, X {{CONTEXTTABLE}, 11, (struct variable *)context_variables, X sizeof(context_variables)/sizeof(*context_variables), X sizeof(*context_variables)}, X {{ACLTABLE}, 11, (struct variable *)acl_variables, X sizeof(acl_variables)/sizeof(*acl_variables), X sizeof(*acl_variables)}, X {{VIEWTABLE}, 11, (struct variable *)view_variables, X sizeof(view_variables)/sizeof(*view_variables), X sizeof(*view_variables)}, X {{2, 6, 6, 200, 5, 1}, 6, (struct variable *)demo_variables, X sizeof(demo_variables)/sizeof(*demo_variables), X sizeof(*demo_variables)} }; X extern int in_view(); /* X * getStatPtr - return a pointer to the named variable, as well as it's X * type, length, and access control list. X * X * If an exact match for the variable name exists, it is returned. If not, X * and exact is false, the next variable lexicographically after the X * requested one is returned. X * X * If no appropriate variable can be found, NULL is returned. X */ u_char * getStatPtr(name, namelen, type, len, acl, exact, write_method, pi, X noSuchObject) X oid *name; /* IN - name of var, OUT - name matched */ X int *namelen; /* IN -number of sub-ids in name, OUT - subid-is in matched name */ X u_char *type; /* OUT - type of matched variable */ X int *len; /* OUT - length of matched variable */ X u_short *acl; /* OUT - access control list */ X int exact; /* IN - TRUE if exact match wanted */ X int (**write_method)(); /* OUT - pointer to function called to set variable, otherwise 0 */ X struct packet_info *pi; /* IN - relevant auth info re PDU */ X int *noSuchObject; { X register struct subtree *tp; X register struct variable *vp; X struct variable compat_var, *cvp = &compat_var; X register int x; X int y; X register u_char *access = NULL; X int result, treeresult; X oid *suffix; X int suffixlen; X int found = FALSE; X oid save[MAX_NAME_LEN]; X int savelen; X X if (!exact){ X bcopy((char *) name, (char *) save, *namelen * sizeof(oid)); X savelen = *namelen; X } X *write_method = NULL; X for (y = 0, tp = subtrees; y < sizeof(subtrees)/sizeof(struct subtree); X tp++, y++){ X treeresult = compare_tree(name, *namelen, tp->name, (int)tp->namelen); X /* if exact and treerresult == 0 X if next and treeresult <= 0 */ X if (treeresult == 0 || (!exact && treeresult < 0)){ X result = treeresult; X suffixlen = *namelen - tp->namelen; X suffix = name + tp->namelen; X /* the following is part of the setup for the compatability X structure below that has been moved out of the main loop. X */ X bcopy((char *)tp->name, (char *)cvp->name, X tp->namelen * sizeof(oid)); X X for(x = 0, vp = tp->variables; x < tp->variables_len; X vp =(struct variable *)((char *)vp +tp->variables_width), x++){ X /* if exact and ALWAYS X if next and result >= 0 */ X if (exact || result >= 0){ X result = compare_tree(suffix, suffixlen, vp->name, X (int)vp->namelen); X } X /* if exact and result == 0 X if next and result <= 0 */ X if ((!exact && (result <= 0)) || (exact && (result == 0))){ X /* builds an old (long) style variable structure to retain X compatability with var_* functions written previously. X */ X bcopy((char *)vp->name, (char *)(cvp->name + tp->namelen), X vp->namelen * sizeof(oid)); X cvp->namelen = tp->namelen + vp->namelen; X cvp->type = vp->type; X cvp->magic = vp->magic; X cvp->acl = vp->acl; X cvp->findVar = vp->findVar; X access = (*(vp->findVar))(cvp, name, namelen, exact, X len, write_method); X if (write_method) X *acl = vp->acl; X if (access && (pi->version == SNMP_VERSION_2) X && !in_view(name, *namelen, X pi->cxp->contextViewIndex)){ X access = NULL; X *write_method = NULL; X /* X if (in_view(vp->name, vp->namelen, X pi->dstParty, pi->dstPartyLength) X found = TRUE; X */ X } else if (exact){ X found = TRUE; X } X /* this code is incorrect if there is X a view configuration that exludes a particular X instance of a variable. It would return noSuchObject, X which would be an error */ X if (access != NULL) X break; X } X /* if exact and result <= 0 */ X if (exact && (result <= 0)){ X *type = vp->type; X *acl = vp->acl; X if (found) X *noSuchObject = FALSE; X else X *noSuchObject = TRUE; X return NULL; X } X } X if (access != NULL) X break; X } X } X if (y == sizeof(subtrees)/sizeof(struct subtree)){ X if (!access && !exact){ X bcopy((char *) save, (char *) name, savelen * sizeof(oid)); X *namelen = savelen; X } X if (found) X *noSuchObject = FALSE; X else X *noSuchObject = TRUE; X return NULL; X } X /* vp now points to the approprate struct */ X *type = vp->type; X *acl = vp->acl; X return access; } X /* { X *write_method = NULL; X for(tp = first; tp < end; tp = next){ X if ((in matches tp) or (in < tp)){ X inlen -= tp->length; X for(vp = tp->vp; vp < end; vp = next){ X if ((in < vp) || (exact && (in == vp))){ X cobble up compatable vp; X call findvar; X if (it returns nonzero) X break both loops; X } X if (exact && (in < vp)) ??? X return NULL; X } X } X } } */ X int compare(name1, len1, name2, len2) X register oid *name1, *name2; X register int len1, len2; { X register int len; X X /* len = minimum of len1 and len2 */ X if (len1 < len2) X len = len1; X else X len = len2; X /* find first non-matching byte */ X while(len-- > 0){ X if (*name1 < *name2) X return -1; X if (*name2++ < *name1++) X return 1; X } X /* bytes match up to length of shorter string */ X if (len1 < len2) X return -1; /* name1 shorter, so it is "less" */ X if (len2 < len1) X return 1; X return 0; /* both strings are equal */ } X int compare_tree(name1, len1, name2, len2) X register oid *name1, *name2; X register int len1, len2; { X register int len; X X /* len = minimum of len1 and len2 */ X if (len1 < len2) X len = len1; X else X len = len2; X /* find first non-matching byte */ X while(len-- > 0){ X if (*name1 < *name2) X return -1; X if (*name2++ < *name1++) X return 1; X } X /* bytes match up to length of shorter string */ X if (len1 < len2) X return -1; /* name1 shorter, so it is "less" */ X /* name1 matches name2 for length of name2, or they are equal */ X return 0; } X #ifdef VXWORKS oid version_id[] = {1, 3, 6, 1, 4, 1, 535, 1, 1, 2}; #else oid version_id[] = {1, 3, 6, 1, 4, 1, 3, 1, 1}; #endif X u_long sysUpTime(){ X #ifdef VXWORKS X return (u_long) ((tickGet () * 100) / sysClkRateGet ()); #else X struct timeval now, boottime; X X if (KNLookup(N_BOOTTIME, (char *)&boottime, sizeof(boottime)) == NULL) { X return(0); X } X gettimeofday(&now, (struct timezone *)0); X return (u_long) ((now.tv_sec - boottime.tv_sec) * 100 X + (now.tv_usec - boottime.tv_usec) / 10000); #endif } X Export u_char * var_hosttimetab(vp, name, length, exact, var_len, write_method) X register struct variable *vp; /* IN - pointer to variable entry that X ** points here X */ X register oid *name; /* IN/OUT - input name requested, X ** output name found X */ X register int *length; /* IN/OUT - length of input and output oid's */ X int exact; /* IN - TRUE if an exact match was requested. */ X int *var_len; /* OUT - length of variable or 0 if function returned. */ X int (**write_method)(); /* OUT - pointer to function to set X ** variable, otherwise 0 X */ { X oid newname[MAX_NAME_LEN]; X int result, zero = 0; X int creationOrder; X X bcopy((char *)vp->name, (char *)newname, (int)vp->namelen * sizeof(oid)); X *write_method = 0; X X newname[vp->namelen] = (oid)1; X X if (exact){ X creationOrder = name[vp->namelen + 1]; X if (creationOrder > 2000) X return NULL; X newname[vp->namelen + 1] = creationOrder; X } else if (*length == vp->namelen + 2){ X creationOrder = name[vp->namelen + 1] + 1; X if (creationOrder > 2000){ X if ((vp->name[vp->namelen - 1] != name[vp->namelen - 1])){ X creationOrder = 1; X } else { X return NULL; X } X } X newname[vp->namelen + 1] = creationOrder; X } else { X printf("Slow code\n"); X creationOrder = 1; X while (creationOrder < 2000) { X newname[vp->namelen + 1] = (oid)creationOrder++; X result = compare(name, *length, newname, (int)vp->namelen + 2); X if ((exact && (result == 0)) || (!exact && (result < 0))) { X break; X } X } X if (creationOrder == 2002) { X return NULL; X } X } X bcopy((char *)newname, (char *)name, X ((int)vp->namelen + 2) * sizeof(oid)); X *length = vp->namelen + 2; X *var_len = sizeof(u_long); X X switch (vp->magic) { X case HOSTTIMETABADDRESS: X *var_len = sizeof(struct ether_addr); X return (u_char *) "RMONRULES"; X case HOSTTIMETABCREATIONORDER: X long_return = creationOrder; X return (u_char *) &long_return; X case HOSTTIMETABINDEX: X case HOSTTIMETABINPKTS: X case HOSTTIMETABOUTPKTS: X case HOSTTIMETABINOCTETS: X case HOSTTIMETABOUTOCTETS: X case HOSTTIMETABOUTERRORS: X case HOSTTIMETABOUTBCASTPKTS: X case HOSTTIMETABOUTMCASTPKTS: X return (u_char *) &zero; X default: X ERROR(""); X } X X return NULL; } X u_char * var_system(vp, name, length, exact, var_len, write_method) X register struct variable *vp; /* IN - pointer to variable entry that points here */ X register oid *name; /* IN/OUT - input name requested, output name found */ X register int *length; /* IN/OUT - length of input and output oid's */ X int exact; /* IN - TRUE if an exact match was requested. */ X int *var_len; /* OUT - length of variable or 0 if function returned. */ X int (**write_method)(); /* OUT - pointer to function to set variable, otherwise 0 */ { X extern int writeVersion(), writeSystem(); X oid newname[MAX_NAME_LEN]; X int result; X X bcopy((char *)vp->name, (char *)newname, (int)vp->namelen * sizeof(oid)); X newname[8] = 0; X result = compare(name, *length, newname, (int)vp->namelen + 1); X if ((exact && (result != 0)) || (!exact && (result >= 0))) X return NULL; X bcopy((char *)newname, (char *)name, ((int)vp->namelen + 1) * sizeof(oid)); X *length = vp->namelen + 1; X *write_method = 0; X *var_len = sizeof(long); /* default length */ X switch (vp->magic){ X case VERSION_DESCR: X *var_len = strlen(version_descr); X *write_method = writeVersion; X return (u_char *)version_descr; X case VERSION_ID: X *var_len = sizeof(version_id); X return (u_char *)version_id; X case UPTIME: X (u_long)long_return = sysUpTime(); X return (u_char *)&long_return; X case IFNUMBER: X long_return = Interface_Scan_Get_Count(); X return (u_char *) &long_return; X case SYSCONTACT: X *var_len = strlen(sysContact); X *write_method = writeSystem; X return (u_char *)sysContact; X case SYSNAME: X *var_len = strlen(sysName); X *write_method = writeSystem; X return (u_char *)sysName; X case SYSLOCATION: X *var_len = strlen(sysLocation); X *write_method = writeSystem; X return (u_char *)sysLocation; X case SYSSERVICES: X long_return = 72; X return (u_char *)&long_return; X default: X ERROR(""); X } X return NULL; } X #ifdef VXWORKS X #ifndef NV_RAM_SIZE #define NV_RAM_SIZE 254 #endif /* NV_RAM_SIZE */ #define BOOT_LINE_LEN NV_RAM_SIZE /*sizeof (struct vxworks_boot_data) */ static char vx_boot_line [BOOT_LINE_LEN]; static BOOT_PARAMS vx_params; static int vx_boot_lengths [] = { X BOOT_DEV_LEN, /* boot device code */ X BOOT_HOST_LEN, /* name of host */ X BOOT_HOST_LEN, /* name of target */ X BOOT_ADDR_LEN, /* ethernet internet addr */ X BOOT_ADDR_LEN, /* backplane internet addr */ X BOOT_ADDR_LEN, /* host internet addr */ X BOOT_ADDR_LEN, /* gateway internet addr */ X BOOT_FILE_LEN, /* name of boot file */ X BOOT_FILE_LEN, /* name of startup script file */ X BOOT_USR_LEN, /* user name */ X BOOT_PASSWORD_LEN, /* password */ X BOOT_OTHER_LEN, /* available for applications */ X sizeof (int), /* processor number */ X sizeof (int) /* configuration flags */ X }; X u_char * var_sscl_vxboot(vp, name, length, exact, var_len, write_method) X register struct variable *vp; /* IN - pointer to variable entry that points here */ X register oid *name; /* IN/OUT - input name requested, output name found */ X register int *length; /* IN/OUT - length of input and output oid's */ X int exact; /* IN - TRUE if an exact match was requested. */ X int *var_len; /* OUT - length of variable or 0 if function returned. */ X int (**write_method)(); /* OUT - pointer to function to set variable, otherwise 0 */ { X extern int write_vxboot (); X oid newname[MAX_NAME_LEN]; X int result; X X bcopy((char *)vp->name, (char *)newname, (int)vp->namelen * sizeof(oid)); X #if 1 /* Apparently, this next line is needed for the compare to work right, X see README.vxWorks for a more detailed description */ X newname[12] = 0; #endif X X result = compare(name, *length, newname, (int)vp->namelen + 1); X if ((exact && (result != 0)) || (!exact && (result >= 0))) X return NULL; X bcopy((char *)newname, (char *)name, ((int)vp->namelen + 1) * sizeof(oid)); X *length = vp->namelen + 1; X *write_method = 0; X *var_len = sizeof(long); /* default length */ X X /* X * get NV RAM values X */ X if (sysNvRamGet (vx_boot_line, NV_RAM_SIZE, 0) == -1 || X vx_boot_line [0] == EOS) X { X ERROR ("Unable to vxWorks parameters from NV Ram"); X return NULL; X } X else X bootStringToStruct (vx_boot_line, &vx_params); X X switch (vp->magic){ X case VXBOOT_DEV: X *var_len = strlen (vx_params.bootDev); X *write_method = write_vxboot; X return (u_char *)&vx_params.bootDev; X break; X X case VXBOOT_HOST: X *var_len = strlen (vx_params.hostName); X *write_method = write_vxboot; X return (u_char *)&vx_params.hostName; X break; X X case VXBOOT_TARGET: X *var_len = strlen (vx_params.targetName); X *write_method = write_vxboot; X return (u_char *)&vx_params.targetName; X break; X X case VXBOOT_EAD: X *var_len = strlen (vx_params.ead); X *write_method = write_vxboot; X return (u_char *)&vx_params.ead; X break; X X case VXBOOT_BAD: X *var_len = strlen (vx_params.bad); X *write_method = write_vxboot; X return (u_char *)&vx_params.bad; X break; X X case VXBOOT_HAD: X *var_len = strlen (vx_params.had); X *write_method = write_vxboot; X return (u_char *)&vx_params.had; X break; X X case VXBOOT_GAD: X *var_len = strlen (vx_params.gad); X *write_method = write_vxboot; X return (u_char *)&vx_params.gad; X break; X X case VXBOOT_BOOTFILE: X *var_len = strlen (vx_params.bootFile); X *write_method = write_vxboot; X return (u_char *)&vx_params.bootFile; X break; X X case VXBOOT_STARTUP: X *var_len = strlen (vx_params.startupScript); X *write_method = write_vxboot; X return (u_char *)&vx_params.startupScript; X break; X X case VXBOOT_USR: X *var_len = strlen (vx_params.usr); X *write_method = write_vxboot; X return (u_char *)&vx_params.usr; X break; X X case VXBOOT_PASSWD: X *var_len = strlen (vx_params.passwd); X *write_method = write_vxboot; X return (u_char *)&vx_params.passwd; X break; X X case VXBOOT_OTHER: X *var_len = strlen (vx_params.other); X *write_method = write_vxboot; X return (u_char *)&vx_params.other; X break; X X case VXBOOT_PROCNUM: X *write_method = write_vxboot; X return (u_char *) &vx_params.procNum; X break; X X case VXBOOT_FLAGS: X *write_method = write_vxboot; X return (u_char *) &vx_params.flags; X break; X X default: X ERROR(""); X } X return NULL; X } X u_char * var_sscl_vxclock(vp, name, length, exact, var_len, write_method) X register struct variable *vp; /* IN - pointer to variable entry that points here */ X register oid *name; /* IN/OUT - input name requested, output name found */ X register int *length; /* IN/OUT - length of input and output oid's */ X int exact; /* IN - TRUE if an exact match was requested. */ X int *var_len; /* OUT - length of variable or 0 if function returned. */ X int (**write_method)(); /* OUT - pointer to function to set variable, otherwise 0 */ { X oid newname[MAX_NAME_LEN]; X int result; X X bcopy((char *)vp->name, (char *)newname, (int)vp->namelen * sizeof(oid)); X newname[13] = 0; X result = compare(name, *length, newname, (int)vp->namelen + 1); X if ((exact && (result != 0)) || (!exact && (result >= 0))) X return NULL; X bcopy((char *)newname, (char *)name, ((int)vp->namelen + 1) * sizeof(oid)); X *length = vp->namelen + 1; X *write_method = 0; X *var_len = sizeof(long); /* default length */ X switch (vp->magic){ X case VXCLOCK_RATE: X long_return = sysClkRateGet (); X return (u_char *)&long_return; X break; X X case VXCLOCK_TICKS: X long_return = tickGet (); X return (u_char *)&long_return; X break; X X default: X ERROR(""); X } X return NULL; } X u_char * var_sscl_snmpd(vp, name, length, exact, var_len, write_method) X register struct variable *vp; /* IN - pointer to variable entry that points here */ X register oid *name; /* IN/OUT - input name requested, output name found */ X register int *length; /* IN/OUT - length of input and output oid's */ X int exact; /* IN - TRUE if an exact match was requested. */ X int *var_len; /* OUT - length of variable or 0 if function returned. */ X int (**write_method)(); /* OUT - pointer to function to set variable, otherwise 0 */ { X extern int write_ssclrt_snmpd (); X oid newname[MAX_NAME_LEN]; X int result; X X bcopy((char *)vp->name, (char *)newname, (int)vp->namelen * sizeof(oid)); X newname[10] = 0; X result = compare(name, *length, newname, (int)vp->namelen + 1); X if ((exact && (result != 0)) || (!exact && (result >= 0))) X return NULL; X bcopy((char *)newname, (char *)name, ((int)vp->namelen + 1) * sizeof(oid)); X *length = vp->namelen + 1; X *write_method = 0; X *var_len = sizeof(long); /* default length */ X switch (vp->magic){ X case SNMPD_AGNT_VER: X *var_len = strlen(sscl_agent_version); X return (u_char *)sscl_agent_version; X break; X X case SNMPD_PORT_VER: X *var_len = strlen(sscl_port_version); X return (u_char *)sscl_port_version; X break; X X case SNMPD_PRIORITY: X taskPriorityGet (taskIdSelf (), &long_return); X *write_method = write_ssclrt_snmpd; X return (u_char *)&long_return; X break; X X default: X ERROR("var_sscl_snmpd"); X } X return NULL; } X static int user_interval = 15; u_char * var_sscl_idle(vp, name, length, exact, var_len, write_method) X register struct variable *vp; /* IN - pointer to variable entry that points here */ X register oid *name; /* IN/OUT - input name requested, output name found */ X register int *length; /* IN/OUT - length of input and output oid's */ X int exact; /* IN - TRUE if an exact match was requested. */ X int *var_len; /* OUT - length of variable or 0 if function returned. */ X int (**write_method)(); /* OUT - pointer to function to set variable, otherwise 0 */ { X extern int write_ssclrt_idle (); X oid newname[MAX_NAME_LEN]; X int result; X int num_valid = valid_idle (); X X bcopy((char *)vp->name, (char *)newname, (int)vp->namelen * sizeof(oid)); X newname[10] = 0; X result = compare(name, *length, newname, (int)vp->namelen + 1); X if ((exact && (result != 0)) || (!exact && (result >= 0))) X return NULL; X bcopy((char *)newname, (char *)name, ((int)vp->namelen + 1) * sizeof(oid)); X *length = vp->namelen + 1; X *write_method = 0; X *var_len = sizeof(long); /* default length */ X switch (vp->magic){ X case IDLE_CURRENT: X long_return = cpu_idle (1); X return (u_char *)&long_return; X break; X X case IDLE_10SEC: X long_return = cpu_idle ((num_valid > 10) ? 10 : num_valid); X return (u_char *)&long_return; X break; X X case IDLE_60SEC: X long_return = cpu_idle ((num_valid > 60) ? 60 : num_valid); X return (u_char *)&long_return; X break; X X case IDLE_USERSEC: X long_return = cpu_idle ((num_valid > user_interval) ? user_interval : num_valid); SHAR_EOF : || echo 'restore of snmp2/agent/snmp_vars.c failed' fi echo 'End of snmp2 part 30' echo 'File snmp2/agent/snmp_vars.c is continued in part 31' echo 31 > _sharseq.tmp exit 0