home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / nocol / part17 < prev    next >
Encoding:
Text File  |  1993-11-23  |  76.3 KB  |  2,172 lines

  1. Newsgroups: comp.sources.misc
  2. From: vikas@jvnc.net (Vikas Aggarwal)
  3. Subject: v40i147:  nocol - Network Monitoring System, Part17/26
  4. Message-ID: <1993Nov23.212735.21882@sparky.sterling.com>
  5. X-Md4-Signature: 8afacf19ba73e33cad7941807563d93a
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Tue, 23 Nov 1993 21:27:35 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: vikas@jvnc.net (Vikas Aggarwal)
  12. Posting-number: Volume 40, Issue 147
  13. Archive-name: nocol/part17
  14. Environment: INET, UNIX
  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:  nocol-3.0/src/cmu-snmp/apps/snmptrapd.c
  21. #   nocol-3.0/src/cmu-snmp/cisco.mib91.D
  22. #   nocol-3.0/src/cmu-snmp/include/mib.h
  23. #   nocol-3.0/src/cmu-snmp/include/snmp.c
  24. #   nocol-3.0/src/cmu-snmp/snmplib/mib.h
  25. #   nocol-3.0/src/cmu-snmp/snmplib/snmp.c
  26. #   nocol-3.0/src/support/multiping/multiping.8
  27. # Wrapped by kent@sparky on Tue Nov  9 22:22:21 1993
  28. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  29. echo If this archive is complete, you will see the following message:
  30. echo '          "shar: End of archive 17 (of 26)."'
  31. if test -f 'nocol-3.0/src/cmu-snmp/apps/snmptrapd.c' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/apps/snmptrapd.c'\"
  33. else
  34.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/apps/snmptrapd.c'\" \(5883 characters\)
  35.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/apps/snmptrapd.c' <<'END_OF_FILE'
  36. X/*
  37. X * snmptrapd.c - receive and log snmp traps
  38. X *
  39. X */
  40. X/***********************************************************
  41. X    Copyright 1989 by Carnegie Mellon University
  42. X
  43. X                      All Rights Reserved
  44. X
  45. XPermission to use, copy, modify, and distribute this software and its 
  46. Xdocumentation for any purpose and without fee is hereby granted, 
  47. Xprovided that the above copyright notice appear in all copies and that
  48. Xboth that copyright notice and this permission notice appear in 
  49. Xsupporting documentation, and that the name of CMU not be
  50. Xused in advertising or publicity pertaining to distribution of the
  51. Xsoftware without specific, written prior permission.  
  52. X
  53. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  54. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  55. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  56. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  57. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  58. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  59. XSOFTWARE.
  60. X******************************************************************/
  61. X#include <sys/types.h>
  62. X#include <netinet/in.h>
  63. X#include <stdio.h>
  64. X#include <sys/time.h>
  65. X#include <errno.h>
  66. X#include <syslog.h>
  67. X
  68. X#include "snmp.h"
  69. X#include "snmp_impl.h"
  70. X#include "asn1.h"
  71. X#include "snmp_api.h"
  72. X#include "snmp_client.h"
  73. X
  74. X#ifndef BSD4_3
  75. X
  76. Xtypedef long    fd_mask;
  77. X#define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  78. X
  79. X#define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  80. X#define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  81. X#define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  82. X#define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  83. X#endif
  84. X
  85. Xextern int  errno;
  86. Xint    snmp_dump_packet = 0;
  87. Xint Print = 1;                  /* default is to print and not log */
  88. X
  89. Xchar *
  90. Xtrap_description(trap)
  91. X    int trap;
  92. X{
  93. X    switch(trap){
  94. X    case SNMP_TRAP_COLDSTART:
  95. X        return "Cold Start";
  96. X    case SNMP_TRAP_WARMSTART:
  97. X        return "Warm Start";
  98. X    case SNMP_TRAP_LINKDOWN:
  99. X        return "Link Down";
  100. X    case SNMP_TRAP_LINKUP:
  101. X        return "Link Up";
  102. X    case SNMP_TRAP_AUTHFAIL:
  103. X        return "Authentication Failure";
  104. X    case SNMP_TRAP_EGPNEIGHBORLOSS:
  105. X        return "EGP Neighbor Loss";
  106. X    case SNMP_TRAP_ENTERPRISESPECIFIC:
  107. X        return "Enterprise Specific";
  108. X    default:
  109. X        return "Unknown Type";
  110. X    }
  111. X}
  112. X
  113. Xchar *
  114. Xuptime_string(timeticks, buf)
  115. X    register u_long timeticks;
  116. X    char *buf;
  117. X{
  118. X    int    seconds, minutes, hours, days;
  119. X
  120. X    timeticks /= 100;
  121. X    days = timeticks / (60 * 60 * 24);
  122. X    timeticks %= (60 * 60 * 24);
  123. X
  124. X    hours = timeticks / (60 * 60);
  125. X    timeticks %= (60 * 60);
  126. X
  127. X    minutes = timeticks / 60;
  128. X    seconds = timeticks % 60;
  129. X
  130. X    if (days == 0){
  131. X    sprintf(buf, "%d:%02d:%02d", hours, minutes, seconds);
  132. X    } else if (days == 1) {
  133. X    sprintf(buf, "%d day, %d:%02d:%02d", days, hours, minutes, seconds);
  134. X    } else {
  135. X    sprintf(buf, "%d days, %d:%02d:%02d", days, hours, minutes, seconds);
  136. X    }
  137. X    return buf;
  138. X}
  139. X
  140. Xint snmp_input(op, session, reqid, pdu, magic)
  141. X    int op;
  142. X    struct snmp_session *session;
  143. X    int reqid;
  144. X    struct snmp_pdu *pdu;
  145. X    void *magic;
  146. X{
  147. X    char buf[64];
  148. X
  149. X    if (op == RECEIVED_MESSAGE && pdu->command == TRP_REQ_MSG){
  150. X    if (Print){
  151. X        printf("%s: %s Trap (%d) Uptime: %s\n", inet_ntoa(pdu->agent_addr.sin_addr),
  152. X        trap_description(pdu->trap_type), pdu->specific_type, uptime_string(pdu->time, buf));
  153. X    } else {
  154. X        syslog(LOG_WARNING, "%s: %s Trap (%d) Uptime: %s\n", inet_ntoa(pdu->agent_addr.sin_addr),
  155. X        trap_description(pdu->trap_type), pdu->specific_type, uptime_string(pdu->time, buf));
  156. X    }
  157. X    } else if (op == TIMED_OUT){
  158. X    printf("Timeout: This shouldn't happen!\n");
  159. X    }
  160. X}
  161. X
  162. X
  163. Xmain(argc, argv)
  164. X    int        argc;
  165. X    char    *argv[];
  166. X{
  167. X    struct snmp_session session, *ss;
  168. X    int    arg;
  169. X    int count, numfds, block;
  170. X    fd_set fdset;
  171. X    struct timeval timeout, *tvp;
  172. X
  173. X
  174. X    init_syslog();
  175. X    /*
  176. X     * usage: snmptrapd [-d ] [-l]
  177. X     */
  178. X    for(arg = 1; arg < argc; arg++){
  179. X    if (argv[arg][0] == '-'){
  180. X        switch(argv[arg][1]){
  181. X        case 'd':
  182. X            snmp_dump_packet++;
  183. X            break;
  184. X          case 'l':         /* Log to syslog - default is print */
  185. X            Print--;
  186. X            break;
  187. X        default:
  188. X            printf("invalid option: -%c\n", argv[arg][1]);
  189. X            printf("Usage: snmptrapd [-d ][-l ]\n");
  190. X            exit (-1) ;
  191. X            break;
  192. X        }
  193. X        continue;
  194. X    }
  195. X    }
  196. X
  197. X    bzero((char *)&session, sizeof(struct snmp_session));
  198. X    session.peername = NULL;
  199. X    session.community = NULL;
  200. X    session.community_len = 0;
  201. X    session.retries = SNMP_DEFAULT_RETRIES;
  202. X    session.timeout = SNMP_DEFAULT_TIMEOUT;
  203. X    session.authenticator = NULL;
  204. X    session.callback = snmp_input;
  205. X    session.callback_magic = NULL;
  206. X    session.local_port = SNMP_TRAP_PORT;
  207. X    ss = snmp_open(&session);
  208. X    if (ss == NULL){
  209. X    printf("Couldn't open snmp\n");
  210. X    exit(-1);
  211. X    }
  212. X
  213. X    while(1){
  214. X    numfds = 0;
  215. X    FD_ZERO(&fdset);
  216. X    block = 1;
  217. X    tvp = &timeout;
  218. X    timerclear(tvp);
  219. X    snmp_select_info(&numfds, &fdset, tvp, &block);
  220. X    if (block == 1)
  221. X        tvp = NULL;    /* block without timeout */
  222. X    count = select(numfds, &fdset, 0, 0, tvp);
  223. X    if (count > 0){
  224. X        snmp_read(&fdset);
  225. X    } else switch(count){
  226. X        case 0:
  227. X        snmp_timeout();
  228. X        break;
  229. X        case -1:
  230. X        if (errno == EINTR){
  231. X            continue;
  232. X        } else {
  233. X            perror("select");
  234. X        }
  235. X        return -1;
  236. X        default:
  237. X        printf("select returned %d\n", count);
  238. X        return -1;
  239. X    }
  240. X    }
  241. X}
  242. X
  243. Xinit_syslog(){
  244. X/*
  245. X * These definitions handle 4.2 systems without additional syslog facilities.
  246. X */
  247. X#ifndef LOG_CONS
  248. X#define LOG_CONS    0    /* Don't bother if not defined... */
  249. X#endif
  250. X#ifndef LOG_LOCAL0
  251. X#define LOG_LOCAL0    0
  252. X#endif
  253. X    /*
  254. X     * All messages will be logged to the local0 facility and will be sent to
  255. X     * the console if syslog doesn't work.
  256. X     */
  257. X    openlog("snmptrapd", LOG_CONS, LOG_LOCAL0);
  258. X    syslog(LOG_INFO, "Starting snmptrapd");
  259. X}
  260. END_OF_FILE
  261.   if test 5883 -ne `wc -c <'nocol-3.0/src/cmu-snmp/apps/snmptrapd.c'`; then
  262.     echo shar: \"'nocol-3.0/src/cmu-snmp/apps/snmptrapd.c'\" unpacked with wrong size!
  263.   fi
  264.   # end of 'nocol-3.0/src/cmu-snmp/apps/snmptrapd.c'
  265. fi
  266. if test -f 'nocol-3.0/src/cmu-snmp/cisco.mib91.D' -a "${1}" != "-c" ; then 
  267.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/cisco.mib91.D'\"
  268. else
  269.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/cisco.mib91.D'\" \(10280 characters\)
  270.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/cisco.mib91.D' <<'END_OF_FILE'
  271. X
  272. X
  273. X
  274. X
  275. X          -- Request for Comments: Draft             cisco Systems, Inc.
  276. X
  277. X
  278. X                   STATUS  mandatory
  279. X                   DESCRIPTION
  280. X                           "Total count of number of NOVELL SAP request
  281. X                           packets received."
  282. X                   ::= { novell 14 }
  283. X
  284. X               novellSapresin OBJECT-TYPE
  285. X                   SYNTAX  INTEGER
  286. X                   ACCESS  read-only
  287. X                   STATUS  mandatory
  288. X                   DESCRIPTION
  289. X                           "Total count of number of NOVELL SAP response
  290. X                           packets received."
  291. X                   ::= { novell 15 }
  292. X
  293. X               novellSapout OBJECT-TYPE
  294. X                   SYNTAX  INTEGER
  295. X                   ACCESS  read-only
  296. X                   STATUS  mandatory
  297. X                   DESCRIPTION
  298. X                           "Total count of number of NOVELL SAP request
  299. X                           packets sent."
  300. X                   ::= { novell 16 }
  301. X
  302. X               novellSapreply OBJECT-TYPE
  303. X                   SYNTAX  INTEGER
  304. X                   ACCESS  read-only
  305. X                   STATUS  mandatory
  306. X                   DESCRIPTION
  307. X                           "Total count of number of NOVELL SAP reply
  308. X                           packets sent."
  309. X                   ::= { novell 17 }
  310. X
  311. X
  312. X               -- Temporary Vines Section
  313. X
  314. X          -- This group is present in all router based products.
  315. X
  316. X               vinesInput OBJECT-TYPE
  317. X                   SYNTAX  INTEGER
  318. X                   ACCESS  read-only
  319. X                   STATUS  mandatory
  320. X                   DESCRIPTION
  321. X                           "Total input count of number of Vines
  322. X                           packets."
  323. X
  324. X
  325. X
  326. X
  327. X
  328. X          -- cisco MIB                                        [Page 101]
  329. X--
  330. X
  331. X
  332. X
  333. X
  334. X
  335. X          -- Request for Comments: Draft             cisco Systems, Inc.
  336. X
  337. X
  338. X                   ::= { vines 1 }
  339. X
  340. X               vinesOutput OBJECT-TYPE
  341. X                   SYNTAX  INTEGER
  342. X                   ACCESS  read-only
  343. X                   STATUS  mandatory
  344. X                   DESCRIPTION
  345. X                           "Total count of number of Vines output
  346. X                           packets."
  347. X                   ::= { vines 2 }
  348. X
  349. X               vinesLocaldest OBJECT-TYPE
  350. X                   SYNTAX  INTEGER
  351. X                   ACCESS  read-only
  352. X                   STATUS  mandatory
  353. X                   DESCRIPTION
  354. X                           "Total count of Vines input packets for this
  355. X                           host."
  356. X                   ::= { vines 3 }
  357. X
  358. X               vinesForwarded OBJECT-TYPE
  359. X                   SYNTAX  INTEGER
  360. X                   ACCESS  read-only
  361. X                   STATUS  mandatory
  362. X                   DESCRIPTION
  363. X                           "Total count of number of Vines packets
  364. X                           forwarded."
  365. X                   ::= { vines 4 }
  366. X
  367. X               vinesBcastin OBJECT-TYPE
  368. X                   SYNTAX  INTEGER
  369. X                   ACCESS  read-only
  370. X                   STATUS  mandatory
  371. X                   DESCRIPTION
  372. X                           "Total count of number of Vines input
  373. X                           broadcast packets."
  374. X                   ::= { vines 5 }
  375. X
  376. X               vinesBcastout OBJECT-TYPE
  377. X                   SYNTAX  INTEGER
  378. X                   ACCESS  read-only
  379. X                   STATUS  mandatory
  380. X                   DESCRIPTION
  381. X                           "Total count of number of Vines output
  382. X                           broadcast packets."
  383. X
  384. X
  385. X
  386. X
  387. X
  388. X          -- cisco MIB                                        [Page 102]
  389. X--
  390. X
  391. X
  392. X
  393. X
  394. X
  395. X          -- Request for Comments: Draft             cisco Systems, Inc.
  396. X
  397. X
  398. X                   ::= { vines 6 }
  399. X
  400. X               vinesBcastfwd OBJECT-TYPE
  401. X                   SYNTAX  INTEGER
  402. X                   ACCESS  read-only
  403. X                   STATUS  mandatory
  404. X                   DESCRIPTION
  405. X                           "Total count of number of Vines broadcast
  406. X                           packets forwarded."
  407. X                   ::= { vines 7 }
  408. X
  409. X               vinesNotlan OBJECT-TYPE
  410. X                   SYNTAX  INTEGER
  411. X                   ACCESS  read-only
  412. X                   STATUS  mandatory
  413. X                   DESCRIPTION
  414. X                           "Total count of number of Vines broadcast
  415. X                           packets not forwarded to all interfaces
  416. X                           because the LAN ONLY bit was set."
  417. X                   ::= { vines 8 }
  418. X
  419. X               vinesNotgt4800 OBJECT-TYPE
  420. X                   SYNTAX  INTEGER
  421. X                   ACCESS  read-only
  422. X                   STATUS  mandatory
  423. X                   DESCRIPTION
  424. X                           "Total count of number of Vines broadcast
  425. X                           packets not forwarded to all interfaces
  426. X                           because the OVER 4800 BPS bit was set."
  427. X                   ::= { vines 9 }
  428. X
  429. X               vinesNocharges OBJECT-TYPE
  430. X                   SYNTAX  INTEGER
  431. X                   ACCESS  read-only
  432. X                   STATUS  mandatory
  433. X                   DESCRIPTION
  434. X                           "Total count of number of Vines broadcast
  435. X                           packets not forwarded to all interfaces
  436. X                           because the NO CHARGES only bit was set."
  437. X                   ::= { vines 10 }
  438. X
  439. X               vinesFormaterror OBJECT-TYPE
  440. X                   SYNTAX  INTEGER
  441. X                   ACCESS  read-only
  442. X                   STATUS  mandatory
  443. X
  444. X
  445. X
  446. X
  447. X
  448. X          -- cisco MIB                                        [Page 103]
  449. X--
  450. X
  451. X
  452. X
  453. X
  454. X
  455. X          -- Request for Comments: Draft             cisco Systems, Inc.
  456. X
  457. X
  458. X                   DESCRIPTION
  459. X                           "Total count of number of Vines input packets
  460. X                           with header errors."
  461. X                   ::= { vines 11 }
  462. X
  463. X               vinesCksumerr OBJECT-TYPE
  464. X                   SYNTAX  INTEGER
  465. X                   ACCESS  read-only
  466. X                   STATUS  mandatory
  467. X                   DESCRIPTION
  468. X                           "Total count of number of Vines input packets
  469. X                           with checksum erors."
  470. X                   ::= { vines 12 }
  471. X
  472. X               vinesHopcount OBJECT-TYPE
  473. X                   SYNTAX  INTEGER
  474. X                   ACCESS  read-only
  475. X                   STATUS  mandatory
  476. X                   DESCRIPTION
  477. X                           "Total count of number of Vines input packets
  478. X                           that have exceeded the maximum hop count."
  479. X                   ::= { vines 13 }
  480. X
  481. X               vinesNoroute OBJECT-TYPE
  482. X                   SYNTAX  INTEGER
  483. X                   ACCESS  read-only
  484. X                   STATUS  mandatory
  485. X                   DESCRIPTION
  486. X                           "Total count of number of Vines packets
  487. X                           dropped due to no route."
  488. X                   ::= { vines 14 }
  489. X
  490. X               vinesEncapsfailed OBJECT-TYPE
  491. X                   SYNTAX  INTEGER
  492. X                   ACCESS  read-only
  493. X                   STATUS  mandatory
  494. X                   DESCRIPTION
  495. X                           "Total count of number of Vines packets
  496. X                           dropped due to output encapsulation failed."
  497. X                   ::= { vines 15 }
  498. X
  499. X               vinesUnknown OBJECT-TYPE
  500. X                   SYNTAX  INTEGER
  501. X                   ACCESS  read-only
  502. X                   STATUS  mandatory
  503. X
  504. X
  505. X
  506. X
  507. X
  508. X          -- cisco MIB                                        [Page 104]
  509. X--
  510. X
  511. X
  512. X
  513. X
  514. X
  515. X          -- Request for Comments: Draft             cisco Systems, Inc.
  516. X
  517. X
  518. X                   DESCRIPTION
  519. X                           "Total count of number of unknown Vines input
  520. X                           packets."
  521. X                   ::= { vines 16 }
  522. X
  523. X               vinesIcpIn OBJECT-TYPE
  524. X                   SYNTAX  INTEGER
  525. X                   ACCESS  read-only
  526. X                   STATUS  mandatory
  527. X                   DESCRIPTION
  528. X                           "Total count of number of Vines ICP packets
  529. X                           received."
  530. X                   ::= { vines 17 }
  531. X
  532. X               vinesIcpOut OBJECT-TYPE
  533. X                   SYNTAX  INTEGER
  534. X                   ACCESS  read-only
  535. X                   STATUS  mandatory
  536. X                   DESCRIPTION
  537. X                           "Total count of number of Vines ICP packets
  538. X                           generaed."
  539. X                   ::= { vines 18 }
  540. X
  541. X               vinesMetricOut OBJECT-TYPE
  542. X                   SYNTAX  INTEGER
  543. X                   ACCESS  read-only
  544. X                   STATUS  mandatory
  545. X                   DESCRIPTION
  546. X                           "Total count of number of Vines ICP Metric
  547. X                           Notification packets generated."
  548. X                   ::= { vines 19 }
  549. X
  550. X               vinesMacEchoIn OBJECT-TYPE
  551. X                   SYNTAX  INTEGER
  552. X                   ACCESS  read-only
  553. X                   STATUS  mandatory
  554. X                   DESCRIPTION
  555. X                           "Total count of number of Vines MAC level
  556. X                           Echo packets received."
  557. X                   ::= { vines 20 }
  558. X
  559. X               vinesMacEchoOut OBJECT-TYPE
  560. X                   SYNTAX  INTEGER
  561. X                   ACCESS  read-only
  562. X                   STATUS  mandatory
  563. X
  564. X
  565. X
  566. X
  567. X
  568. X          -- cisco MIB                                        [Page 105]
  569. X--
  570. X
  571. X
  572. X
  573. X
  574. X
  575. X          -- Request for Comments: Draft             cisco Systems, Inc.
  576. X
  577. X
  578. X                   DESCRIPTION
  579. X                           "Total count of number of Vines MAC level
  580. X                           Echo packets generated."
  581. X                   ::= { vines 21 }
  582. X
  583. X               vinesEchoIn OBJECT-TYPE
  584. X                   SYNTAX  INTEGER
  585. X                   ACCESS  read-only
  586. X                   STATUS  mandatory
  587. X                   DESCRIPTION
  588. X                           "Total count of number of Vines Echo packets
  589. X                           received."
  590. X                   ::= { vines 22 }
  591. X
  592. X               vinesEchoOut OBJECT-TYPE
  593. X                   SYNTAX  INTEGER
  594. X                   ACCESS  read-only
  595. X                   STATUS  mandatory
  596. X                   DESCRIPTION
  597. X                           "Total count of number of Vines Echo packets
  598. X                           generated."
  599. X                   ::= { vines 23 }
  600. X               END
  601. X
  602. X
  603. X
  604. X
  605. X
  606. X
  607. X
  608. X
  609. X
  610. X
  611. X
  612. X
  613. X
  614. X
  615. X
  616. X
  617. X
  618. X
  619. X
  620. X
  621. X
  622. X
  623. X
  624. X
  625. X
  626. X
  627. X
  628. X          -- cisco MIB                                        [Page 106]
  629. X--
  630. X
  631. END_OF_FILE
  632.   if test 10280 -ne `wc -c <'nocol-3.0/src/cmu-snmp/cisco.mib91.D'`; then
  633.     echo shar: \"'nocol-3.0/src/cmu-snmp/cisco.mib91.D'\" unpacked with wrong size!
  634.   elif test -f 'nocol-3.0/src/cmu-snmp/cisco.mib91.A' && test -f 'nocol-3.0/src/cmu-snmp/cisco.mib91.B' && test -f 'nocol-3.0/src/cmu-snmp/cisco.mib91.C'; then
  635.     echo shar: Combining  \"'nocol-3.0/src/cmu-snmp/cisco.mib91'\" \(190589 characters\)
  636.     cat 'nocol-3.0/src/cmu-snmp/cisco.mib91.A' 'nocol-3.0/src/cmu-snmp/cisco.mib91.B' 'nocol-3.0/src/cmu-snmp/cisco.mib91.C' 'nocol-3.0/src/cmu-snmp/cisco.mib91.D' > 'nocol-3.0/src/cmu-snmp/cisco.mib91'
  637.     if test 190589 -ne `wc -c <'nocol-3.0/src/cmu-snmp/cisco.mib91'`; then
  638.       echo shar: \"'nocol-3.0/src/cmu-snmp/cisco.mib91'\" combined with wrong size!
  639.     else
  640.       rm nocol-3.0/src/cmu-snmp/cisco.mib91.A nocol-3.0/src/cmu-snmp/cisco.mib91.B nocol-3.0/src/cmu-snmp/cisco.mib91.C nocol-3.0/src/cmu-snmp/cisco.mib91.D
  641.     fi
  642.   fi
  643.   # end of 'nocol-3.0/src/cmu-snmp/cisco.mib91.D'
  644. fi
  645. if test -f 'nocol-3.0/src/cmu-snmp/include/mib.h' -a "${1}" != "-c" ; then 
  646.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/mib.h'\"
  647. else
  648.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/mib.h'\" \(10793 characters\)
  649.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/mib.h' <<'END_OF_FILE'
  650. X/*
  651. X * Definitions for the variables as defined in the MIB
  652. X */
  653. X/***********************************************************
  654. X    Copyright 1988, 1989 by Carnegie Mellon University
  655. X
  656. X                      All Rights Reserved
  657. X
  658. XPermission to use, copy, modify, and distribute this software and its 
  659. Xdocumentation for any purpose and without fee is hereby granted, 
  660. Xprovided that the above copyright notice appear in all copies and that
  661. Xboth that copyright notice and this permission notice appear in 
  662. Xsupporting documentation, and that the name of CMU not be
  663. Xused in advertising or publicity pertaining to distribution of the
  664. Xsoftware without specific, written prior permission.  
  665. X
  666. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  667. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  668. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  669. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  670. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  671. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  672. XSOFTWARE.
  673. X******************************************************************/
  674. X
  675. Xstruct    mib_system {
  676. X    char    sysDescr[32];   /* textual description */
  677. X    u_char  sysObjectID[16];/* OBJECT IDENTIFIER of system */
  678. X    u_char  ObjIDLen;        /* length of sysObjectID */
  679. X    u_long  sysUpTime;        /* Uptime in 100/s of a second */    
  680. X};
  681. X
  682. Xstruct mib_interface {
  683. X    long    ifNumber;        /* number of interfaces */
  684. X};
  685. X
  686. Xstruct mib_ifEntry {
  687. X    long    ifIndex;        /* index of this interface    */
  688. X    char    ifDescr[32];    /* english description of interface    */
  689. X    long    ifType;        /* network type of device    */
  690. X    long    ifMtu;        /* size of largest packet in bytes    */
  691. X    u_long  ifSpeed;        /* bandwidth in bits/sec    */
  692. X    u_char  ifPhysAddress[11];    /* interface's address */
  693. X    u_char  PhysAddrLen;    /* length of physAddr */
  694. X    long    ifAdminStatus;  /* desired state of interface */
  695. X    long    ifOperStatus;   /* current operational status */
  696. X    u_long  ifLastChange;   /* value of sysUpTime when current state entered */
  697. X    u_long  ifInOctets;        /* number of octets received on interface */
  698. X    u_long  ifInUcastPkts;  /* number of unicast packets delivered */
  699. X    u_long  ifInNUcastPkts; /* number of broadcasts or multicasts */
  700. X    u_long  ifInDiscards;   /* number of packets discarded with no error */
  701. X    u_long  ifInErrors;        /* number of packets containing errors */
  702. X    u_long  ifInUnknownProtos;    /* number of packets with unknown protocol */
  703. X    u_long  ifOutOctets;    /* number of octets transmitted */
  704. X    u_long  ifOutUcastPkts; /* number of unicast packets sent */
  705. X    u_long  ifOutNUcastPkts;/* number of broadcast or multicast pkts */
  706. X    u_long  ifOutDiscards;  /* number of packets discarded with no error */
  707. X    u_long  ifOutErrors;    /* number of pkts discarded with an error */
  708. X    u_long  ifOutQLen;        /* number of packets in output queue */
  709. X};
  710. X
  711. Xstruct mib_atEntry {
  712. X    long    atIfIndex;        /* interface on which this entry maps */
  713. X    u_char  atPhysAddress[11]; /* physical address of destination */
  714. X    u_char  PhysAddressLen; /* length of atPhysAddress */
  715. X    u_long  atNetAddress;   /* IP address of physical address */
  716. X};
  717. X
  718. Xstruct mib_ip {
  719. X    long    ipForwarding;   /* 1 if gateway, 2 if host */
  720. X    long    ipDefaultTTL;   /* default TTL for pkts originating here */
  721. X    u_long  ipInReceives;   /* no. of IP packets received from interfaces */
  722. X    u_long  ipInHdrErrors;  /* number of pkts discarded due to header errors */
  723. X    u_long  ipInAddrErrors; /* no. of pkts discarded due to bad address */
  724. X    u_long  ipForwDatagrams;/* number pf pkts forwarded through this entity */
  725. X    u_long  ipInUnknownProtos;/* no. of local-addressed pkts w/unknown proto */
  726. X    u_long  ipInDiscards;   /* number of error-free packets discarded */
  727. X    u_long  ipInDelivers;   /* number of datagrams delivered to upper level */
  728. X    u_long  ipOutRequests;  /* number of IP datagrams originating locally */
  729. X    u_long  ipOutDiscards;  /* number of error-free output IP pkts discarded */
  730. X    u_long  ipOutNoRoutes;  /* number of IP pkts discarded due to no route */
  731. X    long    ipReasmTimeout; /* seconds fragment is held awaiting reassembly */
  732. X    u_long  ipReasmReqds;   /* no. of fragments needing reassembly (here) */
  733. X    u_long  ipReasmOKs;        /* number of fragments reassembled */
  734. X    u_long  ipReasmFails;   /* number of failures in IP reassembly */
  735. X    u_long  ipFragOKs;        /* number of datagrams fragmented here */
  736. X    u_long  ipFragFails;    /* no. pkts unable to be fragmented here */
  737. X    u_long  ipFragCreates;  /* number of IP fragments created here */
  738. X};
  739. X
  740. Xstruct mib_ipAddrEntry {
  741. X    u_long  ipAdEntAddr;    /* IP address of this entry */
  742. X    long    ipAdEntIfIndex; /* IF for this entry */
  743. X    u_long  ipAdEntNetMask; /* subnet mask of this entry */
  744. X    long    ipAdEntBcastAddr;/* read the MIB for this one */
  745. X};
  746. X
  747. Xstruct mib_ipRouteEntry {
  748. X    u_long  ipRouteDest;    /* destination IP addr for this route */
  749. X    long    ipRouteIfIndex; /* index of local IF for this route */
  750. X    long    ipRouteMetric1; /* Primary routing metric */
  751. X    long    ipRouteMetric2; /* Alternate routing metric */
  752. X    long    ipRouteMetric3; /* Alternate routing metric */
  753. X    long    ipRouteMetric4; /* Alternate routing metric */
  754. X    u_long  ipRouteNextHop; /* IP addr of next hop */
  755. X    long    ipRouteType;    /* Type of this route */
  756. X    long    ipRouteProto;   /* How this route was learned */
  757. X    long    ipRouteAge;        /* No. of seconds since updating this route */
  758. X};
  759. X
  760. Xstruct mib_icmp {
  761. X    u_long  icmpInMsgs;        /* Total of ICMP msgs received */
  762. X    u_long  icmpInErrors;   /* Total of ICMP msgs received with errors */
  763. X    u_long  icmpInDestUnreachs;
  764. X    u_long  icmpInTimeExcds;
  765. X    u_long  icmpInParmProbs;
  766. X    u_long  icmpInSrcQuenchs;
  767. X    u_long  icmpInRedirects;
  768. X    u_long  icmpInEchos;
  769. X    u_long  icmpInEchoReps;
  770. X    u_long  icmpInTimestamps;
  771. X    u_long  icmpInTimestampReps;
  772. X    u_long  icmpInAddrMasks;
  773. X    u_long  icmpInAddrMaskReps;
  774. X    u_long  icmpOutMsgs;
  775. X    u_long  icmpOutErrors;
  776. X    u_long  icmpOutDestUnreachs;
  777. X    u_long  icmpOutTimeExcds;
  778. X    u_long  icmpOutParmProbs;
  779. X    u_long  icmpOutSrcQuenchs;
  780. X    u_long  icmpOutRedirects;
  781. X    u_long  icmpOutEchos;
  782. X    u_long  icmpOutEchoReps;
  783. X    u_long  icmpOutTimestamps;
  784. X    u_long  icmpOutTimestampReps;
  785. X    u_long  icmpOutAddrMasks;
  786. X    u_long  icmpOutAddrMaskReps;
  787. X};
  788. X
  789. Xstruct    mib_tcp {
  790. X    long    tcpRtoAlgorithm;    /* retransmission timeout algorithm */
  791. X    long    tcpRtoMin;        /* minimum retransmission timeout (mS) */
  792. X    long    tcpRtoMax;        /* maximum retransmission timeout (mS) */ 
  793. X    long    tcpMaxConn;        /* maximum tcp connections possible */
  794. X    u_long  tcpActiveOpens;    /* number of SYN-SENT -> CLOSED transitions */
  795. X    u_long  tcpPassiveOpens;    /* number of SYN-RCVD -> LISTEN transitions */
  796. X    u_long  tcpAttemptFails;/*(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN*/
  797. X    u_long  tcpEstabResets;    /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */
  798. X    u_long  tcpCurrEstab;    /* number in ESTABLISHED or CLOSE-WAIT state */
  799. X    u_long  tcpInSegs;        /* number of segments received */
  800. X    u_long  tcpOutSegs;        /* number of segments sent */
  801. X    u_long  tcpRetransSegs;    /* number of retransmitted segments */
  802. X};
  803. X
  804. Xstruct mib_tcpConnEntry {
  805. X    long    tcpConnState;    /* State of this connection */
  806. X    u_long  tcpConnLocalAddress;/* local IP address for this connection */
  807. X    long    tcpConnLocalPort;    /* local port for this connection */
  808. X    u_long  tcpConnRemAddress;    /* remote IP address for this connection */
  809. X    long    tcpConnRemPort;    /* remote port for this connection */
  810. X};
  811. X
  812. Xstruct mib_udp {
  813. X    u_long  udpInDatagrams; /* No. of UDP datagrams delivered to users */
  814. X    u_long  udpNoPorts;        /* No. of UDP datagrams to port with no listener */
  815. X    u_long  udpInErrors;    /* No. of UDP datagrams unable to be delivered */
  816. X    u_long  udpOutDatagrams;/* No. of UDP datagrams sent from this entity */
  817. X};
  818. X
  819. Xstruct    mib_egp {
  820. X    u_long  egpInMsgs;    /* No. of EGP msgs received without error */
  821. X    u_long  egpInErrors;/* No. of EGP msgs received with error */
  822. X    u_long  egpOutMsgs;    /* No. of EGP msgs sent */
  823. X    u_long  egpOutErrors;/* No. of (outgoing) EGP msgs dropped due to error */
  824. X};
  825. X
  826. Xstruct    mib_egpNeighEntry {
  827. X    long    egpNeighState;  /* local EGP state with this entry's neighbor */
  828. X    u_long  egpNeighAddr;   /* IP address of this entry's neighbor */
  829. X};
  830. X
  831. X#define MIB 1, 3, 6, 1, 2, 1
  832. X
  833. X#define MIB_IFTYPE_OTHER            1
  834. X#define MIB_IFTYPE_REGULAR1822            2
  835. X#define MIB_IFTYPE_HDH1822            3
  836. X#define MIB_IFTYPE_DDNX25            4
  837. X#define MIB_IFTYPE_RFC877X25            5
  838. X#define MIB_IFTYPE_ETHERNETCSMACD        6
  839. X#define MIB_IFTYPE_ISO88023CSMACD        7
  840. X#define MIB_IFTYPE_ISO88024TOKENBUS        8
  841. X#define MIB_IFTYPE_ISO88025TOKENRING        9
  842. X#define MIB_IFTYPE_ISO88026MAN            10
  843. X#define MIB_IFTYPE_STARLAN            11
  844. X#define MIB_IFTYPE_PROTEON10MBIT        12
  845. X#define MIB_IFTYPE_PROTEON80MBIT        13
  846. X#define MIB_IFTYPE_HYPERCHANNEL            14
  847. X#define MIB_IFTYPE_FDDI                15
  848. X#define MIB_IFTYPE_LAPB                16
  849. X#define MIB_IFTYPE_SDLC                17
  850. X#define MIB_IFTYPE_T1CARRIER            18
  851. X#define MIB_IFTYPE_CEPT                19
  852. X#define MIB_IFTYPE_BASICISDN            20
  853. X#define MIB_IFTYPE_PRIMARYISDN            21
  854. X#define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL   22
  855. X
  856. X#define MIB_IFSTATUS_UP        1
  857. X#define MIB_IFSTATUS_DOWN    2
  858. X#define MIB_IFSTATUS_TESTING    3
  859. X
  860. X#define MIB_FORWARD_GATEWAY    1
  861. X#define MIB_FORWARD_HOST    2
  862. X
  863. X#define MIB_IPROUTETYPE_OTHER    1
  864. X#define MIB_IPROUTETYPE_INVALID    2
  865. X#define MIB_IPROUTETYPE_DIRECT    3
  866. X#define MIB_IPROUTETYPE_REMOTE    4
  867. X
  868. X#define MIB_IPROUTEPROTO_OTHER        1
  869. X#define MIB_IPROUTEPROTO_LOCAL        2
  870. X#define MIB_IPROUTEPROTO_NETMGMT    3
  871. X#define MIB_IPROUTEPROTO_ICMP        4
  872. X#define MIB_IPROUTEPROTO_EGP        5
  873. X#define MIB_IPROUTEPROTO_GGP        6
  874. X#define MIB_IPROUTEPROTO_HELLO        7
  875. X#define MIB_IPROUTEPROTO_RIP        8
  876. X#define MIB_IPROUTEPROTO_ISIS        9
  877. X#define MIB_IPROUTEPROTO_ESIS        10
  878. X#define MIB_IPROUTEPROTO_CISCOIGRP  11
  879. X#define MIB_IPROUTEPROTO_BBNSPFIGP  12
  880. X#define MIB_IPROUTEPROTO_OIGP        13
  881. X
  882. X#define MIB_TCPRTOALG_OTHER    1
  883. X#define MIB_TCPRTOALG_CONSTANT    2
  884. X#define MIB_TCPRTOALG_RSRE    3
  885. X#define MIB_TCPRTOALG_VANJ    4
  886. X
  887. X#define MIB_TCPCONNSTATE_CLOSED        1
  888. X#define MIB_TCPCONNSTATE_LISTEN        2
  889. X#define MIB_TCPCONNSTATE_SYNSENT    3
  890. X#define MIB_TCPCONNSTATE_SYNRECEIVED    4
  891. X#define MIB_TCPCONNSTATE_ESTABLISHED    5
  892. X#define MIB_TCPCONNSTATE_FINWAIT1    6
  893. X#define MIB_TCPCONNSTATE_FINWAIT2    7
  894. X#define MIB_TCPCONNSTATE_CLOSEWAIT    8
  895. X#define MIB_TCPCONNSTATE_LASTACK    9
  896. X#define MIB_TCPCONNSTATE_CLOSING    10
  897. X#define MIB_TCPCONNSTATE_TIMEWAIT    11
  898. X
  899. X#define MIB_EGPNEIGHSTATE_IDLE        1
  900. X#define MIB_EGPNEIGHSTATE_AQUISITION    2
  901. X#define MIB_EGPNEIGHSTATE_DOWN        3
  902. X#define MIB_EGPNEIGHSTATE_UP        4
  903. X#define MIB_EGPNEIGHSTATE_CEASE        5
  904. X
  905. X
  906. X
  907. END_OF_FILE
  908.   if test 10793 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/mib.h'`; then
  909.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/mib.h'\" unpacked with wrong size!
  910.   fi
  911.   # end of 'nocol-3.0/src/cmu-snmp/include/mib.h'
  912. fi
  913. if test -f 'nocol-3.0/src/cmu-snmp/include/snmp.c' -a "${1}" != "-c" ; then 
  914.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/snmp.c'\"
  915. else
  916.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/snmp.c'\" \(10258 characters\)
  917.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/snmp.c' <<'END_OF_FILE'
  918. X/*
  919. X * Simple Network Management Protocol (RFC 1067).
  920. X *
  921. X */
  922. X/***********************************************************
  923. X    Copyright 1988, 1989 by Carnegie Mellon University
  924. X
  925. X                      All Rights Reserved
  926. X
  927. XPermission to use, copy, modify, and distribute this software and its 
  928. Xdocumentation for any purpose and without fee is hereby granted, 
  929. Xprovided that the above copyright notice appear in all copies and that
  930. Xboth that copyright notice and this permission notice appear in 
  931. Xsupporting documentation, and that the name of CMU not be
  932. Xused in advertising or publicity pertaining to distribution of the
  933. Xsoftware without specific, written prior permission.  
  934. X
  935. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  936. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  937. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  938. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  939. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  940. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  941. XSOFTWARE.
  942. X******************************************************************/
  943. X
  944. X#ifdef KINETICS
  945. X#include "gw.h"
  946. X#include "ab.h"
  947. X#include "inet.h"
  948. X#include "fp4/cmdmacro.h"
  949. X#include "fp4/pbuf.h"
  950. X#include "glob.h"
  951. X#endif
  952. X
  953. X#if (defined(unix) && !defined(KINETICS))
  954. X#include <sys/types.h>
  955. X#include <netinet/in.h>
  956. X#ifndef NULL
  957. X#define NULL 0
  958. X#endif
  959. X#endif
  960. X
  961. X#include "asn1.h"
  962. X#include "snmp.h"
  963. X#include "snmp_impl.h"
  964. X
  965. X#include "mib.h"
  966. X
  967. X
  968. Xu_char *
  969. Xsnmp_parse_var_op(data, var_name, var_name_len, var_val_type, var_val_len, var_val, listlength)
  970. X    register u_char *data;  /* IN - pointer to the start of object */
  971. X    oid        *var_name;        /* OUT - object id of variable */
  972. X    int        *var_name_len;  /* IN/OUT - length of variable name */
  973. X    u_char  *var_val_type;  /* OUT - type of variable (int or octet string) (one byte) */
  974. X    int        *var_val_len;   /* OUT - length of variable */
  975. X    u_char  **var_val;        /* OUT - pointer to ASN1 encoded value of variable */
  976. X    int        *listlength;    /* IN/OUT - number of valid bytes left in var_op_list */
  977. X{
  978. X    u_char        var_op_type;
  979. X    int            var_op_len = *listlength;
  980. X    u_char        *var_op_start = data;
  981. X
  982. X    data = asn_parse_header(data, &var_op_len, &var_op_type);
  983. X    if (data == NULL){
  984. X    ERROR("");
  985. X    return NULL;
  986. X    }
  987. X    if (var_op_type != (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR))
  988. X    return NULL;
  989. X    data = asn_parse_objid(data, &var_op_len, &var_op_type, var_name, var_name_len);
  990. X    if (data == NULL){
  991. X    ERROR("");
  992. X    return NULL;
  993. X    }
  994. X    if (var_op_type != (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  995. X    return NULL;
  996. X    *var_val = data;    /* save pointer to this object */
  997. X    /* find out what type of object this is */
  998. X    data = asn_parse_header(data, &var_op_len, var_val_type);
  999. X    if (data == NULL){
  1000. X    ERROR("");
  1001. X    return NULL;
  1002. X    }
  1003. X    *var_val_len = var_op_len;
  1004. X    data += var_op_len;
  1005. X    *listlength -= (int)(data - var_op_start);
  1006. X    return data;
  1007. X}
  1008. X
  1009. Xshift_array(begin, length, shift_amount)
  1010. X    u_char        *begin;
  1011. X    register int    length;
  1012. X    int            shift_amount;
  1013. X{
  1014. X    register u_char    *old, *new;
  1015. X
  1016. X    if (shift_amount >= 0){
  1017. X    old = begin + length - 1;
  1018. X    new = old + shift_amount;
  1019. X
  1020. X    while(length--)
  1021. X        *new-- = *old--;
  1022. X    } else {
  1023. X    old = begin;
  1024. X    new = begin + shift_amount;
  1025. X
  1026. X    while(length--)
  1027. X        *new++ = *old++;
  1028. X    }
  1029. X}
  1030. X
  1031. Xu_char *
  1032. Xsnmp_build_var_op(data, var_name, var_name_len, var_val_type, var_val_len, var_val, listlength)
  1033. X    register u_char *data;    /* IN - pointer to the beginning of the output buffer */
  1034. X    oid        *var_name;    /* IN - object id of variable */
  1035. X    int        *var_name_len;    /* IN - length of object id */
  1036. X    u_char    var_val_type;    /* IN - type of variable */
  1037. X    int        var_val_len;    /* IN - length of variable */
  1038. X    u_char    *var_val;    /* IN - value of variable */
  1039. X    register int *listlength;    /* IN/OUT - number of valid bytes left in output buffer */
  1040. X{
  1041. X    int            dummyLen, headerLen, header_shift;
  1042. X    u_char        *dataPtr;
  1043. X
  1044. X    dummyLen = *listlength;
  1045. X    dataPtr = data;
  1046. X    data = asn_build_header(data, &dummyLen, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0);
  1047. X    if (data == NULL){
  1048. X    ERROR("");
  1049. X    return NULL;
  1050. X    }
  1051. X    headerLen = data - dataPtr;
  1052. X    *listlength -= headerLen;
  1053. X    data = asn_build_objid(data, listlength,
  1054. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID),
  1055. X        var_name, *var_name_len);
  1056. X    if (data == NULL){
  1057. X    ERROR("");
  1058. X    return NULL;
  1059. X    }
  1060. X    switch(var_val_type){
  1061. X    case ASN_INTEGER:
  1062. X    case GAUGE:
  1063. X    case COUNTER:
  1064. X    case TIMETICKS:
  1065. X        data = asn_build_int(data, listlength, var_val_type,
  1066. X            (long *)var_val, var_val_len);
  1067. X        break;
  1068. X    case ASN_OCTET_STR:
  1069. X    case IPADDRESS:
  1070. X    case OPAQUE:
  1071. X        data = asn_build_string(data, listlength, var_val_type,
  1072. X            var_val, var_val_len);
  1073. X        break;
  1074. X    case ASN_OBJECT_ID:
  1075. X        data = asn_build_objid(data, listlength, var_val_type,
  1076. X            (oid *)var_val, var_val_len / sizeof(oid));
  1077. X        break;
  1078. X    case ASN_NULL:
  1079. X        data = asn_build_null(data, listlength, var_val_type);
  1080. X        break;
  1081. X    default:
  1082. X        ERROR("wrong type");
  1083. X        return NULL;
  1084. X    }
  1085. X    if (data == NULL){
  1086. X    ERROR("");
  1087. X    return NULL;
  1088. X    }
  1089. X    dummyLen = (data - dataPtr) - headerLen;
  1090. X    header_shift = 0;
  1091. X    if (dummyLen >= 0x80){
  1092. X    header_shift++;
  1093. X    if (dummyLen > 0xFF)
  1094. X        header_shift++;
  1095. X    }
  1096. X    if (header_shift){
  1097. X    /* should check available length here */
  1098. X    shift_array(dataPtr + headerLen, dummyLen, header_shift);
  1099. X    data += header_shift;
  1100. X    headerLen += header_shift;
  1101. X    }
  1102. X
  1103. X    
  1104. X    if (asn_build_header(dataPtr, &dummyLen, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), dummyLen) == NULL){
  1105. X    ERROR("");
  1106. X    return NULL;
  1107. X    }
  1108. X    return data;
  1109. X}
  1110. X
  1111. X
  1112. X
  1113. Xint
  1114. Xsnmp_build_trap(out_data, length, sysOid, sysOidLen, myAddr, trapType, specificType, time, varName, varNameLen, varType, varLen, varVal)
  1115. X    register u_char  *out_data;
  1116. X    int        *length;
  1117. X    oid        *sysOid;
  1118. X    int        sysOidLen;
  1119. X    u_long  myAddr;
  1120. X    int        trapType;
  1121. X    int        specificType;
  1122. X    u_long  time;
  1123. X    oid        *varName;
  1124. X    int        varNameLen;
  1125. X    u_char  varType;
  1126. X    int        varLen;
  1127. X    u_char  *varVal;
  1128. X{
  1129. X    long    version = SNMP_VERSION_1;
  1130. X    int        sidLen = strlen("public");
  1131. X    int        dummyLen;
  1132. X    u_char  *out_auth, *out_header, *out_pdu, *out_varHeader, *out_varlist, *out_end;
  1133. X    int        auth_shift, pdu_shift, list_shift;
  1134. X    
  1135. X
  1136. X
  1137. X    out_auth = out_data;
  1138. X    out_header = snmp_auth_build(out_data, length, (u_char *)"public", &sidLen, &version, 90);
  1139. X    if (out_header == NULL){
  1140. X    ERROR("auth build failed");
  1141. X    return 0;
  1142. X    }
  1143. X    out_pdu = asn_build_header(out_header, length, (u_char)TRP_REQ_MSG, 90);
  1144. X    if (out_pdu == NULL){
  1145. X    ERROR("header build failed");
  1146. X    return 0;
  1147. X    }
  1148. X    out_data = asn_build_objid(out_pdu, length,
  1149. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID),
  1150. X        (oid *)sysOid, sysOidLen);
  1151. X    if (out_data == NULL){
  1152. X    ERROR("build enterprise failed");
  1153. X    return 0;
  1154. X    }
  1155. X    out_data = asn_build_string(out_data, length,
  1156. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
  1157. X        (u_char *)&myAddr, sizeof(myAddr));
  1158. X    if (out_data == NULL){
  1159. X    ERROR("build agent_addr failed");
  1160. X    return 0;
  1161. X    }
  1162. X    out_data = asn_build_int(out_data, length,
  1163. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
  1164. X        (long *)&trapType, sizeof(trapType));
  1165. X    if (out_data == NULL){
  1166. X    ERROR("build trap_type failed");
  1167. X    return 0;
  1168. X    }
  1169. X    out_data = asn_build_int(out_data, length,
  1170. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
  1171. X        (long *)&specificType, sizeof(specificType));
  1172. X    if (out_data == NULL){
  1173. X    ERROR("build specificType failed");
  1174. X    return 0;
  1175. X    }
  1176. X    out_varHeader = asn_build_int(out_data, length,
  1177. X        (u_char)(TIMETICKS),
  1178. X        (long *)&time, sizeof(time));
  1179. X    if (out_varHeader == NULL){
  1180. X    ERROR("build timestampfailed");
  1181. X    return 0;
  1182. X    }
  1183. X    out_varlist = asn_build_header(out_varHeader,  length, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 90);
  1184. X    out_end = snmp_build_var_op(out_varlist, varName, &varNameLen, varType, varLen, varVal, length);
  1185. X    if (out_end == NULL){
  1186. X    ERROR("build varop failed");
  1187. X    return 0;
  1188. X    }
  1189. X
  1190. X    /*
  1191. X     * Because of the assumption above that header lengths would be encoded
  1192. X     * in one byte, things need to be fixed, now that the actual lengths are known.
  1193. X     */
  1194. X    list_shift = 0;
  1195. X    *length = out_end - out_varlist;
  1196. X    if (*length >= 0x80){
  1197. X    list_shift++;
  1198. X    if (*length > 0xFF)
  1199. X        list_shift++;
  1200. X    }
  1201. X    pdu_shift = 0;
  1202. X    *length = (out_end - out_pdu) + list_shift;
  1203. X    if (*length >= 0x80){
  1204. X    pdu_shift++;
  1205. X    if (*length > 0xFF)
  1206. X        pdu_shift++;
  1207. X    }
  1208. X    auth_shift = 0;
  1209. X    /*  2 below is the size of the assumed asn header in the auth header */
  1210. X    *length = (out_end - out_auth) - 2 + pdu_shift + list_shift;
  1211. X    if (*length >= 0x80){
  1212. X    auth_shift++;
  1213. X    if (*length > 0xFF)
  1214. X        auth_shift++;
  1215. X    }
  1216. X    if (auth_shift + pdu_shift + list_shift){
  1217. X    /*
  1218. X     * Shift packet (from start of varlist to end of packet) by the sum of the
  1219. X     * necessary shift counts.
  1220. X     */
  1221. X    shift_array(out_varlist, out_end - out_varlist, auth_shift + pdu_shift + list_shift);
  1222. X    /* Now adjust pointers into the packet */
  1223. X    out_end += auth_shift + pdu_shift + list_shift;
  1224. X    out_varlist += auth_shift + pdu_shift + list_shift;
  1225. X    out_varHeader += auth_shift + pdu_shift;
  1226. X    }
  1227. X    /* Now rebuild header with the actual lengths */
  1228. X    dummyLen = out_end - out_varlist;
  1229. X    if (asn_build_header(out_varHeader, &dummyLen, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), dummyLen) != out_varlist)
  1230. X    return 0;
  1231. X
  1232. X    if (auth_shift + pdu_shift){
  1233. X    /*
  1234. X     * Shift packet (from start of varlist to end of packet) by the sum of the
  1235. X     * necessary shift counts.
  1236. X     */
  1237. X    shift_array(out_pdu, out_varHeader - out_pdu, auth_shift + pdu_shift);
  1238. X    /* Now adjust pointers into the packet */
  1239. X    out_pdu += auth_shift + pdu_shift;
  1240. X    out_header += auth_shift;
  1241. X    }
  1242. X    /* Now rebuild header with the actual lengths */
  1243. X    dummyLen = out_end - out_pdu;
  1244. X    if (asn_build_header(out_header, &dummyLen, (u_char)TRP_REQ_MSG, dummyLen) != out_pdu)
  1245. X    return 0;
  1246. X
  1247. X    out_data = out_auth;
  1248. X    *length = out_end - out_auth;
  1249. X    out_data = snmp_auth_build(out_data, length, (u_char *)"public", &sidLen, &version, out_end - out_header);
  1250. X    if (out_data != out_header){
  1251. X    ERROR("internal error");
  1252. X    return 0;
  1253. X    }
  1254. X    *length = out_end - out_auth;
  1255. X    return *length;
  1256. X}
  1257. X
  1258. X
  1259. END_OF_FILE
  1260.   if test 10258 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/snmp.c'`; then
  1261.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/snmp.c'\" unpacked with wrong size!
  1262.   fi
  1263.   # end of 'nocol-3.0/src/cmu-snmp/include/snmp.c'
  1264. fi
  1265. if test -f 'nocol-3.0/src/cmu-snmp/snmplib/mib.h' -a "${1}" != "-c" ; then 
  1266.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/snmplib/mib.h'\"
  1267. else
  1268.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/snmplib/mib.h'\" \(10793 characters\)
  1269.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/snmplib/mib.h' <<'END_OF_FILE'
  1270. X/*
  1271. X * Definitions for the variables as defined in the MIB
  1272. X */
  1273. X/***********************************************************
  1274. X    Copyright 1988, 1989 by Carnegie Mellon University
  1275. X
  1276. X                      All Rights Reserved
  1277. X
  1278. XPermission to use, copy, modify, and distribute this software and its 
  1279. Xdocumentation for any purpose and without fee is hereby granted, 
  1280. Xprovided that the above copyright notice appear in all copies and that
  1281. Xboth that copyright notice and this permission notice appear in 
  1282. Xsupporting documentation, and that the name of CMU not be
  1283. Xused in advertising or publicity pertaining to distribution of the
  1284. Xsoftware without specific, written prior permission.  
  1285. X
  1286. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1287. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1288. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1289. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1290. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1291. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1292. XSOFTWARE.
  1293. X******************************************************************/
  1294. X
  1295. Xstruct    mib_system {
  1296. X    char    sysDescr[32];   /* textual description */
  1297. X    u_char  sysObjectID[16];/* OBJECT IDENTIFIER of system */
  1298. X    u_char  ObjIDLen;        /* length of sysObjectID */
  1299. X    u_long  sysUpTime;        /* Uptime in 100/s of a second */    
  1300. X};
  1301. X
  1302. Xstruct mib_interface {
  1303. X    long    ifNumber;        /* number of interfaces */
  1304. X};
  1305. X
  1306. Xstruct mib_ifEntry {
  1307. X    long    ifIndex;        /* index of this interface    */
  1308. X    char    ifDescr[32];    /* english description of interface    */
  1309. X    long    ifType;        /* network type of device    */
  1310. X    long    ifMtu;        /* size of largest packet in bytes    */
  1311. X    u_long  ifSpeed;        /* bandwidth in bits/sec    */
  1312. X    u_char  ifPhysAddress[11];    /* interface's address */
  1313. X    u_char  PhysAddrLen;    /* length of physAddr */
  1314. X    long    ifAdminStatus;  /* desired state of interface */
  1315. X    long    ifOperStatus;   /* current operational status */
  1316. X    u_long  ifLastChange;   /* value of sysUpTime when current state entered */
  1317. X    u_long  ifInOctets;        /* number of octets received on interface */
  1318. X    u_long  ifInUcastPkts;  /* number of unicast packets delivered */
  1319. X    u_long  ifInNUcastPkts; /* number of broadcasts or multicasts */
  1320. X    u_long  ifInDiscards;   /* number of packets discarded with no error */
  1321. X    u_long  ifInErrors;        /* number of packets containing errors */
  1322. X    u_long  ifInUnknownProtos;    /* number of packets with unknown protocol */
  1323. X    u_long  ifOutOctets;    /* number of octets transmitted */
  1324. X    u_long  ifOutUcastPkts; /* number of unicast packets sent */
  1325. X    u_long  ifOutNUcastPkts;/* number of broadcast or multicast pkts */
  1326. X    u_long  ifOutDiscards;  /* number of packets discarded with no error */
  1327. X    u_long  ifOutErrors;    /* number of pkts discarded with an error */
  1328. X    u_long  ifOutQLen;        /* number of packets in output queue */
  1329. X};
  1330. X
  1331. Xstruct mib_atEntry {
  1332. X    long    atIfIndex;        /* interface on which this entry maps */
  1333. X    u_char  atPhysAddress[11]; /* physical address of destination */
  1334. X    u_char  PhysAddressLen; /* length of atPhysAddress */
  1335. X    u_long  atNetAddress;   /* IP address of physical address */
  1336. X};
  1337. X
  1338. Xstruct mib_ip {
  1339. X    long    ipForwarding;   /* 1 if gateway, 2 if host */
  1340. X    long    ipDefaultTTL;   /* default TTL for pkts originating here */
  1341. X    u_long  ipInReceives;   /* no. of IP packets received from interfaces */
  1342. X    u_long  ipInHdrErrors;  /* number of pkts discarded due to header errors */
  1343. X    u_long  ipInAddrErrors; /* no. of pkts discarded due to bad address */
  1344. X    u_long  ipForwDatagrams;/* number pf pkts forwarded through this entity */
  1345. X    u_long  ipInUnknownProtos;/* no. of local-addressed pkts w/unknown proto */
  1346. X    u_long  ipInDiscards;   /* number of error-free packets discarded */
  1347. X    u_long  ipInDelivers;   /* number of datagrams delivered to upper level */
  1348. X    u_long  ipOutRequests;  /* number of IP datagrams originating locally */
  1349. X    u_long  ipOutDiscards;  /* number of error-free output IP pkts discarded */
  1350. X    u_long  ipOutNoRoutes;  /* number of IP pkts discarded due to no route */
  1351. X    long    ipReasmTimeout; /* seconds fragment is held awaiting reassembly */
  1352. X    u_long  ipReasmReqds;   /* no. of fragments needing reassembly (here) */
  1353. X    u_long  ipReasmOKs;        /* number of fragments reassembled */
  1354. X    u_long  ipReasmFails;   /* number of failures in IP reassembly */
  1355. X    u_long  ipFragOKs;        /* number of datagrams fragmented here */
  1356. X    u_long  ipFragFails;    /* no. pkts unable to be fragmented here */
  1357. X    u_long  ipFragCreates;  /* number of IP fragments created here */
  1358. X};
  1359. X
  1360. Xstruct mib_ipAddrEntry {
  1361. X    u_long  ipAdEntAddr;    /* IP address of this entry */
  1362. X    long    ipAdEntIfIndex; /* IF for this entry */
  1363. X    u_long  ipAdEntNetMask; /* subnet mask of this entry */
  1364. X    long    ipAdEntBcastAddr;/* read the MIB for this one */
  1365. X};
  1366. X
  1367. Xstruct mib_ipRouteEntry {
  1368. X    u_long  ipRouteDest;    /* destination IP addr for this route */
  1369. X    long    ipRouteIfIndex; /* index of local IF for this route */
  1370. X    long    ipRouteMetric1; /* Primary routing metric */
  1371. X    long    ipRouteMetric2; /* Alternate routing metric */
  1372. X    long    ipRouteMetric3; /* Alternate routing metric */
  1373. X    long    ipRouteMetric4; /* Alternate routing metric */
  1374. X    u_long  ipRouteNextHop; /* IP addr of next hop */
  1375. X    long    ipRouteType;    /* Type of this route */
  1376. X    long    ipRouteProto;   /* How this route was learned */
  1377. X    long    ipRouteAge;        /* No. of seconds since updating this route */
  1378. X};
  1379. X
  1380. Xstruct mib_icmp {
  1381. X    u_long  icmpInMsgs;        /* Total of ICMP msgs received */
  1382. X    u_long  icmpInErrors;   /* Total of ICMP msgs received with errors */
  1383. X    u_long  icmpInDestUnreachs;
  1384. X    u_long  icmpInTimeExcds;
  1385. X    u_long  icmpInParmProbs;
  1386. X    u_long  icmpInSrcQuenchs;
  1387. X    u_long  icmpInRedirects;
  1388. X    u_long  icmpInEchos;
  1389. X    u_long  icmpInEchoReps;
  1390. X    u_long  icmpInTimestamps;
  1391. X    u_long  icmpInTimestampReps;
  1392. X    u_long  icmpInAddrMasks;
  1393. X    u_long  icmpInAddrMaskReps;
  1394. X    u_long  icmpOutMsgs;
  1395. X    u_long  icmpOutErrors;
  1396. X    u_long  icmpOutDestUnreachs;
  1397. X    u_long  icmpOutTimeExcds;
  1398. X    u_long  icmpOutParmProbs;
  1399. X    u_long  icmpOutSrcQuenchs;
  1400. X    u_long  icmpOutRedirects;
  1401. X    u_long  icmpOutEchos;
  1402. X    u_long  icmpOutEchoReps;
  1403. X    u_long  icmpOutTimestamps;
  1404. X    u_long  icmpOutTimestampReps;
  1405. X    u_long  icmpOutAddrMasks;
  1406. X    u_long  icmpOutAddrMaskReps;
  1407. X};
  1408. X
  1409. Xstruct    mib_tcp {
  1410. X    long    tcpRtoAlgorithm;    /* retransmission timeout algorithm */
  1411. X    long    tcpRtoMin;        /* minimum retransmission timeout (mS) */
  1412. X    long    tcpRtoMax;        /* maximum retransmission timeout (mS) */ 
  1413. X    long    tcpMaxConn;        /* maximum tcp connections possible */
  1414. X    u_long  tcpActiveOpens;    /* number of SYN-SENT -> CLOSED transitions */
  1415. X    u_long  tcpPassiveOpens;    /* number of SYN-RCVD -> LISTEN transitions */
  1416. X    u_long  tcpAttemptFails;/*(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN*/
  1417. X    u_long  tcpEstabResets;    /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */
  1418. X    u_long  tcpCurrEstab;    /* number in ESTABLISHED or CLOSE-WAIT state */
  1419. X    u_long  tcpInSegs;        /* number of segments received */
  1420. X    u_long  tcpOutSegs;        /* number of segments sent */
  1421. X    u_long  tcpRetransSegs;    /* number of retransmitted segments */
  1422. X};
  1423. X
  1424. Xstruct mib_tcpConnEntry {
  1425. X    long    tcpConnState;    /* State of this connection */
  1426. X    u_long  tcpConnLocalAddress;/* local IP address for this connection */
  1427. X    long    tcpConnLocalPort;    /* local port for this connection */
  1428. X    u_long  tcpConnRemAddress;    /* remote IP address for this connection */
  1429. X    long    tcpConnRemPort;    /* remote port for this connection */
  1430. X};
  1431. X
  1432. Xstruct mib_udp {
  1433. X    u_long  udpInDatagrams; /* No. of UDP datagrams delivered to users */
  1434. X    u_long  udpNoPorts;        /* No. of UDP datagrams to port with no listener */
  1435. X    u_long  udpInErrors;    /* No. of UDP datagrams unable to be delivered */
  1436. X    u_long  udpOutDatagrams;/* No. of UDP datagrams sent from this entity */
  1437. X};
  1438. X
  1439. Xstruct    mib_egp {
  1440. X    u_long  egpInMsgs;    /* No. of EGP msgs received without error */
  1441. X    u_long  egpInErrors;/* No. of EGP msgs received with error */
  1442. X    u_long  egpOutMsgs;    /* No. of EGP msgs sent */
  1443. X    u_long  egpOutErrors;/* No. of (outgoing) EGP msgs dropped due to error */
  1444. X};
  1445. X
  1446. Xstruct    mib_egpNeighEntry {
  1447. X    long    egpNeighState;  /* local EGP state with this entry's neighbor */
  1448. X    u_long  egpNeighAddr;   /* IP address of this entry's neighbor */
  1449. X};
  1450. X
  1451. X#define MIB 1, 3, 6, 1, 2, 1
  1452. X
  1453. X#define MIB_IFTYPE_OTHER            1
  1454. X#define MIB_IFTYPE_REGULAR1822            2
  1455. X#define MIB_IFTYPE_HDH1822            3
  1456. X#define MIB_IFTYPE_DDNX25            4
  1457. X#define MIB_IFTYPE_RFC877X25            5
  1458. X#define MIB_IFTYPE_ETHERNETCSMACD        6
  1459. X#define MIB_IFTYPE_ISO88023CSMACD        7
  1460. X#define MIB_IFTYPE_ISO88024TOKENBUS        8
  1461. X#define MIB_IFTYPE_ISO88025TOKENRING        9
  1462. X#define MIB_IFTYPE_ISO88026MAN            10
  1463. X#define MIB_IFTYPE_STARLAN            11
  1464. X#define MIB_IFTYPE_PROTEON10MBIT        12
  1465. X#define MIB_IFTYPE_PROTEON80MBIT        13
  1466. X#define MIB_IFTYPE_HYPERCHANNEL            14
  1467. X#define MIB_IFTYPE_FDDI                15
  1468. X#define MIB_IFTYPE_LAPB                16
  1469. X#define MIB_IFTYPE_SDLC                17
  1470. X#define MIB_IFTYPE_T1CARRIER            18
  1471. X#define MIB_IFTYPE_CEPT                19
  1472. X#define MIB_IFTYPE_BASICISDN            20
  1473. X#define MIB_IFTYPE_PRIMARYISDN            21
  1474. X#define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL   22
  1475. X
  1476. X#define MIB_IFSTATUS_UP        1
  1477. X#define MIB_IFSTATUS_DOWN    2
  1478. X#define MIB_IFSTATUS_TESTING    3
  1479. X
  1480. X#define MIB_FORWARD_GATEWAY    1
  1481. X#define MIB_FORWARD_HOST    2
  1482. X
  1483. X#define MIB_IPROUTETYPE_OTHER    1
  1484. X#define MIB_IPROUTETYPE_INVALID    2
  1485. X#define MIB_IPROUTETYPE_DIRECT    3
  1486. X#define MIB_IPROUTETYPE_REMOTE    4
  1487. X
  1488. X#define MIB_IPROUTEPROTO_OTHER        1
  1489. X#define MIB_IPROUTEPROTO_LOCAL        2
  1490. X#define MIB_IPROUTEPROTO_NETMGMT    3
  1491. X#define MIB_IPROUTEPROTO_ICMP        4
  1492. X#define MIB_IPROUTEPROTO_EGP        5
  1493. X#define MIB_IPROUTEPROTO_GGP        6
  1494. X#define MIB_IPROUTEPROTO_HELLO        7
  1495. X#define MIB_IPROUTEPROTO_RIP        8
  1496. X#define MIB_IPROUTEPROTO_ISIS        9
  1497. X#define MIB_IPROUTEPROTO_ESIS        10
  1498. X#define MIB_IPROUTEPROTO_CISCOIGRP  11
  1499. X#define MIB_IPROUTEPROTO_BBNSPFIGP  12
  1500. X#define MIB_IPROUTEPROTO_OIGP        13
  1501. X
  1502. X#define MIB_TCPRTOALG_OTHER    1
  1503. X#define MIB_TCPRTOALG_CONSTANT    2
  1504. X#define MIB_TCPRTOALG_RSRE    3
  1505. X#define MIB_TCPRTOALG_VANJ    4
  1506. X
  1507. X#define MIB_TCPCONNSTATE_CLOSED        1
  1508. X#define MIB_TCPCONNSTATE_LISTEN        2
  1509. X#define MIB_TCPCONNSTATE_SYNSENT    3
  1510. X#define MIB_TCPCONNSTATE_SYNRECEIVED    4
  1511. X#define MIB_TCPCONNSTATE_ESTABLISHED    5
  1512. X#define MIB_TCPCONNSTATE_FINWAIT1    6
  1513. X#define MIB_TCPCONNSTATE_FINWAIT2    7
  1514. X#define MIB_TCPCONNSTATE_CLOSEWAIT    8
  1515. X#define MIB_TCPCONNSTATE_LASTACK    9
  1516. X#define MIB_TCPCONNSTATE_CLOSING    10
  1517. X#define MIB_TCPCONNSTATE_TIMEWAIT    11
  1518. X
  1519. X#define MIB_EGPNEIGHSTATE_IDLE        1
  1520. X#define MIB_EGPNEIGHSTATE_AQUISITION    2
  1521. X#define MIB_EGPNEIGHSTATE_DOWN        3
  1522. X#define MIB_EGPNEIGHSTATE_UP        4
  1523. X#define MIB_EGPNEIGHSTATE_CEASE        5
  1524. X
  1525. X
  1526. X
  1527. END_OF_FILE
  1528.   if test 10793 -ne `wc -c <'nocol-3.0/src/cmu-snmp/snmplib/mib.h'`; then
  1529.     echo shar: \"'nocol-3.0/src/cmu-snmp/snmplib/mib.h'\" unpacked with wrong size!
  1530.   fi
  1531.   # end of 'nocol-3.0/src/cmu-snmp/snmplib/mib.h'
  1532. fi
  1533. if test -f 'nocol-3.0/src/cmu-snmp/snmplib/snmp.c' -a "${1}" != "-c" ; then 
  1534.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/snmplib/snmp.c'\"
  1535. else
  1536.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/snmplib/snmp.c'\" \(10258 characters\)
  1537.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/snmplib/snmp.c' <<'END_OF_FILE'
  1538. X/*
  1539. X * Simple Network Management Protocol (RFC 1067).
  1540. X *
  1541. X */
  1542. X/***********************************************************
  1543. X    Copyright 1988, 1989 by Carnegie Mellon University
  1544. X
  1545. X                      All Rights Reserved
  1546. X
  1547. XPermission to use, copy, modify, and distribute this software and its 
  1548. Xdocumentation for any purpose and without fee is hereby granted, 
  1549. Xprovided that the above copyright notice appear in all copies and that
  1550. Xboth that copyright notice and this permission notice appear in 
  1551. Xsupporting documentation, and that the name of CMU not be
  1552. Xused in advertising or publicity pertaining to distribution of the
  1553. Xsoftware without specific, written prior permission.  
  1554. X
  1555. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1556. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1557. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1558. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1559. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1560. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1561. XSOFTWARE.
  1562. X******************************************************************/
  1563. X
  1564. X#ifdef KINETICS
  1565. X#include "gw.h"
  1566. X#include "ab.h"
  1567. X#include "inet.h"
  1568. X#include "fp4/cmdmacro.h"
  1569. X#include "fp4/pbuf.h"
  1570. X#include "glob.h"
  1571. X#endif
  1572. X
  1573. X#if (defined(unix) && !defined(KINETICS))
  1574. X#include <sys/types.h>
  1575. X#include <netinet/in.h>
  1576. X#ifndef NULL
  1577. X#define NULL 0
  1578. X#endif
  1579. X#endif
  1580. X
  1581. X#include "asn1.h"
  1582. X#include "snmp.h"
  1583. X#include "snmp_impl.h"
  1584. X
  1585. X#include "mib.h"
  1586. X
  1587. X
  1588. Xu_char *
  1589. Xsnmp_parse_var_op(data, var_name, var_name_len, var_val_type, var_val_len, var_val, listlength)
  1590. X    register u_char *data;  /* IN - pointer to the start of object */
  1591. X    oid        *var_name;        /* OUT - object id of variable */
  1592. X    int        *var_name_len;  /* IN/OUT - length of variable name */
  1593. X    u_char  *var_val_type;  /* OUT - type of variable (int or octet string) (one byte) */
  1594. X    int        *var_val_len;   /* OUT - length of variable */
  1595. X    u_char  **var_val;        /* OUT - pointer to ASN1 encoded value of variable */
  1596. X    int        *listlength;    /* IN/OUT - number of valid bytes left in var_op_list */
  1597. X{
  1598. X    u_char        var_op_type;
  1599. X    int            var_op_len = *listlength;
  1600. X    u_char        *var_op_start = data;
  1601. X
  1602. X    data = asn_parse_header(data, &var_op_len, &var_op_type);
  1603. X    if (data == NULL){
  1604. X    ERROR("");
  1605. X    return NULL;
  1606. X    }
  1607. X    if (var_op_type != (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR))
  1608. X    return NULL;
  1609. X    data = asn_parse_objid(data, &var_op_len, &var_op_type, var_name, var_name_len);
  1610. X    if (data == NULL){
  1611. X    ERROR("");
  1612. X    return NULL;
  1613. X    }
  1614. X    if (var_op_type != (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  1615. X    return NULL;
  1616. X    *var_val = data;    /* save pointer to this object */
  1617. X    /* find out what type of object this is */
  1618. X    data = asn_parse_header(data, &var_op_len, var_val_type);
  1619. X    if (data == NULL){
  1620. X    ERROR("");
  1621. X    return NULL;
  1622. X    }
  1623. X    *var_val_len = var_op_len;
  1624. X    data += var_op_len;
  1625. X    *listlength -= (int)(data - var_op_start);
  1626. X    return data;
  1627. X}
  1628. X
  1629. Xshift_array(begin, length, shift_amount)
  1630. X    u_char        *begin;
  1631. X    register int    length;
  1632. X    int            shift_amount;
  1633. X{
  1634. X    register u_char    *old, *new;
  1635. X
  1636. X    if (shift_amount >= 0){
  1637. X    old = begin + length - 1;
  1638. X    new = old + shift_amount;
  1639. X
  1640. X    while(length--)
  1641. X        *new-- = *old--;
  1642. X    } else {
  1643. X    old = begin;
  1644. X    new = begin + shift_amount;
  1645. X
  1646. X    while(length--)
  1647. X        *new++ = *old++;
  1648. X    }
  1649. X}
  1650. X
  1651. Xu_char *
  1652. Xsnmp_build_var_op(data, var_name, var_name_len, var_val_type, var_val_len, var_val, listlength)
  1653. X    register u_char *data;    /* IN - pointer to the beginning of the output buffer */
  1654. X    oid        *var_name;    /* IN - object id of variable */
  1655. X    int        *var_name_len;    /* IN - length of object id */
  1656. X    u_char    var_val_type;    /* IN - type of variable */
  1657. X    int        var_val_len;    /* IN - length of variable */
  1658. X    u_char    *var_val;    /* IN - value of variable */
  1659. X    register int *listlength;    /* IN/OUT - number of valid bytes left in output buffer */
  1660. X{
  1661. X    int            dummyLen, headerLen, header_shift;
  1662. X    u_char        *dataPtr;
  1663. X
  1664. X    dummyLen = *listlength;
  1665. X    dataPtr = data;
  1666. X    data = asn_build_header(data, &dummyLen, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0);
  1667. X    if (data == NULL){
  1668. X    ERROR("");
  1669. X    return NULL;
  1670. X    }
  1671. X    headerLen = data - dataPtr;
  1672. X    *listlength -= headerLen;
  1673. X    data = asn_build_objid(data, listlength,
  1674. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID),
  1675. X        var_name, *var_name_len);
  1676. X    if (data == NULL){
  1677. X    ERROR("");
  1678. X    return NULL;
  1679. X    }
  1680. X    switch(var_val_type){
  1681. X    case ASN_INTEGER:
  1682. X    case GAUGE:
  1683. X    case COUNTER:
  1684. X    case TIMETICKS:
  1685. X        data = asn_build_int(data, listlength, var_val_type,
  1686. X            (long *)var_val, var_val_len);
  1687. X        break;
  1688. X    case ASN_OCTET_STR:
  1689. X    case IPADDRESS:
  1690. X    case OPAQUE:
  1691. X        data = asn_build_string(data, listlength, var_val_type,
  1692. X            var_val, var_val_len);
  1693. X        break;
  1694. X    case ASN_OBJECT_ID:
  1695. X        data = asn_build_objid(data, listlength, var_val_type,
  1696. X            (oid *)var_val, var_val_len / sizeof(oid));
  1697. X        break;
  1698. X    case ASN_NULL:
  1699. X        data = asn_build_null(data, listlength, var_val_type);
  1700. X        break;
  1701. X    default:
  1702. X        ERROR("wrong type");
  1703. X        return NULL;
  1704. X    }
  1705. X    if (data == NULL){
  1706. X    ERROR("");
  1707. X    return NULL;
  1708. X    }
  1709. X    dummyLen = (data - dataPtr) - headerLen;
  1710. X    header_shift = 0;
  1711. X    if (dummyLen >= 0x80){
  1712. X    header_shift++;
  1713. X    if (dummyLen > 0xFF)
  1714. X        header_shift++;
  1715. X    }
  1716. X    if (header_shift){
  1717. X    /* should check available length here */
  1718. X    shift_array(dataPtr + headerLen, dummyLen, header_shift);
  1719. X    data += header_shift;
  1720. X    headerLen += header_shift;
  1721. X    }
  1722. X
  1723. X    
  1724. X    if (asn_build_header(dataPtr, &dummyLen, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), dummyLen) == NULL){
  1725. X    ERROR("");
  1726. X    return NULL;
  1727. X    }
  1728. X    return data;
  1729. X}
  1730. X
  1731. X
  1732. X
  1733. Xint
  1734. Xsnmp_build_trap(out_data, length, sysOid, sysOidLen, myAddr, trapType, specificType, time, varName, varNameLen, varType, varLen, varVal)
  1735. X    register u_char  *out_data;
  1736. X    int        *length;
  1737. X    oid        *sysOid;
  1738. X    int        sysOidLen;
  1739. X    u_long  myAddr;
  1740. X    int        trapType;
  1741. X    int        specificType;
  1742. X    u_long  time;
  1743. X    oid        *varName;
  1744. X    int        varNameLen;
  1745. X    u_char  varType;
  1746. X    int        varLen;
  1747. X    u_char  *varVal;
  1748. X{
  1749. X    long    version = SNMP_VERSION_1;
  1750. X    int        sidLen = strlen("public");
  1751. X    int        dummyLen;
  1752. X    u_char  *out_auth, *out_header, *out_pdu, *out_varHeader, *out_varlist, *out_end;
  1753. X    int        auth_shift, pdu_shift, list_shift;
  1754. X    
  1755. X
  1756. X
  1757. X    out_auth = out_data;
  1758. X    out_header = snmp_auth_build(out_data, length, (u_char *)"public", &sidLen, &version, 90);
  1759. X    if (out_header == NULL){
  1760. X    ERROR("auth build failed");
  1761. X    return 0;
  1762. X    }
  1763. X    out_pdu = asn_build_header(out_header, length, (u_char)TRP_REQ_MSG, 90);
  1764. X    if (out_pdu == NULL){
  1765. X    ERROR("header build failed");
  1766. X    return 0;
  1767. X    }
  1768. X    out_data = asn_build_objid(out_pdu, length,
  1769. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID),
  1770. X        (oid *)sysOid, sysOidLen);
  1771. X    if (out_data == NULL){
  1772. X    ERROR("build enterprise failed");
  1773. X    return 0;
  1774. X    }
  1775. X    out_data = asn_build_string(out_data, length,
  1776. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
  1777. X        (u_char *)&myAddr, sizeof(myAddr));
  1778. X    if (out_data == NULL){
  1779. X    ERROR("build agent_addr failed");
  1780. X    return 0;
  1781. X    }
  1782. X    out_data = asn_build_int(out_data, length,
  1783. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
  1784. X        (long *)&trapType, sizeof(trapType));
  1785. X    if (out_data == NULL){
  1786. X    ERROR("build trap_type failed");
  1787. X    return 0;
  1788. X    }
  1789. X    out_data = asn_build_int(out_data, length,
  1790. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
  1791. X        (long *)&specificType, sizeof(specificType));
  1792. X    if (out_data == NULL){
  1793. X    ERROR("build specificType failed");
  1794. X    return 0;
  1795. X    }
  1796. X    out_varHeader = asn_build_int(out_data, length,
  1797. X        (u_char)(TIMETICKS),
  1798. X        (long *)&time, sizeof(time));
  1799. X    if (out_varHeader == NULL){
  1800. X    ERROR("build timestampfailed");
  1801. X    return 0;
  1802. X    }
  1803. X    out_varlist = asn_build_header(out_varHeader,  length, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 90);
  1804. X    out_end = snmp_build_var_op(out_varlist, varName, &varNameLen, varType, varLen, varVal, length);
  1805. X    if (out_end == NULL){
  1806. X    ERROR("build varop failed");
  1807. X    return 0;
  1808. X    }
  1809. X
  1810. X    /*
  1811. X     * Because of the assumption above that header lengths would be encoded
  1812. X     * in one byte, things need to be fixed, now that the actual lengths are known.
  1813. X     */
  1814. X    list_shift = 0;
  1815. X    *length = out_end - out_varlist;
  1816. X    if (*length >= 0x80){
  1817. X    list_shift++;
  1818. X    if (*length > 0xFF)
  1819. X        list_shift++;
  1820. X    }
  1821. X    pdu_shift = 0;
  1822. X    *length = (out_end - out_pdu) + list_shift;
  1823. X    if (*length >= 0x80){
  1824. X    pdu_shift++;
  1825. X    if (*length > 0xFF)
  1826. X        pdu_shift++;
  1827. X    }
  1828. X    auth_shift = 0;
  1829. X    /*  2 below is the size of the assumed asn header in the auth header */
  1830. X    *length = (out_end - out_auth) - 2 + pdu_shift + list_shift;
  1831. X    if (*length >= 0x80){
  1832. X    auth_shift++;
  1833. X    if (*length > 0xFF)
  1834. X        auth_shift++;
  1835. X    }
  1836. X    if (auth_shift + pdu_shift + list_shift){
  1837. X    /*
  1838. X     * Shift packet (from start of varlist to end of packet) by the sum of the
  1839. X     * necessary shift counts.
  1840. X     */
  1841. X    shift_array(out_varlist, out_end - out_varlist, auth_shift + pdu_shift + list_shift);
  1842. X    /* Now adjust pointers into the packet */
  1843. X    out_end += auth_shift + pdu_shift + list_shift;
  1844. X    out_varlist += auth_shift + pdu_shift + list_shift;
  1845. X    out_varHeader += auth_shift + pdu_shift;
  1846. X    }
  1847. X    /* Now rebuild header with the actual lengths */
  1848. X    dummyLen = out_end - out_varlist;
  1849. X    if (asn_build_header(out_varHeader, &dummyLen, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), dummyLen) != out_varlist)
  1850. X    return 0;
  1851. X
  1852. X    if (auth_shift + pdu_shift){
  1853. X    /*
  1854. X     * Shift packet (from start of varlist to end of packet) by the sum of the
  1855. X     * necessary shift counts.
  1856. X     */
  1857. X    shift_array(out_pdu, out_varHeader - out_pdu, auth_shift + pdu_shift);
  1858. X    /* Now adjust pointers into the packet */
  1859. X    out_pdu += auth_shift + pdu_shift;
  1860. X    out_header += auth_shift;
  1861. X    }
  1862. X    /* Now rebuild header with the actual lengths */
  1863. X    dummyLen = out_end - out_pdu;
  1864. X    if (asn_build_header(out_header, &dummyLen, (u_char)TRP_REQ_MSG, dummyLen) != out_pdu)
  1865. X    return 0;
  1866. X
  1867. X    out_data = out_auth;
  1868. X    *length = out_end - out_auth;
  1869. X    out_data = snmp_auth_build(out_data, length, (u_char *)"public", &sidLen, &version, out_end - out_header);
  1870. X    if (out_data != out_header){
  1871. X    ERROR("internal error");
  1872. X    return 0;
  1873. X    }
  1874. X    *length = out_end - out_auth;
  1875. X    return *length;
  1876. X}
  1877. X
  1878. X
  1879. END_OF_FILE
  1880.   if test 10258 -ne `wc -c <'nocol-3.0/src/cmu-snmp/snmplib/snmp.c'`; then
  1881.     echo shar: \"'nocol-3.0/src/cmu-snmp/snmplib/snmp.c'\" unpacked with wrong size!
  1882.   fi
  1883.   # end of 'nocol-3.0/src/cmu-snmp/snmplib/snmp.c'
  1884. fi
  1885. if test -f 'nocol-3.0/src/support/multiping/multiping.8' -a "${1}" != "-c" ; then 
  1886.   echo shar: Will not clobber existing file \"'nocol-3.0/src/support/multiping/multiping.8'\"
  1887. else
  1888.   echo shar: Extracting \"'nocol-3.0/src/support/multiping/multiping.8'\" \(11372 characters\)
  1889.   sed "s/^X//" >'nocol-3.0/src/support/multiping/multiping.8' <<'END_OF_FILE'
  1890. X.\" $Header: /nocol/src/support/multiping/RCS/multiping.8,v 1.1 1992/06/10 18:28:24 spencer Exp spencer $
  1891. X.\"
  1892. X.TH MULTIPING 8 "June 9, 1992"
  1893. X.SH NAME
  1894. Xmultiping \- send ICMP ECHO_REQUEST packets to one or more network hosts
  1895. X.SH SYNOPSIS
  1896. X.LP
  1897. X.B multiping
  1898. X[ \fB-dfnqrtvR\fR ] [ \fB-c \fIcount\fR ] [ \fB-i \fIinterval\fR ]
  1899. X.if n .ti +0.25i
  1900. X[ \fB-l \fIpreload\fR ] [ \fB-p \fIpattern\fR ] [ \fB-s \fIpacketsize\fR ]
  1901. X.if n .ti +0.25i
  1902. X.B host\fR [ \fBhost ...\fR ]
  1903. X.SH ATTRIBUTION
  1904. XNote -- since the program, and this man page, are derived in large part
  1905. Xfrom the original versions by Mike Muuss, most of what is said here applies to
  1906. Xthe usual \fBping\fR program as well.  Hereafter, ``\fBping\fR'' should be
  1907. Xunderstood to refer to both programs, \fBmultiping\fR and \fBping\fR, except
  1908. Xwhere specifically noted.  However, since I have seen at least two versions of
  1909. X\fBping\fR with different command line options, if you are using \fBping\fR
  1910. Xyou should obviously consult that man page instead, to be safe.
  1911. X.if n .ti +3.5i
  1912. XS. Spencer Sun, 6/9/92
  1913. X.SH DESCRIPTION
  1914. XThe DARPA Internet is a large and complex aggregation of
  1915. Xnetwork hardware, connected together by gateways.
  1916. XTracking a single-point hardware or software failure
  1917. Xcan often be difficult. \fBping\fR uses the
  1918. XICMP protocol's mandatory ECHO_REQUEST datagram to elicit an
  1919. XICMP ECHO_RESPONSE from a host or gateway.
  1920. XECHO_REQUEST datagrams (``pings'') have an IP and ICMP header,
  1921. Xfollowed by a \fIstruct timeval\fR, and then an arbitrary number
  1922. Xof ``pad'' bytes used to fill out the packet.
  1923. XDefault datagram length is 64 bytes, but this may be changed
  1924. X(see the \fB-s\fR option below).
  1925. X.PP
  1926. XAs you no doubt guessed, \fBmultiping\fR differs from \fBping\fR in that it
  1927. Xcan ping multiple sites simultaneously, using only one process.  Of course,
  1928. Xonce the number of sites starts getting very large, the round-trip times
  1929. Xwill be thrown off slightly due to delays, but for most purposes this probably
  1930. Xwill not present a problem.
  1931. X.PP
  1932. X\fBping\fR has to run with root permissions to access the ICMP socket.
  1933. X.SH OPTIONS
  1934. X.TP 15
  1935. X.B \-c \fIcount\fR
  1936. XStop after receiving \fIcount\fR ECHO_RESPONSE packets from any one host.
  1937. X.TP
  1938. X.B \-d
  1939. XSet the SO_DEBUG option on the socket being used.
  1940. X.TP
  1941. X.B \-f
  1942. XFlood ping.  Outputs packets as fast as they come back or one hundred times
  1943. Xper second, whichever is more.  For every ECHO_REQUEST sent a period `.'
  1944. Xis printed, while for ever ECHO_REPLY received a backspace is printed.
  1945. XThis provides a rapid display of how many packets are being dropped.
  1946. X\fIThis can be very hard on a network and should be used with caution.\fR
  1947. XOnly someone with root permissions can use the \fB-f\fR option.
  1948. X.TP
  1949. X.B \-i \fIinterval\fR
  1950. XWait \fIinterval\fR seconds between sending each packet.
  1951. XThe default is to wait for one second between each packet.
  1952. XThis option is incompatible with the \fB-f\fR option.
  1953. X.TP
  1954. X.B \-l \fIpreload\fR
  1955. XIf run with this option, \fBping\fR will send off \fIpreload\fR
  1956. Xpackets as soon as it starts up, without waiting for responses, before
  1957. Xfalling into its normal mode of behavior.
  1958. X.TP
  1959. X.B \-n
  1960. XNumeric output only.  No attempt will be made to lookup symbolic
  1961. Xnames for host addresses.
  1962. X.TP
  1963. X.B \-p \fIpattern\fR
  1964. XYou may specify up to 16 "pad" bytes to fill out the packet you send.
  1965. XThis is useful for diagnosing data-dependent problems in a network.
  1966. XFor example, running with \fB-p ff\fR will cause the sent packet to be
  1967. Xfilled with all ones.
  1968. X.TP
  1969. X.B \-q
  1970. XQuiet output.  Nothing is displayed except the list of hosts being pinged
  1971. Xat the beginning and the summary lines at the end.
  1972. X.TP
  1973. X.B \-r
  1974. XBypass the normal routing tables and send directly to a host on an attached
  1975. Xnetwork.
  1976. XIf the host is not on a directly-attached network,
  1977. Xan error is returned.
  1978. XThis option can be used to ping a local host through an interface
  1979. Xthat has no route through it (e.g., after the interface was dropped by
  1980. X.B routed(8C)
  1981. X).
  1982. X.TP
  1983. X.B \-s \fIpacketsize\fR
  1984. XSpecifies the number of data bytes to be sent.  
  1985. XThe default is 56, which translates into 64 ICMP data bytes when combined
  1986. Xwith the 8 bytes of ICMP header data.
  1987. X.TP
  1988. X.B \-t
  1989. XTabular output.  Print the results in a nicely-formatted table.  By default
  1990. Xthis option is turned \fIoff\fR and the output looks like multiple instances
  1991. Xof the old-style output.  (Try it both ways with multiple hosts and you'll
  1992. Xsee what I mean).  This option is specific to \fBmultiping\fR.
  1993. X.TP
  1994. X.B \-v
  1995. XVerbose output.  ICMP packets other than ECHO_RESPONSE that are received
  1996. Xare listed.
  1997. X.TP
  1998. X.B \-R
  1999. XRecord Route.  Includes the RECORD_ROUTE option in the ECHO_REQUEST
  2000. Xpacket and displays the route buffer on returned packets.  Note that
  2001. Xthe IP header is only large enough for nine such routes.  Many hosts
  2002. Xignore or discard this option.
  2003. X.PP
  2004. XWhen using \fBping\fR for fault isolation, it should first be run
  2005. Xon the local host, to verify that the local network interface is up and
  2006. Xrunning. Then, hosts and gateways further and further away
  2007. Xshould be pinged.  \fBping\fR sends one datagram per second (or
  2008. Xper \fIinterval\fR seconds), and
  2009. Xprints one line of output for every ECHO_RESPONSE returned.
  2010. XIf an optional \fIcount\fR is given, only that number of requests is sent.
  2011. XRound-trip times and packet loss statistics are computed.
  2012. XIf duplicate packets are received, they are not included in the
  2013. Xpacket loss calculation, although the round trip time of these packets is
  2014. Xused in calculating the minimum/average/maximum round-trip time numbers.
  2015. XWhen all responses have been received or the program times out (with a
  2016. X\fIcount\fR specified), or if the program is terminated with a SIGINT, a brief
  2017. Xsummary is displayed.
  2018. X.PP
  2019. XThis program is intended for use in network testing, measurement
  2020. Xand management.
  2021. XIt should be used primarily for manual fault isolation.
  2022. XBecause of the load it could impose on the network,
  2023. Xit is unwise to use \fBping\fR
  2024. Xduring normal operations or from automated scripts.
  2025. X.SH ICMP Packet Details
  2026. XAn IP header without options is 20 bytes.
  2027. XAn ICMP ECHO_REQUEST packet contains an additional 8 bytes worth
  2028. Xof ICMP header followed by an arbitrary amount of data.  When a
  2029. X.I packetsize
  2030. Xis given, this indicates the size of this extra blob of data (the
  2031. Xdefault is 56).  Thus the amount of data received inside of an IP
  2032. Xpacket of type ICMP ECHO_REPLY will always be 8 bytes more than
  2033. Xthe requested data space (the ICMP header).
  2034. X.PP
  2035. XIf the data space is at least eight bytes large, \fBping\fR
  2036. Xuses the first eight bytes of this space to include a timestamp which
  2037. Xit uses in the computation of round trip times.  This explains why if
  2038. Xless than eight bytes of pad are requested, no round trip times are given.
  2039. X.SH Duplicate and Damaged packets
  2040. X\fBping\fR will report duplicate and damaged packets.
  2041. XDuplicate packets should never occur, and seem to be caused by
  2042. Xinappropriate link-level retransmissions (See also the BUGS section).
  2043. XThe author [MM] has seen duplicates in many situations and has never known them
  2044. Xto be a good thing, although the presence of low levels of
  2045. Xduplicates may not always be cause for alarm.
  2046. XNetwork maintainers ignore them at
  2047. Xtheir own risk as they have been known to be harbingers of severe
  2048. Xnetwork problems.
  2049. X.PP
  2050. XDamaged packets are obviously serious cause for alarm and most likely
  2051. Xindicate broken hardware somewhere in the \fBping\fR packet's path
  2052. X(in the network or in the hosts).
  2053. X.SH Trying Different Data Patterns
  2054. XIt should go without saying that the (inter)network layer 
  2055. X\fIshould\fR never treat packets differently depending on the
  2056. Xdata contained in the data portion.
  2057. XUnfortunately, data-dependent problems have been known to sneak into
  2058. Xnetworks and remain undetected for long periods of time.
  2059. XIn many cases the particular pattern that will have problems is something
  2060. Xthat doesn't have "enough" transitions, such as all ones or all zeros,
  2061. Xor a pattern right at the edge, such as almost all zeros.
  2062. XIt isn't necessarily enough to specify a data pattern of all zeros (for
  2063. Xexample) on the command line (as in \fB-p 00\fR), because the pattern
  2064. Xthat is of interest is at the data link level, and the relationship
  2065. Xbetween what you type and what the controllers transmit can be
  2066. Xcomplicated.
  2067. X.PP
  2068. XThis means that if you have a data-dependent problem you will have
  2069. Xto be prepared to do a lot of testing to find it. 
  2070. XIf you are lucky, you may manage to find a file that either can't be sent
  2071. Xacross your network or that takes much longer to transfer than other
  2072. Xsimilar length files.
  2073. XYou can then examine this file for repeated patterns that you can test
  2074. Xusing the \fB-p\fR option of \fBping\fR.
  2075. X.SH TTL Details
  2076. XThe TTL value of an IP packet represents the maximum number of IP routers
  2077. Xthat the packet can go through before being thrown away.
  2078. XIn current practice you can expect each router in the Internet to decrement the
  2079. XTTL field by exactly one.
  2080. X.PP
  2081. XThe TCP/IP specification says that the TTL field for TCP packets should
  2082. Xbe set to 60, but many systems use smaller values (4.3 BSD uses 30, 4.2 used
  2083. X15).
  2084. X.PP
  2085. XThe maximum possible value of this field is 255, and most Unix systems set
  2086. Xthe TTL field of ICMP ECHO_REQUEST packets to 255.
  2087. XThis is why you will find you can ping some hosts, but not reach them with
  2088. X\fBtelnet\fR or \fBftp\fR.
  2089. X.PP
  2090. XIn normal operation \fBping\fR prints the ttl value from the packet it
  2091. Xreceives.  When a remote system receives a \fBping\fR packet, it can do one
  2092. Xof three things with the TTL field in its response:
  2093. X.TP
  2094. X.B (1)
  2095. XNot change it; this is what Berkeley Unix systems did until 4.3 BSD tahoe
  2096. Xlevel releases.
  2097. XIn this case the TTL value in the received packet will be 255 minus the
  2098. Xnumber of routers in the round-trip path.
  2099. X.TP
  2100. X.B (2)
  2101. XSet it to 255; this is what Berkeley Unix systems have done since the 4.3
  2102. Xtahoe release.
  2103. XIn this case the TTL value in the received packet will be 255 minus the number
  2104. Xof routers in the path \fIfrom\fR the remote system \fIto\fR the
  2105. Xpinging host.
  2106. X.TP
  2107. X.B (3)
  2108. XSet it to some other value.
  2109. XSome machines use the same value for ICMP packets that they use for
  2110. XTCP packets, for example either 30 or 60.
  2111. XOthers may use completely wild values.
  2112. X.SH BUGS
  2113. X.PP
  2114. XIf an IP address (or its corresponding host name) appears more than once on
  2115. Xthe command line, it will receive more than one ECHO_REQUEST and thus will
  2116. Xsend back more than one ECHO_REPLY.  The additional ECHO_REPLY packets will
  2117. Xbe flagged as being duplicates, because currently the means of identifying
  2118. Xa packet are (1) the socket address it came from and (2) the ICMP sequence
  2119. Xnumber, stored in the ICMP header.  Thus, there is no way (for the time
  2120. Xbeing anyway) to distinguish between the two.
  2121. X.PP
  2122. XMany Hosts and Gateways ignore the RECORD_ROUTE option.
  2123. X.PP
  2124. XThe maximum IP header length is too small for options like
  2125. XRECORD_ROUTE to be completely useful.  There's not much that
  2126. Xwe can do about that however.
  2127. X.PP
  2128. XFlood pinging is not recommended in general, and flood pinging the broadcast
  2129. Xaddress should only be done under very controlled conditions.
  2130. X.SH AUTHORS
  2131. XMike Muuss, U. S. Army Ballistic Research Laboratory, December, 1983
  2132. X.PP
  2133. XModified at Uc Berkeley
  2134. X.PP
  2135. XRecord Route and verbose headers - Phil Dykstra, BRL, March 1988.
  2136. X.PP
  2137. Xttl, duplicate detection - Cliff Frost, UCB, April 1989
  2138. X.PP
  2139. XPad pattern - Cliff Frost (from Tom Ferrin, UCSF), April 1989
  2140. X.PP
  2141. XWait for dribbles, option decoding, pkt compare - vjs@sgi.com, May 1989
  2142. X.PP
  2143. XPing multiple sites simultaneously - Spencer Sun, Princeton Univ. '94,
  2144. Xfor JvNCnet
  2145. XJune 1992
  2146. X.SH SEE ALSO
  2147. Xnetstat(1),
  2148. Xifconfig(8C)
  2149. END_OF_FILE
  2150.   if test 11372 -ne `wc -c <'nocol-3.0/src/support/multiping/multiping.8'`; then
  2151.     echo shar: \"'nocol-3.0/src/support/multiping/multiping.8'\" unpacked with wrong size!
  2152.   fi
  2153.   # end of 'nocol-3.0/src/support/multiping/multiping.8'
  2154. fi
  2155. echo shar: End of archive 17 \(of 26\).
  2156. cp /dev/null ark17isdone
  2157. MISSING=""
  2158. 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 26 ; do
  2159.     if test ! -f ark${I}isdone ; then
  2160.     MISSING="${MISSING} ${I}"
  2161.     fi
  2162. done
  2163. if test "${MISSING}" = "" ; then
  2164.     echo You have unpacked all 26 archives.
  2165.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2166. else
  2167.     echo You still must unpack the following archives:
  2168.     echo "        " ${MISSING}
  2169. fi
  2170. exit 0
  2171. exit 0 # Just in case...
  2172.