home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-08 | 64.3 KB | 1,957 lines |
- Newsgroups: comp.sources.misc
- From: nevil@ccu1.aukuni.ac.nz (J Nevil Brownlee)
- Subject: v40i111: netramet - Network Traffic Accounting Meter, Part23/25
- Message-ID: <1993Nov9.020746.19212@sparky.sterling.com>
- X-Md4-Signature: 2b4fe2f33b6f7a1751f52b635144e912
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Sterling Software
- Date: Tue, 9 Nov 1993 02:07:46 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: nevil@ccu1.aukuni.ac.nz (J Nevil Brownlee)
- Posting-number: Volume 40, Issue 111
- Archive-name: netramet/part23
- Environment: INET, UNIX, DOS
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: netramet/doc/snmp/README netramet/doc/snmp/snmpstatus.1
- # netramet/doc/snmp/snmptest.1 netramet/doc/snmp/snmptrap.1
- # netramet/doc/snmp/snmpwalk.1 netramet/doc/snmp/variables.5
- # netramet/sg/apps/Makefile netramet/src/apps/snmpget.c
- # netramet/src/apps/snmpgetnext.c netramet/src/apps/snmptrapd.c
- # netramet/src/meter/chart.c netramet/src/meter/include/pktsnap.h
- # netramet/src/snmplib/include/asn1.h
- # netramet/src/snmplib/include/snmpimpl.h
- # netramet/src/snmplib/snmpauth.c
- # Wrapped by kent@sparky on Tue Nov 2 18:17:14 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 23 (of 25)."'
- if test -f 'netramet/doc/snmp/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/doc/snmp/README'\"
- else
- echo shar: Extracting \"'netramet/doc/snmp/README'\" \(4489 characters\)
- sed "s/^X//" >'netramet/doc/snmp/README' <<'END_OF_FILE'
- X
- X The files in this directory compromise the 1.0 release of the CMU SNMP
- Xdistribution. This includes the SNMP/ASN.1 library, many client
- Xapplications, and supporting documentation. The snmp agent for the Kinetics
- Xbox is included in this distribution, but the KIP code it links against is not
- Xyet distributable (this is not the released KIP code). This will probably
- Xbe distributed at another time if there is sufficient demand.
- X
- XThis code was written with efficiency and portability in mind. The
- Xapplications compile and run on the following systems: IBM PC/RT running ACIS
- XRelease 3, Sun3/60 running SUNOS 3.5, DEC microVax running Ultrix 2.2, and
- XDECStation 3100's runing Ultrix 3.0. They are expected to run on any system
- Xwith a Berkeley socket interface.
- X
- XThe agent compiles into about 10 KB of 68000 code. The machine independent
- Xportions of this agent also run on CMU's IBM PC/AT based router.
- X
- XThe applications are designed to be useful in the real world. Snmpnetstat
- Xis a port of the Berkeley Unix netstat that gathers it's information using
- XSNMP. (Many people will enjoy "snmpnetstat mygateway public -r"). Snmpstatus
- Xcollects several pieces of information and presents them in a useful format
- Xand is good for everyday status monitoring. The rest of the tools are simpler,
- Xbut still interpret input and output symbolicly (they can be used without
- Xreferencing the RFC's!).
- X
- XFor instance,
- Xsnmpnetstat mygateway public -r returns:
- XRouting tables
- XDestination Gateway Flags Interface
- Xbbn-net-temp psc-gw3.psc.edu UG Ethernet0
- Xarpanet prpnet-gw.cc.cmu.e UG Ethernet0
- Xxerox-net psc-gw3.psc.edu UG Ethernet0
- Xhp-internet psc-gw3.psc.edu UG Ethernet0
- X...
- X
- Xsnmpstatus returns:
- X[128.2.56.220]=>[Kinetics Fastpath2] Up: 1 day, 4:43:31
- XRecv/Trans packets - Interface: 262874/39867 | IP 47432/34587
- X
- XThe rest of the applications typically present a variable in a form similar
- Xto the following:
- XName: interfaces.ifTable.ifEntry.ifType.1
- XINTEGER: ethernet-csmacd(6)
- X
- XThe parsing and printing of symbolic object identifiers and the printing of
- Xtyped variables is driven by a database that describes the MIB.
- XThe MIB database is now retrieved from a text file in the ASN.1 format used in
- Xthe RFC1066 MIB. This makes adding new (enterprise specific) mibs to the database
- Xvery simple. I will solicit description files from other SNMP vendors and redistribute
- Xthem via anonymous FTP. Initially, the mib.txt file contains a discription of the
- XRFC 1066 MIB and portions of the CMU enterprise specific MIB. I had help in optimizing
- Xthe parser from Phil Lapsley of Berkeley (Thanks Phil!).
- X
- XFor further information, please consult the man pages. There are man pages for
- Xeach of the applications, as well as for the Application Programming Interface (API).
- X
- XThe API has been redesigned to present a very convenient and useful asynchronous
- Xinterface to the SNMP transport. In addition, snmp_client.c contains a toolkit
- Xof routines that simplify writing client applications. In particular, there is
- Xa synchronous interface built on top of the asyncronous interface that makes
- Xwriting applications very easy.
- X
- XThis distribution is coprighted by CMU, but may be used and sold without
- Xpermission. The snmpnetstat application is derived from the Berkeley 4.3 netstat,
- Xand is therefore also copyrighted by Berkeley. Consult the copyright notices for
- Xfurther information.
- X
- XThe distribution is available by anonymous FTP from the host
- Xlancaster.andrew.cmu.edu (128.2.13.21) as the file pub/cmu-snmp1.0.tar. I will
- Xmaintain a repository of mib description files in the directory pub/mibs.
- X
- XPlease direct questions, comments, and bug reports to sw0l+snmp@andrew.cmu.edu.
- XI have received very helpful feedback in the past that has been integrated into
- Xthe current release. This wil continue in the future.
- X
- XIf you pick up this package, please send me a note to the above address, so
- Xthat I may notify you of future enhancements/changes and additions to the
- Xset of applications (several are planned). I will also redistribute applications
- Xusing the CMU SNMP library that were written elsewhere and placed in the public domain.
- XThere are already several such applications pending such a distribution.
- X
- XThere is a gateway at CMU running the agent. Feel free to query it. You
- Xcan access as netdev-kbox.cc.cmu.edu (128.2.56.220) with community name
- X"public".
- X
- X
- XSteve Waldbusser
- XNetwork Development
- XCarnegie-Mellon University
- END_OF_FILE
- if test 4489 -ne `wc -c <'netramet/doc/snmp/README'`; then
- echo shar: \"'netramet/doc/snmp/README'\" unpacked with wrong size!
- fi
- # end of 'netramet/doc/snmp/README'
- fi
- if test -f 'netramet/doc/snmp/snmpstatus.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmpstatus.1'\"
- else
- echo shar: Extracting \"'netramet/doc/snmp/snmpstatus.1'\" \(3422 characters\)
- sed "s/^X//" >'netramet/doc/snmp/snmpstatus.1' <<'END_OF_FILE'
- X.\* /***********************************************************
- X.\" Copyright 1988, 1989 by Carnegie Mellon University
- X.\"
- X.\" All Rights Reserved
- X.\"
- X.\" Permission to use, copy, modify, and distribute this software and its
- X.\" documentation for any purpose and without fee is hereby granted,
- X.\" provided that the above copyright notice appear in all copies and that
- X.\" both that copyright notice and this permission notice appear in
- X.\" supporting documentation, and that the name of CMU not be
- X.\" used in advertising or publicity pertaining to distribution of the
- X.\" software without specific, written prior permission.
- X.\"
- X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X.\" SOFTWARE.
- X.\" ******************************************************************/
- X.TH SNMPSTATUS 1 "17 September 1989"
- X.UC 4
- X.SH NAME
- Xsnmpstatus - Retrieves important information from a network entity.
- X.SH SYNOPSIS
- Xsnmpstatus host [community]
- X.SH DESCRIPTION
- XSnmpstatus is an SNMP application that retrieves several important
- Xstatistics from a network entity.
- X.PP
- XThe
- X.I host
- Xspecification may be either a host name or an internet address
- Xspecified in "dot notation"
- X.PP
- XThe
- X.I community
- Xspecifies the community name for the transaction with the remote system.
- XIf this argument is not given, the community name will default to
- X.I "public".
- X.PP
- XThe information returned is:
- X.PP
- XThe IP address of the entity.
- X.br
- XA textual description of the entity
- X.I (sysDescr.0)
- X.br
- XThe uptime of the entity
- X.I (sysUpTime.0)
- X.br
- XThe sum of received packets on all interfaces
- X.I (ifInUCastPkts.* + ifInNUCastPkts.*)
- X.br
- XThe sum of transmitted packets on all interfaces
- X.I (ifOutUCastPkts.* + ifOutNUCastPkts.*)
- X.br
- XThe number of IP input packets
- X.I (ipInReceives.0)
- X.br
- XThe number of IP output packets
- X.I (ipOutRequests.0)
- X.PP
- XFor example
- X.PP
- X.I snmpstatus netdev-kbox.cc.cmu.edu public
- X.PP
- Xwill produce output similar to the following:
- X.PP
- X.I [128.2.56.220]=>[Kinetics FastPath2] Up: 1 day, 4:43:31
- X.br
- X.I IF recv/trans packets 262874/39867 |
- X.I IP recv/trans packets 31603/15805
- X.PP
- XSnmpstatus also checks the operational status of all interfaces (ifOperStatus.*),
- Xand if it finds any that are not running, it will report in a manner similar to this:
- X.PP
- X.I 2 interfaces are down!
- XThe
- X.I host
- Xspecification may be either a host name or an internet address
- Xspecified in "dot notation"
- X.PP
- XThe
- X.I community
- Xspecifies the community name for the transaction with the remote system. If none is
- Xgiven, the community name defaults to
- X.I "public".
- X.PP
- XIf the network entity has an error processing the request packet, an error
- Xpacket will be returned and a message will be shown, helping to pinpoint in what way
- Xthe request was malformed. Snmpstatus will attempt to reform it's request to eliminate
- Xthe malformed variable, but this variable will then be missing from the displayed data.
- X.PP
- XAdding a "-d" to the argument list will cause the application to dump input and output packets.
- X.PP
- X.SH "SEE ALSO"
- XRFC 1065, RFC 1066, RFC 1067
- END_OF_FILE
- if test 3422 -ne `wc -c <'netramet/doc/snmp/snmpstatus.1'`; then
- echo shar: \"'netramet/doc/snmp/snmpstatus.1'\" unpacked with wrong size!
- fi
- # end of 'netramet/doc/snmp/snmpstatus.1'
- fi
- if test -f 'netramet/doc/snmp/snmptest.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmptest.1'\"
- else
- echo shar: Extracting \"'netramet/doc/snmp/snmptest.1'\" \(3555 characters\)
- sed "s/^X//" >'netramet/doc/snmp/snmptest.1' <<'END_OF_FILE'
- X.\* /***********************************************************
- X.\" Copyright 1988, 1989 by Carnegie Mellon University
- X.\"
- X.\" All Rights Reserved
- X.\"
- X.\" Permission to use, copy, modify, and distribute this software and its
- X.\" documentation for any purpose and without fee is hereby granted,
- X.\" provided that the above copyright notice appear in all copies and that
- X.\" both that copyright notice and this permission notice appear in
- X.\" supporting documentation, and that the name of CMU not be
- X.\" used in advertising or publicity pertaining to distribution of the
- X.\" software without specific, written prior permission.
- X.\"
- X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X.\" SOFTWARE.
- X.\" ******************************************************************/
- X.TH SNMPTEST 1 "17 September 1989"
- X.UC 4
- X.SH NAME
- Xsnmptest - communicates with a network entity using SNMP GET Requests.
- X.SH SYNOPSIS
- Xsnmptest host community
- X.SH DESCRIPTION
- XSnmptest is a flexible SNMP application that can monitor and manage
- Xinformation on a network entity.
- X.PP
- XThe
- X.I host
- Xspecification may be either a host name or an internet address
- Xspecified in "dot notation"
- X.PP
- XThe
- X.I community
- Xspecifies the community name for the transaction with the remote system.
- X.PP
- XAfter invoking the program, a command line
- Xinterpreter proceeds to accept commands. It will prompt with:
- X.PP
- X.I Please enter the variable name:
- X.PP
- XAt this point you can enter one or more variable names, one per line.
- XA blank line is a command to send a request for each of the variables (in a single
- Xpacket) to the remote entity. Each variable name is given in the format specified in
- X.IR variables (5).
- XFor example
- X.PP
- X.I snmpget netdev-kbox.cc.cmu.edu public
- X.br
- X.I Please enter the variable name: system.sysdescr.0
- X.br
- X.I Please enter the variable name:
- X.PP
- XWill return some information about the request and reply packets, as well as the
- Xinformation:
- X.PP
- X.I Name: system.sysDescr.0
- X.br
- X.I OCTET STRING- (ascii): Kinetics FastPath2
- X.PP
- XUpon startup, the program defaults to sending a GET Request packet. This can be changed
- Xto a GET NEXT Request or a SET Request by typing the commands "$N" or "$S" repectively. Typing
- X"$G" will go back to the GET Request mode.
- X.PP
- XThe command "$D" will toggle the dumping of each sent and received packet.
- X.PP
- XWhen in the "SET Request" mode, more information is requested by the prompt for each variable. The prompt:
- X.PP
- X.I Please enter variable type [i|s|n]:
- X.PP
- Xrequests the type of the variable be entered. Type "i" for an integer, "s" for an octet string,
- Xand "n" for a null value.
- X.br
- XAt this point a value will be prompted for:
- X.PP
- X.I Please enter new value:
- X.PP
- XIf this is an integer value, just type the integer (in decimal). If it is a string, type in
- Xwhite-space seperated decimal numbers, one per byte of the string. Again type a blank line at
- Xthe prompt for the variable name to send the packet.
- X.PP
- XAt the variable name line, typing "$Q" will quit the program.
- X.PP
- XAdding a "-d" to the argument list will cause the application to dump input and output packets.
- X.PP
- X.SH "SEE ALSO"
- Xvariables(5), RFC 1065, RFC 1066, RFC 1067
- END_OF_FILE
- if test 3555 -ne `wc -c <'netramet/doc/snmp/snmptest.1'`; then
- echo shar: \"'netramet/doc/snmp/snmptest.1'\" unpacked with wrong size!
- fi
- # end of 'netramet/doc/snmp/snmptest.1'
- fi
- if test -f 'netramet/doc/snmp/snmptrap.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmptrap.1'\"
- else
- echo shar: Extracting \"'netramet/doc/snmp/snmptrap.1'\" \(3877 characters\)
- sed "s/^X//" >'netramet/doc/snmp/snmptrap.1' <<'END_OF_FILE'
- X.\* /***********************************************************
- X.\" Copyright 1988, 1989 by Carnegie Mellon University
- X.\"
- X.\" All Rights Reserved
- X.\"
- X.\" Permission to use, copy, modify, and distribute this software and its
- X.\" documentation for any purpose and without fee is hereby granted,
- X.\" provided that the above copyright notice appear in all copies and that
- X.\" both that copyright notice and this permission notice appear in
- X.\" supporting documentation, and that the name of CMU not be
- X.\" used in advertising or publicity pertaining to distribution of the
- X.\" software without specific, written prior permission.
- X.\"
- X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X.\" SOFTWARE.
- X.\" ******************************************************************/
- X.TH SNMPTRAP 1 "17 September 1989"
- X.UC 4
- X.SH NAME
- Xsnmptrap - Send an SNMP TRAP message to a host.
- X.SH SYNOPSIS
- Xsnmptrap host community trap-type specific-type device-description [ -a agent-addr ]
- X.SH DESCRIPTION
- Xsnmptrap is an SNMP application that forms and sends an SNMP TRAP message to
- Xa host.
- X.PP
- XThe
- X.I host
- Xspecification may be either a host name or an internet address
- Xspecified in "dot notation"
- X.PP
- XThe
- X.I community
- Xspecifies the community name for the transaction with the remote system.
- X.PP
- XThe
- X.I trap-type
- Xand
- X.I specific-type
- Xare integers that specify the type of trap message being sent.
- X.PP
- XThe
- X.I device-description
- Xis a textual description of the device sending this trap, to be used as the value of
- Xa system.sysDescr.0 variable sent in the variable list of this trap message.
- XThe optional argument
- X.I -a agent-addr
- Xcan be used to change the address from which the trap reports it is being sent. Otherwise
- Xthe sending host's address is used.
- X.PP
- XFor example
- X.PP
- X.I snmptrap nic.andrew.cmu.edu public 0 0
- X.I 'SUN 3/60: SUNOS4.0'
- X.PP
- Xwill send a Cold Start trap to the specified machine.
- X.PP
- XThe defined trap types are:
- X.TP
- X.B 0
- XcoldStart \- signifies that the sending protocol entity is
- Xreinitializing itself such that the agent's configuration or the
- Xprotocol entity implementation may be altered.
- X.TP
- X.B 1
- XwarmStart \- signifies that the sending protocol entity is
- Xreinitializing itself such that neither the agent configuration nor
- Xthe protocol entity implementation is altered.
- X.TP
- X.B 2
- XlinkDown \- signifies that the sending protocol entity
- Xrecognizes a failure in one of the communication links represented in
- Xthe agent's configuration.
- X.TP
- X.B 3
- XlinkUp \- signifies that the sending protocol entity
- Xrecognizes that one of the communication links represented in the
- Xagent's configuration has come up.
- X.TP
- X.B 4
- XauthenticationFailure \- signifies that the sending protocol
- Xentity is the addressee of a protocol message that is not properly
- Xauthenticated. While implementations of the SNMP must be capable of
- Xgenerating this trap, they must also be capable of suppressing the
- Xemission of such traps via an implementation-specific mechanism.
- X.TP
- X.B 5
- XegpNeighborLoss \- signifies that an EGP neighbor for whom
- Xthe sending protocol entity was an EGP peer has been marked down and
- Xthe peer relationship no longer obtains.
- X.TP
- X.B 6
- XenterpriseSpecific \- signifies that the sending protocol
- Xentity recognizes that some enterprise-specific event has occurred.
- XThe specific-trap field identifies the particular trap which
- Xoccurred.
- X.PP
- XAdding a "-d" to the argument list will cause the application to dump the output packet.
- X.PP
- X.SH "SEE ALSO"
- XRFC 1065, RFC 1066, RFC 1067
- END_OF_FILE
- if test 3877 -ne `wc -c <'netramet/doc/snmp/snmptrap.1'`; then
- echo shar: \"'netramet/doc/snmp/snmptrap.1'\" unpacked with wrong size!
- fi
- # end of 'netramet/doc/snmp/snmptrap.1'
- fi
- if test -f 'netramet/doc/snmp/snmpwalk.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmpwalk.1'\"
- else
- echo shar: Extracting \"'netramet/doc/snmp/snmpwalk.1'\" \(3034 characters\)
- sed "s/^X//" >'netramet/doc/snmp/snmpwalk.1' <<'END_OF_FILE'
- X.\* /***********************************************************
- X.\" Copyright 1988, 1989 by Carnegie Mellon University
- X.\"
- X.\" All Rights Reserved
- X.\"
- X.\" Permission to use, copy, modify, and distribute this software and its
- X.\" documentation for any purpose and without fee is hereby granted,
- X.\" provided that the above copyright notice appear in all copies and that
- X.\" both that copyright notice and this permission notice appear in
- X.\" supporting documentation, and that the name of CMU not be
- X.\" used in advertising or publicity pertaining to distribution of the
- X.\" software without specific, written prior permission.
- X.\"
- X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X.\" SOFTWARE.
- X.\" ******************************************************************/
- X.TH SNMPWALK 1 "17 September 1989"
- X.UC 4
- X.SH NAME
- Xsnmpwalk - communicates with a network entity using SNMP GET Next Requests.
- X.SH SYNOPSIS
- Xsnmpwalk host community [variable-name]
- X.SH DESCRIPTION
- XSnmpwalk is an SNMP application that uses GET NEXT Requests to query for a tree
- Xof information about a network entity.
- X.PP
- XThe
- X.I host
- Xspecification may be either a host name or an internet address
- Xspecified in "dot notation"
- X.PP
- XThe
- X.I community
- Xspecifies the community name for the transaction with the remote system.
- X.PP
- XA variable may also be given on the
- Xcommand line. This variable specifies which portion of the object identifier
- Xspace will be searched using GET NEXT Requests. All variables in the subtree
- Xbelow the given variable are queried and their values presented to the user.
- XEach variable name is given in the format specified in
- X.IR variables (5).
- X.PP
- XIf the "variable-name" argument is not present, snmpwalk will search the whole Internet MIB.
- X.PP
- XFor example
- X.PP
- X.I snmpwalk netdev-kbox.cc.cmu.edu public system
- X.PP
- Xwill retrieve the variables sysDescr.0 and sysObjectID.0 and sysUpTime.0:
- X.PP
- X.I Name: system.sysDescr.0
- X.br
- X.I OCTET STRING- (ascii): Kinetics FastPath2
- X.PP
- X.I Name: system.sysObjectID.0
- X.br
- X.I OBJECT IDENTIFIER: .iso.org.dod.internet.private.enterprises.CMU.sysID.CMU-KIP
- X.PP
- X.I Name: system.sysUpTime.0
- X.br
- X.I Timeticks: (2291082) 6:21:50
- X.PP
- XIf the network entity has an error processing the request packet, an error
- Xpacket will be returned and a message will be shown, helping to pinpoint why
- Xthe request was malformed.
- X.PP
- XIf the tree search causes attempts to search beyond the end of the MIB, a message
- Xwill be displayed:
- X.PP
- X.I End of MIB.
- X.PP
- XAdding a "-d" to the argument list will cause the application to dump input and output packets.
- X.PP
- X.SH "SEE ALSO"
- Xvariables(5), RFC 1065, RFC 1066, RFC 1067
- END_OF_FILE
- if test 3034 -ne `wc -c <'netramet/doc/snmp/snmpwalk.1'`; then
- echo shar: \"'netramet/doc/snmp/snmpwalk.1'\" unpacked with wrong size!
- fi
- # end of 'netramet/doc/snmp/snmpwalk.1'
- fi
- if test -f 'netramet/doc/snmp/variables.5' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/doc/snmp/variables.5'\"
- else
- echo shar: Extracting \"'netramet/doc/snmp/variables.5'\" \(2850 characters\)
- sed "s/^X//" >'netramet/doc/snmp/variables.5' <<'END_OF_FILE'
- X.\* /***********************************************************
- X.\" Copyright 1988, 1989 by Carnegie Mellon University
- X.\"
- X.\" All Rights Reserved
- X.\"
- X.\" Permission to use, copy, modify, and distribute this software and its
- X.\" documentation for any purpose and without fee is hereby granted,
- X.\" provided that the above copyright notice appear in all copies and that
- X.\" both that copyright notice and this permission notice appear in
- X.\" supporting documentation, and that the name of CMU not be
- X.\" used in advertising or publicity pertaining to distribution of the
- X.\" software without specific, written prior permission.
- X.\"
- X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X.\" SOFTWARE.
- X.\" ******************************************************************/
- X.TH VARIABLES 5 "17 September 1989"
- X.UC 4
- X.SH NAME
- X variables - Format of specifying variable names to SNMP tools.
- X.SH SYNOPSIS
- X system.sysdescr.0
- X.SH DESCRIPTION
- XVariable names are in the format of Object Identifiers (ASN.1). There are
- Xseveral methods of representation. Each variable name is given in the format of A.B.C.D...,
- Xwhere A, B, C, and D are subidentifiers in one of two forms of notation.
- XEach subidentifier may be encoded as a decimal integer, or a symbol as found in
- Xthe RFC1066 MIB. The case of the symbols is not significant.
- X.br
- XIf there is no leading "." in the variable name, the name will be formed
- Xas if having been preceded with "iso.org.dod.internet.mgmt.mib.". A "." must
- Xbe placed before the first variable if the user is to fully specify the name.
- XFor example:
- X.PP
- X.I 1.1.0 system.sysDescr.0 and 1.sysDescr.0
- X.PP
- Xall refer to the same variable name. Likewise:
- X.PP
- X.I .1.3.6.1.2.1.1.1.0 .iso.org.dod.internet.mgmt.mib.system.sysdescr.0 .1.3.6.1.2.1.1.sysdescr.0
- X.PP
- XAll refer to the same variable name.
- X.PP
- XThe description of the variables in the MIB is given in a file named
- X.I "mib.txt"
- Xin the current directory or in a file named in the environment variable
- X.I "MIBFILE" or in
- X.I "/etc/mib.txt".
- XThese files are searched in the above order. The files are in the ASN.1 notation and use the
- XOBJECT TYPE macro defined in RFC 1065. Most of the file describing the RFC 1066 MIB is pulled
- Xout of RFC 1066 without change.
- X.SH "SEE ALSO"
- XRFC 1065, RFC 1066, RFC 1067, ISO IS 8824(ASN.1)
- X.SH BUGS
- XThe parser of the
- X.I "mib.txt"
- Xfile is not expected to handle bizarre (although correct) interpretations of the ASN.1 notation.
- X
- X
- END_OF_FILE
- if test 2850 -ne `wc -c <'netramet/doc/snmp/variables.5'`; then
- echo shar: \"'netramet/doc/snmp/variables.5'\" unpacked with wrong size!
- fi
- # end of 'netramet/doc/snmp/variables.5'
- fi
- if test -f 'netramet/sg/apps/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/sg/apps/Makefile'\"
- else
- echo shar: Extracting \"'netramet/sg/apps/Makefile'\" \(2730 characters\)
- sed "s/^X//" >'netramet/sg/apps/Makefile' <<'END_OF_FILE'
- X# Modified by Nevil Brownlee, Auckland University
- X# Silicon Graphics version
- X#
- X# Makefile for snmpget, manager, snmpgetnext, collect, snmpwalk, snmpstatus, snmptest snmptrap snmptrapd snmpd
- X#
- X
- XSRC= ../../src/apps
- XSINCLUDE= ../../src/snmplib/include
- X
- XSNMPH = $(SINCLUDE)/asn1.h $(SINCLUDE)/mib.h $(SINCLUDE)/parse.h \
- X $(SINCLUDE)/snmp.h $(SINCLUDE)/snmpapi.h \
- X $(SINCLUDE)/snmpclnt.h $(SINCLUDE)/snmpimpl.h
- X
- XTARG= snmpagnt.o snmptest
- X# snmpget snmpgetnext snmpwalk snmpstatus \
- X# snmptrap snmptrapd snmpd
- X
- XLIBS= ../snmplib/libsnmp.a
- X
- XCFLAGS= -g -I$(SINCLUDE) -cckr -D_BSD_SIGNALS -D_BSD_COMPAT
- X#CFLAGS= -g -I$(SINCLUDE) -D_BSD_SIGNALS -D_BSD_COMPAT
- X
- X
- Xall: $(TARG)
- X
- X
- Xsnmptest.o: $(SNMPH) $(SRC)/snmptest.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmptest.c
- X
- Xsnmptest: snmptest.o ${LIBS}
- X ${CC} -o $@ snmptest.o ${LIBS}
- X
- X
- Xsnmptrap.o: $(SNMPH) $(SRC)/snmptrap.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmptrap.c
- X
- Xsnmptrap: snmptrap.o ${LIBS}
- X ${CC} -o $@ snmptrap.o ${LIBS} -lmld
- X# ${CC} -o $@ snmptrap.o ${LIBS}
- X
- X
- Xsnmptrapd.o: $(SNMPH) $(SRC)/snmptrapd.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmptrapd.c
- X
- Xsnmptrapd: snmptrapd.o ${LIBS}
- X ${CC} -o $@ snmptrapd.o ${LIBS}
- X
- X
- Xsnmpget.o: $(SNMPH) $(SRC)/snmpget.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmpget.c
- X
- Xsnmpget: snmpget.o ${LIBS}
- X ${CC} -o $@ snmpget.o ${LIBS}
- X
- X
- X#manager.o: $(SNMPH) $(SRC)/manager.c
- X# ${CC} $(CFLAGS) -c $(SRC)/manager.c
- X
- X#manager: manager.o ${LIBS}
- X# ${CC} -o $@ manager.o ${LIBS}
- X
- X
- X#monitor.o: $(SNMPH) $(SRC)/monitor.c
- X# ${CC} $(CFLAGS) -c $(SRC)/monitor.c
- X
- X#monitor: monitor.o ${LIBS}
- X# ${CC} -o $@ monitor.o ${LIBS}
- X
- X
- Xsnmpgetnext.o: $(SNMPH) $(SRC)/snmpgetnext.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmpgetnext.c
- X
- Xsnmpgetnext: snmpgetnext.o ${LIBS}
- X ${CC} -o $@ snmpgetnext.o ${LIBS}
- X
- X
- X#collect: collect.o ${LIBS}
- X# ${CC} -o $@ collect.o ${LIBS}
- X
- X
- Xsnmpwalk.o: $(SNMPH) $(SRC)/snmpwalk.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmpwalk.c
- X
- Xsnmpwalk: snmpwalk.o ${LIBS}
- X ${CC} -o $@ snmpwalk.o ${LIBS}
- X
- X
- Xsnmpstatus.o: $(SNMPH) $(SRC)/snmpstatus.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmpstatus.c
- X
- Xsnmpstatus: snmpstatus.o ${LIBS}
- X ${CC} -o $@ snmpstatus.o ${LIBS}
- X
- X
- Xsnmpd.o: $(SNMPH) $(SRC)/snmpd.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmpd.c
- X
- Xkernel.o: $(SNMPH) $(SRC)/kernel.c
- X ${CC} $(CFLAGS) -c $(SRC)/kernel.c
- X
- Xsnmpagnt.o: $(SNMPH) $(SRC)/snmpagnt.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmpagnt.c
- X
- Xsnmp_vars.o: $(SNMPH) $(SRC)/snmp_vars.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmp_vars.c
- X
- Xsnmp_var_route.o: $(SNMPH) $(SRC)/snmp_var_route.c
- X ${CC} $(CFLAGS) -c $(SRC)/snmp_var_route.c
- X
- Xsnmpd: snmpd.o kernel.o snmpagnt.o snmp_vars.o snmp_var_route.o ${LIBS}
- X ${CC} -o $@ snmpd.o kernel.o snmpagnt.o snmp_vars.o \
- X snmp_var_route.o ${LIBS} -lmld
- X
- X
- Xclean:
- X rm -f *.o ${TARG}
- X
- Xinstall:
- X cp ${TARG} ../bin
- X
- X
- END_OF_FILE
- if test 2730 -ne `wc -c <'netramet/sg/apps/Makefile'`; then
- echo shar: \"'netramet/sg/apps/Makefile'\" unpacked with wrong size!
- fi
- # end of 'netramet/sg/apps/Makefile'
- fi
- if test -f 'netramet/src/apps/snmpget.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/src/apps/snmpget.c'\"
- else
- echo shar: Extracting \"'netramet/src/apps/snmpget.c'\" \(4151 characters\)
- sed "s/^X//" >'netramet/src/apps/snmpget.c' <<'END_OF_FILE'
- X/*
- X * snmpget.c - send snmp GET requests to a network entity.
- X *
- X */
- X/***********************************************************
- X Copyright 1988, 1989 by Carnegie Mellon University
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute this software and its
- Xdocumentation for any purpose and without fee is hereby granted,
- Xprovided that the above copyright notice appear in all copies and that
- Xboth that copyright notice and this permission notice appear in
- Xsupporting documentation, and that the name of CMU not be
- Xused in advertising or publicity pertaining to distribution of the
- Xsoftware without specific, written prior permission.
- X
- XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- XSOFTWARE.
- X******************************************************************/
- X#include <sys/types.h>
- X#include <netinet/in.h>
- X#include <stdio.h>
- X
- X#include "ausnmp.h"
- X#include "snmp.h"
- X#include "snmpimpl.h"
- X#include "asn1.h"
- X#include "snmpapi.h"
- X#include "snmpclnt.h"
- X
- Xextern int errno;
- Xint snmp_dump_packet = 0;
- X
- Xmain(argc, argv)
- X int argc;
- X char *argv[];
- X{
- X struct snmp_session session, *ss;
- X struct snmp_pdu *pdu, *response;
- X struct variable_list *vars;
- X int arg;
- X char *gateway = NULL;
- X char *community = NULL;
- X int count, current_name = 0;
- X char *names[128];
- X oid name[MAX_NAME_LEN];
- X int name_length;
- X int status;
- X
- X init_mib();
- X /*
- X * usage: snmpget gateway-name community-name
- X */
- X for(arg = 1; arg < argc; arg++){
- X if (argv[arg][0] == '-'){
- X switch(argv[arg][1]){
- X case 'd':
- X snmp_dump_packet++;
- X break;
- X default:
- X printf("invalid option: -%c\n", argv[arg][1]);
- X break;
- X }
- X continue;
- X }
- X if (gateway == NULL){
- X gateway = argv[arg];
- X } else if (community == NULL){
- X community = argv[arg];
- X } else {
- X names[current_name++] = argv[arg];
- X }
- X }
- X
- X if (!(gateway && community && current_name > 0)){
- X printf("usage: snmpget gateway-name community-name object-identifier [object-identifier ...]\n");
- X exit(1);
- X }
- X
- X bzero((char *)&session, sizeof(struct snmp_session));
- X session.peername = gateway;
- X session.community = (u_char *)community;
- X session.community_len = strlen((char *)community);
- X session.retries = SNMP_DEFAULT_RETRIES;
- X session.timeout = SNMP_DEFAULT_TIMEOUT;
- X session.authenticator = NULL;
- X snmp_synch_setup(&session);
- X ss = snmp_open(&session);
- X if (ss == NULL){
- X printf("Couldn't open snmp\n");
- X exit(-1);
- X }
- X
- X pdu = snmp_pdu_create(GET_REQ_MSG);
- X
- X for(count = 0; count < current_name; count++){
- X name_length = MAX_NAME_LEN;
- X if (!read_objid(names[count], name, &name_length)){
- X printf("Invalid object identifier: %s\n", names[count]);
- X }
- X
- X snmp_add_null_var(pdu, name, name_length);
- X }
- X
- Xretry:
- X status = snmp_synch_response(ss, pdu, &response);
- X if (status == STAT_SUCCESS){
- X if (response->errstat == SNMP_ERR_NOERROR){
- X for(vars = response->variables; vars; vars = vars->next_variable)
- X print_variable(vars->name, vars->name_length, vars);
- X } else {
- X printf("Error in packet.\nReason: %s\n", snmp_errstring(response->errstat));
- X if (response->errstat == SNMP_ERR_NOSUCHNAME){
- X printf("This name doesn't exist: ");
- X for(count = 1, vars = response->variables; vars && count != response->errindex;
- X vars = vars->next_variable, count++)
- X ;
- X if (vars)
- X print_objid(vars->name, vars->name_length);
- X printf("\n");
- X }
- X if ((pdu = snmp_fix_pdu(response, GET_REQ_MSG)) != NULL)
- X goto retry;
- X }
- X
- X } else if (status == STAT_TIMEOUT){
- X printf("No Response from %s\n", gateway);
- X } else { /* status == STAT_ERROR */
- X printf("An error occurred, Quitting\n");
- X }
- X
- X if (response)
- X snmp_free_pdu(response);
- X snmp_close(ss);
- X}
- X
- END_OF_FILE
- if test 4151 -ne `wc -c <'netramet/src/apps/snmpget.c'`; then
- echo shar: \"'netramet/src/apps/snmpget.c'\" unpacked with wrong size!
- fi
- # end of 'netramet/src/apps/snmpget.c'
- fi
- if test -f 'netramet/src/apps/snmpgetnext.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/src/apps/snmpgetnext.c'\"
- else
- echo shar: Extracting \"'netramet/src/apps/snmpgetnext.c'\" \(4233 characters\)
- sed "s/^X//" >'netramet/src/apps/snmpgetnext.c' <<'END_OF_FILE'
- X/*
- X * snmpgetnext.c - send snmp GETNEXT requests to a network entity.
- X *
- X */
- X/***********************************************************
- X Copyright 1988, 1989 by Carnegie Mellon University
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute this software and its
- Xdocumentation for any purpose and without fee is hereby granted,
- Xprovided that the above copyright notice appear in all copies and that
- Xboth that copyright notice and this permission notice appear in
- Xsupporting documentation, and that the name of CMU not be
- Xused in advertising or publicity pertaining to distribution of the
- Xsoftware without specific, written prior permission.
- X
- XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- XSOFTWARE.
- X******************************************************************/
- X#include <sys/types.h>
- X#include <netinet/in.h>
- X#include <stdio.h>
- X
- X#include "ausnmp.h"
- X#include "snmp.h"
- X#include "snmpimpl.h"
- X#include "asn1.h"
- X#include "snmpapi.h"
- X#include "snmpclnt.h"
- X
- Xextern int errno;
- Xint snmp_dump_packet = 0;
- X
- Xmain(argc, argv)
- X int argc;
- X char *argv[];
- X{
- X struct snmp_session session, *ss;
- X struct snmp_pdu *pdu, *response;
- X struct variable_list *vars;
- X int arg;
- X char *gateway = NULL;
- X char *community = NULL;
- X int count, current_name = 0;
- X char *names[128];
- X oid name[MAX_NAME_LEN];
- X int name_length;
- X int status;
- X
- X init_mib();
- X /*
- X * usage: snmpgetnext gateway-name community-name object-id-list
- X */
- X for(arg = 1; arg < argc; arg++){
- X if (argv[arg][0] == '-'){
- X switch(argv[arg][1]){
- X case 'd':
- X snmp_dump_packet++;
- X break;
- X default:
- X printf("invalid option: -%c\n", argv[arg][1]);
- X break;
- X }
- X continue;
- X }
- X if (gateway == NULL){
- X gateway = argv[arg];
- X } else if (community == NULL){
- X community = argv[arg];
- X } else {
- X names[current_name++] = argv[arg];
- X }
- X }
- X
- X if (!(gateway && community && current_name > 0)){
- X printf("usage: snmpgetnext gateway-name community-name object-identifier [object-identifier ...]\n");
- X exit(1);
- X }
- X
- X bzero((char *)&session, sizeof(struct snmp_session));
- X session.peername = gateway;
- X session.community = (u_char *)community;
- X session.community_len = strlen((char *)community);
- X session.retries = SNMP_DEFAULT_RETRIES;
- X session.timeout = SNMP_DEFAULT_TIMEOUT;
- X session.authenticator = NULL;
- X snmp_synch_setup(&session);
- X ss = snmp_open(&session);
- X if (ss == NULL){
- X printf("Couldn't open snmp\n");
- X exit(-1);
- X }
- X
- X pdu = snmp_pdu_create(GETNEXT_REQ_MSG);
- X
- X for(count = 0; count < current_name; count++){
- X name_length = MAX_NAME_LEN;
- X if (!read_objid(names[count], name, &name_length)){
- X printf("Invalid object identifier: %s\n", names[count]);
- X }
- X
- X snmp_add_null_var(pdu, name, name_length);
- X }
- X
- X status = snmp_synch_response(ss, pdu, &response);
- X if (status == STAT_SUCCESS){
- X if (response->errstat == SNMP_ERR_NOERROR){
- X for(vars = response->variables; vars; vars = vars->next_variable)
- X print_variable(vars->name, vars->name_length, vars);
- X } else {
- X if (response->errstat == SNMP_ERR_NOSUCHNAME){
- X printf("You have reached the end of the MIB.\n");
- X } else {
- X printf("Error in packet.\nReason: %s\n", snmp_errstring(response->errstat));
- X if (response->errstat == SNMP_ERR_NOSUCHNAME){
- X printf("This name doesn't exist: ");
- X for(count = 1, vars = response->variables; vars && count != response->errindex;
- X vars = vars->next_variable, count++)
- X ;
- X if (vars)
- X print_objid(vars->name, vars->name_length);
- X printf("\n");
- X }
- X }
- X }
- X
- X } else if (status == STAT_TIMEOUT){
- X printf("No Response from %s\n", gateway);
- X } else { /* status == STAT_ERROR */
- X printf("An error occurred, Quitting\n");
- X }
- X
- X if (response)
- X snmp_free_pdu(response);
- X snmp_close(ss);
- X}
- X
- END_OF_FILE
- if test 4233 -ne `wc -c <'netramet/src/apps/snmpgetnext.c'`; then
- echo shar: \"'netramet/src/apps/snmpgetnext.c'\" unpacked with wrong size!
- fi
- # end of 'netramet/src/apps/snmpgetnext.c'
- fi
- if test -f 'netramet/src/apps/snmptrapd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/src/apps/snmptrapd.c'\"
- else
- echo shar: Extracting \"'netramet/src/apps/snmptrapd.c'\" \(5934 characters\)
- sed "s/^X//" >'netramet/src/apps/snmptrapd.c' <<'END_OF_FILE'
- X/*
- X * snmptrapd.c - receive and log snmp traps
- X *
- X */
- X/***********************************************************
- X Copyright 1989 by Carnegie Mellon University
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute this software and its
- Xdocumentation for any purpose and without fee is hereby granted,
- Xprovided that the above copyright notice appear in all copies and that
- Xboth that copyright notice and this permission notice appear in
- Xsupporting documentation, and that the name of CMU not be
- Xused in advertising or publicity pertaining to distribution of the
- Xsoftware without specific, written prior permission.
- X
- XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- XSOFTWARE.
- X******************************************************************/
- X#include <sys/types.h>
- X#include <netinet/in.h>
- X#include <stdio.h>
- X#include <sys/time.h>
- X#include <errno.h>
- X#include <syslog.h>
- X
- X#include "ausnmp.h"
- X#include "snmp.h"
- X#include "snmpimpl.h"
- X#include "asn1.h"
- X#include "snmpapi.h"
- X#include "snmpclnt.h"
- X
- X#ifndef BSD4_3
- X
- Xtypedef long fd_mask;
- X#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
- X
- X#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
- X#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
- X#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
- X#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
- X#endif
- X
- Xextern int errno;
- Xint snmp_dump_packet = 0;
- Xint Print = 0;
- X
- Xchar *
- Xtrap_description(trap)
- X int trap;
- X{
- X switch(trap){
- X case SNMP_TRAP_COLDSTART:
- X return "Cold Start";
- X case SNMP_TRAP_WARMSTART:
- X return "Warm Start";
- X case SNMP_TRAP_LINKDOWN:
- X return "Link Down";
- X case SNMP_TRAP_LINKUP:
- X return "Link Up";
- X case SNMP_TRAP_AUTHFAIL:
- X return "Authentication Failure";
- X case SNMP_TRAP_EGPNEIGHBORLOSS:
- X return "EGP Neighbor Loss";
- X case SNMP_TRAP_ENTERPRISESPECIFIC:
- X return "Enterprise Specific";
- X default:
- X return "Unknown Type";
- X }
- X}
- X
- Xchar *
- Xuptime_string(timeticks, buf)
- X register u_long timeticks;
- X char *buf;
- X{
- X int seconds, minutes, hours, days;
- X
- X timeticks /= 100;
- X days = timeticks / (60 * 60 * 24);
- X timeticks %= (60 * 60 * 24);
- X
- X hours = timeticks / (60 * 60);
- X timeticks %= (60 * 60);
- X
- X minutes = timeticks / 60;
- X seconds = timeticks % 60;
- X
- X if (days == 0){
- X sprintf(buf, "%d:%02d:%02d", hours, minutes, seconds);
- X } else if (days == 1) {
- X sprintf(buf, "%d day, %d:%02d:%02d", days, hours, minutes, seconds);
- X } else {
- X sprintf(buf, "%d days, %d:%02d:%02d", days, hours, minutes, seconds);
- X }
- X return buf;
- X}
- X
- Xint snmp_input(op, session, reqid, pdu, magic)
- X int op;
- X struct snmp_session *session;
- X int reqid;
- X struct snmp_pdu *pdu;
- X void *magic;
- X{
- X struct variable_list *vars;
- X char buf[64];
- X
- X if (op == RECEIVED_MESSAGE && pdu->command == TRP_REQ_MSG){
- X if (Print){
- X printf("%s: %s Trap (%d) Uptime: %s\n", inet_ntoa(pdu->agent_addr.sin_addr),
- X trap_description(pdu->trap_type), pdu->specific_type, uptime_string(pdu->time, buf));
- X for(vars = pdu->variables; vars; vars = vars->next_variable)
- X print_variable(vars->name, vars->name_length, vars);
- X } else {
- X syslog(LOG_WARNING, "%s: %s Trap (%d) Uptime: %s\n", inet_ntoa(pdu->agent_addr.sin_addr),
- X trap_description(pdu->trap_type), pdu->specific_type, uptime_string(pdu->time, buf));
- X }
- X } else if (op == TIMED_OUT){
- X printf("Timeout: This shouldn't happen!\n");
- X }
- X}
- X
- X
- Xmain(argc, argv)
- X int argc;
- X char *argv[];
- X{
- X struct snmp_session session, *ss;
- X int arg;
- X int count, numfds, block;
- X fd_set fdset;
- X struct timeval timeout, *tvp;
- X
- X
- X init_syslog();
- X init_mib();
- X /*
- X * usage: snmptrapd [-p]
- X */
- X for(arg = 1; arg < argc; arg++){
- X if (argv[arg][0] == '-'){
- X switch(argv[arg][1]){
- X case 'd':
- X snmp_dump_packet++;
- X break;
- X case 'p':
- X Print++;
- X break;
- X default:
- X printf("invalid option: -%c\n", argv[arg][1]);
- X printf("Usage: snmptrapd [-p ]\n");
- X break;
- X }
- X continue;
- X }
- X }
- X
- X bzero((char *)&session, sizeof(struct snmp_session));
- X session.peername = NULL;
- X session.community = NULL;
- X session.community_len = 0;
- X session.retries = SNMP_DEFAULT_RETRIES;
- X session.timeout = SNMP_DEFAULT_TIMEOUT;
- X session.authenticator = NULL;
- X session.callback = snmp_input;
- X session.callback_magic = NULL;
- X session.local_port = SNMP_TRAP_PORT;
- X ss = snmp_open(&session);
- X if (ss == NULL){
- X printf("Couldn't open snmp\n");
- X exit(-1);
- X }
- X
- X while(1){
- X numfds = 0;
- X FD_ZERO(&fdset);
- X block = 1;
- X tvp = &timeout;
- X timerclear(tvp);
- X snmp_select_info(&numfds, &fdset, tvp, &block);
- X if (block == 1)
- X tvp = NULL; /* block without timeout */
- X count = select(numfds, &fdset, 0, 0, tvp);
- X if (count > 0){
- X snmp_read(&fdset);
- X } else switch(count){
- X case 0:
- X snmp_timeout();
- X break;
- X case -1:
- X if (errno == EINTR){
- X continue;
- X } else {
- X perror("select");
- X }
- X return -1;
- X default:
- X printf("select returned %d\n", count);
- X return -1;
- X }
- X }
- X}
- X
- Xinit_syslog(){
- X/*
- X * These definitions handle 4.2 systems without additional syslog facilities.
- X */
- X#ifndef LOG_CONS
- X#define LOG_CONS 0 /* Don't bother if not defined... */
- X#endif
- X#ifndef LOG_LOCAL0
- X#define LOG_LOCAL0 0
- X#endif
- X /*
- X * All messages will be logged to the local0 facility and will be sent to
- X * the console if syslog doesn't work.
- X */
- X openlog("snmptrapd", LOG_CONS, LOG_LOCAL0);
- X syslog(LOG_INFO, "Starting snmptrapd");
- X}
- END_OF_FILE
- if test 5934 -ne `wc -c <'netramet/src/apps/snmptrapd.c'`; then
- echo shar: \"'netramet/src/apps/snmptrapd.c'\" unpacked with wrong size!
- fi
- # end of 'netramet/src/apps/snmptrapd.c'
- fi
- if test -f 'netramet/src/meter/chart.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/src/meter/chart.c'\"
- else
- echo shar: Extracting \"'netramet/src/meter/chart.c'\" \(4246 characters\)
- sed "s/^X//" >'netramet/src/meter/chart.c' <<'END_OF_FILE'
- X/* 0920, Mon 21 Jun 93
- X
- X CHART.C: Strip chart in screen window for AU monitor
- X
- X Copyright (C) 1992,1993 by Nevil Brownlee,
- X Computer Centre, University of Auckland */
- X
- X#include "pktsnap.h"
- X
- X#include <mem.h>
- X
- X#include <bios.h>
- X#include <dos.h>
- X
- X#ifdef XXYYZZ
- Xint kbstatus() /* See if there's a kb character */
- X{
- X#ifdef INLINE
- X _AH = 0x01; geninterrupt(0x16);
- X asm mov ax,0
- X asm jz kbsret
- X asm mov al,1
- Xkbsret:
- X return _AX;
- X#else
- X return bioskey(1);
- X#endif
- X#ifdef doitourselves
- X union REGS call_regs, ret_regs;
- X call_regs.h.ah = 0x01; /* Test kb: Zero flag on => no char */
- X int86(0x16,&call_regs,&ret_regs);
- X /* Ecosoft C88 int86 returns flags as result instead of in REGS */
- X /* Turbo C int86 puts flags in REGS and returns AX as result ! */
- X return !(ret_regs.x.flags & 0x40); /* Zero flag */
- X#endif
- X }
- X
- Xunsigned char kbcode() /* Read char from the keyboard */
- X{ _AH = 0x00; geninterrupt(0x16); return _AL; } /* AH = scan code */
- X#endif
- X
- X
- X#define UP 0x06 /* BIOS scroll parameters */
- X#define DOWN 0x07
- X#define CHATR 0x07 /* Screen attribute for chart */
- X
- Xvoid bios_scroll(way, tx,ty, bx,by, nrows, attr)
- Xint way, tx,ty, bx,by, nrows, attr;
- X{
- X _AH = (way == UP) ? UP : DOWN; /* Scroll direction */
- X _AL = nrows; /* Rows to scroll */
- X _BH = attr; /* Screen attribute for blank fill */
- X _CH = ty; _CL = tx; /* Top left */
- X _DH = by; _DL = bx; /* Bottom right */
- X geninterrupt(0x10);
- X }
- X
- Xvoid scpos(x,y) /* Set Cursor Position */
- Xunsigned char x,y;
- X{
- X _AH = 2; _BH = 0; _DH = y; _DL = x;
- X geninterrupt(0x10);
- X }
- X
- Xvoid sputc(c) /* Write char to screen, don't move cursor */
- Xunsigned char c;
- X{
- X _BH = 0; _CX = 1; _AH = 10; _AL = c;
- X geninterrupt(0x10);
- X }
- X
- Xvoid swrite(c) /* Write char to screen */
- Xunsigned char c;
- X{
- X _AH = 14; _AL = c;
- X geninterrupt(0x10);
- X }
- X
- X#define MTICKS 1092L /* 18.20000 per second */
- X#define HTICKS 65543L /* 18.20639 */
- X#define DTICKS 1573040L /* 18.20648 */
- X
- X#define DCSEC 8640000L /* centiseconds per day */
- X
- Xlong biosticks()
- X{
- X long tt = biostime(0,0L); /* Clock ticks */
- X if (tt < l_tod) ++midnight_crossings;
- X return l_tod = tt;
- X }
- X
- Xvoid start_uptime_clock(void)
- X{
- X midnight_crossings = 0;
- X boot_time = biostime(0,0L) - 1;
- X /* About 5 cs early, to allow first flow create times to be > 1 cs */
- X }
- X
- Xunsigned long uptime() /* Since startup, in centiseconds */
- X{
- X return ((biosticks()-boot_time)*549L+275L)/100L /* cs per clock tick */
- X + (long)midnight_crossings*DCSEC;
- X }
- X
- Xvoid set_tod()
- X{
- X long tt = biosticks();
- X tod_h = tt/HTICKS; tt -= (long)tod_h*HTICKS;
- X tod_m = tt/MTICKS; tt -= (long)tod_m*MTICKS;
- X tod_s = (tt*10+91l)/182l;
- X if (tod_s == 60) {
- X ++tod_m; tod_s = 0;
- X }
- X if (tod_m == 60) {
- X ++tod_h; tod_m = 0;
- X }
- X if (tod_h == 24) tod_h = 0;
- X }
- X
- Xvoid sclear()
- X{
- X bios_scroll(UP, 0,0, 79,24, 0, CHATR); /* Blank screen */
- X }
- X
- Xvoid w_clear(tx,ty, bx,by)
- Xint tx,ty, bx,by;
- X{
- X bios_scroll(UP, tx,ty, bx,by, 0, CHATR); /* Blank window */
- X }
- X
- Xvoid w_roll(tx,ty, bx,by, n)
- Xint tx,ty, bx,by, n;
- X{
- X bios_scroll(UP, tx,ty, bx,by, n, CHATR); /* Roll window up n lines */
- X scpos(tx,by); /* Leave cursor at start of bottom window line */
- X }
- X
- X#define DOT 0xFA /* Small dot in centre of char rectangle */
- X
- Xvoid chart(tx,ty, bx,by, x1,x2,x3)
- Xint tx,ty, bx,by, x1,x2,x3;
- X{
- X int w,k;
- X#define TIMEWIDTH 8
- X char buf[TIMEWIDTH+102], *bar;
- X bios_scroll(UP, tx,ty, bx,by, 1, CHATR);
- X w = bx+1-tx - TIMEWIDTH; /* Plot chars from bar[0] to bar[w-1], 0-org */
- X bar = &buf[TIMEWIDTH];
- X if (tod_s%30 == 0) {
- X sprintf(buf, "%02d%02d:%02d +", tod_h,tod_m,tod_s);
- X memset(bar+1,DOT,w-1);
- X }
- X else {
- X memset(buf, ' ',TIMEWIDTH+w);
- X bar[0] = '|';
- X }
- X for (k = 10; k < w; k += 10) bar[k] = ':';
- X if (x1 >= w) x1 = w;
- X if (x2 >= w) x2 = w;
- X if (x3 >= w) x3 = w;
- X for (k = x1+1; k < x3; ++k) bar[k] = '-';
- X for (k = 10; k < w; k += 10)
- X if (bar[k] == '-') bar[k] = '+';
- X bar[x1] = '<';
- X bar[x3] = '>';
- X bar[x2] = '*';
- X k = bar[w-1]; bar[w-1] = '\0';
- X scpos(tx,by);
- X for (bar = buf; *bar; ) swrite(*bar++);
- X sputc(k); /* Leave cursor at (bx,by) */
- X }
- END_OF_FILE
- if test 4246 -ne `wc -c <'netramet/src/meter/chart.c'`; then
- echo shar: \"'netramet/src/meter/chart.c'\" unpacked with wrong size!
- fi
- # end of 'netramet/src/meter/chart.c'
- fi
- if test -f 'netramet/src/meter/include/pktsnap.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/src/meter/include/pktsnap.h'\"
- else
- echo shar: Extracting \"'netramet/src/meter/include/pktsnap.h'\" \(2839 characters\)
- sed "s/^X//" >'netramet/src/meter/include/pktsnap.h' <<'END_OF_FILE'
- X/* 1400, Wed 6 Oct 93
- X
- X PKTSNAP.H: Declarations for AU packet monitoring
- X extensions to Waterloo TCP/IP
- X
- X Copyright (C) 1992,1993 by Nevil Brownlee,
- X Computer Centre, University of Auckland */
- X
- X#ifdef PKTSNAP
- X#define EXTERN
- X#else
- X#define EXTERN extern
- X#endif
- X
- X#ifdef AU_MSDOS
- X/* Declared in wattcp\src\pcpkt.c .. */
- X
- Xvoid pkt_rcv_call2(unsigned int handle, unsigned int len,
- X unsigned char far *buff);
- X
- Xextern char au_monitor; /* 1 to enable monitoring */
- X
- Xextern unsigned char eth_addr[6];
- Xextern unsigned long npackets,nbytes;
- X#else
- XEXTERN unsigned long npackets; /* Declared in meter_ux.c */
- X#endif
- X
- X/* Declared in wattcp\acct\meter_pc.c .. */
- X
- XEXTERN unsigned int bkgi; /* Seconds before next run of backgound process */
- X
- XEXTERN unsigned int /* Statistics variables */
- X max_pkt_rate, pkt_backlog,max_pkt_backlog,
- X dummypackets, mdpacketrate;
- XEXTERN unsigned long
- X stats_time, t_backlog,
- X spackets,sbytes,
- X kilodummypackets, dummypacketrate, mindummyrate,
- X badpackets,nobufpackets;
- XEXTERN unsigned char
- X clear_pkt_stats; /* 1 to clear stats variables */
- X
- X/* Declared in wattcp\elib\q*.asm .. */
- X
- X#ifdef AU_MSDOS
- Xvoid qmove(unsigned char far *s, unsigned char far *d, unsigned int n);
- Xint qcmp(unsigned char far *s, unsigned char far *d, unsigned int n);
- X
- X#else
- X
- X#define qmove(s,d,n) memcpy((char *)d,(char *)s,n)
- X#define qcmp(s,d,n) memcmp((char *)s,(char *)d,n)
- X
- X#define w_roll(x1,y1, x2,y2, up)
- X#define scpos(x,y)
- X#define w_clear(x1,y1, x2,y2)
- X#endif
- X
- X/* Monitor variables .. */
- X
- XEXTERN long lostpackets;
- X
- X#define SNAPFROM 0 /* Dest Ethernet address */
- X#define SNAPTO 43 /* IPX source socket */
- X#define SNAPLEN (SNAPTO - SNAPFROM + 1) /* Save bytes FROM to TO in pkt */
- X
- X#define MAXPKTLEN 1526
- X
- X#ifdef AU_MSDOS
- X/* pkt data structure */
- Xstruct pkt {
- X unsigned int p_len;
- X unsigned char p_type,
- X p_data[SNAPLEN];
- X };
- X
- XEXTERN struct pkt far *pkts;
- X
- XEXTERN int
- X maxpkt, /* Must be a power of 2 */
- X pktmask, /* maxpkt-1 */
- X maxpkthi, /* maxpkt/256 */
- X prcv, /* Index of next pkt to be received (i.e. next empty pkt) */
- X pproc; /* Index of next pkt to be processed (i.e. next full pkt) */
- X#endif
- X
- XEXTERN long l_tod; /* Time of day */
- XEXTERN char tod_h,tod_m,tod_s,
- X s_tod_h,s_tod_m,s_tod_s; /* Time when counters last saved */
- X
- XEXTERN int midnight_crossings;
- XEXTERN long boot_time;
- X
- XEXTERN long elapsed_sec; /* Seconds since counters last saved */
- X
- Xunsigned long uptime(void); /* Since startup, in centiseconds */
- X
- X#ifdef AU_MSDOS
- Xvoid chart(int tx, int ty, /* Declared in chart.c */
- X int bx, int by,
- X int x1, int x2, int x3);
- X
- Xlong biosticks(void); /* PC clock ticks */
- X
- X/* 12 bytes interframe space + 8 bytes preamble + 4 byte FCS */
- X#define util_pc(p,b) (((24l*p + b)/1250l + 5l)/10l) /* % utilisation */
- X#endif
- X
- X#ifndef NULL
- X#define NULL 0
- X#endif
- X
- X
- END_OF_FILE
- if test 2839 -ne `wc -c <'netramet/src/meter/include/pktsnap.h'`; then
- echo shar: \"'netramet/src/meter/include/pktsnap.h'\" unpacked with wrong size!
- fi
- # end of 'netramet/src/meter/include/pktsnap.h'
- fi
- if test -f 'netramet/src/snmplib/include/asn1.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/src/snmplib/include/asn1.h'\"
- else
- echo shar: Extracting \"'netramet/src/snmplib/include/asn1.h'\" \(3408 characters\)
- sed "s/^X//" >'netramet/src/snmplib/include/asn1.h' <<'END_OF_FILE'
- X/*
- X * Definitions for Abstract Syntax Notation One, ASN.1
- X * As defined in ISO/IS 8824 and ISO/IS 8825
- X *
- X *
- X */
- X/***********************************************************
- X Copyright 1988, 1989 by Carnegie Mellon University
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute this software and its
- Xdocumentation for any purpose and without fee is hereby granted,
- Xprovided that the above copyright notice appear in all copies and that
- Xboth that copyright notice and this permission notice appear in
- Xsupporting documentation, and that the name of CMU not be
- Xused in advertising or publicity pertaining to distribution of the
- Xsoftware without specific, written prior permission.
- X
- XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- XSOFTWARE.
- X******************************************************************/
- X
- X#ifdef EIGHTBIT_SUBIDS
- Xtypedef u_char oid;
- X#define MAX_SUBID 0xFF
- X#elif SIXTEENBIT_SUBIDS
- Xtypedef u_short oid;
- X#define MAX_SUBID 0xFFFF
- X#else
- Xtypedef u_long oid;
- X#define MAX_SUBID 0xFFFFFFFF
- X#endif
- X
- X#define MAX_OID_LEN 64 /* max subid's in an oid */
- X
- X#define ASN_BOOLEAN (0x01)
- X#define ASN_INTEGER (0x02)
- X#define ASN_BIT_STR (0x03)
- X#define ASN_OCTET_STR (0x04)
- X#define ASN_NULL (0x05)
- X#define ASN_OBJECT_ID (0x06)
- X#define ASN_SEQUENCE (0x10)
- X#define ASN_SET (0x11)
- X
- X#define ASN_UNIVERSAL (0x00)
- X#define ASN_APPLICATION (0x40)
- X#define ASN_CONTEXT (0x80)
- X#define ASN_PRIVATE (0xC0)
- X
- X#define ASN_PRIMITIVE (0x00)
- X#define ASN_CONSTRUCTOR (0x20)
- X
- X#define ASN_LONG_LEN (0x80)
- X#define ASN_EXTENSION_ID (0x1F)
- X#define ASN_BIT8 (0x80)
- X
- X#define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR)
- X#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
- X
- Xu_char *asn_parse_int(u_char *data, int *datalength, u_char *type,
- X long *intp, int intsize);
- Xu_char *asn_build_int(u_char *, int *, u_char,
- X long far *, int);
- X/* u_char *asn_build_int(u_char *data, int *datalength, u_char type,
- X long far *intp, int intsize); */
- Xu_char *asn_parse_string(u_char *, int *, u_char *,
- X u_char *, int *);
- Xu_char *asn_build_string(u_char *, int *, u_char,
- X u_char far *, int);
- X/* u_char *asn_build_string(u_char *data, int *datalength, u_char type,
- X u_char far *string, int strlength); */
- Xu_char *asn_parse_header(u_char *data, int *datalength, u_char *type);
- Xu_char *asn_build_header(u_char *data, int *datalength, u_char type,
- X int length);
- Xu_char *asn_parse_length(u_char *data, u_long *length);
- Xu_char *asn_build_length(u_char *data, int *datalength,
- X int length);
- Xu_char *asn_parse_objid(u_char *, int *, u_char *,
- X oid *, int *);
- X/* u_char *asn_parse_objid(u_char *data, int *datalength, u_char *type,
- X oid *objid, int *objidlength); */
- Xu_char *asn_build_objid(u_char *data, int *datalength, u_char type,
- X oid far *objid, int objidlength);
- Xu_char *asn_parse_null(u_char *data, int *datalength, u_char *type);
- Xu_char *asn_build_null(u_char *data, int *datalength, u_char type);
- END_OF_FILE
- if test 3408 -ne `wc -c <'netramet/src/snmplib/include/asn1.h'`; then
- echo shar: \"'netramet/src/snmplib/include/asn1.h'\" unpacked with wrong size!
- fi
- # end of 'netramet/src/snmplib/include/asn1.h'
- fi
- if test -f 'netramet/src/snmplib/include/snmpimpl.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/src/snmplib/include/snmpimpl.h'\"
- else
- echo shar: Extracting \"'netramet/src/snmplib/include/snmpimpl.h'\" \(2616 characters\)
- sed "s/^X//" >'netramet/src/snmplib/include/snmpimpl.h' <<'END_OF_FILE'
- X/*
- X * Definitions for SNMP (RFC 1067) implementation.
- X *
- X *
- X */
- X/***********************************************************
- X Copyright 1988, 1989 by Carnegie Mellon University
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute this software and its
- Xdocumentation for any purpose and without fee is hereby granted,
- Xprovided that the above copyright notice appear in all copies and that
- Xboth that copyright notice and this permission notice appear in
- Xsupporting documentation, and that the name of CMU not be
- Xused in advertising or publicity pertaining to distribution of the
- Xsoftware without specific, written prior permission.
- X
- XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- XSOFTWARE.
- X******************************************************************/
- X
- X#ifdef NOT_ANSI_C
- X#if (defined vax) || (defined (mips))
- X/*
- X * This is a fairly bogus thing to do, but there seems to be no better way for
- X * compilers that don't understand void pointers.
- X */
- X#define void char
- X#endif
- X#endif
- X
- X/*
- X * Error codes:
- X */
- X/*
- X * These must not clash with SNMP error codes (all positive).
- X */
- X#define PARSE_ERROR -1
- X#define BUILD_ERROR -2
- X
- X#define SID_MAX_LEN 64
- X#define MAX_NAME_LEN 64 /* number of subid's in a objid */
- X
- X#ifndef NULL
- X#define NULL 0
- X#endif
- X
- X#ifndef TRUE
- X#define TRUE 1
- X#endif
- X#ifndef FALSE
- X#define FALSE 0
- X#endif
- X
- X#define READ 1
- X#define WRITE 0
- X
- X#define RONLY 0xAAAA /* read access for everyone */
- X#define RWRITE 0xAABA /* add write access for community private */
- X#define NOACCESS 0x0000 /* no access for anybody */
- X
- X#define INTEGER ASN_INTEGER
- X#define STRING ASN_OCTET_STR
- X#define OBJID ASN_OBJECT_ID
- X#define NULLOBJ ASN_NULL
- X
- X/* defined types (from the SMI, RFC 1065) */
- X#define IPADDRESS (ASN_APPLICATION | 0)
- X#define COUNTER (ASN_APPLICATION | 1)
- X#define GAUGE (ASN_APPLICATION | 2)
- X#define TIMETICKS (ASN_APPLICATION | 3)
- X#define OPAQUE (ASN_APPLICATION | 4)
- X
- X#ifdef DEBUG
- X#define ERROR(string) printf("%s(%d): %s",__FILE__, __LINE__, string);
- X#else
- X#define ERROR(string)
- X#endif
- X
- X/* from snmp.c*/
- Xextern u_char sid[]; /* size SID_MAX_LEN */
- X
- Xu_char *snmp_parse_var_op();
- Xu_char *snmp_build_var_op();
- X
- Xu_char *snmp_auth_parse();
- Xu_char *snmp_auth_build();
- END_OF_FILE
- if test 2616 -ne `wc -c <'netramet/src/snmplib/include/snmpimpl.h'`; then
- echo shar: \"'netramet/src/snmplib/include/snmpimpl.h'\" unpacked with wrong size!
- fi
- # end of 'netramet/src/snmplib/include/snmpimpl.h'
- fi
- if test -f 'netramet/src/snmplib/snmpauth.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netramet/src/snmplib/snmpauth.c'\"
- else
- echo shar: Extracting \"'netramet/src/snmplib/snmpauth.c'\" \(3057 characters\)
- sed "s/^X//" >'netramet/src/snmplib/snmpauth.c' <<'END_OF_FILE'
- X/*
- X * snmp_auth.c -
- X * Authentication for SNMP (RFC 1067). This implements a null
- X * authentication layer.
- X *
- X *
- X */
- X/***********************************************************
- X Copyright 1988, 1989 by Carnegie Mellon University
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute this software and its
- Xdocumentation for any purpose and without fee is hereby granted,
- Xprovided that the above copyright notice appear in all copies and that
- Xboth that copyright notice and this permission notice appear in
- Xsupporting documentation, and that the name of CMU not be
- Xused in advertising or publicity pertaining to distribution of the
- Xsoftware without specific, written prior permission.
- X
- XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- XSOFTWARE.
- X******************************************************************/
- X
- X#include "ausnmp.h"
- X
- X#ifdef KINETICS
- X#include "gw.h"
- X#include "fp4/cmdmacro.h"
- X#endif
- X
- X#if (defined(unix) && !defined(KINETICS))
- X#include <sys/types.h>
- X#include <netinet/in.h>
- X#ifndef NULL
- X#define NULL 0
- X#endif
- X#endif
- X
- X#include "asn1.h"
- X#include "snmp.h"
- X#include "snmpimpl.h"
- X
- Xu_char *
- Xsnmp_auth_parse(data, length, sid, slen, version)
- X u_char *data;
- X int *length;
- X u_char *sid;
- X int *slen;
- X long *version;
- X{
- X u_char type;
- X
- X data = asn_parse_header(data, length, &type);
- X if (data == NULL){
- X ERROR("bad header");
- X return NULL;
- X }
- X if (type != (ASN_SEQUENCE | ASN_CONSTRUCTOR)){
- X ERROR("wrong auth header type");
- X return NULL;
- X }
- X data = asn_parse_int(data, length, &type, version, sizeof(*version));
- X if (data == NULL){
- X ERROR("bad parse of version");
- X return NULL;
- X }
- X data = asn_parse_string(data, length, &type, sid, slen);
- X if (data == NULL){
- X ERROR("bad parse of community");
- X return NULL;
- X }
- X sid[*slen] = '\0';
- X return (u_char *)data;
- X}
- X
- Xu_char *
- Xsnmp_auth_build(data, length, sid, slen, version, messagelen)
- X u_char *data;
- X int *length;
- X u_char *sid;
- X int *slen;
- X long *version;
- X int messagelen;
- X{
- X data = asn_build_header(data, length, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), messagelen + *slen + 5);
- X if (data == NULL){
- X ERROR("buildheader");
- X return NULL;
- X }
- X data = asn_build_int(data, length,
- X (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
- X (long *)version, sizeof(*version));
- X if (data == NULL){
- X ERROR("buildint");
- X return NULL;
- X }
- X data = asn_build_string(data, length,
- X (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
- X sid, *slen);
- X if (data == NULL){
- X ERROR("buildstring");
- X return NULL;
- X }
- X return (u_char *)data;
- X}
- END_OF_FILE
- if test 3057 -ne `wc -c <'netramet/src/snmplib/snmpauth.c'`; then
- echo shar: \"'netramet/src/snmplib/snmpauth.c'\" unpacked with wrong size!
- fi
- # end of 'netramet/src/snmplib/snmpauth.c'
- fi
- echo shar: End of archive 23 \(of 25\).
- cp /dev/null ark23isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 25 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-