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

  1. Newsgroups: comp.sources.misc
  2. From: nevil@ccu1.aukuni.ac.nz (J Nevil Brownlee)
  3. Subject: v40i110:  netramet - Network Traffic Accounting Meter, Part22/25
  4. Message-ID: <1993Nov9.020716.19136@sparky.sterling.com>
  5. X-Md4-Signature: ad7fc0ab101f7ae1a36e3b8fbffa1700
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Tue, 9 Nov 1993 02:07:16 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 110
  13. Archive-name: netramet/part22
  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/NeTraMet/copyright.notice
  21. #   netramet/doc/snmp/snmp_api.3 netramet/examples/rules.UofA
  22. #   netramet/mib/mib.UofA.txt netramet/src/apps/snmp_var_route.c
  23. #   netramet/src/meter/include/met_vars.h
  24. #   netramet/src/snmplib/include/snmpapi.h
  25. #   netramet/src/snmplib/include/snmpvars.h
  26. # Wrapped by kent@sparky on Tue Nov  2 18:17:13 1993
  27. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  28. echo If this archive is complete, you will see the following message:
  29. echo '          "shar: End of archive 22 (of 25)."'
  30. if test -f 'netramet/doc/NeTraMet/copyright.notice' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'netramet/doc/NeTraMet/copyright.notice'\"
  32. else
  33.   echo shar: Extracting \"'netramet/doc/NeTraMet/copyright.notice'\" \(8103 characters\)
  34.   sed "s/^X//" >'netramet/doc/NeTraMet/copyright.notice' <<'END_OF_FILE'
  35. XNeTraMet is free software, distributed under the terms of
  36. Xthe GNU Emacs general public license.  A copy of this is attached; for
  37. X'GNU Emacs' read 'NeTraMet,' for 'Richard M. Stallman' read 'Nevil
  38. XBrownlee,' and for 'Free Software Foundation, Inc.' read 'The
  39. XUniversity of Auckland.'
  40. X
  41. X--------------------------------------------------------------------------
  42. X
  43. X         GNU EMACS GENERAL PUBLIC LICENSE
  44. X            (Clarified 11 Feb 1988)
  45. X
  46. X Copyright (C) 1985, 1987, 1988 Richard M. Stallman
  47. X Everyone is permitted to copy and distribute verbatim copies
  48. X of this license, but changing it is not allowed.  You can also
  49. X use this wording to make the terms for other programs.
  50. X
  51. X  The license agreements of most software companies keep you at the
  52. Xmercy of those companies.  By contrast, our general public license is
  53. Xintended to give everyone the right to share GNU Emacs.  To make
  54. Xsure that you get the rights we want you to have, we need to make
  55. Xrestrictions that forbid anyone to deny you these rights or to ask you
  56. Xto surrender the rights.  Hence this license agreement.
  57. X
  58. X  Specifically, we want to make sure that you have the right to give
  59. Xaway copies of Emacs, that you receive source code or else can get it
  60. Xif you want it, that you can change Emacs or use pieces of it in new
  61. Xfree programs, and that you know you can do these things.
  62. X
  63. X  To make sure that everyone has such rights, we have to forbid you to
  64. Xdeprive anyone else of these rights.  For example, if you distribute
  65. Xcopies of Emacs, you must give the recipients all the rights that you
  66. Xhave.  You must make sure that they, too, receive or can get the
  67. Xsource code.  And you must tell them their rights.
  68. X
  69. X  Also, for our own protection, we must make certain that everyone
  70. Xfinds out that there is no warranty for GNU Emacs.  If Emacs is
  71. Xmodified by someone else and passed on, we want its recipients to know
  72. Xthat what they have is not what we distributed, so that any problems
  73. Xintroduced by others will not reflect on our reputation.
  74. X
  75. X  Therefore we (Richard Stallman and the Free Software Fundation,
  76. XInc.) make the following terms which say what you must do to be
  77. Xallowed to distribute or change GNU Emacs.
  78. X
  79. X            COPYING POLICIES
  80. X
  81. X  1. You may copy and distribute verbatim copies of GNU Emacs source code
  82. Xas you receive it, in any medium, provided that you conspicuously and
  83. Xappropriately publish on each copy a valid copyright notice "Copyright
  84. X(C) 1988 Free Software Foundation, Inc." (or with whatever year is
  85. Xappropriate); keep intact the notices on all files that refer to this
  86. XLicense Agreement and to the absence of any warranty; and give any
  87. Xother recipients of the GNU Emacs program a copy of this License
  88. XAgreement along with the program.  You may charge a distribution fee
  89. Xfor the physical act of transferring a copy.
  90. X
  91. X  2. You may modify your copy or copies of GNU Emacs source code or
  92. Xany portion of it, and copy and distribute such modifications under
  93. Xthe terms of Paragraph 1 above, provided that you also do the following:
  94. X
  95. X    a) cause the modified files to carry prominent notices stating
  96. X    that you changed the files and the date of any change; and
  97. X
  98. X    b) cause the whole of any work that you distribute or publish,
  99. X    that in whole or in part contains or is a derivative of GNU Emacs
  100. X    or any part thereof, to be licensed at no charge to all third
  101. X    parties on terms identical to those contained in this License
  102. X    Agreement (except that you may choose to grant more extensive
  103. X    warranty protection to some or all third parties, at your option).
  104. X
  105. X    c) if the modified program serves as a text editor, cause it when
  106. X    started running in the simplest and usual way, to print an
  107. X    announcement including a valid copyright notice "Copyright (C)
  108. X    1988 Free Software Foundation, Inc." (or with the year that is
  109. X    appropriate), saying that there is no warranty (or else, saying
  110. X    that you provide a warranty) and that users may redistribute the
  111. X    program under these conditions, and telling the user how to view a
  112. X    copy of this License Agreement.
  113. X
  114. X    d) You may charge a distribution fee for the physical act of
  115. X    transferring a copy, and you may at your option offer warranty
  116. X    protection in exchange for a fee.
  117. X
  118. XMere aggregation of another unrelated program with this program (or its
  119. Xderivative) on a volume of a storage or distribution medium does not bring
  120. Xthe other program under the scope of these terms.
  121. X
  122. X  3. You may copy and distribute GNU Emacs (or a portion or derivative of it,
  123. Xunder Paragraph 2) in object code or executable form under the terms of
  124. XParagraphs 1 and 2 above provided that you also do one of the following:
  125. X
  126. X    a) accompany it with the complete corresponding machine-readable
  127. X    source code, which must be distributed under the terms of
  128. X    Paragraphs 1 and 2 above; or,
  129. X
  130. X    b) accompany it with a written offer, valid for at least three
  131. X    years, to give any third party free (except for a nominal
  132. X    shipping charge) a complete machine-readable copy of the
  133. X    corresponding source code, to be distributed under the terms of
  134. X    Paragraphs 1 and 2 above; or,
  135. X
  136. X    c) accompany it with the information you received as to where the
  137. X    corresponding source code may be obtained.  (This alternative is
  138. X    allowed only for noncommercial distribution and only if you
  139. X    received the program in object code or executable form alone.)
  140. X
  141. XFor an executable file, complete source code means all the source code for
  142. Xall modules it contains; but, as a special exception, it need not include
  143. Xsource code for modules which are standard libraries that accompany the
  144. Xoperating system on which the executable file runs.
  145. X
  146. X  4. You may not copy, sublicense, distribute or transfer GNU Emacs
  147. Xexcept as expressly provided under this License Agreement.  Any attempt
  148. Xotherwise to copy, sublicense, distribute or transfer GNU Emacs is void and
  149. Xyour rights to use GNU Emacs under this License agreement shall be
  150. Xautomatically terminated.  However, parties who have received computer
  151. Xsoftware programs from you with this License Agreement will not have
  152. Xtheir licenses terminated so long as such parties remain in full compliance.
  153. X
  154. X  5. If you wish to incorporate parts of GNU Emacs into other free programs
  155. Xwhose distribution conditions are different, write to the Free Software
  156. XFoundation.  We have not yet worked out a simple rule that can be stated
  157. Xhere, but we will often permit this.  We will be guided by the two goals of
  158. Xpreserving the free status of all derivatives of our free software and of
  159. Xpromoting the sharing and reuse of software.
  160. X
  161. XYour comments and suggestions about our licensing policies and our
  162. Xsoftware are welcome!  Please contact the Free Software Foundation, Inc.,
  163. X675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296.
  164. X
  165. X               NO WARRANTY
  166. X
  167. X  BECAUSE GNU EMACS IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
  168. XNO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
  169. XWHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
  170. XRICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE GNU EMACS "AS IS"
  171. XWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  172. XBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  173. XFITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  174. XAND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE GNU EMACS
  175. XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  176. XSERVICING, REPAIR OR CORRECTION.
  177. X
  178. X IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL FREE SOFTWARE
  179. XFOUNDATION, INC., RICHARD M. STALLMAN, AND/OR ANY OTHER PARTY WHO MAY
  180. XMODIFY AND REDISTRIBUTE GNU EMACS AS PERMITTED ABOVE, BE LIABLE TO YOU
  181. XFOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER
  182. XSPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  183. XINABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  184. XBEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
  185. XFAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY
  186. XFREE SOFTWARE FOUNDATION, INC.) THE PROGRAM, EVEN IF YOU HAVE BEEN
  187. XADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
  188. XOTHER PARTY.
  189. X
  190. END_OF_FILE
  191.   if test 8103 -ne `wc -c <'netramet/doc/NeTraMet/copyright.notice'`; then
  192.     echo shar: \"'netramet/doc/NeTraMet/copyright.notice'\" unpacked with wrong size!
  193.   fi
  194.   # end of 'netramet/doc/NeTraMet/copyright.notice'
  195. fi
  196. if test -f 'netramet/doc/snmp/snmp_api.3' -a "${1}" != "-c" ; then 
  197.   echo shar: Will not clobber existing file \"'netramet/doc/snmp/snmp_api.3'\"
  198. else
  199.   echo shar: Extracting \"'netramet/doc/snmp/snmp_api.3'\" \(8220 characters\)
  200.   sed "s/^X//" >'netramet/doc/snmp/snmp_api.3' <<'END_OF_FILE'
  201. X.\* /***********************************************************
  202. X.\"     Copyright 1989 by Carnegie Mellon University
  203. X.\" 
  204. X.\"                       All Rights Reserved
  205. X.\" 
  206. X.\" Permission to use, copy, modify, and distribute this software and its 
  207. X.\" documentation for any purpose and without fee is hereby granted, 
  208. X.\" provided that the above copyright notice appear in all copies and that
  209. X.\" both that copyright notice and this permission notice appear in 
  210. X.\" supporting documentation, and that the name of CMU not be
  211. X.\" used in advertising or publicity pertaining to distribution of the
  212. X.\" software without specific, written prior permission.  
  213. X.\" 
  214. X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  215. X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  216. X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  217. X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  218. X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  219. X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  220. X.\" SOFTWARE.
  221. X.\" ******************************************************************/
  222. X.TH SNMP_API 3 "Sept 17, 1989"
  223. X.UC 5
  224. X.SH NAME
  225. Xsnmp_open, snmp_close, snmp_send, snmp_read, snmp_free_pdu, snmp_select_info, snmp_timeout \- send and receive SNMP messages
  226. X.SH SYNOPSIS
  227. X.B "#include <sys/types>
  228. X.br
  229. X.B "#include <netinet/in.h>
  230. X.br
  231. X.B "#include <sys/time.h>
  232. X.br
  233. X.B #include """snmp.h""
  234. X.br
  235. X.B #include """snmp_impl.h""
  236. X.br
  237. X.B #include """asn1.h""
  238. X.br
  239. X.B #include """snmp_api.c""
  240. X.PP
  241. X.B "extern int snmp_errno;
  242. X.PP
  243. X.B "struct snmp_session *snmp_open(session)
  244. X.br
  245. X.B "struct snmp_session *session;
  246. X.PP
  247. X.B "int snmp_close(session)
  248. X.br
  249. X.B "struct snmp_session *session;
  250. X.PP
  251. X.B "int snmp_send(session, pdu)
  252. X.br
  253. X.B "struct snmp_session *session;
  254. X.br
  255. X.B "struct snmp_pdu *pdu;
  256. X.PP
  257. X.B "void snmp_read(fdset)
  258. X.br
  259. X.B "fd_set *fdset;
  260. X.PP
  261. X.B "int snmp_select_info(numfds, fdset, timeout, block)
  262. X.br
  263. X.B "int *numfds;
  264. X.br
  265. X.B "fd_set *fdset;
  266. X.br
  267. X.B "struct timeval *timeout;
  268. X.br
  269. X.B "int *block;
  270. X.PP
  271. X.B "void snmp_timeout()
  272. X.PP
  273. X.B "void snmp_free_pdu(pdu)
  274. X.br
  275. X.B "struct snmp_pdu *pdu;
  276. X.PP
  277. X.SH DESCRIPTION
  278. X.I Snmp_open, snmp_close,
  279. Xand
  280. X.I snmp_send
  281. Xeach take as input a pointer to an object with the
  282. Xfollowing structure.  In addition,
  283. X.I snmp_open
  284. Xalso returns a pointer to an object with this structure.
  285. XThis structure contains information for a set of transactions that
  286. Xwill share similar transport characteristics.
  287. X.RS
  288. X.PP
  289. X.nf
  290. Xtypedef struct sockaddr_in  ipaddr;
  291. X
  292. Xstruct snmp_session {
  293. X    u_char  *community;    /* community for outgoing requests. */
  294. X    int        community_len;  /* Length of community name. */
  295. X    int        retries;    /* Number of retries before timeout. */
  296. X    long    timeout;    /* Number of uS until first timeout, then exponential backoff */
  297. X    char    *peername;    /* Domain name or dotted IP address of default peer */
  298. X    u_short remote_port;/* UDP port number of peer. */
  299. X    u_short local_port; /* My UDP port number, 0 for default, picked randomly */
  300. X
  301. X    /* Authentication function or NULL if null authentication is used */
  302. X    u_char  *(*authenticator)();
  303. X
  304. X    int        (*callback)();  /* Function to interpret incoming data */
  305. X
  306. X    /* Pointer to data that the callback function may consider important */
  307. X    void    *callback_magic;
  308. X};
  309. X
  310. X/*
  311. X * Set fields in session and pdu to the following to get a default or unconfigured value.
  312. X */
  313. X#define SNMP_DEFAULT_COMMUNITY_LEN  0/* for default community name */
  314. X#define SNMP_DEFAULT_RETRIES        -1
  315. X#define SNMP_DEFAULT_TIMEOUT        -1
  316. X#define SNMP_DEFAULT_REMPORT        0
  317. X#define SNMP_DEFAULT_REQID        0
  318. X#define SNMP_DEFAULT_ERRSTAT        -1
  319. X#define SNMP_DEFAULT_ERRINDEX        -1
  320. X#define SNMP_DEFAULT_ADDRESS        0
  321. X#define SNMP_DEFAULT_PEERNAME        NULL
  322. X#define SNMP_DEFAULT_ENTERPRISE_LENGTH    0
  323. X#define SNMP_DEFAULT_TIME        0
  324. X
  325. X/*
  326. X * This routine must be supplied by the application:
  327. X *
  328. X * u_char *authenticator(pdu, length, community, community_len)
  329. X * u_char *pdu;        The rest of the PDU to be authenticated
  330. X * int *length;        The length of the PDU (updated by the authenticator)
  331. X * u_char *community;    The community name to authenticate under.
  332. X * int    community_len    The length of the community name.
  333. X *
  334. X * Returns the authenticated pdu, or NULL if authentication failed.
  335. X * If null authentication is used, the authenticator in snmp_session can be
  336. X * set to NULL(0).
  337. X */
  338. X
  339. X/*
  340. X * This routine must be supplied by the application:
  341. X *
  342. X * int callback(operation, session, reqid, pdu, magic)
  343. X * int operation;
  344. X * struct snmp_session *session;    The session authenticated under.
  345. X * int reqid;                The request id of this pdu (0 for TRAP)
  346. X * struct snmp_pdu *pdu;        The pdu information.
  347. X * void *magic                A link to the data for this routine.
  348. X *
  349. X * Returns 1 if request was successful, 0 if it should be kept pending.
  350. X * Any data in the pdu must be copied because it will be freed elsewhere.
  351. X * Operations are defined below:
  352. X */
  353. X#define RECEIVED_MESSAGE   1
  354. X#define TIMED_OUT       2
  355. X.ft R
  356. X.ad
  357. X.fi
  358. X.RE
  359. X.PP
  360. X.I Snmp_send
  361. Xand
  362. X.I snmp_free_pdu
  363. Xeach take as input a pointer to an object with the
  364. Xfollowing structure.
  365. XThis structure contains information that describes a transaction
  366. Xthat will be performed over an open session.
  367. X.RS
  368. X.PP
  369. X.nf
  370. Xstruct snmp_pdu {
  371. X    ipaddr  address;    /* Address of peer */
  372. X
  373. X    int        command;    /* Type of this PDU */
  374. X
  375. X    u_long  reqid;    /* Request id */
  376. X    u_long  errstat;    /* Error status */
  377. X    u_long  errindex;    /* Error index */
  378. X
  379. X    /* Trap information */
  380. X    oid        *enterprise;/* System OID */
  381. X    int        enterprise_length;
  382. X    ipaddr  agent_addr;    /* address of object generating trap */
  383. X    int        trap_type;    /* trap type */
  384. X    int        specific_type;  /* specific type */
  385. X    u_long  time;    /* Uptime */
  386. X
  387. X    struct variable_list *variables;
  388. X};
  389. X
  390. X
  391. Xstruct variable_list {
  392. X    struct variable_list *next_variable;    /* NULL for last variable */
  393. X    oid        *name;  /* Object identifier of variable */
  394. X    int        name_length;    /* number of subid's in name */
  395. X    u_char  type;   /* ASN type of variable */
  396. X    union { /* value of variable */
  397. X    long    *integer;
  398. X    u_char    *string;
  399. X    oid    *objid;
  400. X    } val;
  401. X    int        val_len;
  402. X};
  403. X.ft R
  404. X.ad
  405. X.fi
  406. X.RE
  407. X.PP
  408. X.I Snmp_read, snmp_select_info,
  409. Xand
  410. X.I snmp_timeout
  411. Xprovide an interface for the use of the
  412. X.IR select (2)
  413. Xsystem call so that SNMP transactions can occur asynchronously.
  414. X.PP
  415. X.I Snmp_select_info
  416. Xis given the information that would have been passed to
  417. X.I select
  418. Xin the absence of SNMP.  For example, this might include window update information.
  419. XThis information is modified so that SNMP will get the service it requires from the
  420. Xcall to
  421. X.I select.
  422. XIn this case,
  423. X.I numfds, fdset,
  424. Xand
  425. X.I timeout
  426. Xcorrespond to the
  427. X.I nfds, readfds,
  428. Xand
  429. X.I timeout
  430. Xarguments to
  431. X.I select,
  432. Xrespectively.  The only exception is that timeout must always point to an allocated (but perhaps uninitialized)
  433. X.I struct timeval.
  434. XIf
  435. X.I timeout
  436. Xwould have been passed as NULL,
  437. X.I block
  438. Xis set to true, and
  439. X.I timeout
  440. Xis treated as undefined.  This same rule applies upon return from
  441. X.I snmp_select_info.
  442. X.PP
  443. XAfter calling
  444. X.I snmp_select_info, select
  445. Xis called with the returned data.  When select returns,
  446. X.I snmp_read
  447. Xis called with the
  448. X.I fd_set
  449. Xreturned from
  450. X.I select.
  451. XThis will read all SNMP sockets with input.
  452. XIf
  453. X.I select
  454. Xtimes out,
  455. X.I snmp_timeout
  456. Xshould be called to see if the timeout was intended for SNMP.
  457. X.SH DIAGNOSTICS
  458. X.PP
  459. XError return status from 
  460. X.I snmp_open
  461. Xis indicated by return of a null pointer.
  462. XError return status from 
  463. X.I snmp_close
  464. Xand
  465. X.I snmp_send
  466. Xis indicated by return of 0.  A successful status will return a 1.
  467. XThe external integer
  468. X.IR snmp_errno
  469. Xmay then be checked to see what type of error has occurred
  470. X.PP
  471. X.IR snmp_errno
  472. Xcan have the following values:
  473. X.RS
  474. X.IP SNMPERR_GENERR \w'SNMPERR_BAD_LOCPORT'u+2n
  475. XA generic error occurred.
  476. X.IP SNMPERR_BAD_LOCPORT \w'SNMPERR_BAD_LOCPORT'u+2n
  477. XThe local port was bad because it had already been
  478. Xallocated or permission was denied.
  479. X.IP SNMPERR_BAD_ADDRESS \w'SNMPERR_BAD_LOCPORT'u+2n
  480. XThe host name or address given was not useable.
  481. X.IP SNMPERR_BAD_SESSION \w'SNMPERR_BAD_SESSION'u+2n
  482. XThe specified session was not open.
  483. X.RE
  484. X.SH "SEE ALSO"
  485. Xselect(2), snmp_api.h
  486. END_OF_FILE
  487.   if test 8220 -ne `wc -c <'netramet/doc/snmp/snmp_api.3'`; then
  488.     echo shar: \"'netramet/doc/snmp/snmp_api.3'\" unpacked with wrong size!
  489.   fi
  490.   # end of 'netramet/doc/snmp/snmp_api.3'
  491. fi
  492. if test -f 'netramet/examples/rules.UofA' -a "${1}" != "-c" ; then 
  493.   echo shar: Will not clobber existing file \"'netramet/examples/rules.UofA'\"
  494. else
  495.   echo shar: Extracting \"'netramet/examples/rules.UofA'\" \(6310 characters\)
  496.   sed "s/^X//" >'netramet/examples/rules.UofA' <<'END_OF_FILE'
  497. X#  1440, Fri 1 Oct 93
  498. X#
  499. X#  Rule specification file to tally traffic for Auckland, using
  500. X#     three groups of sites: UA, Local, NZ
  501. X#
  502. X#  Nevil Brownlee,  Computer Centre,  University of Auckland
  503. X#
  504. XSET 8  # Rule + action set number
  505. X#
  506. XRULES
  507. X#
  508. XSourcePeerType & 255 = IP :   Pushto,  7;  #   1
  509. XNull & 0 = 0 :               Succeed,  0;  #   2  Ignore
  510. X#
  511. XNull & 0 = 0 :               Succeed,  0;  #   3  Ignore
  512. XNull & 0 = 0 :               Succeed,  0;  #   4  Ignore
  513. XNull & 0 = 0 :               Succeed,  0;  #   5  Ignore
  514. XNull & 0 = 0 :               Succeed,  0;  #   6  Ignore
  515. X#
  516. XSourcePeerAddress & 255.255.0.0 = 130.216.0.0 :  Pushto, 33  #   7  UA
  517. X#
  518. XSourcePeerAddress & 255.255.255.0 = 192.156.165.0 :  Pushto, 31  #  8 decus
  519. XSourcePeerAddress & 255.255.255.0 = 192.251.230.0 :  Pushto, 31  #  9 clearfield
  520. XSourcePeerAddress & 255.255.255.0 = 202.12.104.0 :  Pushto, 31  # 10 dse
  521. XSourcePeerAddress & 255.255.255.0 = 202.12.105.0 :  Pushto, 31  # 11 f&p
  522. XSourcePeerAddress & 255.255.255.0 = 202.14.100.0 :  Pushto, 31  # 12 status
  523. XSourcePeerAddress & 255.255.255.0 = 202.14.102.0 :  Pushto, 31  # 13 kcbbs
  524. XSourcePeerAddress & 255.255.255.0 = 202.14.216.0 :  Pushto, 31  # 14 manakau
  525. XSourcePeerAddress & 255.255.255.0 = 202.14.217.0 :  Pushto, 31  # 15 maleficarun
  526. XSourcePeerAddress & 255.255.255.0 = 202.14.252.0 :  Pushto, 31  # 16 cray 1
  527. XSourcePeerAddress & 255.255.255.0 = 202.14.253.0 :  Pushto, 31  # 17 cray 2
  528. XSourcePeerAddress & 255.255.255.0 = 202.14.254.0 :  Pushto, 31  # 18 cray 3
  529. X#
  530. XSourcePeerAddress & 255.255.0.0 = 156.62.0.0 :  Pushto, 31  #  19 ati
  531. X#
  532. X# Source isn't UA or local
  533. X#
  534. XNull & 0 = 0 :                  Fail,  0;  #  20  Try match again
  535. X#
  536. XNull & 0 = 0 :               Succeed,  0;  #  21
  537. XNull & 0 = 0 :               Succeed,  0;  #  22
  538. XNull & 0 = 0 :               Succeed,  0;  #  23
  539. XNull & 0 = 0 :               Succeed,  0;  #  24
  540. XNull & 0 = 0 :               Succeed,  0;  #  25
  541. XNull & 0 = 0 :               Succeed,  0;  #  26
  542. XNull & 0 = 0 :               Succeed,  0;  #  27
  543. XNull & 0 = 0 :               Succeed,  0;  #  28
  544. XNull & 0 = 0 :               Succeed,  0;  #  29
  545. XNull & 0 = 0 :               Succeed,  0;  #  30
  546. X#
  547. X# Source is local
  548. X#
  549. XDestPeerAddress & 255.255.0.0 = 130.216.0.0 :  Fail,  0;  #  31  Retry match
  550. XNull & 0 = 0 :                 Pushto,  34;  #  32  Tally packet
  551. X#
  552. X# Source is UA
  553. X#
  554. XDestPeerAddress & 255.255.0.0 = 130.216.0.0 :  Count, 0;  #  33  UA-UA
  555. X#
  556. X# Direction determined; tally the packet
  557. X#
  558. XDestPeerAddress & 140.200.0.0 = 255.255.0.0 : Pushto, 48;  #  34  Tuia: tally C
  559. X#
  560. XDestPeerAddress & 192.0.0.0 = 192.0.0.0 :   Pushto, 49;  #  35  Tally C
  561. XDestPeerAddress & 192.0.0.0 = 128.0.0.0 :   Pushto, 43;  #  36  Tally B
  562. X#
  563. XSourceDetailType & 255 = icmp :            Tally,   4;  #  37  Tally A
  564. XSourceDetailAddress & 255.255 = domain :   Tally,   7;  #  38
  565. XDestDetailAddress & 255.255 = domain :     Tally,   7;  #  39
  566. XDestDetailAddress & 255.255 = ftpdata :    Tally,  10;  #  40
  567. XSourceDetailAddress & 255.255 = ftpdata :  Tally,  13;  #  41
  568. XNull & 0 = 0 :                             Tally,   1;  #  42
  569. X#
  570. XSourceDetailType & 255 = icmp :            Tally,   5;  #  43  Tally B
  571. XSourceDetailAddress & 255.255 = domain :   Tally,   8;  #  44
  572. XDestDetailAddress & 255.255 = domain :     Tally,   8;  #  45
  573. XDestDetailAddress & 255.255 = ftpdata :    Tally,  11;  #  46
  574. XSourceDetailAddress & 255.255 = ftpdata :  Tally,  14;  #  47
  575. XNull & 0 = 0 :                             Tally,   2;  #  48
  576. X#
  577. XSourceDetailType & 255 = icmp :            Tally,   6;  #  49 Tally C
  578. XSourceDetailAddress & 255.255 = domain :   Tally,   9;  #  50
  579. XDestDetailAddress & 255.255 = domain :     Tally,   9;  #  51
  580. XDestDetailAddress & 255.255 = ftpdata :    Tally,  12;  #  52
  581. XSourceDetailAddress & 255.255 = ftpdata :  Tally,  15;  #  53
  582. XNull & 0 = 0 :                             Tally,   3;  #  54
  583. X#
  584. XACTIONS
  585. X#
  586. XSourcePeerMask=255.255.255.0, DestPeerMask=255.0.0.0,  #  1 Tally ports A
  587. X   SourceDetailTypeMask=255, 
  588. X   SourceDetailMask=255.255, DestDetailMask=255.255;
  589. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.0.0,  #  2 Tally ports B
  590. X   SourceDetailTypeMask=255, 
  591. X   SourceDetailMask=255.255, DestDetailMask=255.255;
  592. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.255.0,  #  3 Tally ports C
  593. X   SourceDetailTypeMask=255, 
  594. X   SourceDetailMask=255.255, DestDetailMask=255.255;
  595. X#
  596. XSourcePeerMask=255.255.255.0, DestPeerMask=255.0.0.0,  #  4 Tally icmp A
  597. X   SourceDetailType=icmp, DestDetailType=icmp;
  598. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.0.0,  #  5 Tally icmp B
  599. X   SourceDetailType=icmp, DestDetailType=icmp;
  600. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.255.0,  #  6 Tally icmp C
  601. X   SourceDetailType=icmp, DestDetailType=icmp;
  602. X#
  603. XSourcePeerMask=255.255.255.0, DestPeerMask=255.0.0.0,  #  7 Tally domain A
  604. X   SourceDetailTypeMask=255, 
  605. X   SourceDetailAddress=domain, DestDetailAddress=domain;
  606. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.0.0,  #  8 Tally domain B
  607. X   SourceDetailTypeMask=255, 
  608. X   SourceDetailAddress=domain, DestDetailAddress=domain;
  609. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.255.0,  #  9 Tally domain C
  610. X   SourceDetailTypeMask=255, 
  611. X   SourceDetailAddress=domain, DestDetailAddress=domain;
  612. X#
  613. XSourcePeerMask=255.255.255.0, DestPeerMask=255.0.0.0,  # 10 Tally ftp in A
  614. X   SourceDetailTypeMask=255, DestDetailAddress=ftpdata;
  615. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.0.0,  # 11 Tally ftp in B
  616. X   SourceDetailTypeMask=255, DestDetailAddress=ftpdata;
  617. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.255.0,  # 12 Tally ftp in C
  618. X   SourceDetailTypeMask=255, DestDetailAddress=ftpdata;
  619. X#
  620. XSourcePeerMask=255.255.255.0, DestPeerMask=255.0.0.0,  # 13 Tally ftp out A
  621. X   SourceDetailTypeMask=255, SourceDetailAddress=ftpdata;
  622. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.0.0,  # 14 Tally ftp out B
  623. X   SourceDetailTypeMask=255, SourceDetailAddress=ftpdata;
  624. XSourcePeerMask=255.255.255.0, DestPeerMask=255.255.255.0,  # 15 Tally ftp out C
  625. X   SourceDetailTypeMask=255, SourceDetailAddress=ftpdata;
  626. X#
  627. XFORMAT FlowRuleSet FlowIndex FirstTime "  "
  628. X#  SourceAdjacentAddress DestAdjacentAddress "  "
  629. X#  SourcePeerType 
  630. X   SourcePeerAddress DestPeerAddress "  "
  631. X   SourceDetailType SourceDetailAddress DestDetailAddress "  "
  632. X   ToPDUs FromPDUs "  " ToOctets FromOctets;
  633. X#
  634. XSTATISTICS  #  Collect meter statistics
  635. X#
  636. X# end of file
  637. END_OF_FILE
  638.   if test 6310 -ne `wc -c <'netramet/examples/rules.UofA'`; then
  639.     echo shar: \"'netramet/examples/rules.UofA'\" unpacked with wrong size!
  640.   fi
  641.   # end of 'netramet/examples/rules.UofA'
  642. fi
  643. if test -f 'netramet/mib/mib.UofA.txt' -a "${1}" != "-c" ; then 
  644.   echo shar: Will not clobber existing file \"'netramet/mib/mib.UofA.txt'\"
  645. else
  646.   echo shar: Extracting \"'netramet/mib/mib.UofA.txt'\" \(3743 characters\)
  647.   sed "s/^X//" >'netramet/mib/mib.UofA.txt' <<'END_OF_FILE'
  648. X   -- Auckland University Monitor MIB
  649. X   -- Nevil Brownlee, 5 Oct 93
  650. X
  651. X   UofAuckland OBJECT IDENTIFIER ::= { enterprises 411 }
  652. X
  653. X   MeterStats OBJECT IDENTIFIER ::= { UofAuckland 1 }
  654. X
  655. X   msStatsReset OBJECT-TYPE    -- Write to zero statistics counters
  656. X      SYNTAX  INTEGER
  657. X      ACCESS  read-write
  658. X      STATUS  mandatory
  659. X      ::= { MeterStats 1 }
  660. X
  661. X   msStatsTime OBJECT-TYPE    -- Seconds since stats counters were zeroed
  662. X      SYNTAX  INTEGER
  663. X      ACCESS  read-only
  664. X      STATUS  mandatory
  665. X      ::= { MeterStats 2 }
  666. X
  667. X   msNbrPackets OBJECT-TYPE    -- Nbr of packets this stats interval
  668. X      SYNTAX  INTEGER
  669. X      ACCESS  read-only
  670. X      STATUS  mandatory
  671. X      ::= { MeterStats 3 }
  672. X
  673. X   msTotalPacketBacklog OBJECT-TYPE  -- Sum of pkt backlogs this stats interval
  674. X      SYNTAX  INTEGER
  675. X      ACCESS  read-only
  676. X      STATUS  mandatory
  677. X      ::= { MeterStats 4 }
  678. X
  679. X   msMaxPacketRate OBJECT-TYPE    -- Max packet rate this stats interval
  680. X      SYNTAX  INTEGER
  681. X      ACCESS  read-only
  682. X      STATUS  mandatory
  683. X      ::= { MeterStats 5 }
  684. X
  685. X   msMaxPacketBacklog OBJECT-TYPE  -- Max packet backlog this stats interval
  686. X      SYNTAX  INTEGER
  687. X      ACCESS  read-only
  688. X      STATUS  mandatory
  689. X      ::= { MeterStats 6 }
  690. X
  691. X   msNbrFlows OBJECT-TYPE        -- Nbr of flows currently in use
  692. X      SYNTAX  INTEGER
  693. X      ACCESS  read-only
  694. X      STATUS  mandatory
  695. X      ::= { MeterStats 7 }
  696. X
  697. X   msFlowsRecovered OBJECT-TYPE    -- Flows recovered during this stats interval
  698. X      SYNTAX  INTEGER
  699. X      ACCESS  read-only
  700. X      STATUS  mandatory
  701. X      ::= { MeterStats 8 }
  702. X
  703. X   msRuleMatches OBJECT-TYPE    -- Rules matched during this stats interval
  704. X      SYNTAX  INTEGER
  705. X      ACCESS  read-only
  706. X      STATUS  mandatory
  707. X      ::= { MeterStats 9 }
  708. X
  709. X   msHashSearches OBJECT-TYPE    -- Tally hash searches this stats interval
  710. X      SYNTAX  INTEGER
  711. X      ACCESS  read-only
  712. X      STATUS  mandatory
  713. X      ::= { MeterStats 10 }
  714. X
  715. X   msHashCompares OBJECT-TYPE    -- Compares for tally searches this interval
  716. X      SYNTAX  INTEGER
  717. X      ACCESS  read-only
  718. X      STATUS  mandatory
  719. X      ::= { MeterStats 11 }
  720. X
  721. X   msTotalHashSize OBJECT-TYPE    -- Current sum of tally hash table sizes
  722. X      SYNTAX  INTEGER
  723. X      ACCESS  read-only
  724. X      STATUS  mandatory
  725. X      ::= { MeterStats 12 }
  726. X
  727. X   msNbrHashEntries OBJECT-TYPE    -- Nbr of in-use slots in tally hash tables
  728. X      SYNTAX  INTEGER
  729. X      ACCESS  read-only
  730. X      STATUS  mandatory
  731. X      ::= { MeterStats 13 }
  732. X
  733. X   msGarbageCollectInterval OBJECT-TYPE  -- Seconds between G.C. invocations
  734. X      SYNTAX  INTEGER
  735. X      ACCESS  read-write
  736. X      STATUS  mandatory
  737. X      ::= { MeterStats 14 }
  738. X
  739. X   msMaxFlows OBJECT-TYPE  -- Max nbr of flows in meter's flows table
  740. X      SYNTAX  INTEGER
  741. X      ACCESS  read-only
  742. X      STATUS  mandatory
  743. X      ::= { MeterStats 15 }
  744. X
  745. X   msAvIdlePer1000 OBJECT-TYPE  -- Average idle processor % * 10
  746. X      SYNTAX  INTEGER
  747. X      ACCESS  read-only
  748. X      STATUS  mandatory
  749. X      ::= { MeterStats 16 }
  750. X
  751. X   msMinIdlePer1000 OBJECT-TYPE  -- Minimum idels processor % * 10
  752. X      SYNTAX  INTEGER
  753. X      ACCESS  read-only
  754. X      STATUS  mandatory
  755. X      ::= { MeterStats 17 }
  756. X
  757. X
  758. X   pcSystem OBJECT IDENTIFIER ::= { UofAuckland 2 }
  759. X
  760. X   pcNearMem OBJECT-TYPE
  761. X      SYNTAX  INTEGER
  762. X      ACCESS  read-only
  763. X      STATUS  mandatory
  764. X      ::= { pcSystem 1 }
  765. X
  766. X   pcFarMem OBJECT-TYPE
  767. X      SYNTAX  INTEGER
  768. X      ACCESS  read-only
  769. X      STATUS  mandatory
  770. X      ::= { pcSystem 2 }
  771. X
  772. X   pcBadPackets OBJECT-TYPE
  773. X      SYNTAX  INTEGER
  774. X      ACCESS  read-only
  775. X      STATUS  mandatory
  776. X      ::= { pcSystem 3 }
  777. X
  778. X   pcNoBufPackets OBJECT-TYPE
  779. X      SYNTAX  INTEGER
  780. X      ACCESS  read-only
  781. X      STATUS  mandatory
  782. X      ::= { pcSystem 4 }
  783. X
  784. X   pcLostPackets OBJECT-TYPE
  785. X      SYNTAX  INTEGER
  786. X      ACCESS  read-only
  787. X      STATUS  mandatory
  788. X      ::= { pcSystem 5 }
  789. END_OF_FILE
  790.   if test 3743 -ne `wc -c <'netramet/mib/mib.UofA.txt'`; then
  791.     echo shar: \"'netramet/mib/mib.UofA.txt'\" unpacked with wrong size!
  792.   fi
  793.   # end of 'netramet/mib/mib.UofA.txt'
  794. fi
  795. if test -f 'netramet/src/apps/snmp_var_route.c' -a "${1}" != "-c" ; then 
  796.   echo shar: Will not clobber existing file \"'netramet/src/apps/snmp_var_route.c'\"
  797. else
  798.   echo shar: Extracting \"'netramet/src/apps/snmp_var_route.c'\" \(8556 characters\)
  799.   sed "s/^X//" >'netramet/src/apps/snmp_var_route.c' <<'END_OF_FILE'
  800. X/*
  801. X * snmp_var_route.c - return a pointer to the named variable.
  802. X *
  803. X *
  804. X */
  805. X/***********************************************************
  806. X    Copyright 1988, 1989 by Carnegie Mellon University
  807. X    Copyright 1989    TGV, Incorporated
  808. X
  809. X              All Rights Reserved
  810. X
  811. XPermission to use, copy, modify, and distribute this software and its
  812. Xdocumentation for any purpose and without fee is hereby granted,
  813. Xprovided that the above copyright notice appear in all copies and that
  814. Xboth that copyright notice and this permission notice appear in
  815. Xsupporting documentation, and that the name of CMU and TGV not be used
  816. Xin advertising or publicity pertaining to distribution of the software
  817. Xwithout specific, written prior permission.
  818. X
  819. XCMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  820. XINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  821. XEVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  822. XCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  823. XUSE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  824. XOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  825. XPERFORMANCE OF THIS SOFTWARE.
  826. X******************************************************************/
  827. X
  828. X#define GATEWAY            /* MultiNet is always configured this way! */
  829. X#include <sys/types.h>
  830. X#include <sys/socket.h>
  831. X#include <sys/time.h>
  832. X#include <netinet/in.h>
  833. X#include <syslog.h>
  834. X/* #include <sys/mbuf.h> */
  835. X#include <net/if.h>
  836. X#define KERNEL        /* to get routehash and RTHASHSIZ */
  837. X#include <net/route.h>
  838. X#undef    KERNEL
  839. X#define rt_unit rt_hash               /* Reuse this field for device # */
  840. X#include <nlist.h>
  841. X#ifndef NULL
  842. X#define NULL 0
  843. X#endif
  844. X
  845. X#define CACHE_TIME (120)        /* Seconds */
  846. X
  847. X#include "ausnmp.h"
  848. X
  849. X#include "asn1.h"
  850. X#include "snmp.h"
  851. X#include "snmpimpl.h"
  852. X#include "mib.h"
  853. X#include "snmp_vars.h"
  854. X
  855. Xstatic struct rtentry **rthead=0;
  856. Xstatic int rtsize=0, rtalloc=0;
  857. X
  858. Xstatic struct nlist nl[] = {
  859. X#define N_RTHOST       0
  860. X    { "_rthost" },
  861. X#define N_RTNET        1
  862. X    { "_rtnet" },
  863. X#define N_RTHASHSIZE    2
  864. X    { "_rthashsize" },
  865. X    0,
  866. X};
  867. X
  868. Xu_char *
  869. Xvar_ipRouteEntry(vp, name, length, exact, var_len, access_method)
  870. X    register struct variable *vp;   /* IN - pointer to variable entry that points here */
  871. X    register oid    *name;        /* IN/OUT - input name requested, output name found */
  872. X    register int    *length;    /* IN/OUT - length of input and output strings */
  873. X    int            exact;        /* IN - TRUE if an exact match was requested. */
  874. X    int            *var_len;   /* OUT - length of variable or 0 if function returned. */
  875. X    int            *access_method; /* OUT - 1 if function, 0 if char pointer. */
  876. X{
  877. X    /*
  878. X     * object identifier is of form:
  879. X     * 1.3.6.1.2.1.4.21.1.1.A.B.C.D,  where A.B.C.D is IP address.
  880. X     * IPADDR starts at offset 10.
  881. X     */
  882. X    register int Save_Valid, result, RtIndex;
  883. X    static int saveNameLen=0, saveExact=0, saveRtIndex=0;
  884. X    static oid saveName[14], Current[14];
  885. X    u_char *cp;
  886. X    oid *op;
  887. X
  888. X
  889. X    /*
  890. X     *    OPTIMIZATION:
  891. X     *
  892. X     *    If the name was the same as the last name, with the possible
  893. X     *    exception of the [9]th token, then don't read the routing table
  894. X     *
  895. X     */
  896. X
  897. X    if ((saveNameLen == *length) && (saveExact == exact)) {
  898. X    register int temp=name[9];
  899. X    name[9] = 0;
  900. X    Save_Valid = (compare(name, *length, saveName, saveNameLen) == 0);
  901. X    name[9] = temp;
  902. X    } else Save_Valid = 0;
  903. X
  904. X    if (Save_Valid) {
  905. X    register int temp=name[9];    /* Fix up 'lowest' found entry */
  906. X    bcopy((char *) Current, (char *) name, 14 * sizeof(oid));
  907. X    name[9] = temp;
  908. X    *length = 14;
  909. X    RtIndex = saveRtIndex;
  910. X    } else {
  911. X    /* fill in object part of name for current (less sizeof instance part) */
  912. X
  913. X    bcopy((char *)vp->name, (char *)Current, (int)(vp->namelen - 4) * sizeof(oid));
  914. X
  915. X#if 0
  916. X    /*
  917. X     *  Only reload if this is the start of a wildcard
  918. X     */
  919. X    if (*length < 14) {
  920. X        Route_Scan_Reload();
  921. X    }
  922. X#else
  923. X        Route_Scan_Reload();
  924. X#endif
  925. X    for(RtIndex=0; RtIndex < rtsize; RtIndex++) {
  926. X        cp = (u_char *)&(((struct sockaddr_in *) &(rthead[RtIndex]->rt_dst))->sin_addr.s_addr);
  927. X        op = Current + 10;
  928. X        *op++ = *cp++;
  929. X        *op++ = *cp++;
  930. X        *op++ = *cp++;
  931. X        *op++ = *cp++;
  932. X
  933. X        result = compare(name, *length, Current, 14);
  934. X        if ((exact && (result == 0)) || (!exact && (result < 0)))
  935. X        break;
  936. X    }
  937. X    if (RtIndex >= rtsize) return(NULL);
  938. X    /*
  939. X     *  Save in the 'cache'
  940. X     */
  941. X    bcopy((char *) name, (char *) saveName, *length * sizeof(oid));
  942. X    saveName[9] = '\0';
  943. X    saveNameLen = *length;
  944. X    saveExact = exact;
  945. X    saveRtIndex = RtIndex;
  946. X    /*
  947. X     *  Return the name
  948. X     */
  949. X    bcopy((char *) Current, (char *) name, 14 * sizeof(oid));
  950. X    *length = 14;
  951. X    }
  952. X
  953. X    *access_method = 0;
  954. X    *var_len = sizeof(long_return);
  955. X    switch(vp->magic){
  956. X    case IPROUTEDEST:
  957. X        return(u_char *) &((struct sockaddr_in *) &rthead[RtIndex]->rt_dst)->sin_addr.s_addr;
  958. X    case IPROUTEIFINDEX:
  959. X        long_return = rthead[RtIndex]->rt_unit;
  960. X        return (u_char *)&long_return;
  961. X    case IPROUTEMETRIC1:
  962. X        long_return = (rthead[RtIndex]->rt_flags & RTF_GATEWAY) ? 1 : 0;
  963. X        return (u_char *)&long_return;
  964. X    case IPROUTEMETRIC2:
  965. X        long_return = -1;
  966. X        return (u_char *)&long_return;
  967. X    case IPROUTEMETRIC3:
  968. X        long_return = -1;
  969. X        return (u_char *)&long_return;
  970. X    case IPROUTEMETRIC4:
  971. X        long_return = -1;
  972. X        return (u_char *)&long_return;
  973. X    case IPROUTENEXTHOP:
  974. X        return(u_char *) &((struct sockaddr_in *) &rthead[RtIndex]->rt_gateway)->sin_addr.s_addr;
  975. X    case IPROUTETYPE:
  976. X        long_return = (rthead[RtIndex]->rt_flags & RTF_GATEWAY) ? 4 : 3;
  977. X        return (u_char *)&long_return;
  978. X    case IPROUTEPROTO:
  979. X        long_return = (rthead[RtIndex]->rt_flags & RTF_DYNAMIC) ? 4 : 2;
  980. X        return (u_char *)&long_return;
  981. X    case IPROUTEAGE:
  982. X        long_return = 0;
  983. X        return (u_char *)&long_return;
  984. X    default:
  985. X        ERROR("");
  986. X   }
  987. X   return NULL;
  988. X}
  989. X
  990. Xinit_routes(){
  991. X
  992. X    nlist("/vmunix",nl);
  993. X}
  994. X
  995. Xstatic Route_Scan_Reload()
  996. X{
  997. X#ifdef XXYYZZ
  998. X    struct mbuf **routehash, mb;
  999. X    register struct mbuf *m;
  1000. X    struct ifnet ifnet;
  1001. X    struct rtentry *rt;
  1002. X    int i, table, qsort_compare();
  1003. X    register char *cp;
  1004. X    char name[16], temp[16];
  1005. X    static int Time_Of_Last_Reload=0;
  1006. X    struct timeval now;
  1007. X    int hashsize;
  1008. X
  1009. X    gettimeofday(&now, (struct timezone *)0);
  1010. X    if (Time_Of_Last_Reload+CACHE_TIME > now.tv_sec)
  1011. X        return;
  1012. X    Time_Of_Last_Reload =  now.tv_sec;
  1013. X
  1014. X    /*
  1015. X     *  Makes sure we have SOME space allocated for new routing entries
  1016. X     */
  1017. X    if (!rthead) {
  1018. X        rthead = (struct rtentry **) malloc(100 * sizeof(struct rtentry *));
  1019. X        bzero((char *)rthead, 100 * sizeof(struct rtentry *));
  1020. X        rtalloc = 100;
  1021. X    }
  1022. X
  1023. X    for (table=N_RTHOST; table<=N_RTNET; table++) {
  1024. X        klseek(nl[N_RTHASHSIZE].n_value);
  1025. X        klread((char *)&hashsize, sizeof(hashsize));
  1026. X        routehash = (struct mbuf **)malloc(hashsize * sizeof(struct mbuf *));
  1027. X        klseek(nl[table].n_value);
  1028. X        klread((char *)routehash, hashsize * sizeof(struct mbuf *));
  1029. X        for (i = 0; i < hashsize; i++) {
  1030. X        if (routehash[i] == 0)
  1031. X            continue;
  1032. X        m = routehash[i];
  1033. X        while (m) {
  1034. X            /*
  1035. X             *    Dig the route out of the kernel...
  1036. X             */
  1037. X            klseek(m);
  1038. X            klread(&mb, sizeof (mb));
  1039. X            m = mb.m_next;
  1040. X            rt = mtod(&mb, struct rtentry *);
  1041. X            if (rt->rt_ifp != 0) {
  1042. X            klseek(rt->rt_ifp);
  1043. X            klread((char *)&ifnet, sizeof (ifnet));
  1044. X            klseek((int)ifnet.if_name);
  1045. X            klread(name, 16);
  1046. X            name[15] = '\0';
  1047. X            cp = (char *) index(name, '\0');
  1048. X            *cp++ = ifnet.if_unit + '0';
  1049. X            *cp = '\0';
  1050. X/*            if (strcmp(name,"lo0") == 0) continue; */
  1051. X            Interface_Scan_Init();
  1052. X            while (Interface_Scan_Next(&rt->rt_unit, temp, 0, 0) != 0) {
  1053. X                if (strcmp(name, temp) == 0) break;
  1054. X            }
  1055. X            }
  1056. X            /*
  1057. X             *    Allocate a block to hold it and add it to the database
  1058. X             */
  1059. X            if (rtsize >= rtalloc) {
  1060. X            rthead = (struct rtentry **) realloc((char *)rthead, 2 * rtalloc * sizeof(struct rtentry *));
  1061. X            bzero((char *) &rthead[rtalloc], rtalloc * sizeof(struct rtentry *));
  1062. X            rtalloc *= 2;
  1063. X            }
  1064. X            if (!rthead[rtsize])
  1065. X            rthead[rtsize] = (struct rtentry *) malloc(sizeof(struct rtentry));
  1066. X            /*
  1067. X             *    Add this to the database
  1068. X             */
  1069. X            bcopy((char *)rt, (char *)rthead[rtsize], sizeof(struct rtentry));
  1070. X            rtsize++;
  1071. X        }
  1072. X        }
  1073. X    }
  1074. X    /*
  1075. X     *  Sort it!
  1076. X     */
  1077. X    qsort((char *)rthead,rtsize,sizeof(rthead[0]),qsort_compare);
  1078. X#endif /* $$$ */
  1079. X}
  1080. X
  1081. X
  1082. X
  1083. X/*
  1084. X *    Create a host table
  1085. X */
  1086. Xstatic int qsort_compare(r1,r2)
  1087. Xstruct rtentry **r1, **r2;
  1088. X{
  1089. X    register u_long dst1 = ntohl(((struct sockaddr_in *) &((*r1)->rt_dst))->sin_addr.s_addr);
  1090. X    register u_long dst2 = ntohl(((struct sockaddr_in *) &((*r2)->rt_dst))->sin_addr.s_addr);
  1091. X
  1092. X    /*
  1093. X     *    Do the comparison
  1094. X     */
  1095. X    if (dst1 == dst2) return(0);
  1096. X    if (dst1 > dst2) return(1);
  1097. X    return(-1);
  1098. X}
  1099. END_OF_FILE
  1100.   if test 8556 -ne `wc -c <'netramet/src/apps/snmp_var_route.c'`; then
  1101.     echo shar: \"'netramet/src/apps/snmp_var_route.c'\" unpacked with wrong size!
  1102.   fi
  1103.   # end of 'netramet/src/apps/snmp_var_route.c'
  1104. fi
  1105. if test -f 'netramet/src/meter/include/met_vars.h' -a "${1}" != "-c" ; then 
  1106.   echo shar: Will not clobber existing file \"'netramet/src/meter/include/met_vars.h'\"
  1107. else
  1108.   echo shar: Extracting \"'netramet/src/meter/include/met_vars.h'\" \(8490 characters\)
  1109.   sed "s/^X//" >'netramet/src/meter/include/met_vars.h' <<'END_OF_FILE'
  1110. X/* 1125, Tue 5 Oct 93
  1111. X
  1112. X   MET_VARS.H:  Data structures for AU Meter SNMP interface
  1113. X
  1114. X   Copyright (C) 1992,1993 by Nevil Brownlee,
  1115. X   Computer Centre,  University of Auckland */
  1116. X
  1117. X/* Definitions for SNMP (RFC 1067) agent variable finder.
  1118. X *
  1119. X *
  1120. X/***********************************************************
  1121. X    Copyright 1988, 1989 by Carnegie Mellon University
  1122. X    Copyright 1989    TGV, Incorporated
  1123. X
  1124. X              All Rights Reserved
  1125. X
  1126. XPermission to use, copy, modify, and distribute this software and its
  1127. Xdocumentation for any purpose and without fee is hereby granted,
  1128. Xprovided that the above copyright notice appear in all copies and that
  1129. Xboth that copyright notice and this permission notice appear in
  1130. Xsupporting documentation, and that the name of CMU and TGV not be used
  1131. Xin advertising or publicity pertaining to distribution of the software
  1132. Xwithout specific, written prior permission.
  1133. X
  1134. XCMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  1135. XINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  1136. XEVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  1137. XCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  1138. XUSE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1139. XOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1140. XPERFORMANCE OF THIS SOFTWARE.
  1141. X******************************************************************/
  1142. X
  1143. Xu_char far *var_system();
  1144. Xu_char far *var_ifEntry();
  1145. Xu_char far *var_atEntry();
  1146. Xu_char far *var_ip();
  1147. Xu_char far *var_ipAddrEntry();
  1148. Xu_char far *var_ipRouteEntry();
  1149. Xu_char far *var_icmp();
  1150. Xu_char far *var_tcp();
  1151. Xu_char far *var_udp();
  1152. Xu_char far *var_process();
  1153. Xu_char far *var_event();
  1154. Xu_char far *var_rinfo();  /* Internet Accounting .. */
  1155. Xu_char far *var_col_tbl();
  1156. Xu_char far *var_ft();
  1157. Xu_char far *var_flow_index();
  1158. Xu_char far *var_rt();
  1159. Xu_char far *getStatPtr();
  1160. X
  1161. Xextern long long_return;
  1162. Xextern u_char return_buf[];
  1163. X
  1164. X#define INST    0xFFFFFFFF    /* used to fill out the instance field of the variables table */
  1165. X
  1166. X/*
  1167. X * These are unit magic numbers for each variable.
  1168. X */
  1169. X
  1170. X#define VERSION_DESCR          0
  1171. X#define VERSION_ID          1
  1172. X#define UPTIME              3
  1173. X#define IFNUMBER          2
  1174. X
  1175. X#define HIGHWATERMARK        11  /* 1 in SNMP */
  1176. X#define FLOODMARK            12
  1177. X#define INACT_TIMEOUT        13
  1178. X#define LAST_COLLECT_TIME    16
  1179. X#define CURRENT_RULE_SET     18
  1180. X#define EMERGENCY_RULE_SET   19
  1181. X
  1182. X#define MSSTATSRESET         31
  1183. X#define MSSTATSTIME          32
  1184. X#define MSNPACKETS           33
  1185. X#define MSTBACKLOG           34
  1186. X#define MSMXPKTRATE          35
  1187. X#define MSMXBACKLOG          36
  1188. X#define MSNFLOWS             37
  1189. X#define MSFLOWSRCV           38
  1190. X#define MSNMATCHES           39
  1191. X#define MSHASHSRCHS          40
  1192. X#define MSHASHCMPS           41
  1193. X#define MSTHASHSZ            42
  1194. X#define MSNHASHENTS          43
  1195. X#define MSGCINTERVAL         44
  1196. X#define MSMXFLOWS            45
  1197. X#define MSAVIDLEPER1000      46
  1198. X#define MSMINIDLEPER1000     47
  1199. X
  1200. X#define PCNEARMEM         61
  1201. X#define PCFARMEM             62
  1202. X#define PCBADPKTS         63
  1203. X#define PCNOBUFPKTS         64
  1204. X#define PCLOSTPKTS         65
  1205. X
  1206. X#define IFINDEX         1
  1207. X#define IFDESCR         2
  1208. X#define IFTYPE             3
  1209. X#define IFMTU         4
  1210. X#define IFSPEED         5
  1211. X#define IFPHYSADDRESS     6
  1212. X#define IFADMINSTATUS     7
  1213. X#define IFOPERSTATUS     8
  1214. X#define IFLASTCHANGE     9
  1215. X#define IFINOCTETS    10
  1216. X#define IFINUCASTPKTS    11
  1217. X#define IFINNUCASTPKTS    12
  1218. X#define IFINDISCARDS    13
  1219. X#define IFINERRORS    14
  1220. X#define IFINUNKNOWNPROTOS 15
  1221. X#define IFOUTOCTETS    16
  1222. X#define IFOUTUCASTPKTS    17
  1223. X#define IFOUTNUCASTPKTS 18
  1224. X#define IFOUTDISCARDS    19
  1225. X#define IFOUTERRORS    20
  1226. X#define IFOUTQLEN    21
  1227. X
  1228. X#define ATIFINDEX    0
  1229. X#define ATPHYSADDRESS    1
  1230. X#define ATNETADDRESS    2
  1231. X
  1232. X#define IPFORWARDING    0
  1233. X#define IPDEFAULTTTL    1
  1234. X#define IPINRECEIVES    2
  1235. X#define IPINHDRERRORS    3
  1236. X#define IPINADDRERRORS    4
  1237. X#define IPFORWDATAGRAMS 5
  1238. X#define IPINUNKNOWNPROTOS 6
  1239. X#define IPINDISCARDS    7
  1240. X#define IPINDELIVERS    8
  1241. X#define IPOUTREQUESTS    9
  1242. X#define IPOUTDISCARDS    10
  1243. X#define IPOUTNOROUTES    11
  1244. X#define IPREASMTIMEOUT    12
  1245. X#define IPREASMREQDS    13
  1246. X#define IPREASMOKS    14
  1247. X#define IPREASMFAILS    15
  1248. X#define IPFRAGOKS    16
  1249. X#define IPFRAGFAILS    17
  1250. X#define IPFRAGCREATES    18
  1251. X
  1252. X#define IPADADDR    1
  1253. X#define IPADIFINDEX    2
  1254. X#define IPADNETMASK    3
  1255. X#define IPADBCASTADDR    4
  1256. X
  1257. X#define IPROUTEDEST    0
  1258. X#define IPROUTEIFINDEX    1
  1259. X#define IPROUTEMETRIC1    2
  1260. X#define IPROUTEMETRIC2    3
  1261. X#define IPROUTEMETRIC3    4
  1262. X#define IPROUTEMETRIC4    5
  1263. X#define IPROUTENEXTHOP    6
  1264. X#define IPROUTETYPE    7
  1265. X#define IPROUTEPROTO    8
  1266. X#define IPROUTEAGE    9
  1267. X
  1268. X#define ICMPINMSGS         0
  1269. X#define ICMPINERRORS         1
  1270. X#define ICMPINDESTUNREACHS   2
  1271. X#define ICMPINTIMEEXCDS      3
  1272. X#define ICMPINPARMPROBS      4
  1273. X#define ICMPINSRCQUENCHS     5
  1274. X#define ICMPINREDIRECTS      6
  1275. X#define ICMPINECHOS         7
  1276. X#define ICMPINECHOREPS         8
  1277. X#define ICMPINTIMESTAMPS     9
  1278. X#define ICMPINTIMESTAMPREPS 10
  1279. X#define ICMPINADDRMASKS     11
  1280. X#define ICMPINADDRMASKREPS  12
  1281. X#define ICMPOUTMSGS        13
  1282. X#define ICMPOUTERRORS        14
  1283. X#define ICMPOUTDESTUNREACHS 15
  1284. X#define ICMPOUTTIMEEXCDS    16
  1285. X#define ICMPOUTPARMPROBS    17
  1286. X#define ICMPOUTSRCQUENCHS   18
  1287. X#define ICMPOUTREDIRECTS    19
  1288. X#define ICMPOUTECHOS        20
  1289. X#define ICMPOUTECHOREPS     21
  1290. X#define ICMPOUTTIMESTAMPS   22
  1291. X#define ICMPOUTTIMESTAMPREPS 23
  1292. X#define ICMPOUTADDRMASKS    24
  1293. X#define ICMPOUTADDRMASKREPS 25
  1294. X
  1295. X#define TCPRTOALGORITHM      1
  1296. X#define TCPRTOMIN         2
  1297. X#define TCPRTOMAX         3
  1298. X#define TCPMAXCONN         4
  1299. X#define TCPACTIVEOPENS         5
  1300. X#define TCPPASSIVEOPENS      6
  1301. X#define TCPATTEMPTFAILS      7
  1302. X#define TCPESTABRESETS         8
  1303. X#define TCPCURRESTAB         9
  1304. X#define TCPINSEGS        10
  1305. X#define TCPOUTSEGS        11
  1306. X#define TCPRETRANSSEGS        12
  1307. X#define TCPCONNSTATE        13
  1308. X#define TCPCONNLOCALADDRESS 14
  1309. X#define TCPCONNLOCALPORT    15
  1310. X#define TCPCONNREMADDRESS   16
  1311. X#define TCPCONNREMPORT        17
  1312. X
  1313. X#define UDPINDATAGRAMS        0
  1314. X#define UDPNOPORTS        1
  1315. X#define UDPINERRORS        2
  1316. X#define UDPOUTDATAGRAMS     3
  1317. X
  1318. X#define EVENTCLASS            0
  1319. X#define EVENTINSTANCE            1
  1320. X#define EVENTALARMTYPE            2
  1321. X#define EVENTTIME            3
  1322. X#define EVENTPROBCAUSE            4
  1323. X#define EVENTSPECIFICPROBLEM        5
  1324. X#define EVENTSEVERITY            6
  1325. X#define EVENTBACKUPSTATUS        7
  1326. X#define EVENTBACKUPINSTANCE        8
  1327. X#define EVENTTREND            9
  1328. X#define EVENTTHRESHOLD            10
  1329. X#define EVENTTHRESHOLDLEVEL        11
  1330. X#define EVENTTHRESHOLDOBSVALUE        12
  1331. X#define EVENTID                13
  1332. X#define EVENTCORRELATIONS        14
  1333. X#define EVENTOPERSTATE            16
  1334. X#define EVENTADMINSTATE            17
  1335. X#define EVENTMONATTRIBUTES        18
  1336. X#define EVENTREPAIRACTION        19
  1337. X#define EVENTDATA            20
  1338. X#define EVENTTEXT            21
  1339. X#define EVENTCREDIBILITY        22
  1340. X#define EVENTINDEX            23
  1341. X#define EVENTVALID            24
  1342. X
  1343. X#define RIINDEX         1
  1344. X#define RIRULESIZE     2
  1345. X#define RIACTIONSIZE     3
  1346. X
  1347. X#define CIINDEX     11
  1348. X#define CIPEERADDR    12
  1349. X#define CILASTTIME    13
  1350. X#define CIPREVTIME    14
  1351. X
  1352. X/* FT defines for flow table moved to flowhash.h */
  1353. X
  1354. X#define FTCRFIRSTTIME            0
  1355. X#define FTCRFLOWINDEX            1
  1356. X#define FTACFIRSTTIME            2
  1357. X#define FTACFLOWINDEX            3
  1358. X
  1359. X#define FTCOLATTRIB           11
  1360. X#define FTCOLTIME           12
  1361. X#define FTCOLINDEX           13
  1362. X#define FTCOLBLOB           14
  1363. X
  1364. X#define RTRULESET           1
  1365. X#define RTRULEINDEX         2
  1366. X#define RTSELECTOR         3
  1367. X#define RTRULEMASK         4
  1368. X#define RTMATCHVALUE         5
  1369. X#define RTRULEACTION         6
  1370. X#define RTJUMPINDEX         7
  1371. X
  1372. X#define ATACTIONINDEX          101
  1373. X#define ATLOWINTERFACE        103
  1374. X#define ATLOWADJACENTTYPE     104
  1375. X#define ATLOWADJACENTADDRESS  105
  1376. X#define ATLOWADJACENTMASK     106
  1377. X#define ATLOWPEERTYPE          107
  1378. X#define ATLOWPEERTYPEMASK     108
  1379. X#define ATLOWPEERADDRESS      109
  1380. X#define ATLOWPEERMASK         110
  1381. X#define ATLOWDETAILTYPE       111
  1382. X#define ATLOWDETAILTYPEMASK   112
  1383. X#define ATLOWDETAILADDRESS    113
  1384. X#define ATLOWDETAILMASK       114
  1385. X#define ATHIINTERFACE         117
  1386. X#define ATHIADJACENTTYPE      118
  1387. X#define ATHIADJACENTADDRESS   119
  1388. X#define ATHIADJACENTMASK      120
  1389. X#define ATHIPEERTYPE          121
  1390. X#define ATHIPEERTYPEMASK      122
  1391. X#define ATHIPEERADDRESS       123
  1392. X#define ATHIPEERMASK          124
  1393. X#define ATHIDETAILTYPE        125
  1394. X#define ATHIDETAILTYPEMASK    126
  1395. X#define ATHIDETAILADDRESS     127
  1396. X#define ATHIDETAILMASK        128
  1397. X#define ATPDUSCALE            133
  1398. X#define ATOCTETSCALE          134
  1399. X#define ATACTIONSET          135
  1400. X
  1401. Xstruct variable {
  1402. X    oid            name[26];        /* object identifier of variable */
  1403. X    u_char        namelen;        /* length of above */
  1404. X    char        type;        /* type of variable, INTEGER or (octet) STRING */
  1405. X    u_char        magic;        /* passed to function as a hint */
  1406. X    u_short        acl;        /* access control list for variable */
  1407. X    u_char far        *(*findVar)();  /* function that finds variable */
  1408. X};
  1409. END_OF_FILE
  1410.   if test 8490 -ne `wc -c <'netramet/src/meter/include/met_vars.h'`; then
  1411.     echo shar: \"'netramet/src/meter/include/met_vars.h'\" unpacked with wrong size!
  1412.   fi
  1413.   # end of 'netramet/src/meter/include/met_vars.h'
  1414. fi
  1415. if test -f 'netramet/src/snmplib/include/snmpapi.h' -a "${1}" != "-c" ; then 
  1416.   echo shar: Will not clobber existing file \"'netramet/src/snmplib/include/snmpapi.h'\"
  1417. else
  1418.   echo shar: Extracting \"'netramet/src/snmplib/include/snmpapi.h'\" \(8565 characters\)
  1419.   sed "s/^X//" >'netramet/src/snmplib/include/snmpapi.h' <<'END_OF_FILE'
  1420. X/***********************************************************
  1421. X    Copyright 1989 by Carnegie Mellon University
  1422. X
  1423. X                      All Rights Reserved
  1424. X
  1425. XPermission to use, copy, modify, and distribute this software and its 
  1426. Xdocumentation for any purpose and without fee is hereby granted, 
  1427. Xprovided that the above copyright notice appear in all copies and that
  1428. Xboth that copyright notice and this permission notice appear in 
  1429. Xsupporting documentation, and that the name of CMU not be
  1430. Xused in advertising or publicity pertaining to distribution of the
  1431. Xsoftware without specific, written prior permission.  
  1432. X
  1433. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1434. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1435. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1436. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1437. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1438. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1439. XSOFTWARE.
  1440. X******************************************************************/
  1441. X/*
  1442. X * snmp_api.h - API for access to snmp.
  1443. X */
  1444. X
  1445. X
  1446. Xtypedef struct sockaddr_in  ipaddr;
  1447. X
  1448. Xstruct snmp_session {
  1449. X    u_char  *community;    /* community for outgoing requests. */
  1450. X    int        community_len;  /* Length of community name. */
  1451. X    int        retries;    /* Number of retries before timeout. */
  1452. X    long    timeout;    /* Number of uS until first timeout, then exponential backoff */
  1453. X    char    *peername;    /* Domain name or dotted IP address of default peer */
  1454. X    u_short remote_port;/* UDP port number of peer. */
  1455. X    u_short local_port; /* My UDP port number, 0 for default, picked randomly */
  1456. X    /* Authentication function or NULL if null authentication is used */
  1457. X    u_char    *(*authenticator)();
  1458. X    int        (*callback)();  /* Function to interpret incoming data */
  1459. X    /* Pointer to data that the callback function may consider important */
  1460. X    void    *callback_magic;
  1461. X};
  1462. X
  1463. X/*
  1464. X * Set fields in session and pdu to the following to get a default or unconfigured value.
  1465. X */
  1466. X#define SNMP_DEFAULT_COMMUNITY_LEN  0    /* to get a default community name */
  1467. X#define SNMP_DEFAULT_RETRIES        -1
  1468. X#define SNMP_DEFAULT_TIMEOUT        -1
  1469. X#define SNMP_DEFAULT_REMPORT        0
  1470. X#define SNMP_DEFAULT_REQID        0
  1471. X#define SNMP_DEFAULT_ERRSTAT        -1
  1472. X#define SNMP_DEFAULT_ERRINDEX        -1
  1473. X#define SNMP_DEFAULT_ADDRESS        0
  1474. X#define SNMP_DEFAULT_PEERNAME        NULL
  1475. X#define SNMP_DEFAULT_ENTERPRISE_LENGTH    0
  1476. X#define SNMP_DEFAULT_TIME        0
  1477. X
  1478. Xextern int snmp_errno;
  1479. X/* Error return values */
  1480. X#define SNMPERR_GENERR        -1
  1481. X#define SNMPERR_BAD_LOCPORT    -2  /* local port was already in use */
  1482. X#define SNMPERR_BAD_ADDRESS    -3
  1483. X#define SNMPERR_BAD_SESSION    -4
  1484. X#define SNMPERR_TOO_LONG    -5
  1485. X
  1486. X
  1487. Xstruct snmp_pdu {
  1488. X    ipaddr  address;    /* Address of peer */
  1489. X
  1490. X    int        command;    /* Type of this PDU */
  1491. X
  1492. X    u_long  reqid;    /* Request id */
  1493. X    u_long  errstat;    /* Error status */
  1494. X    u_long  errindex;    /* Error index */
  1495. X
  1496. X    /* Trap information */
  1497. X    oid        *enterprise;/* System OID */
  1498. X    int        enterprise_length;
  1499. X    ipaddr  agent_addr;    /* address of object generating trap */
  1500. X    int        trap_type;    /* trap type */
  1501. X    int        specific_type;  /* specific type */
  1502. X    u_long  time;    /* Uptime */
  1503. X
  1504. X    struct variable_list *variables;
  1505. X};
  1506. X
  1507. X
  1508. Xstruct variable_list {
  1509. X    struct variable_list *next_variable;    /* NULL for last variable */
  1510. X    oid        *name;  /* Object identifier of variable */
  1511. X    int        name_length;    /* number of subid's in name */
  1512. X    u_char  type;   /* ASN type of variable */
  1513. X    union { /* value of variable */
  1514. X    long    *integer;
  1515. X    u_char    *string;
  1516. X    oid    *objid;
  1517. X    } val;
  1518. X    int        val_len;
  1519. X};
  1520. X
  1521. X/*
  1522. X * struct snmp_session *snmp_open(session)
  1523. X *    struct snmp_session *session;
  1524. X * 
  1525. X * Sets up the session with the snmp_session information provided
  1526. X * by the user.  Then opens and binds the necessary UDP port.
  1527. X * A handle to the created session is returned (this is different than
  1528. X * the pointer passed to snmp_open()).  On any error, NULL is returned
  1529. X * and snmp_errno is set to the appropriate error code.
  1530. X */
  1531. Xstruct snmp_session *snmp_open();
  1532. X
  1533. X/*
  1534. X * int snmp_close(session)
  1535. X *     struct snmp_session *session;
  1536. X * 
  1537. X * Close the input session.  Frees all data allocated for the session,
  1538. X * dequeues any pending requests, and closes any sockets allocated for
  1539. X * the session.  Returns 0 on error, 1 otherwise.
  1540. X */
  1541. Xint snmp_close();
  1542. X
  1543. X
  1544. X/*
  1545. X * int snmp_send(session, pdu)
  1546. X *     struct snmp_session *session;
  1547. X *     struct snmp_pdu    *pdu;
  1548. X * 
  1549. X * Sends the input pdu on the session after calling snmp_build to create
  1550. X * a serialized packet.  If necessary, set some of the pdu data from the
  1551. X * session defaults.  Add a request corresponding to this pdu to the list
  1552. X * of outstanding requests on this session, then send the pdu.
  1553. X * Returns the request id of the generated packet if applicable, otherwise 1.
  1554. X * On any error, 0 is returned.
  1555. X * The pdu is freed by snmp_send() unless a failure occured.
  1556. X */
  1557. Xint snmp_send();
  1558. X
  1559. X
  1560. X/*
  1561. X * void snmp_read(fdset)
  1562. X *     fd_set  *fdset;
  1563. X * 
  1564. X * Checks to see if any of the fd's set in the fdset belong to
  1565. X * snmp.  Each socket with it's fd set has a packet read from it
  1566. X * and snmp_parse is called on the packet received.  The resulting pdu
  1567. X * is passed to the callback routine for that session.  If the callback
  1568. X * routine returns successfully, the pdu and it's request are deleted.
  1569. X */
  1570. Xvoid snmp_read();
  1571. X
  1572. X
  1573. X/*
  1574. X * void
  1575. X * snmp_free_pdu(pdu)
  1576. X *     struct snmp_pdu *pdu;
  1577. X * 
  1578. X * Frees the pdu and any malloc'd data associated with it.
  1579. X */
  1580. Xvoid snmp_free_pdu();
  1581. X
  1582. X/*
  1583. X * int snmp_select_info(numfds, fdset, timeout, block)
  1584. X * int *numfds;
  1585. X * fd_set   *fdset;
  1586. X * struct timeval *timeout;
  1587. X * int *block;
  1588. X *
  1589. X * Returns info about what snmp requires from a select statement.
  1590. X * numfds is the number of fds in the list that are significant.
  1591. X * All file descriptors opened for SNMP are OR'd into the fdset.
  1592. X * If activity occurs on any of these file descriptors, snmp_read
  1593. X * should be called with that file descriptor set.
  1594. X *
  1595. X * The timeout is the latest time that SNMP can wait for a timeout.  The
  1596. X * select should be done with the minimum time between timeout and any other
  1597. X * timeouts necessary.  This should be checked upon each invocation of select.
  1598. X * If a timeout is received, snmp_timeout should be called to check if the
  1599. X * timeout was for SNMP.  (snmp_timeout is idempotent)
  1600. X *
  1601. X * Block is 1 if the select is requested to block indefinitely, rather than time out.
  1602. X * If block is input as 1, the timeout value will be treated as undefined, but it must
  1603. X * be available for setting in snmp_select_info.  On return, if block is true, the value
  1604. X * of timeout will be undefined.
  1605. X *
  1606. X * snmp_select_info returns the number of open sockets.  (i.e. The number of sessions open)
  1607. X */
  1608. Xint snmp_select_info();
  1609. X
  1610. X/*
  1611. X * void snmp_timeout();
  1612. X * 
  1613. X * snmp_timeout should be called whenever the timeout from snmp_select_info expires,
  1614. X * but it is idempotent, so snmp_timeout can be polled (probably a cpu expensive
  1615. X * proposition).  snmp_timeout checks to see if any of the sessions have an
  1616. X * outstanding request that has timed out.  If it finds one (or more), and that
  1617. X * pdu has more retries available, a new packet is formed from the pdu and is
  1618. X * resent.  If there are no more retries available, the callback for the session
  1619. X * is used to alert the user of the timeout.
  1620. X */
  1621. Xvoid snmp_timeout();
  1622. X
  1623. X
  1624. X/*
  1625. X * This routine must be supplied by the application:
  1626. X *
  1627. X * u_char *authenticator(pdu, length, community, community_len)
  1628. X * u_char *pdu;        The rest of the PDU to be authenticated
  1629. X * int *length;        The length of the PDU (updated by the authenticator)
  1630. X * u_char *community;    The community name to authenticate under.
  1631. X * int    community_len    The length of the community name.
  1632. X *
  1633. X * Returns the authenticated pdu, or NULL if authentication failed.
  1634. X * If null authentication is used, the authenticator in snmp_session can be
  1635. X * set to NULL(0).
  1636. X */
  1637. X
  1638. X/*
  1639. X * This routine must be supplied by the application:
  1640. X *
  1641. X * int callback(operation, session, reqid, pdu, magic)
  1642. X * int operation;
  1643. X * struct snmp_session *session;    The session authenticated under.
  1644. X * int reqid;                The request id of this pdu (0 for TRAP)
  1645. X * struct snmp_pdu *pdu;        The pdu information.
  1646. X * void *magic                A link to the data for this routine.
  1647. X *
  1648. X * Returns 1 if request was successful, 0 if it should be kept pending.
  1649. X * Any data in the pdu must be copied because it will be freed elsewhere.
  1650. X * Operations are defined below:
  1651. X */
  1652. X#define RECEIVED_MESSAGE   1
  1653. X#define TIMED_OUT       2
  1654. X
  1655. X
  1656. Xextern int snmp_dump_packet;
  1657. END_OF_FILE
  1658.   if test 8565 -ne `wc -c <'netramet/src/snmplib/include/snmpapi.h'`; then
  1659.     echo shar: \"'netramet/src/snmplib/include/snmpapi.h'\" unpacked with wrong size!
  1660.   fi
  1661.   # end of 'netramet/src/snmplib/include/snmpapi.h'
  1662. fi
  1663. if test -f 'netramet/src/snmplib/include/snmpvars.h' -a "${1}" != "-c" ; then 
  1664.   echo shar: Will not clobber existing file \"'netramet/src/snmplib/include/snmpvars.h'\"
  1665. else
  1666.   echo shar: Extracting \"'netramet/src/snmplib/include/snmpvars.h'\" \(6610 characters\)
  1667.   sed "s/^X//" >'netramet/src/snmplib/include/snmpvars.h' <<'END_OF_FILE'
  1668. X/*
  1669. X * Definitions for SNMP (RFC 1067) agent variable finder.
  1670. X *
  1671. X *
  1672. X/***********************************************************
  1673. X    Copyright 1988, 1989 by Carnegie Mellon University
  1674. X    Copyright 1989    TGV, Incorporated
  1675. X
  1676. X              All Rights Reserved
  1677. X
  1678. XPermission to use, copy, modify, and distribute this software and its
  1679. Xdocumentation for any purpose and without fee is hereby granted,
  1680. Xprovided that the above copyright notice appear in all copies and that
  1681. Xboth that copyright notice and this permission notice appear in
  1682. Xsupporting documentation, and that the name of CMU and TGV not be used
  1683. Xin advertising or publicity pertaining to distribution of the software
  1684. Xwithout specific, written prior permission.
  1685. X
  1686. XCMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  1687. XINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  1688. XEVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  1689. XCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  1690. XUSE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1691. XOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1692. XPERFORMANCE OF THIS SOFTWARE.
  1693. X******************************************************************/
  1694. X
  1695. Xu_char    *var_system();
  1696. Xu_char    *var_ifEntry();
  1697. Xu_char    *var_atEntry();
  1698. Xu_char    *var_ip();
  1699. Xu_char    *var_ipAddrEntry();
  1700. Xu_char    *var_ipRouteEntry();
  1701. Xu_char    *var_icmp();
  1702. Xu_char    *var_tcp();
  1703. Xu_char    *var_udp();
  1704. Xu_char    *var_process();
  1705. Xu_char    *var_event();
  1706. Xu_char    *var_pt();  /* AU: packet types table */
  1707. Xu_char    *var_ft();  /* AU: flow table */
  1708. Xu_char    *var_rt();  /* AU: rule table */
  1709. Xu_char    *getStatPtr();
  1710. X
  1711. Xextern long long_return;
  1712. Xextern u_char return_buf[];
  1713. X
  1714. X#define INST    0xFFFFFFFF    /* used to fill out the instance field of the variables table */
  1715. X
  1716. X/*
  1717. X * These are unit magic numbers for each variable.
  1718. X */
  1719. X
  1720. X#define VERSION_DESCR    0
  1721. X#define VERSION_ID    1
  1722. X#define IFNUMBER    2
  1723. X#define UPTIME        3
  1724. X#define EVENTNEXTINDEX    4
  1725. X
  1726. X#define PTTYPES        5  /* Don't really need this in var_system */
  1727. X
  1728. X#define FTFLOWCOUNT    6
  1729. X#define FTCHKTIME    7
  1730. X#define FTCHKFLOWCOUNT    8
  1731. X#define FTPREVCHKTIME    9
  1732. X
  1733. X#define IFINDEX        1
  1734. X#define IFDESCR        2
  1735. X#define IFTYPE        3
  1736. X#define IFMTU        4
  1737. X#define IFSPEED        5
  1738. X#define IFPHYSADDRESS    6
  1739. X#define IFADMINSTATUS    7
  1740. X#define IFOPERSTATUS    8
  1741. X#define IFLASTCHANGE    9
  1742. X#define IFINOCTETS    10
  1743. X#define IFINUCASTPKTS    11
  1744. X#define IFINNUCASTPKTS    12
  1745. X#define IFINDISCARDS    13
  1746. X#define IFINERRORS    14
  1747. X#define IFINUNKNOWNPROTOS 15
  1748. X#define IFOUTOCTETS    16
  1749. X#define IFOUTUCASTPKTS    17
  1750. X#define IFOUTNUCASTPKTS 18
  1751. X#define IFOUTDISCARDS    19
  1752. X#define IFOUTERRORS    20
  1753. X#define IFOUTQLEN    21
  1754. X
  1755. X#define ATIFINDEX    0
  1756. X#define ATPHYSADDRESS    1
  1757. X#define ATNETADDRESS    2
  1758. X
  1759. X#define IPFORWARDING    0
  1760. X#define IPDEFAULTTTL    1
  1761. X#define IPINRECEIVES    2
  1762. X#define IPINHDRERRORS    3
  1763. X#define IPINADDRERRORS    4
  1764. X#define IPFORWDATAGRAMS 5
  1765. X#define IPINUNKNOWNPROTOS 6
  1766. X#define IPINDISCARDS    7
  1767. X#define IPINDELIVERS    8
  1768. X#define IPOUTREQUESTS    9
  1769. X#define IPOUTDISCARDS    10
  1770. X#define IPOUTNOROUTES    11
  1771. X#define IPREASMTIMEOUT    12
  1772. X#define IPREASMREQDS    13
  1773. X#define IPREASMOKS    14
  1774. X#define IPREASMFAILS    15
  1775. X#define IPFRAGOKS    16
  1776. X#define IPFRAGFAILS    17
  1777. X#define IPFRAGCREATES    18
  1778. X
  1779. X#define IPADADDR    1
  1780. X#define IPADIFINDEX    2
  1781. X#define IPADNETMASK    3
  1782. X#define IPADBCASTADDR    4
  1783. X
  1784. X#define IPROUTEDEST    0
  1785. X#define IPROUTEIFINDEX    1
  1786. X#define IPROUTEMETRIC1    2
  1787. X#define IPROUTEMETRIC2    3
  1788. X#define IPROUTEMETRIC3    4
  1789. X#define IPROUTEMETRIC4    5
  1790. X#define IPROUTENEXTHOP    6
  1791. X#define IPROUTETYPE    7
  1792. X#define IPROUTEPROTO    8
  1793. X#define IPROUTEAGE    9
  1794. X
  1795. X#define ICMPINMSGS         0
  1796. X#define ICMPINERRORS         1
  1797. X#define ICMPINDESTUNREACHS   2
  1798. X#define ICMPINTIMEEXCDS      3
  1799. X#define ICMPINPARMPROBS      4
  1800. X#define ICMPINSRCQUENCHS     5
  1801. X#define ICMPINREDIRECTS      6
  1802. X#define ICMPINECHOS         7
  1803. X#define ICMPINECHOREPS         8
  1804. X#define ICMPINTIMESTAMPS     9
  1805. X#define ICMPINTIMESTAMPREPS 10
  1806. X#define ICMPINADDRMASKS     11
  1807. X#define ICMPINADDRMASKREPS  12
  1808. X#define ICMPOUTMSGS        13
  1809. X#define ICMPOUTERRORS        14
  1810. X#define ICMPOUTDESTUNREACHS 15
  1811. X#define ICMPOUTTIMEEXCDS    16
  1812. X#define ICMPOUTPARMPROBS    17
  1813. X#define ICMPOUTSRCQUENCHS   18
  1814. X#define ICMPOUTREDIRECTS    19
  1815. X#define ICMPOUTECHOS        20
  1816. X#define ICMPOUTECHOREPS     21
  1817. X#define ICMPOUTTIMESTAMPS   22
  1818. X#define ICMPOUTTIMESTAMPREPS 23
  1819. X#define ICMPOUTADDRMASKS    24
  1820. X#define ICMPOUTADDRMASKREPS 25
  1821. X
  1822. X#define TCPRTOALGORITHM      1
  1823. X#define TCPRTOMIN         2
  1824. X#define TCPRTOMAX         3
  1825. X#define TCPMAXCONN         4
  1826. X#define TCPACTIVEOPENS         5
  1827. X#define TCPPASSIVEOPENS      6
  1828. X#define TCPATTEMPTFAILS      7
  1829. X#define TCPESTABRESETS         8
  1830. X#define TCPCURRESTAB         9
  1831. X#define TCPINSEGS        10
  1832. X#define TCPOUTSEGS        11
  1833. X#define TCPRETRANSSEGS        12
  1834. X#define TCPCONNSTATE        13
  1835. X#define TCPCONNLOCALADDRESS 14
  1836. X#define TCPCONNLOCALPORT    15
  1837. X#define TCPCONNREMADDRESS   16
  1838. X#define TCPCONNREMPORT        17
  1839. X
  1840. X#define UDPINDATAGRAMS        0
  1841. X#define UDPNOPORTS        1
  1842. X#define UDPINERRORS        2
  1843. X#define UDPOUTDATAGRAMS     3
  1844. X
  1845. X#define EVENTCLASS            0
  1846. X#define EVENTINSTANCE            1
  1847. X#define EVENTALARMTYPE            2
  1848. X#define EVENTTIME            3
  1849. X#define EVENTPROBCAUSE            4
  1850. X#define EVENTSPECIFICPROBLEM        5
  1851. X#define EVENTSEVERITY            6
  1852. X#define EVENTBACKUPSTATUS        7
  1853. X#define EVENTBACKUPINSTANCE        8
  1854. X#define EVENTTREND            9
  1855. X#define EVENTTHRESHOLD            10
  1856. X#define EVENTTHRESHOLDLEVEL        11
  1857. X#define EVENTTHRESHOLDOBSVALUE        12
  1858. X#define EVENTID                13
  1859. X#define EVENTCORRELATIONS        14
  1860. X#define EVENTOPERSTATE            16
  1861. X#define EVENTADMINSTATE            17
  1862. X#define EVENTMONATTRIBUTES        18
  1863. X#define EVENTREPAIRACTION        19
  1864. X#define EVENTDATA            20
  1865. X#define EVENTTEXT            21
  1866. X#define EVENTCREDIBILITY        22
  1867. X#define EVENTINDEX            23
  1868. X#define EVENTVALID            24
  1869. X
  1870. X#define PTPACKETTYPE        1
  1871. X#define PTPACKETCOUNT        2
  1872. X#define PTBYTECOUNT        3
  1873. X
  1874. X#define FTFLOWNBR     1
  1875. X#define FTFLOWSTATUS     2
  1876. X#define FTNEXTACTIVEFLOW 3
  1877. X#define FTADDRTYPE     4
  1878. X#define FTFROMADDR     5
  1879. X#define FTFROMMASK     6
  1880. X#define FTFROMTALLY     7
  1881. X#define FTTOADDR     8
  1882. X#define FTTOMASK     9
  1883. X#define FTTOTALLY    10
  1884. X#define FTFWDPACKETS    11
  1885. X#define FTFWDBYTES    12
  1886. X#define FTBACKPACKETS    13
  1887. X#define FTBACKBYTES    14
  1888. X#define FTCHKFWDPKTS    15
  1889. X#define FTCHKFWDBYTES    16
  1890. X#define FTCHKBACKPKTS    17
  1891. X#define FTCHKBACKBYTES    18
  1892. X
  1893. X#define RTINDEX       1
  1894. X#define RTTREENBR     2
  1895. X#define RTADDRTYPE     3
  1896. X#define RTFROMADDR     4
  1897. X#define RTFROMMASK     5
  1898. X#define RTFROMTALLY     6
  1899. X#define RTTOADDR     7
  1900. X#define RTTOMASK     8
  1901. X#define RTTOTALLY     9
  1902. X
  1903. Xstruct variable {
  1904. X    oid            name[26];        /* object identifier of variable */
  1905. X    u_char        namelen;        /* length of above */
  1906. X    char        type;        /* type of variable, INTEGER or (octet) STRING */
  1907. X    u_char        magic;        /* passed to function as a hint */
  1908. X    u_short        acl;        /* access control list for variable */
  1909. X    u_char        *(*findVar)();  /* function that finds variable */
  1910. X};
  1911. END_OF_FILE
  1912.   if test 6610 -ne `wc -c <'netramet/src/snmplib/include/snmpvars.h'`; then
  1913.     echo shar: \"'netramet/src/snmplib/include/snmpvars.h'\" unpacked with wrong size!
  1914.   fi
  1915.   # end of 'netramet/src/snmplib/include/snmpvars.h'
  1916. fi
  1917. echo shar: End of archive 22 \(of 25\).
  1918. cp /dev/null ark22isdone
  1919. MISSING=""
  1920. 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
  1921.     if test ! -f ark${I}isdone ; then
  1922.     MISSING="${MISSING} ${I}"
  1923.     fi
  1924. done
  1925. if test "${MISSING}" = "" ; then
  1926.     echo You have unpacked all 25 archives.
  1927.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1928. else
  1929.     echo You still must unpack the following archives:
  1930.     echo "        " ${MISSING}
  1931. fi
  1932. exit 0
  1933. exit 0 # Just in case...
  1934.