home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / netramet / part23 < prev    next >
Encoding:
Text File  |  1993-11-08  |  64.3 KB  |  1,957 lines

  1. Newsgroups: comp.sources.misc
  2. From: nevil@ccu1.aukuni.ac.nz (J Nevil Brownlee)
  3. Subject: v40i111:  netramet - Network Traffic Accounting Meter, Part23/25
  4. Message-ID: <1993Nov9.020746.19212@sparky.sterling.com>
  5. X-Md4-Signature: 2b4fe2f33b6f7a1751f52b635144e912
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Tue, 9 Nov 1993 02:07:46 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: nevil@ccu1.aukuni.ac.nz (J Nevil Brownlee)
  12. Posting-number: Volume 40, Issue 111
  13. Archive-name: netramet/part23
  14. Environment: INET, UNIX, DOS
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  netramet/doc/snmp/README netramet/doc/snmp/snmpstatus.1
  21. #   netramet/doc/snmp/snmptest.1 netramet/doc/snmp/snmptrap.1
  22. #   netramet/doc/snmp/snmpwalk.1 netramet/doc/snmp/variables.5
  23. #   netramet/sg/apps/Makefile netramet/src/apps/snmpget.c
  24. #   netramet/src/apps/snmpgetnext.c netramet/src/apps/snmptrapd.c
  25. #   netramet/src/meter/chart.c netramet/src/meter/include/pktsnap.h
  26. #   netramet/src/snmplib/include/asn1.h
  27. #   netramet/src/snmplib/include/snmpimpl.h
  28. #   netramet/src/snmplib/snmpauth.c
  29. # Wrapped by kent@sparky on Tue Nov  2 18:17:14 1993
  30. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  31. echo If this archive is complete, you will see the following message:
  32. echo '          "shar: End of archive 23 (of 25)."'
  33. if test -f 'netramet/doc/snmp/README' -a "${1}" != "-c" ; then 
  34.   echo shar: Will not clobber existing file \"'netramet/doc/snmp/README'\"
  35. else
  36.   echo shar: Extracting \"'netramet/doc/snmp/README'\" \(4489 characters\)
  37.   sed "s/^X//" >'netramet/doc/snmp/README' <<'END_OF_FILE'
  38. X
  39. X  The files in this directory compromise the 1.0 release of the CMU SNMP
  40. Xdistribution.  This includes the SNMP/ASN.1 library, many client
  41. Xapplications, and supporting documentation.  The snmp agent for the Kinetics
  42. Xbox is included in this distribution, but the KIP code it links against is not
  43. Xyet distributable (this is not the released KIP code).  This will probably
  44. Xbe distributed at another time if there is sufficient demand.
  45. X
  46. XThis code was written with efficiency and portability in mind.  The
  47. Xapplications compile and run on the following systems: IBM PC/RT running ACIS
  48. XRelease 3, Sun3/60 running SUNOS 3.5, DEC microVax running Ultrix 2.2, and
  49. XDECStation 3100's runing Ultrix 3.0.  They are expected to run on any system
  50. Xwith a Berkeley socket interface.
  51. X
  52. XThe agent compiles into about 10 KB of 68000 code.  The machine independent
  53. Xportions of this agent also run on CMU's IBM PC/AT based router.
  54. X
  55. XThe applications are designed to be useful in the real world.  Snmpnetstat
  56. Xis a port of the Berkeley Unix netstat that gathers it's information using
  57. XSNMP.  (Many people will enjoy "snmpnetstat mygateway public -r").  Snmpstatus
  58. Xcollects several pieces of information and presents them in a useful format
  59. Xand is good for everyday status monitoring.  The rest of the tools are simpler,
  60. Xbut still interpret input and output symbolicly (they can be used without
  61. Xreferencing the RFC's!).
  62. X
  63. XFor instance, 
  64. Xsnmpnetstat mygateway public -r returns:
  65. XRouting tables
  66. XDestination      Gateway            Flags   Interface
  67. Xbbn-net-temp     psc-gw3.psc.edu    UG      Ethernet0
  68. Xarpanet          prpnet-gw.cc.cmu.e UG      Ethernet0
  69. Xxerox-net        psc-gw3.psc.edu    UG      Ethernet0
  70. Xhp-internet      psc-gw3.psc.edu    UG      Ethernet0
  71. X...
  72. X
  73. Xsnmpstatus returns:
  74. X[128.2.56.220]=>[Kinetics Fastpath2] Up: 1 day, 4:43:31
  75. XRecv/Trans packets - Interface: 262874/39867 | IP 47432/34587
  76. X
  77. XThe rest of the applications typically present a variable in a form similar
  78. Xto the following:
  79. XName: interfaces.ifTable.ifEntry.ifType.1
  80. XINTEGER: ethernet-csmacd(6)
  81. X
  82. XThe parsing and printing of symbolic object identifiers and the printing of
  83. Xtyped variables is driven by a database that describes the MIB.
  84. XThe MIB database is now retrieved from a text file in the ASN.1 format used in
  85. Xthe RFC1066 MIB.  This makes adding new (enterprise specific) mibs to the database
  86. Xvery simple.  I will solicit description files from other SNMP vendors and redistribute
  87. Xthem via anonymous FTP.  Initially, the mib.txt file contains a discription of the
  88. XRFC 1066 MIB and portions of the CMU enterprise specific MIB.  I had help in optimizing
  89. Xthe parser from Phil Lapsley of Berkeley (Thanks Phil!).
  90. X
  91. XFor further information, please consult the man pages.  There are man pages for
  92. Xeach of the applications, as well as for the Application Programming Interface (API).
  93. X
  94. XThe API has been redesigned to present a very convenient and useful asynchronous
  95. Xinterface to the SNMP transport.  In addition, snmp_client.c contains a toolkit
  96. Xof routines that simplify writing client applications.  In particular, there is
  97. Xa synchronous interface built on top of the asyncronous interface that makes
  98. Xwriting applications very easy.
  99. X
  100. XThis distribution is coprighted by CMU, but may be used and sold without
  101. Xpermission.  The snmpnetstat application is derived from the Berkeley 4.3 netstat,
  102. Xand is therefore also copyrighted by Berkeley.  Consult the copyright notices for
  103. Xfurther information.
  104. X
  105. XThe distribution is available by anonymous FTP from the host
  106. Xlancaster.andrew.cmu.edu (128.2.13.21) as the file pub/cmu-snmp1.0.tar.  I will
  107. Xmaintain a repository of mib description files in the directory pub/mibs.
  108. X
  109. XPlease direct questions, comments, and bug reports to sw0l+snmp@andrew.cmu.edu.
  110. XI have received very helpful feedback in the past that has been integrated into 
  111. Xthe current release.  This wil continue in the future.
  112. X
  113. XIf you pick up this package, please send me a note to the above address, so
  114. Xthat I may notify you of future enhancements/changes and additions to the
  115. Xset of applications (several are planned).  I will also redistribute applications
  116. Xusing the CMU SNMP library that were written elsewhere and placed in the public domain.
  117. XThere are already several such applications pending such a distribution.
  118. X
  119. XThere is a gateway at CMU running the agent.  Feel free to query it.  You
  120. Xcan access as netdev-kbox.cc.cmu.edu (128.2.56.220) with community name
  121. X"public".
  122. X
  123. X
  124. XSteve Waldbusser
  125. XNetwork Development
  126. XCarnegie-Mellon University
  127. END_OF_FILE
  128.   if test 4489 -ne `wc -c <'netramet/doc/snmp/README'`; then
  129.     echo shar: \"'netramet/doc/snmp/README'\" unpacked with wrong size!
  130.   fi
  131.   # end of 'netramet/doc/snmp/README'
  132. fi
  133. if test -f 'netramet/doc/snmp/snmpstatus.1' -a "${1}" != "-c" ; then 
  134.   echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmpstatus.1'\"
  135. else
  136.   echo shar: Extracting \"'netramet/doc/snmp/snmpstatus.1'\" \(3422 characters\)
  137.   sed "s/^X//" >'netramet/doc/snmp/snmpstatus.1' <<'END_OF_FILE'
  138. X.\* /***********************************************************
  139. X.\"     Copyright 1988, 1989 by Carnegie Mellon University
  140. X.\" 
  141. X.\"                       All Rights Reserved
  142. X.\" 
  143. X.\" Permission to use, copy, modify, and distribute this software and its 
  144. X.\" documentation for any purpose and without fee is hereby granted, 
  145. X.\" provided that the above copyright notice appear in all copies and that
  146. X.\" both that copyright notice and this permission notice appear in 
  147. X.\" supporting documentation, and that the name of CMU not be
  148. X.\" used in advertising or publicity pertaining to distribution of the
  149. X.\" software without specific, written prior permission.  
  150. X.\" 
  151. X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  152. X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  153. X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  154. X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  155. X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  156. X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  157. X.\" SOFTWARE.
  158. X.\" ******************************************************************/
  159. X.TH SNMPSTATUS 1 "17 September 1989"
  160. X.UC 4
  161. X.SH NAME
  162. Xsnmpstatus - Retrieves important information from a network entity.
  163. X.SH SYNOPSIS
  164. Xsnmpstatus host [community]
  165. X.SH DESCRIPTION
  166. XSnmpstatus is an SNMP application that retrieves several important
  167. Xstatistics from a network entity.
  168. X.PP
  169. XThe
  170. X.I host
  171. Xspecification may be either a host name or an internet address
  172. Xspecified in "dot notation"
  173. X.PP
  174. XThe
  175. X.I community
  176. Xspecifies the community name for the transaction with the remote system.
  177. XIf this argument is not given, the community name will default to
  178. X.I "public".
  179. X.PP
  180. XThe information returned is:
  181. X.PP
  182. XThe IP address of the entity.
  183. X.br
  184. XA textual description of the entity
  185. X.I (sysDescr.0)
  186. X.br
  187. XThe uptime of the entity
  188. X.I (sysUpTime.0)
  189. X.br
  190. XThe sum of received packets on all interfaces
  191. X.I (ifInUCastPkts.* + ifInNUCastPkts.*)
  192. X.br
  193. XThe sum of transmitted packets on all interfaces
  194. X.I (ifOutUCastPkts.* + ifOutNUCastPkts.*)
  195. X.br
  196. XThe number of IP input packets
  197. X.I (ipInReceives.0)
  198. X.br
  199. XThe number of IP output packets
  200. X.I (ipOutRequests.0)
  201. X.PP
  202. XFor example
  203. X.PP
  204. X.I snmpstatus netdev-kbox.cc.cmu.edu public
  205. X.PP
  206. Xwill produce output similar to the following:
  207. X.PP
  208. X.I [128.2.56.220]=>[Kinetics FastPath2] Up: 1 day, 4:43:31
  209. X.br
  210. X.I IF recv/trans packets 262874/39867 |
  211. X.I IP recv/trans packets 31603/15805
  212. X.PP
  213. XSnmpstatus also checks the operational status of all interfaces (ifOperStatus.*),
  214. Xand if it finds any that are not running, it will report in a manner similar to this:
  215. X.PP
  216. X.I 2 interfaces are down!
  217. XThe
  218. X.I host
  219. Xspecification may be either a host name or an internet address
  220. Xspecified in "dot notation"
  221. X.PP
  222. XThe
  223. X.I community
  224. Xspecifies the community name for the transaction with the remote system.  If none is
  225. Xgiven, the community name defaults to
  226. X.I "public".
  227. X.PP
  228. XIf the network entity has an error processing the request packet, an error
  229. Xpacket will be returned and a message will be shown, helping to pinpoint in what way
  230. Xthe request was malformed.  Snmpstatus will attempt to reform it's request to eliminate
  231. Xthe malformed variable, but this variable will then be missing from the displayed data.
  232. X.PP
  233. XAdding a "-d" to the argument list will cause the application to dump input and output packets.
  234. X.PP
  235. X.SH "SEE ALSO"
  236. XRFC 1065, RFC 1066, RFC 1067
  237. END_OF_FILE
  238.   if test 3422 -ne `wc -c <'netramet/doc/snmp/snmpstatus.1'`; then
  239.     echo shar: \"'netramet/doc/snmp/snmpstatus.1'\" unpacked with wrong size!
  240.   fi
  241.   # end of 'netramet/doc/snmp/snmpstatus.1'
  242. fi
  243. if test -f 'netramet/doc/snmp/snmptest.1' -a "${1}" != "-c" ; then 
  244.   echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmptest.1'\"
  245. else
  246.   echo shar: Extracting \"'netramet/doc/snmp/snmptest.1'\" \(3555 characters\)
  247.   sed "s/^X//" >'netramet/doc/snmp/snmptest.1' <<'END_OF_FILE'
  248. X.\* /***********************************************************
  249. X.\"     Copyright 1988, 1989 by Carnegie Mellon University
  250. X.\" 
  251. X.\"                       All Rights Reserved
  252. X.\" 
  253. X.\" Permission to use, copy, modify, and distribute this software and its 
  254. X.\" documentation for any purpose and without fee is hereby granted, 
  255. X.\" provided that the above copyright notice appear in all copies and that
  256. X.\" both that copyright notice and this permission notice appear in 
  257. X.\" supporting documentation, and that the name of CMU not be
  258. X.\" used in advertising or publicity pertaining to distribution of the
  259. X.\" software without specific, written prior permission.  
  260. X.\" 
  261. X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  262. X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  263. X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  264. X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  265. X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  266. X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  267. X.\" SOFTWARE.
  268. X.\" ******************************************************************/
  269. X.TH SNMPTEST 1 "17 September 1989"
  270. X.UC 4
  271. X.SH NAME
  272. Xsnmptest - communicates with a network entity using SNMP GET Requests.
  273. X.SH SYNOPSIS
  274. Xsnmptest host community
  275. X.SH DESCRIPTION
  276. XSnmptest is a flexible SNMP application that can monitor and manage
  277. Xinformation on a network entity.
  278. X.PP
  279. XThe
  280. X.I host
  281. Xspecification may be either a host name or an internet address
  282. Xspecified in "dot notation"
  283. X.PP
  284. XThe
  285. X.I community
  286. Xspecifies the community name for the transaction with the remote system.
  287. X.PP
  288. XAfter invoking the program, a command line
  289. Xinterpreter proceeds to accept commands.  It will prompt with:
  290. X.PP
  291. X.I Please enter the variable name:
  292. X.PP
  293. XAt this point you can enter one or more variable names, one per line.
  294. XA blank line is a command to send a request for each of the variables (in a single
  295. Xpacket) to the remote entity. Each variable name is given in the format specified in
  296. X.IR variables (5).
  297. XFor example
  298. X.PP
  299. X.I snmpget netdev-kbox.cc.cmu.edu public
  300. X.br
  301. X.I Please enter the variable name: system.sysdescr.0
  302. X.br
  303. X.I Please enter the variable name: 
  304. X.PP
  305. XWill return some information about the request and reply packets, as well as the
  306. Xinformation:
  307. X.PP
  308. X.I Name: system.sysDescr.0
  309. X.br
  310. X.I OCTET STRING- (ascii):    Kinetics FastPath2
  311. X.PP
  312. XUpon startup, the program defaults to sending a GET Request packet.  This can be changed
  313. Xto a GET NEXT Request or a SET Request by typing the commands "$N" or "$S" repectively.  Typing
  314. X"$G" will go back to the GET Request mode.
  315. X.PP
  316. XThe command "$D" will toggle the dumping of each sent and received packet.
  317. X.PP
  318. XWhen in the "SET Request" mode, more information is requested by the prompt for each variable.  The prompt:
  319. X.PP
  320. X.I Please enter variable type [i|s|n]: 
  321. X.PP
  322. Xrequests the type of the variable be entered.  Type "i" for an integer, "s" for an octet string,
  323. Xand "n" for a null value.
  324. X.br
  325. XAt this point a value will be prompted for:
  326. X.PP
  327. X.I Please enter new value: 
  328. X.PP
  329. XIf this is an integer value, just type the integer (in decimal).  If it is a string, type in
  330. Xwhite-space seperated decimal numbers, one per byte of the string.  Again type a blank line at
  331. Xthe prompt for the variable name to send the packet.
  332. X.PP
  333. XAt the variable name line, typing "$Q" will quit the program.
  334. X.PP
  335. XAdding a "-d" to the argument list will cause the application to dump input and output packets.
  336. X.PP
  337. X.SH "SEE ALSO"
  338. Xvariables(5), RFC 1065, RFC 1066, RFC 1067
  339. END_OF_FILE
  340.   if test 3555 -ne `wc -c <'netramet/doc/snmp/snmptest.1'`; then
  341.     echo shar: \"'netramet/doc/snmp/snmptest.1'\" unpacked with wrong size!
  342.   fi
  343.   # end of 'netramet/doc/snmp/snmptest.1'
  344. fi
  345. if test -f 'netramet/doc/snmp/snmptrap.1' -a "${1}" != "-c" ; then 
  346.   echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmptrap.1'\"
  347. else
  348.   echo shar: Extracting \"'netramet/doc/snmp/snmptrap.1'\" \(3877 characters\)
  349.   sed "s/^X//" >'netramet/doc/snmp/snmptrap.1' <<'END_OF_FILE'
  350. X.\* /***********************************************************
  351. X.\"     Copyright 1988, 1989 by Carnegie Mellon University
  352. X.\" 
  353. X.\"                       All Rights Reserved
  354. X.\" 
  355. X.\" Permission to use, copy, modify, and distribute this software and its 
  356. X.\" documentation for any purpose and without fee is hereby granted, 
  357. X.\" provided that the above copyright notice appear in all copies and that
  358. X.\" both that copyright notice and this permission notice appear in 
  359. X.\" supporting documentation, and that the name of CMU not be
  360. X.\" used in advertising or publicity pertaining to distribution of the
  361. X.\" software without specific, written prior permission.  
  362. X.\" 
  363. X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  364. X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  365. X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  366. X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  367. X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  368. X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  369. X.\" SOFTWARE.
  370. X.\" ******************************************************************/
  371. X.TH SNMPTRAP 1 "17 September 1989"
  372. X.UC 4
  373. X.SH NAME
  374. Xsnmptrap - Send an SNMP TRAP message to a host.
  375. X.SH SYNOPSIS
  376. Xsnmptrap host community trap-type specific-type device-description [ -a agent-addr ]
  377. X.SH DESCRIPTION
  378. Xsnmptrap is an SNMP application that forms and sends an SNMP TRAP message to
  379. Xa host.
  380. X.PP
  381. XThe
  382. X.I host
  383. Xspecification may be either a host name or an internet address
  384. Xspecified in "dot notation"
  385. X.PP
  386. XThe
  387. X.I community
  388. Xspecifies the community name for the transaction with the remote system.
  389. X.PP
  390. XThe
  391. X.I trap-type
  392. Xand
  393. X.I specific-type
  394. Xare integers that specify the type of trap message being sent.
  395. X.PP
  396. XThe
  397. X.I device-description
  398. Xis a textual description of the device sending this trap, to be used as the value of
  399. Xa system.sysDescr.0 variable sent in the variable list of this trap message.
  400. XThe optional argument
  401. X.I -a agent-addr
  402. Xcan be used to change the address from which the trap reports it is being sent.  Otherwise
  403. Xthe sending host's address is used.
  404. X.PP
  405. XFor example
  406. X.PP
  407. X.I snmptrap nic.andrew.cmu.edu public 0 0
  408. X.I 'SUN 3/60: SUNOS4.0'
  409. X.PP
  410. Xwill send a Cold Start trap to the specified machine.
  411. X.PP
  412. XThe defined trap types are:
  413. X.TP
  414. X.B 0
  415. XcoldStart \- signifies that the sending protocol entity is
  416. Xreinitializing itself such that the agent's configuration or the
  417. Xprotocol entity implementation may be altered.
  418. X.TP
  419. X.B 1
  420. XwarmStart \- signifies that the sending protocol entity is
  421. Xreinitializing itself such that neither the agent configuration nor
  422. Xthe protocol entity implementation is altered.
  423. X.TP
  424. X.B 2
  425. XlinkDown \- signifies that the sending protocol entity
  426. Xrecognizes a failure in one of the communication links represented in
  427. Xthe agent's configuration.
  428. X.TP
  429. X.B 3
  430. XlinkUp \- signifies that the sending protocol entity
  431. Xrecognizes that one of the communication links represented in the
  432. Xagent's configuration has come up.
  433. X.TP
  434. X.B 4
  435. XauthenticationFailure \- signifies that the sending protocol
  436. Xentity is the addressee of a protocol message that is not properly
  437. Xauthenticated.  While implementations of the SNMP must be capable of
  438. Xgenerating this trap, they must also be capable of suppressing the
  439. Xemission of such traps via an implementation-specific mechanism.
  440. X.TP
  441. X.B 5
  442. XegpNeighborLoss \- signifies that an EGP neighbor for whom
  443. Xthe sending protocol entity was an EGP peer has been marked down and
  444. Xthe peer relationship no longer obtains.
  445. X.TP
  446. X.B 6
  447. XenterpriseSpecific \- signifies that the sending protocol
  448. Xentity recognizes that some enterprise-specific event has occurred.
  449. XThe specific-trap field identifies the particular trap which
  450. Xoccurred.
  451. X.PP
  452. XAdding a "-d" to the argument list will cause the application to dump the output packet.
  453. X.PP
  454. X.SH "SEE ALSO"
  455. XRFC 1065, RFC 1066, RFC 1067
  456. END_OF_FILE
  457.   if test 3877 -ne `wc -c <'netramet/doc/snmp/snmptrap.1'`; then
  458.     echo shar: \"'netramet/doc/snmp/snmptrap.1'\" unpacked with wrong size!
  459.   fi
  460.   # end of 'netramet/doc/snmp/snmptrap.1'
  461. fi
  462. if test -f 'netramet/doc/snmp/snmpwalk.1' -a "${1}" != "-c" ; then 
  463.   echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmpwalk.1'\"
  464. else
  465.   echo shar: Extracting \"'netramet/doc/snmp/snmpwalk.1'\" \(3034 characters\)
  466.   sed "s/^X//" >'netramet/doc/snmp/snmpwalk.1' <<'END_OF_FILE'
  467. X.\* /***********************************************************
  468. X.\"     Copyright 1988, 1989 by Carnegie Mellon University
  469. X.\" 
  470. X.\"                       All Rights Reserved
  471. X.\" 
  472. X.\" Permission to use, copy, modify, and distribute this software and its 
  473. X.\" documentation for any purpose and without fee is hereby granted, 
  474. X.\" provided that the above copyright notice appear in all copies and that
  475. X.\" both that copyright notice and this permission notice appear in 
  476. X.\" supporting documentation, and that the name of CMU not be
  477. X.\" used in advertising or publicity pertaining to distribution of the
  478. X.\" software without specific, written prior permission.  
  479. X.\" 
  480. X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  481. X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  482. X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  483. X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  484. X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  485. X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  486. X.\" SOFTWARE.
  487. X.\" ******************************************************************/
  488. X.TH SNMPWALK 1 "17 September 1989"
  489. X.UC 4
  490. X.SH NAME
  491. Xsnmpwalk - communicates with a network entity using SNMP GET Next Requests.
  492. X.SH SYNOPSIS
  493. Xsnmpwalk host community [variable-name]
  494. X.SH DESCRIPTION
  495. XSnmpwalk is an SNMP application that uses GET NEXT Requests to query for a tree
  496. Xof information about a network entity.
  497. X.PP
  498. XThe
  499. X.I host
  500. Xspecification may be either a host name or an internet address
  501. Xspecified in "dot notation"
  502. X.PP
  503. XThe
  504. X.I community
  505. Xspecifies the community name for the transaction with the remote system.
  506. X.PP
  507. XA variable may also be given on the
  508. Xcommand line.  This variable specifies which portion of the object identifier
  509. Xspace will be searched using GET NEXT Requests.  All variables in the subtree
  510. Xbelow the given variable are queried and their values presented to the user.
  511. XEach variable name is given in the format specified in
  512. X.IR variables (5).
  513. X.PP
  514. XIf the "variable-name" argument is not present, snmpwalk will search the whole Internet MIB.
  515. X.PP
  516. XFor example
  517. X.PP
  518. X.I snmpwalk netdev-kbox.cc.cmu.edu public system
  519. X.PP
  520. Xwill retrieve the variables sysDescr.0 and sysObjectID.0 and sysUpTime.0:
  521. X.PP
  522. X.I Name: system.sysDescr.0
  523. X.br
  524. X.I OCTET STRING- (ascii):    Kinetics FastPath2
  525. X.PP
  526. X.I Name: system.sysObjectID.0
  527. X.br
  528. X.I OBJECT IDENTIFIER:  .iso.org.dod.internet.private.enterprises.CMU.sysID.CMU-KIP
  529. X.PP
  530. X.I Name: system.sysUpTime.0
  531. X.br
  532. X.I Timeticks: (2291082) 6:21:50
  533. X.PP
  534. XIf the network entity has an error processing the request packet, an error
  535. Xpacket will be returned and a message will be shown, helping to pinpoint why
  536. Xthe request was malformed.
  537. X.PP
  538. XIf the tree search causes attempts to search beyond the end of the MIB, a message
  539. Xwill be displayed:
  540. X.PP
  541. X.I End of MIB.
  542. X.PP
  543. XAdding a "-d" to the argument list will cause the application to dump input and output packets.
  544. X.PP
  545. X.SH "SEE ALSO"
  546. Xvariables(5), RFC 1065, RFC 1066, RFC 1067
  547. END_OF_FILE
  548.   if test 3034 -ne `wc -c <'netramet/doc/snmp/snmpwalk.1'`; then
  549.     echo shar: \"'netramet/doc/snmp/snmpwalk.1'\" unpacked with wrong size!
  550.   fi
  551.   # end of 'netramet/doc/snmp/snmpwalk.1'
  552. fi
  553. if test -f 'netramet/doc/snmp/variables.5' -a "${1}" != "-c" ; then 
  554.   echo shar: Will not clobber existing file \"'netramet/doc/snmp/variables.5'\"
  555. else
  556.   echo shar: Extracting \"'netramet/doc/snmp/variables.5'\" \(2850 characters\)
  557.   sed "s/^X//" >'netramet/doc/snmp/variables.5' <<'END_OF_FILE'
  558. X.\* /***********************************************************
  559. X.\"     Copyright 1988, 1989 by Carnegie Mellon University
  560. X.\" 
  561. X.\"                       All Rights Reserved
  562. X.\" 
  563. X.\" Permission to use, copy, modify, and distribute this software and its 
  564. X.\" documentation for any purpose and without fee is hereby granted, 
  565. X.\" provided that the above copyright notice appear in all copies and that
  566. X.\" both that copyright notice and this permission notice appear in 
  567. X.\" supporting documentation, and that the name of CMU not be
  568. X.\" used in advertising or publicity pertaining to distribution of the
  569. X.\" software without specific, written prior permission.  
  570. X.\" 
  571. X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  572. X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  573. X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  574. X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  575. X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  576. X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  577. X.\" SOFTWARE.
  578. X.\" ******************************************************************/
  579. X.TH VARIABLES 5 "17 September 1989"
  580. X.UC 4
  581. X.SH NAME
  582. X    variables - Format of specifying variable names to SNMP tools.
  583. X.SH SYNOPSIS
  584. X    system.sysdescr.0
  585. X.SH DESCRIPTION
  586. XVariable names are in the format of Object Identifiers (ASN.1).  There are
  587. Xseveral methods of representation. Each variable name is given in the format of A.B.C.D...,
  588. Xwhere A, B, C, and D are subidentifiers in one of two forms of notation.
  589. XEach subidentifier may be encoded as a decimal integer, or a symbol as found in
  590. Xthe RFC1066 MIB.  The case of the symbols is not significant.
  591. X.br
  592. XIf there is no leading "." in the variable name, the name will be formed
  593. Xas if having been preceded with "iso.org.dod.internet.mgmt.mib.".  A "." must
  594. Xbe placed before the first variable if the user is to fully specify the name.
  595. XFor example:
  596. X.PP
  597. X.I 1.1.0  system.sysDescr.0 and 1.sysDescr.0
  598. X.PP
  599. Xall refer to the same variable name.  Likewise:
  600. X.PP
  601. 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
  602. X.PP
  603. XAll refer to the same variable name.
  604. X.PP
  605. XThe description of the variables in the MIB is given in a file named
  606. X.I "mib.txt"
  607. Xin the current directory or in a file named in the environment variable
  608. X.I "MIBFILE" or in
  609. X.I "/etc/mib.txt".
  610. XThese files are searched in the above order.  The files are in the ASN.1 notation and use the
  611. XOBJECT TYPE macro defined in RFC 1065.  Most of the file describing the RFC 1066 MIB is pulled
  612. Xout of RFC 1066 without change.
  613. X.SH "SEE ALSO"
  614. XRFC 1065, RFC 1066, RFC 1067, ISO IS 8824(ASN.1)
  615. X.SH BUGS
  616. XThe parser of the
  617. X.I "mib.txt"
  618. Xfile is not expected to handle bizarre (although correct) interpretations of the ASN.1 notation.
  619. X
  620. X
  621. END_OF_FILE
  622.   if test 2850 -ne `wc -c <'netramet/doc/snmp/variables.5'`; then
  623.     echo shar: \"'netramet/doc/snmp/variables.5'\" unpacked with wrong size!
  624.   fi
  625.   # end of 'netramet/doc/snmp/variables.5'
  626. fi
  627. if test -f 'netramet/sg/apps/Makefile' -a "${1}" != "-c" ; then 
  628.   echo shar: Will not clobber existing file \"'netramet/sg/apps/Makefile'\"
  629. else
  630.   echo shar: Extracting \"'netramet/sg/apps/Makefile'\" \(2730 characters\)
  631.   sed "s/^X//" >'netramet/sg/apps/Makefile' <<'END_OF_FILE'
  632. X# Modified by Nevil Brownlee, Auckland University
  633. X#    Silicon Graphics version
  634. X#
  635. X# Makefile for snmpget, manager, snmpgetnext, collect, snmpwalk, snmpstatus, snmptest snmptrap snmptrapd snmpd
  636. X#
  637. X
  638. XSRC=    ../../src/apps
  639. XSINCLUDE= ../../src/snmplib/include
  640. X
  641. XSNMPH = $(SINCLUDE)/asn1.h $(SINCLUDE)/mib.h $(SINCLUDE)/parse.h \
  642. X    $(SINCLUDE)/snmp.h $(SINCLUDE)/snmpapi.h \
  643. X    $(SINCLUDE)/snmpclnt.h $(SINCLUDE)/snmpimpl.h 
  644. X
  645. XTARG=    snmpagnt.o snmptest
  646. X#    snmpget snmpgetnext snmpwalk snmpstatus \
  647. X#    snmptrap snmptrapd snmpd
  648. X
  649. XLIBS=    ../snmplib/libsnmp.a
  650. X
  651. XCFLAGS=    -g -I$(SINCLUDE) -cckr -D_BSD_SIGNALS -D_BSD_COMPAT
  652. X#CFLAGS=    -g -I$(SINCLUDE) -D_BSD_SIGNALS -D_BSD_COMPAT
  653. X
  654. X
  655. Xall: $(TARG)
  656. X
  657. X
  658. Xsnmptest.o:  $(SNMPH) $(SRC)/snmptest.c
  659. X    ${CC} $(CFLAGS) -c $(SRC)/snmptest.c
  660. X
  661. Xsnmptest:    snmptest.o ${LIBS}
  662. X    ${CC} -o $@ snmptest.o ${LIBS}
  663. X
  664. X
  665. Xsnmptrap.o:  $(SNMPH) $(SRC)/snmptrap.c
  666. X    ${CC} $(CFLAGS) -c $(SRC)/snmptrap.c
  667. X
  668. Xsnmptrap:    snmptrap.o ${LIBS}
  669. X    ${CC} -o $@ snmptrap.o  ${LIBS} -lmld
  670. X#    ${CC} -o $@ snmptrap.o  ${LIBS}
  671. X
  672. X
  673. Xsnmptrapd.o:  $(SNMPH) $(SRC)/snmptrapd.c
  674. X    ${CC} $(CFLAGS) -c $(SRC)/snmptrapd.c
  675. X
  676. Xsnmptrapd:    snmptrapd.o ${LIBS}
  677. X    ${CC} -o $@ snmptrapd.o ${LIBS}
  678. X
  679. X
  680. Xsnmpget.o:  $(SNMPH) $(SRC)/snmpget.c
  681. X    ${CC} $(CFLAGS) -c $(SRC)/snmpget.c
  682. X
  683. Xsnmpget:    snmpget.o ${LIBS}
  684. X    ${CC} -o $@ snmpget.o ${LIBS}
  685. X
  686. X
  687. X#manager.o:  $(SNMPH) $(SRC)/manager.c
  688. X#    ${CC} $(CFLAGS) -c $(SRC)/manager.c
  689. X
  690. X#manager:    manager.o ${LIBS}
  691. X#    ${CC} -o $@ manager.o ${LIBS}
  692. X
  693. X
  694. X#monitor.o:  $(SNMPH) $(SRC)/monitor.c
  695. X#    ${CC} $(CFLAGS) -c $(SRC)/monitor.c
  696. X
  697. X#monitor:    monitor.o ${LIBS}
  698. X#    ${CC} -o $@ monitor.o ${LIBS}
  699. X
  700. X
  701. Xsnmpgetnext.o:  $(SNMPH) $(SRC)/snmpgetnext.c
  702. X    ${CC} $(CFLAGS) -c $(SRC)/snmpgetnext.c
  703. X
  704. Xsnmpgetnext:    snmpgetnext.o ${LIBS}
  705. X    ${CC} -o $@ snmpgetnext.o ${LIBS}
  706. X
  707. X
  708. X#collect:    collect.o ${LIBS}
  709. X#    ${CC} -o $@ collect.o ${LIBS}
  710. X
  711. X
  712. Xsnmpwalk.o:  $(SNMPH) $(SRC)/snmpwalk.c
  713. X    ${CC} $(CFLAGS) -c $(SRC)/snmpwalk.c
  714. X
  715. Xsnmpwalk:    snmpwalk.o ${LIBS}
  716. X    ${CC} -o $@ snmpwalk.o ${LIBS}
  717. X
  718. X
  719. Xsnmpstatus.o:  $(SNMPH) $(SRC)/snmpstatus.c
  720. X    ${CC} $(CFLAGS) -c $(SRC)/snmpstatus.c
  721. X
  722. Xsnmpstatus:    snmpstatus.o ${LIBS}
  723. X    ${CC} -o $@ snmpstatus.o ${LIBS}
  724. X
  725. X
  726. Xsnmpd.o:  $(SNMPH) $(SRC)/snmpd.c
  727. X    ${CC} $(CFLAGS) -c $(SRC)/snmpd.c
  728. X
  729. Xkernel.o:  $(SNMPH) $(SRC)/kernel.c
  730. X    ${CC} $(CFLAGS) -c $(SRC)/kernel.c
  731. X
  732. Xsnmpagnt.o:  $(SNMPH) $(SRC)/snmpagnt.c
  733. X    ${CC} $(CFLAGS) -c $(SRC)/snmpagnt.c
  734. X
  735. Xsnmp_vars.o:  $(SNMPH) $(SRC)/snmp_vars.c
  736. X    ${CC} $(CFLAGS) -c $(SRC)/snmp_vars.c
  737. X
  738. Xsnmp_var_route.o:  $(SNMPH) $(SRC)/snmp_var_route.c
  739. X    ${CC} $(CFLAGS) -c $(SRC)/snmp_var_route.c
  740. X
  741. Xsnmpd:    snmpd.o kernel.o snmpagnt.o snmp_vars.o snmp_var_route.o ${LIBS}
  742. X    ${CC} -o $@ snmpd.o kernel.o snmpagnt.o snmp_vars.o \
  743. X        snmp_var_route.o   ${LIBS} -lmld
  744. X
  745. X
  746. Xclean:
  747. X    rm -f *.o ${TARG}
  748. X
  749. Xinstall:
  750. X    cp ${TARG} ../bin
  751. X
  752. X
  753. END_OF_FILE
  754.   if test 2730 -ne `wc -c <'netramet/sg/apps/Makefile'`; then
  755.     echo shar: \"'netramet/sg/apps/Makefile'\" unpacked with wrong size!
  756.   fi
  757.   # end of 'netramet/sg/apps/Makefile'
  758. fi
  759. if test -f 'netramet/src/apps/snmpget.c' -a "${1}" != "-c" ; then 
  760.   echo shar: Will not clobber existing file \"'netramet/src/apps/snmpget.c'\"
  761. else
  762.   echo shar: Extracting \"'netramet/src/apps/snmpget.c'\" \(4151 characters\)
  763.   sed "s/^X//" >'netramet/src/apps/snmpget.c' <<'END_OF_FILE'
  764. X/*
  765. X * snmpget.c - send snmp GET requests to a network entity.
  766. X *
  767. X */
  768. X/***********************************************************
  769. X    Copyright 1988, 1989 by Carnegie Mellon University
  770. X
  771. X                      All Rights Reserved
  772. X
  773. XPermission to use, copy, modify, and distribute this software and its 
  774. Xdocumentation for any purpose and without fee is hereby granted, 
  775. Xprovided that the above copyright notice appear in all copies and that
  776. Xboth that copyright notice and this permission notice appear in 
  777. Xsupporting documentation, and that the name of CMU not be
  778. Xused in advertising or publicity pertaining to distribution of the
  779. Xsoftware without specific, written prior permission.  
  780. X
  781. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  782. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  783. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  784. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  785. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  786. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  787. XSOFTWARE.
  788. X******************************************************************/
  789. X#include <sys/types.h>
  790. X#include <netinet/in.h>
  791. X#include <stdio.h>
  792. X
  793. X#include "ausnmp.h"
  794. X#include "snmp.h"
  795. X#include "snmpimpl.h"
  796. X#include "asn1.h"
  797. X#include "snmpapi.h"
  798. X#include "snmpclnt.h"
  799. X
  800. Xextern int  errno;
  801. Xint    snmp_dump_packet = 0;
  802. X
  803. Xmain(argc, argv)
  804. X    int        argc;
  805. X    char    *argv[];
  806. X{
  807. X    struct snmp_session session, *ss;
  808. X    struct snmp_pdu *pdu, *response;
  809. X    struct variable_list *vars;
  810. X    int    arg;
  811. X    char *gateway = NULL;
  812. X    char *community = NULL;
  813. X    int    count, current_name = 0;
  814. X    char *names[128];
  815. X    oid name[MAX_NAME_LEN];
  816. X    int name_length;
  817. X    int status;
  818. X
  819. X    init_mib();
  820. X    /*
  821. X     * usage: snmpget gateway-name community-name
  822. X     */
  823. X    for(arg = 1; arg < argc; arg++){
  824. X    if (argv[arg][0] == '-'){
  825. X        switch(argv[arg][1]){
  826. X        case 'd':
  827. X            snmp_dump_packet++;
  828. X            break;
  829. X        default:
  830. X            printf("invalid option: -%c\n", argv[arg][1]);
  831. X            break;
  832. X        }
  833. X        continue;
  834. X    }
  835. X    if (gateway == NULL){
  836. X        gateway = argv[arg];
  837. X    } else if (community == NULL){
  838. X        community = argv[arg]; 
  839. X    } else {
  840. X        names[current_name++] = argv[arg];
  841. X    }
  842. X    }
  843. X
  844. X    if (!(gateway && community && current_name > 0)){
  845. X    printf("usage: snmpget gateway-name community-name object-identifier [object-identifier ...]\n");
  846. X    exit(1);
  847. X    }
  848. X
  849. X    bzero((char *)&session, sizeof(struct snmp_session));
  850. X    session.peername = gateway;
  851. X    session.community = (u_char *)community;
  852. X    session.community_len = strlen((char *)community);
  853. X    session.retries = SNMP_DEFAULT_RETRIES;
  854. X    session.timeout = SNMP_DEFAULT_TIMEOUT;
  855. X    session.authenticator = NULL;
  856. X    snmp_synch_setup(&session);
  857. X    ss = snmp_open(&session);
  858. X    if (ss == NULL){
  859. X    printf("Couldn't open snmp\n");
  860. X    exit(-1);
  861. X    }
  862. X
  863. X    pdu = snmp_pdu_create(GET_REQ_MSG);
  864. X
  865. X    for(count = 0; count < current_name; count++){
  866. X    name_length = MAX_NAME_LEN;
  867. X    if (!read_objid(names[count], name, &name_length)){
  868. X        printf("Invalid object identifier: %s\n", names[count]);
  869. X    }
  870. X    
  871. X    snmp_add_null_var(pdu, name, name_length);
  872. X    }
  873. X
  874. Xretry:
  875. X    status = snmp_synch_response(ss, pdu, &response);
  876. X    if (status == STAT_SUCCESS){
  877. X    if (response->errstat == SNMP_ERR_NOERROR){
  878. X        for(vars = response->variables; vars; vars = vars->next_variable)
  879. X        print_variable(vars->name, vars->name_length, vars);
  880. X    } else {
  881. X        printf("Error in packet.\nReason: %s\n", snmp_errstring(response->errstat));
  882. X        if (response->errstat == SNMP_ERR_NOSUCHNAME){
  883. X        printf("This name doesn't exist: ");
  884. X        for(count = 1, vars = response->variables; vars && count != response->errindex;
  885. X            vars = vars->next_variable, count++)
  886. X            ;
  887. X        if (vars)
  888. X            print_objid(vars->name, vars->name_length);
  889. X        printf("\n");
  890. X        }
  891. X        if ((pdu = snmp_fix_pdu(response, GET_REQ_MSG)) != NULL)
  892. X        goto retry;
  893. X    }
  894. X
  895. X    } else if (status == STAT_TIMEOUT){
  896. X    printf("No Response from %s\n", gateway);
  897. X    } else {    /* status == STAT_ERROR */
  898. X    printf("An error occurred, Quitting\n");
  899. X    }
  900. X
  901. X    if (response)
  902. X    snmp_free_pdu(response);
  903. X    snmp_close(ss);
  904. X}
  905. X
  906. END_OF_FILE
  907.   if test 4151 -ne `wc -c <'netramet/src/apps/snmpget.c'`; then
  908.     echo shar: \"'netramet/src/apps/snmpget.c'\" unpacked with wrong size!
  909.   fi
  910.   # end of 'netramet/src/apps/snmpget.c'
  911. fi
  912. if test -f 'netramet/src/apps/snmpgetnext.c' -a "${1}" != "-c" ; then 
  913.   echo shar: Will not clobber existing file \"'netramet/src/apps/snmpgetnext.c'\"
  914. else
  915.   echo shar: Extracting \"'netramet/src/apps/snmpgetnext.c'\" \(4233 characters\)
  916.   sed "s/^X//" >'netramet/src/apps/snmpgetnext.c' <<'END_OF_FILE'
  917. X/*
  918. X * snmpgetnext.c - send snmp GETNEXT requests to a network entity.
  919. X *
  920. X */
  921. X/***********************************************************
  922. X    Copyright 1988, 1989 by Carnegie Mellon University
  923. X
  924. X                      All Rights Reserved
  925. X
  926. XPermission to use, copy, modify, and distribute this software and its 
  927. Xdocumentation for any purpose and without fee is hereby granted, 
  928. Xprovided that the above copyright notice appear in all copies and that
  929. Xboth that copyright notice and this permission notice appear in 
  930. Xsupporting documentation, and that the name of CMU not be
  931. Xused in advertising or publicity pertaining to distribution of the
  932. Xsoftware without specific, written prior permission.  
  933. X
  934. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  935. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  936. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  937. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  938. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  939. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  940. XSOFTWARE.
  941. X******************************************************************/
  942. X#include <sys/types.h>
  943. X#include <netinet/in.h>
  944. X#include <stdio.h>
  945. X
  946. X#include "ausnmp.h"
  947. X#include "snmp.h"
  948. X#include "snmpimpl.h"
  949. X#include "asn1.h"
  950. X#include "snmpapi.h"
  951. X#include "snmpclnt.h"
  952. X
  953. Xextern int  errno;
  954. Xint    snmp_dump_packet = 0;
  955. X
  956. Xmain(argc, argv)
  957. X    int        argc;
  958. X    char    *argv[];
  959. X{
  960. X    struct snmp_session session, *ss;
  961. X    struct snmp_pdu *pdu, *response;
  962. X    struct variable_list *vars;
  963. X    int    arg;
  964. X    char *gateway = NULL;
  965. X    char *community = NULL;
  966. X    int    count, current_name = 0;
  967. X    char *names[128];
  968. X    oid name[MAX_NAME_LEN];
  969. X    int name_length;
  970. X    int status;
  971. X
  972. X    init_mib();
  973. X    /*
  974. X     * usage: snmpgetnext gateway-name community-name object-id-list
  975. X     */
  976. X    for(arg = 1; arg < argc; arg++){
  977. X    if (argv[arg][0] == '-'){
  978. X        switch(argv[arg][1]){
  979. X        case 'd':
  980. X            snmp_dump_packet++;
  981. X            break;
  982. X        default:
  983. X            printf("invalid option: -%c\n", argv[arg][1]);
  984. X            break;
  985. X        }
  986. X        continue;
  987. X    }
  988. X    if (gateway == NULL){
  989. X        gateway = argv[arg];
  990. X    } else if (community == NULL){
  991. X        community = argv[arg]; 
  992. X    } else {
  993. X        names[current_name++] = argv[arg];
  994. X    }
  995. X    }
  996. X
  997. X    if (!(gateway && community && current_name > 0)){
  998. X    printf("usage: snmpgetnext gateway-name community-name object-identifier [object-identifier ...]\n");
  999. X    exit(1);
  1000. X    }
  1001. X
  1002. X    bzero((char *)&session, sizeof(struct snmp_session));
  1003. X    session.peername = gateway;
  1004. X    session.community = (u_char *)community;
  1005. X    session.community_len = strlen((char *)community);
  1006. X    session.retries = SNMP_DEFAULT_RETRIES;
  1007. X    session.timeout = SNMP_DEFAULT_TIMEOUT;
  1008. X    session.authenticator = NULL;
  1009. X    snmp_synch_setup(&session);
  1010. X    ss = snmp_open(&session);
  1011. X    if (ss == NULL){
  1012. X    printf("Couldn't open snmp\n");
  1013. X    exit(-1);
  1014. X    }
  1015. X
  1016. X    pdu = snmp_pdu_create(GETNEXT_REQ_MSG);
  1017. X
  1018. X    for(count = 0; count < current_name; count++){
  1019. X    name_length = MAX_NAME_LEN;
  1020. X    if (!read_objid(names[count], name, &name_length)){
  1021. X        printf("Invalid object identifier: %s\n", names[count]);
  1022. X    }
  1023. X    
  1024. X    snmp_add_null_var(pdu, name, name_length);
  1025. X    }
  1026. X
  1027. X    status = snmp_synch_response(ss, pdu, &response);
  1028. X    if (status == STAT_SUCCESS){
  1029. X    if (response->errstat == SNMP_ERR_NOERROR){
  1030. X        for(vars = response->variables; vars; vars = vars->next_variable)
  1031. X        print_variable(vars->name, vars->name_length, vars);
  1032. X    } else {
  1033. X        if (response->errstat == SNMP_ERR_NOSUCHNAME){
  1034. X        printf("You have reached the end of the MIB.\n");
  1035. X        } else {
  1036. X        printf("Error in packet.\nReason: %s\n", snmp_errstring(response->errstat));
  1037. X        if (response->errstat == SNMP_ERR_NOSUCHNAME){
  1038. X            printf("This name doesn't exist: ");
  1039. X            for(count = 1, vars = response->variables; vars && count != response->errindex;
  1040. X            vars = vars->next_variable, count++)
  1041. X                ;
  1042. X            if (vars)
  1043. X            print_objid(vars->name, vars->name_length);
  1044. X            printf("\n");
  1045. X        }
  1046. X        }
  1047. X    }
  1048. X
  1049. X    } else if (status == STAT_TIMEOUT){
  1050. X    printf("No Response from %s\n", gateway);
  1051. X    } else {    /* status == STAT_ERROR */
  1052. X    printf("An error occurred, Quitting\n");
  1053. X    }
  1054. X
  1055. X    if (response)
  1056. X    snmp_free_pdu(response);
  1057. X    snmp_close(ss);
  1058. X}
  1059. X
  1060. END_OF_FILE
  1061.   if test 4233 -ne `wc -c <'netramet/src/apps/snmpgetnext.c'`; then
  1062.     echo shar: \"'netramet/src/apps/snmpgetnext.c'\" unpacked with wrong size!
  1063.   fi
  1064.   # end of 'netramet/src/apps/snmpgetnext.c'
  1065. fi
  1066. if test -f 'netramet/src/apps/snmptrapd.c' -a "${1}" != "-c" ; then 
  1067.   echo shar: Will not clobber existing file \"'netramet/src/apps/snmptrapd.c'\"
  1068. else
  1069.   echo shar: Extracting \"'netramet/src/apps/snmptrapd.c'\" \(5934 characters\)
  1070.   sed "s/^X//" >'netramet/src/apps/snmptrapd.c' <<'END_OF_FILE'
  1071. X/*
  1072. X * snmptrapd.c - receive and log snmp traps
  1073. X *
  1074. X */
  1075. X/***********************************************************
  1076. X    Copyright 1989 by Carnegie Mellon University
  1077. X
  1078. X                      All Rights Reserved
  1079. X
  1080. XPermission to use, copy, modify, and distribute this software and its 
  1081. Xdocumentation for any purpose and without fee is hereby granted, 
  1082. Xprovided that the above copyright notice appear in all copies and that
  1083. Xboth that copyright notice and this permission notice appear in 
  1084. Xsupporting documentation, and that the name of CMU not be
  1085. Xused in advertising or publicity pertaining to distribution of the
  1086. Xsoftware without specific, written prior permission.  
  1087. X
  1088. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1089. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1090. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1091. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1092. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1093. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1094. XSOFTWARE.
  1095. X******************************************************************/
  1096. X#include <sys/types.h>
  1097. X#include <netinet/in.h>
  1098. X#include <stdio.h>
  1099. X#include <sys/time.h>
  1100. X#include <errno.h>
  1101. X#include <syslog.h>
  1102. X
  1103. X#include "ausnmp.h"
  1104. X#include "snmp.h"
  1105. X#include "snmpimpl.h"
  1106. X#include "asn1.h"
  1107. X#include "snmpapi.h"
  1108. X#include "snmpclnt.h"
  1109. X
  1110. X#ifndef BSD4_3
  1111. X
  1112. Xtypedef long    fd_mask;
  1113. X#define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  1114. X
  1115. X#define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  1116. X#define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  1117. X#define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  1118. X#define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  1119. X#endif
  1120. X
  1121. Xextern int  errno;
  1122. Xint    snmp_dump_packet = 0;
  1123. Xint Print = 0;
  1124. X
  1125. Xchar *
  1126. Xtrap_description(trap)
  1127. X    int trap;
  1128. X{
  1129. X    switch(trap){
  1130. X    case SNMP_TRAP_COLDSTART:
  1131. X        return "Cold Start";
  1132. X    case SNMP_TRAP_WARMSTART:
  1133. X        return "Warm Start";
  1134. X    case SNMP_TRAP_LINKDOWN:
  1135. X        return "Link Down";
  1136. X    case SNMP_TRAP_LINKUP:
  1137. X        return "Link Up";
  1138. X    case SNMP_TRAP_AUTHFAIL:
  1139. X        return "Authentication Failure";
  1140. X    case SNMP_TRAP_EGPNEIGHBORLOSS:
  1141. X        return "EGP Neighbor Loss";
  1142. X    case SNMP_TRAP_ENTERPRISESPECIFIC:
  1143. X        return "Enterprise Specific";
  1144. X    default:
  1145. X        return "Unknown Type";
  1146. X    }
  1147. X}
  1148. X
  1149. Xchar *
  1150. Xuptime_string(timeticks, buf)
  1151. X    register u_long timeticks;
  1152. X    char *buf;
  1153. X{
  1154. X    int    seconds, minutes, hours, days;
  1155. X
  1156. X    timeticks /= 100;
  1157. X    days = timeticks / (60 * 60 * 24);
  1158. X    timeticks %= (60 * 60 * 24);
  1159. X
  1160. X    hours = timeticks / (60 * 60);
  1161. X    timeticks %= (60 * 60);
  1162. X
  1163. X    minutes = timeticks / 60;
  1164. X    seconds = timeticks % 60;
  1165. X
  1166. X    if (days == 0){
  1167. X    sprintf(buf, "%d:%02d:%02d", hours, minutes, seconds);
  1168. X    } else if (days == 1) {
  1169. X    sprintf(buf, "%d day, %d:%02d:%02d", days, hours, minutes, seconds);
  1170. X    } else {
  1171. X    sprintf(buf, "%d days, %d:%02d:%02d", days, hours, minutes, seconds);
  1172. X    }
  1173. X    return buf;
  1174. X}
  1175. X
  1176. Xint snmp_input(op, session, reqid, pdu, magic)
  1177. X    int op;
  1178. X    struct snmp_session *session;
  1179. X    int reqid;
  1180. X    struct snmp_pdu *pdu;
  1181. X    void *magic;
  1182. X{
  1183. X    struct variable_list *vars;
  1184. X    char buf[64];
  1185. X
  1186. X    if (op == RECEIVED_MESSAGE && pdu->command == TRP_REQ_MSG){
  1187. X    if (Print){
  1188. X        printf("%s: %s Trap (%d) Uptime: %s\n", inet_ntoa(pdu->agent_addr.sin_addr),
  1189. X        trap_description(pdu->trap_type), pdu->specific_type, uptime_string(pdu->time, buf));
  1190. X        for(vars = pdu->variables; vars; vars = vars->next_variable)
  1191. X        print_variable(vars->name, vars->name_length, vars);
  1192. X    } else {
  1193. X        syslog(LOG_WARNING, "%s: %s Trap (%d) Uptime: %s\n", inet_ntoa(pdu->agent_addr.sin_addr),
  1194. X        trap_description(pdu->trap_type), pdu->specific_type, uptime_string(pdu->time, buf));
  1195. X    }
  1196. X    } else if (op == TIMED_OUT){
  1197. X    printf("Timeout: This shouldn't happen!\n");
  1198. X    }
  1199. X}
  1200. X
  1201. X
  1202. Xmain(argc, argv)
  1203. X    int        argc;
  1204. X    char    *argv[];
  1205. X{
  1206. X    struct snmp_session session, *ss;
  1207. X    int    arg;
  1208. X    int count, numfds, block;
  1209. X    fd_set fdset;
  1210. X    struct timeval timeout, *tvp;
  1211. X
  1212. X
  1213. X    init_syslog();
  1214. X    init_mib();
  1215. X    /*
  1216. X     * usage: snmptrapd [-p]
  1217. X     */
  1218. X    for(arg = 1; arg < argc; arg++){
  1219. X    if (argv[arg][0] == '-'){
  1220. X        switch(argv[arg][1]){
  1221. X        case 'd':
  1222. X            snmp_dump_packet++;
  1223. X            break;
  1224. X        case 'p':
  1225. X            Print++;
  1226. X            break;
  1227. X        default:
  1228. X            printf("invalid option: -%c\n", argv[arg][1]);
  1229. X            printf("Usage: snmptrapd [-p ]\n");
  1230. X            break;
  1231. X        }
  1232. X        continue;
  1233. X    }
  1234. X    }
  1235. X
  1236. X    bzero((char *)&session, sizeof(struct snmp_session));
  1237. X    session.peername = NULL;
  1238. X    session.community = NULL;
  1239. X    session.community_len = 0;
  1240. X    session.retries = SNMP_DEFAULT_RETRIES;
  1241. X    session.timeout = SNMP_DEFAULT_TIMEOUT;
  1242. X    session.authenticator = NULL;
  1243. X    session.callback = snmp_input;
  1244. X    session.callback_magic = NULL;
  1245. X    session.local_port = SNMP_TRAP_PORT;
  1246. X    ss = snmp_open(&session);
  1247. X    if (ss == NULL){
  1248. X    printf("Couldn't open snmp\n");
  1249. X    exit(-1);
  1250. X    }
  1251. X
  1252. X    while(1){
  1253. X    numfds = 0;
  1254. X    FD_ZERO(&fdset);
  1255. X    block = 1;
  1256. X    tvp = &timeout;
  1257. X    timerclear(tvp);
  1258. X    snmp_select_info(&numfds, &fdset, tvp, &block);
  1259. X    if (block == 1)
  1260. X        tvp = NULL;    /* block without timeout */
  1261. X    count = select(numfds, &fdset, 0, 0, tvp);
  1262. X    if (count > 0){
  1263. X        snmp_read(&fdset);
  1264. X    } else switch(count){
  1265. X        case 0:
  1266. X        snmp_timeout();
  1267. X        break;
  1268. X        case -1:
  1269. X        if (errno == EINTR){
  1270. X            continue;
  1271. X        } else {
  1272. X            perror("select");
  1273. X        }
  1274. X        return -1;
  1275. X        default:
  1276. X        printf("select returned %d\n", count);
  1277. X        return -1;
  1278. X    }
  1279. X    }
  1280. X}
  1281. X
  1282. Xinit_syslog(){
  1283. X/*
  1284. X * These definitions handle 4.2 systems without additional syslog facilities.
  1285. X */
  1286. X#ifndef LOG_CONS
  1287. X#define LOG_CONS    0    /* Don't bother if not defined... */
  1288. X#endif
  1289. X#ifndef LOG_LOCAL0
  1290. X#define LOG_LOCAL0    0
  1291. X#endif
  1292. X    /*
  1293. X     * All messages will be logged to the local0 facility and will be sent to
  1294. X     * the console if syslog doesn't work.
  1295. X     */
  1296. X    openlog("snmptrapd", LOG_CONS, LOG_LOCAL0);
  1297. X    syslog(LOG_INFO, "Starting snmptrapd");
  1298. X}
  1299. END_OF_FILE
  1300.   if test 5934 -ne `wc -c <'netramet/src/apps/snmptrapd.c'`; then
  1301.     echo shar: \"'netramet/src/apps/snmptrapd.c'\" unpacked with wrong size!
  1302.   fi
  1303.   # end of 'netramet/src/apps/snmptrapd.c'
  1304. fi
  1305. if test -f 'netramet/src/meter/chart.c' -a "${1}" != "-c" ; then 
  1306.   echo shar: Will not clobber existing file \"'netramet/src/meter/chart.c'\"
  1307. else
  1308.   echo shar: Extracting \"'netramet/src/meter/chart.c'\" \(4246 characters\)
  1309.   sed "s/^X//" >'netramet/src/meter/chart.c' <<'END_OF_FILE'
  1310. X/* 0920, Mon 21 Jun 93
  1311. X
  1312. X   CHART.C:  Strip chart in screen window for AU monitor
  1313. X
  1314. X   Copyright (C) 1992,1993 by Nevil Brownlee,
  1315. X   Computer Centre,  University of Auckland */
  1316. X
  1317. X#include "pktsnap.h"
  1318. X
  1319. X#include <mem.h>
  1320. X
  1321. X#include <bios.h>
  1322. X#include <dos.h>
  1323. X
  1324. X#ifdef XXYYZZ
  1325. Xint kbstatus()  /* See if there's a kb character */
  1326. X{
  1327. X#ifdef INLINE
  1328. X   _AH = 0x01;  geninterrupt(0x16);
  1329. X   asm mov ax,0
  1330. X   asm jz  kbsret
  1331. X   asm mov al,1
  1332. Xkbsret:
  1333. X   return _AX;
  1334. X#else
  1335. X   return bioskey(1);
  1336. X#endif
  1337. X#ifdef doitourselves
  1338. X   union REGS call_regs, ret_regs;
  1339. X   call_regs.h.ah = 0x01;  /* Test kb: Zero flag on => no char */
  1340. X   int86(0x16,&call_regs,&ret_regs);
  1341. X      /* Ecosoft C88 int86 returns flags as result instead of in REGS */
  1342. X      /* Turbo C int86 puts flags in REGS and returns AX as result ! */
  1343. X   return !(ret_regs.x.flags & 0x40);  /* Zero flag */
  1344. X#endif
  1345. X   }
  1346. X
  1347. Xunsigned char kbcode()  /* Read char from the keyboard */
  1348. X{  _AH = 0x00;  geninterrupt(0x16);  return _AL;  }  /* AH = scan code */
  1349. X#endif
  1350. X
  1351. X
  1352. X#define UP     0x06  /* BIOS scroll parameters */
  1353. X#define DOWN   0x07
  1354. X#define CHATR  0x07  /* Screen attribute for chart */
  1355. X
  1356. Xvoid bios_scroll(way, tx,ty, bx,by, nrows, attr)
  1357. Xint way, tx,ty, bx,by, nrows, attr;
  1358. X{
  1359. X   _AH = (way == UP) ? UP : DOWN;  /* Scroll direction */
  1360. X   _AL = nrows;  /* Rows to scroll */
  1361. X   _BH = attr;  /* Screen attribute for blank fill */
  1362. X   _CH = ty; _CL = tx;  /* Top left */
  1363. X   _DH = by; _DL = bx;  /* Bottom right */
  1364. X   geninterrupt(0x10);
  1365. X   }
  1366. X
  1367. Xvoid scpos(x,y)  /* Set Cursor Position */
  1368. Xunsigned char x,y;
  1369. X{
  1370. X   _AH = 2;  _BH = 0;  _DH = y;  _DL = x;
  1371. X   geninterrupt(0x10);
  1372. X   }
  1373. X
  1374. Xvoid sputc(c)  /* Write char to screen, don't move cursor */
  1375. Xunsigned char c;
  1376. X{
  1377. X   _BH = 0;  _CX = 1;  _AH = 10;  _AL = c;
  1378. X   geninterrupt(0x10);
  1379. X   }
  1380. X
  1381. Xvoid swrite(c)  /* Write char to screen */
  1382. Xunsigned char c;
  1383. X{
  1384. X   _AH = 14;  _AL = c;
  1385. X   geninterrupt(0x10);
  1386. X   }
  1387. X
  1388. X#define MTICKS     1092L  /* 18.20000 per second */
  1389. X#define HTICKS    65543L  /* 18.20639 */
  1390. X#define DTICKS  1573040L  /* 18.20648 */
  1391. X
  1392. X#define DCSEC   8640000L  /* centiseconds per day */
  1393. X
  1394. Xlong biosticks()
  1395. X{
  1396. X   long tt = biostime(0,0L);  /* Clock ticks */
  1397. X   if (tt < l_tod) ++midnight_crossings;
  1398. X   return l_tod = tt;
  1399. X   }
  1400. X
  1401. Xvoid start_uptime_clock(void)
  1402. X{
  1403. X   midnight_crossings = 0;
  1404. X   boot_time = biostime(0,0L) - 1;
  1405. X      /* About 5 cs early, to allow first flow create times to be > 1 cs */
  1406. X   }
  1407. X
  1408. Xunsigned long uptime()  /* Since startup, in centiseconds */
  1409. X{
  1410. X   return ((biosticks()-boot_time)*549L+275L)/100L  /* cs per clock tick */
  1411. X      + (long)midnight_crossings*DCSEC;
  1412. X   }
  1413. X
  1414. Xvoid set_tod()
  1415. X{
  1416. X   long tt = biosticks();
  1417. X   tod_h = tt/HTICKS;  tt -= (long)tod_h*HTICKS;
  1418. X   tod_m = tt/MTICKS;  tt -= (long)tod_m*MTICKS;
  1419. X   tod_s = (tt*10+91l)/182l;
  1420. X   if (tod_s == 60) {
  1421. X      ++tod_m;  tod_s = 0;
  1422. X      }
  1423. X   if (tod_m == 60) {
  1424. X      ++tod_h;  tod_m = 0;
  1425. X      }
  1426. X   if (tod_h == 24) tod_h = 0;
  1427. X   }
  1428. X
  1429. Xvoid sclear()
  1430. X{
  1431. X   bios_scroll(UP, 0,0,  79,24, 0, CHATR);  /* Blank screen */
  1432. X   }
  1433. X
  1434. Xvoid w_clear(tx,ty, bx,by)
  1435. Xint tx,ty, bx,by;
  1436. X{
  1437. X   bios_scroll(UP, tx,ty,  bx,by, 0, CHATR);  /* Blank window */
  1438. X   }
  1439. X
  1440. Xvoid w_roll(tx,ty, bx,by, n)
  1441. Xint tx,ty, bx,by, n;
  1442. X{
  1443. X   bios_scroll(UP, tx,ty,  bx,by, n, CHATR);  /* Roll window up n lines */
  1444. X   scpos(tx,by);  /* Leave cursor at start of bottom window line */
  1445. X   }
  1446. X
  1447. X#define DOT  0xFA  /* Small dot in centre of char rectangle */
  1448. X
  1449. Xvoid chart(tx,ty, bx,by, x1,x2,x3)
  1450. Xint tx,ty, bx,by, x1,x2,x3;
  1451. X{
  1452. X       int w,k;
  1453. X#define TIMEWIDTH  8
  1454. X   char buf[TIMEWIDTH+102], *bar;
  1455. X   bios_scroll(UP, tx,ty,  bx,by, 1, CHATR);
  1456. X   w = bx+1-tx - TIMEWIDTH;  /* Plot chars from bar[0] to bar[w-1], 0-org */
  1457. X   bar = &buf[TIMEWIDTH];
  1458. X   if (tod_s%30 == 0) {
  1459. X      sprintf(buf, "%02d%02d:%02d +", tod_h,tod_m,tod_s);
  1460. X      memset(bar+1,DOT,w-1);
  1461. X      }
  1462. X   else {
  1463. X      memset(buf, ' ',TIMEWIDTH+w);
  1464. X      bar[0] = '|';
  1465. X      }
  1466. X   for (k = 10; k < w; k += 10) bar[k] = ':';
  1467. X   if (x1 >= w) x1 = w;
  1468. X   if (x2 >= w) x2 = w;
  1469. X   if (x3 >= w) x3 = w;
  1470. X   for (k = x1+1; k < x3; ++k) bar[k] = '-';
  1471. X   for (k = 10; k < w; k += 10)
  1472. X      if (bar[k] == '-') bar[k] = '+';
  1473. X   bar[x1] = '<';
  1474. X   bar[x3] = '>';
  1475. X   bar[x2] = '*';
  1476. X   k = bar[w-1];  bar[w-1] = '\0';
  1477. X   scpos(tx,by);
  1478. X   for (bar = buf; *bar; ) swrite(*bar++);
  1479. X   sputc(k);  /* Leave cursor at (bx,by) */
  1480. X   }
  1481. END_OF_FILE
  1482.   if test 4246 -ne `wc -c <'netramet/src/meter/chart.c'`; then
  1483.     echo shar: \"'netramet/src/meter/chart.c'\" unpacked with wrong size!
  1484.   fi
  1485.   # end of 'netramet/src/meter/chart.c'
  1486. fi
  1487. if test -f 'netramet/src/meter/include/pktsnap.h' -a "${1}" != "-c" ; then 
  1488.   echo shar: Will not clobber existing file \"'netramet/src/meter/include/pktsnap.h'\"
  1489. else
  1490.   echo shar: Extracting \"'netramet/src/meter/include/pktsnap.h'\" \(2839 characters\)
  1491.   sed "s/^X//" >'netramet/src/meter/include/pktsnap.h' <<'END_OF_FILE'
  1492. X/* 1400, Wed 6 Oct 93
  1493. X
  1494. X   PKTSNAP.H:  Declarations for AU packet monitoring
  1495. X          extensions to Waterloo TCP/IP
  1496. X
  1497. X   Copyright (C) 1992,1993 by Nevil Brownlee,
  1498. X   Computer Centre,  University of Auckland */
  1499. X
  1500. X#ifdef PKTSNAP
  1501. X#define EXTERN
  1502. X#else
  1503. X#define EXTERN extern
  1504. X#endif
  1505. X
  1506. X#ifdef AU_MSDOS
  1507. X/* Declared in wattcp\src\pcpkt.c .. */
  1508. X
  1509. Xvoid pkt_rcv_call2(unsigned int handle, unsigned int len,
  1510. X   unsigned char far *buff);
  1511. X
  1512. Xextern char au_monitor;  /* 1 to enable monitoring */
  1513. X
  1514. Xextern unsigned char eth_addr[6];
  1515. Xextern unsigned long npackets,nbytes;
  1516. X#else
  1517. XEXTERN unsigned long npackets;  /* Declared in meter_ux.c */
  1518. X#endif
  1519. X
  1520. X/* Declared in wattcp\acct\meter_pc.c .. */
  1521. X
  1522. XEXTERN unsigned int bkgi;  /* Seconds before next run of backgound process */
  1523. X
  1524. XEXTERN unsigned int  /* Statistics variables */
  1525. X   max_pkt_rate, pkt_backlog,max_pkt_backlog,
  1526. X   dummypackets, mdpacketrate;
  1527. XEXTERN unsigned long
  1528. X   stats_time, t_backlog,
  1529. X   spackets,sbytes,
  1530. X   kilodummypackets, dummypacketrate, mindummyrate,
  1531. X   badpackets,nobufpackets;
  1532. XEXTERN unsigned char
  1533. X   clear_pkt_stats;  /* 1 to clear stats variables */
  1534. X
  1535. X/* Declared in wattcp\elib\q*.asm .. */
  1536. X
  1537. X#ifdef AU_MSDOS
  1538. Xvoid qmove(unsigned char far *s, unsigned char far *d, unsigned int n);
  1539. Xint qcmp(unsigned char far *s, unsigned char far *d, unsigned int n);
  1540. X
  1541. X#else 
  1542. X
  1543. X#define qmove(s,d,n) memcpy((char *)d,(char *)s,n)
  1544. X#define qcmp(s,d,n) memcmp((char *)s,(char *)d,n)
  1545. X
  1546. X#define w_roll(x1,y1, x2,y2, up)
  1547. X#define scpos(x,y)
  1548. X#define w_clear(x1,y1, x2,y2)
  1549. X#endif
  1550. X
  1551. X/* Monitor variables .. */
  1552. X
  1553. XEXTERN long lostpackets;
  1554. X
  1555. X#define SNAPFROM   0  /* Dest Ethernet address */
  1556. X#define SNAPTO    43  /* IPX source socket */
  1557. X#define SNAPLEN   (SNAPTO - SNAPFROM + 1)  /* Save bytes FROM to TO in pkt */
  1558. X
  1559. X#define MAXPKTLEN  1526
  1560. X
  1561. X#ifdef AU_MSDOS
  1562. X/* pkt data structure */
  1563. Xstruct pkt {
  1564. X   unsigned int p_len;
  1565. X   unsigned char p_type,
  1566. X      p_data[SNAPLEN];
  1567. X   };
  1568. X
  1569. XEXTERN struct pkt far *pkts;
  1570. X
  1571. XEXTERN int
  1572. X   maxpkt,  /* Must be a power of 2 */
  1573. X   pktmask,   /* maxpkt-1 */
  1574. X   maxpkthi,  /* maxpkt/256 */
  1575. X   prcv,   /* Index of next pkt to be received (i.e. next empty pkt) */
  1576. X   pproc;  /* Index of next pkt to be processed (i.e. next full pkt) */
  1577. X#endif
  1578. X
  1579. XEXTERN long l_tod;  /* Time of day */
  1580. XEXTERN char tod_h,tod_m,tod_s,
  1581. X   s_tod_h,s_tod_m,s_tod_s;  /* Time when counters last saved */
  1582. X
  1583. XEXTERN int midnight_crossings;
  1584. XEXTERN long boot_time;
  1585. X
  1586. XEXTERN long elapsed_sec;  /* Seconds since counters last saved */
  1587. X
  1588. Xunsigned long uptime(void);  /* Since startup, in centiseconds */
  1589. X
  1590. X#ifdef AU_MSDOS
  1591. Xvoid chart(int tx, int ty,  /* Declared in chart.c */
  1592. X   int bx, int by,
  1593. X   int x1, int x2, int x3);
  1594. X
  1595. Xlong biosticks(void);  /* PC clock ticks */
  1596. X
  1597. X/* 12 bytes interframe space + 8 bytes preamble + 4 byte FCS */
  1598. X#define util_pc(p,b)  (((24l*p + b)/1250l + 5l)/10l)  /* % utilisation */
  1599. X#endif
  1600. X
  1601. X#ifndef NULL
  1602. X#define NULL  0
  1603. X#endif
  1604. X
  1605. X
  1606. END_OF_FILE
  1607.   if test 2839 -ne `wc -c <'netramet/src/meter/include/pktsnap.h'`; then
  1608.     echo shar: \"'netramet/src/meter/include/pktsnap.h'\" unpacked with wrong size!
  1609.   fi
  1610.   # end of 'netramet/src/meter/include/pktsnap.h'
  1611. fi
  1612. if test -f 'netramet/src/snmplib/include/asn1.h' -a "${1}" != "-c" ; then 
  1613.   echo shar: Will not clobber existing file \"'netramet/src/snmplib/include/asn1.h'\"
  1614. else
  1615.   echo shar: Extracting \"'netramet/src/snmplib/include/asn1.h'\" \(3408 characters\)
  1616.   sed "s/^X//" >'netramet/src/snmplib/include/asn1.h' <<'END_OF_FILE'
  1617. X/*
  1618. X * Definitions for Abstract Syntax Notation One, ASN.1
  1619. X * As defined in ISO/IS 8824 and ISO/IS 8825
  1620. X *
  1621. X *
  1622. X */
  1623. X/***********************************************************
  1624. X    Copyright 1988, 1989 by Carnegie Mellon University
  1625. X
  1626. X                      All Rights Reserved
  1627. X
  1628. XPermission to use, copy, modify, and distribute this software and its 
  1629. Xdocumentation for any purpose and without fee is hereby granted, 
  1630. Xprovided that the above copyright notice appear in all copies and that
  1631. Xboth that copyright notice and this permission notice appear in 
  1632. Xsupporting documentation, and that the name of CMU not be
  1633. Xused in advertising or publicity pertaining to distribution of the
  1634. Xsoftware without specific, written prior permission.  
  1635. X
  1636. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1637. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1638. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1639. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1640. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1641. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1642. XSOFTWARE.
  1643. X******************************************************************/
  1644. X
  1645. X#ifdef EIGHTBIT_SUBIDS
  1646. Xtypedef u_char    oid;
  1647. X#define MAX_SUBID   0xFF
  1648. X#elif SIXTEENBIT_SUBIDS
  1649. Xtypedef u_short    oid;
  1650. X#define MAX_SUBID   0xFFFF
  1651. X#else
  1652. Xtypedef u_long    oid;
  1653. X#define MAX_SUBID   0xFFFFFFFF
  1654. X#endif
  1655. X
  1656. X#define MAX_OID_LEN        64    /* max subid's in an oid */
  1657. X
  1658. X#define ASN_BOOLEAN        (0x01)
  1659. X#define ASN_INTEGER        (0x02)
  1660. X#define ASN_BIT_STR        (0x03)
  1661. X#define ASN_OCTET_STR        (0x04)
  1662. X#define ASN_NULL        (0x05)
  1663. X#define ASN_OBJECT_ID        (0x06)
  1664. X#define ASN_SEQUENCE        (0x10)
  1665. X#define ASN_SET            (0x11)
  1666. X
  1667. X#define ASN_UNIVERSAL        (0x00)
  1668. X#define ASN_APPLICATION     (0x40)
  1669. X#define ASN_CONTEXT        (0x80)
  1670. X#define ASN_PRIVATE        (0xC0)
  1671. X
  1672. X#define ASN_PRIMITIVE        (0x00)
  1673. X#define ASN_CONSTRUCTOR        (0x20)
  1674. X
  1675. X#define ASN_LONG_LEN        (0x80)
  1676. X#define ASN_EXTENSION_ID    (0x1F)
  1677. X#define ASN_BIT8        (0x80)
  1678. X
  1679. X#define IS_CONSTRUCTOR(byte)    ((byte) & ASN_CONSTRUCTOR)
  1680. X#define IS_EXTENSION_ID(byte)    (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  1681. X
  1682. Xu_char    *asn_parse_int(u_char *data, int *datalength, u_char *type,
  1683. X   long *intp, int intsize);
  1684. Xu_char  *asn_build_int(u_char *, int *, u_char,
  1685. X   long far *, int);
  1686. X/* u_char  *asn_build_int(u_char *data, int *datalength, u_char type,
  1687. X   long far *intp, int intsize); */
  1688. Xu_char    *asn_parse_string(u_char *, int *, u_char *,
  1689. X   u_char *, int *);
  1690. Xu_char  *asn_build_string(u_char *, int *, u_char,
  1691. X       u_char far *, int);
  1692. X/* u_char  *asn_build_string(u_char *data, int *datalength, u_char type,
  1693. X       u_char far *string, int strlength); */
  1694. Xu_char    *asn_parse_header(u_char *data, int *datalength, u_char *type);
  1695. Xu_char  *asn_build_header(u_char *data, int *datalength, u_char type,
  1696. X       int length);
  1697. Xu_char    *asn_parse_length(u_char *data, u_long *length);
  1698. Xu_char  *asn_build_length(u_char *data, int *datalength,
  1699. X       int length);
  1700. Xu_char    *asn_parse_objid(u_char *, int *, u_char *,
  1701. X   oid *, int *);
  1702. X/* u_char    *asn_parse_objid(u_char *data, int *datalength, u_char *type,
  1703. X   oid *objid, int *objidlength); */
  1704. Xu_char  *asn_build_objid(u_char *data, int *datalength, u_char type,
  1705. X       oid far *objid, int objidlength);
  1706. Xu_char    *asn_parse_null(u_char *data, int *datalength, u_char *type);
  1707. Xu_char  *asn_build_null(u_char *data, int *datalength, u_char type);
  1708. END_OF_FILE
  1709.   if test 3408 -ne `wc -c <'netramet/src/snmplib/include/asn1.h'`; then
  1710.     echo shar: \"'netramet/src/snmplib/include/asn1.h'\" unpacked with wrong size!
  1711.   fi
  1712.   # end of 'netramet/src/snmplib/include/asn1.h'
  1713. fi
  1714. if test -f 'netramet/src/snmplib/include/snmpimpl.h' -a "${1}" != "-c" ; then 
  1715.   echo shar: Will not clobber existing file \"'netramet/src/snmplib/include/snmpimpl.h'\"
  1716. else
  1717.   echo shar: Extracting \"'netramet/src/snmplib/include/snmpimpl.h'\" \(2616 characters\)
  1718.   sed "s/^X//" >'netramet/src/snmplib/include/snmpimpl.h' <<'END_OF_FILE'
  1719. X/*
  1720. X * Definitions for SNMP (RFC 1067) implementation.
  1721. X *
  1722. X *
  1723. X */
  1724. X/***********************************************************
  1725. X    Copyright 1988, 1989 by Carnegie Mellon University
  1726. X
  1727. X                      All Rights Reserved
  1728. X
  1729. XPermission to use, copy, modify, and distribute this software and its 
  1730. Xdocumentation for any purpose and without fee is hereby granted, 
  1731. Xprovided that the above copyright notice appear in all copies and that
  1732. Xboth that copyright notice and this permission notice appear in 
  1733. Xsupporting documentation, and that the name of CMU not be
  1734. Xused in advertising or publicity pertaining to distribution of the
  1735. Xsoftware without specific, written prior permission.  
  1736. X
  1737. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1738. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1739. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1740. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1741. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1742. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1743. XSOFTWARE.
  1744. X******************************************************************/
  1745. X
  1746. X#ifdef NOT_ANSI_C
  1747. X#if (defined vax) || (defined (mips))
  1748. X/*
  1749. X * This is a fairly bogus thing to do, but there seems to be no better way for
  1750. X * compilers that don't understand void pointers.
  1751. X */
  1752. X#define void char
  1753. X#endif
  1754. X#endif
  1755. X
  1756. X/*
  1757. X * Error codes:
  1758. X */
  1759. X/*
  1760. X * These must not clash with SNMP error codes (all positive).
  1761. X */
  1762. X#define PARSE_ERROR    -1
  1763. X#define BUILD_ERROR    -2
  1764. X
  1765. X#define SID_MAX_LEN    64
  1766. X#define MAX_NAME_LEN    64  /* number of subid's in a objid */
  1767. X
  1768. X#ifndef NULL
  1769. X#define NULL 0
  1770. X#endif
  1771. X
  1772. X#ifndef TRUE
  1773. X#define TRUE    1
  1774. X#endif
  1775. X#ifndef FALSE
  1776. X#define FALSE    0
  1777. X#endif
  1778. X
  1779. X#define READ        1
  1780. X#define WRITE        0
  1781. X
  1782. X#define RONLY    0xAAAA    /* read access for everyone */
  1783. X#define RWRITE    0xAABA    /* add write access for community private */
  1784. X#define NOACCESS 0x0000    /* no access for anybody */
  1785. X
  1786. X#define INTEGER        ASN_INTEGER
  1787. X#define STRING        ASN_OCTET_STR
  1788. X#define OBJID        ASN_OBJECT_ID
  1789. X#define NULLOBJ        ASN_NULL
  1790. X
  1791. X/* defined types (from the SMI, RFC 1065) */
  1792. X#define IPADDRESS   (ASN_APPLICATION | 0)
  1793. X#define COUNTER        (ASN_APPLICATION | 1)
  1794. X#define GAUGE        (ASN_APPLICATION | 2)
  1795. X#define TIMETICKS   (ASN_APPLICATION | 3)
  1796. X#define OPAQUE        (ASN_APPLICATION | 4)
  1797. X
  1798. X#ifdef DEBUG
  1799. X#define ERROR(string)    printf("%s(%d): %s",__FILE__, __LINE__, string);
  1800. X#else
  1801. X#define ERROR(string)
  1802. X#endif
  1803. X
  1804. X/* from snmp.c*/
  1805. Xextern u_char    sid[];    /* size SID_MAX_LEN */
  1806. X
  1807. Xu_char    *snmp_parse_var_op();
  1808. Xu_char  *snmp_build_var_op();
  1809. X
  1810. Xu_char    *snmp_auth_parse();
  1811. Xu_char    *snmp_auth_build();
  1812. END_OF_FILE
  1813.   if test 2616 -ne `wc -c <'netramet/src/snmplib/include/snmpimpl.h'`; then
  1814.     echo shar: \"'netramet/src/snmplib/include/snmpimpl.h'\" unpacked with wrong size!
  1815.   fi
  1816.   # end of 'netramet/src/snmplib/include/snmpimpl.h'
  1817. fi
  1818. if test -f 'netramet/src/snmplib/snmpauth.c' -a "${1}" != "-c" ; then 
  1819.   echo shar: Will not clobber existing file \"'netramet/src/snmplib/snmpauth.c'\"
  1820. else
  1821.   echo shar: Extracting \"'netramet/src/snmplib/snmpauth.c'\" \(3057 characters\)
  1822.   sed "s/^X//" >'netramet/src/snmplib/snmpauth.c' <<'END_OF_FILE'
  1823. X/*
  1824. X * snmp_auth.c -
  1825. X *   Authentication for SNMP (RFC 1067).  This implements a null
  1826. X * authentication layer.
  1827. X *
  1828. X *
  1829. X */
  1830. X/***********************************************************
  1831. X    Copyright 1988, 1989 by Carnegie Mellon University
  1832. X
  1833. X                      All Rights Reserved
  1834. X
  1835. XPermission to use, copy, modify, and distribute this software and its 
  1836. Xdocumentation for any purpose and without fee is hereby granted, 
  1837. Xprovided that the above copyright notice appear in all copies and that
  1838. Xboth that copyright notice and this permission notice appear in 
  1839. Xsupporting documentation, and that the name of CMU not be
  1840. Xused in advertising or publicity pertaining to distribution of the
  1841. Xsoftware without specific, written prior permission.  
  1842. X
  1843. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1844. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1845. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1846. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1847. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1848. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1849. XSOFTWARE.
  1850. X******************************************************************/
  1851. X
  1852. X#include "ausnmp.h"
  1853. X
  1854. X#ifdef KINETICS
  1855. X#include "gw.h"
  1856. X#include "fp4/cmdmacro.h"
  1857. X#endif
  1858. X
  1859. X#if (defined(unix) && !defined(KINETICS))
  1860. X#include <sys/types.h>
  1861. X#include <netinet/in.h>
  1862. X#ifndef NULL
  1863. X#define NULL 0
  1864. X#endif
  1865. X#endif
  1866. X
  1867. X#include "asn1.h"
  1868. X#include "snmp.h"
  1869. X#include "snmpimpl.h"
  1870. X
  1871. Xu_char *
  1872. Xsnmp_auth_parse(data, length, sid, slen, version)
  1873. X    u_char        *data;
  1874. X    int            *length;
  1875. X    u_char        *sid;
  1876. X    int            *slen;
  1877. X    long        *version;
  1878. X{
  1879. X    u_char    type;
  1880. X
  1881. X    data = asn_parse_header(data, length, &type);
  1882. X    if (data == NULL){
  1883. X    ERROR("bad header");
  1884. X    return NULL;
  1885. X    }
  1886. X    if (type != (ASN_SEQUENCE | ASN_CONSTRUCTOR)){
  1887. X    ERROR("wrong auth header type");
  1888. X    return NULL;
  1889. X    }
  1890. X    data = asn_parse_int(data, length, &type, version, sizeof(*version));
  1891. X    if (data == NULL){
  1892. X    ERROR("bad parse of version");
  1893. X    return NULL;
  1894. X    }
  1895. X    data = asn_parse_string(data, length, &type, sid, slen);
  1896. X    if (data == NULL){
  1897. X    ERROR("bad parse of community");
  1898. X    return NULL;
  1899. X    }
  1900. X    sid[*slen] = '\0';
  1901. X    return (u_char *)data;
  1902. X}
  1903. X
  1904. Xu_char *
  1905. Xsnmp_auth_build(data, length, sid, slen, version, messagelen)
  1906. X    u_char        *data;
  1907. X    int            *length;
  1908. X    u_char        *sid;
  1909. X    int            *slen;
  1910. X    long        *version;
  1911. X    int            messagelen;
  1912. X{
  1913. X    data = asn_build_header(data, length, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), messagelen + *slen + 5);
  1914. X    if (data == NULL){
  1915. X    ERROR("buildheader");
  1916. X    return NULL;
  1917. X    }
  1918. X    data = asn_build_int(data, length,
  1919. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
  1920. X        (long *)version, sizeof(*version));
  1921. X    if (data == NULL){
  1922. X    ERROR("buildint");
  1923. X    return NULL;
  1924. X    }
  1925. X    data = asn_build_string(data, length,
  1926. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR), 
  1927. X        sid, *slen);
  1928. X    if (data == NULL){
  1929. X    ERROR("buildstring");
  1930. X    return NULL;
  1931. X    }
  1932. X    return (u_char *)data;
  1933. X}
  1934. END_OF_FILE
  1935.   if test 3057 -ne `wc -c <'netramet/src/snmplib/snmpauth.c'`; then
  1936.     echo shar: \"'netramet/src/snmplib/snmpauth.c'\" unpacked with wrong size!
  1937.   fi
  1938.   # end of 'netramet/src/snmplib/snmpauth.c'
  1939. fi
  1940. echo shar: End of archive 23 \(of 25\).
  1941. cp /dev/null ark23isdone
  1942. MISSING=""
  1943. 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
  1944.     if test ! -f ark${I}isdone ; then
  1945.     MISSING="${MISSING} ${I}"
  1946.     fi
  1947. done
  1948. if test "${MISSING}" = "" ; then
  1949.     echo You have unpacked all 25 archives.
  1950.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1951. else
  1952.     echo You still must unpack the following archives:
  1953.     echo "        " ${MISSING}
  1954. fi
  1955. exit 0
  1956. exit 0 # Just in case...
  1957.