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

  1. Newsgroups: comp.sources.misc
  2. From: vikas@jvnc.net (Vikas Aggarwal)
  3. Subject: v40i155:  nocol - Network Monitoring System, Part25/26
  4. Message-ID: <1993Nov24.163954.2175@sparky.sterling.com>
  5. X-Md4-Signature: e3ae664d8d96d7937bd03f36b5ddb529
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Wed, 24 Nov 1993 16:39:54 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: vikas@jvnc.net (Vikas Aggarwal)
  12. Posting-number: Volume 40, Issue 155
  13. Archive-name: nocol/part25
  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/snmpnetstat/Makefile
  21. #   nocol-3.0/src/cmu-snmp/include/asn1.h
  22. #   nocol-3.0/src/cmu-snmp/include/snmp.h
  23. #   nocol-3.0/src/cmu-snmp/include/snmp_client.h
  24. #   nocol-3.0/src/cmu-snmp/include/snmp_vars.h.kip
  25. #   nocol-3.0/src/cmu-snmp/snmplib/asn1.h
  26. #   nocol-3.0/src/cmu-snmp/snmplib/snmp_client.h
  27. #   nocol-3.0/src/cmu-snmp/snmplib/snmp_vars.h.kip
  28. #   nocol-3.0/src/doc/nocol-utility.8 nocol-3.0/src/doc/nsmon.8
  29. #   nocol-3.0/src/doc/portmon.8 nocol-3.0/src/genmon/Makefile
  30. #   nocol-3.0/src/include/pingmon.h nocol-3.0/src/include/portmon.h
  31. #   nocol-3.0/src/lib/Makefile nocol-3.0/src/lib/ftime.c
  32. #   nocol-3.0/src/lib/putenv.c nocol-3.0/src/netmon/Makefile
  33. #   nocol-3.0/src/netmon/nocol-help nocol-3.0/src/netmon/poll_input.c
  34. #   nocol-3.0/src/noclog/Makefile nocol-3.0/src/nsmon/Makefile
  35. #   nocol-3.0/src/nsmon/nsmon-confg nocol-3.0/src/nsmon/nstest.c
  36. #   nocol-3.0/src/perlnocol/README nocol-3.0/src/portmon/Makefile
  37. #   nocol-3.0/src/support/mping/msummary.dat
  38. #   nocol-3.0/src/support/multiping/pingmisc.c
  39. #   nocol-3.0/src/tpmon/Makefile nocol-3.0/src/tpmon/tptest.h
  40. #   nocol-3.0/src/utility/keepalive_monitors
  41. # Wrapped by kent@sparky on Tue Nov  9 22:22:29 1993
  42. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  43. echo If this archive is complete, you will see the following message:
  44. echo '          "shar: End of archive 25 (of 26)."'
  45. if test -f 'nocol-3.0/src/cmu-snmp/apps/snmpnetstat/Makefile' -a "${1}" != "-c" ; then 
  46.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/apps/snmpnetstat/Makefile'\"
  47. else
  48.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/apps/snmpnetstat/Makefile'\" \(1283 characters\)
  49.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/apps/snmpnetstat/Makefile' <<'END_OF_FILE'
  50. X#
  51. X# Copyright (c) 1987 Regents of the University of California.
  52. X# All rights reserved.
  53. X#
  54. X# Redistribution and use in source and binary forms are permitted
  55. X# provided that the above copyright notice and this paragraph are
  56. X# duplicated in all such forms and that any documentation,
  57. X# advertising materials, and other materials related to such
  58. X# distribution and use acknowledge that the software was developed
  59. X# by the University of California, Berkeley.  The name of the
  60. X# University may not be used to endorse or promote products derived
  61. X# from this software without specific prior written permission.
  62. X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  63. X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  64. X# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  65. X#
  66. X#    @(#)Makefile    5.10 (Berkeley) 9/20/88
  67. X#
  68. XCFLAGS=    -g -I../../include
  69. XLIBS=    ../../lib/libsnmp.a
  70. XSRCS=    inet.c if.c main.c route.c 
  71. XOBJS=    inet.o if.o main.o route.o
  72. X
  73. Xall: snmpnetstat
  74. X
  75. Xsnmpnetstat: ${OBJS} ${LIBS}
  76. X    ${CC} -o $@ ${CFLAGS} ${OBJS} ${LIBS}
  77. X
  78. Xclean:
  79. X    rm -f ${OBJS} core snmpnetstat
  80. X
  81. Xcleandir: clean
  82. X    rm -f ${MAN} tags .depend
  83. X
  84. Xdepend: ${SRCS}
  85. X    mkdep ${CFLAGS} ${SRCS}
  86. X
  87. Xlint: ${SRCS}
  88. X    lint ${CFLAGS} ${SRCS}
  89. X
  90. Xtags: ${SRCS}
  91. X    ctags ${SRCS}
  92. X
  93. Xinstall:
  94. X    cp snmpnetstat ../../bin
  95. END_OF_FILE
  96.   if test 1283 -ne `wc -c <'nocol-3.0/src/cmu-snmp/apps/snmpnetstat/Makefile'`; then
  97.     echo shar: \"'nocol-3.0/src/cmu-snmp/apps/snmpnetstat/Makefile'\" unpacked with wrong size!
  98.   fi
  99.   # end of 'nocol-3.0/src/cmu-snmp/apps/snmpnetstat/Makefile'
  100. fi
  101. if test -f 'nocol-3.0/src/cmu-snmp/include/asn1.h' -a "${1}" != "-c" ; then 
  102.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/asn1.h'\"
  103. else
  104.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/asn1.h'\" \(2415 characters\)
  105.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/asn1.h' <<'END_OF_FILE'
  106. X/*
  107. X * Definitions for Abstract Syntax Notation One, ASN.1
  108. X * As defined in ISO/IS 8824 and ISO/IS 8825
  109. X *
  110. X *
  111. X */
  112. X/***********************************************************
  113. X    Copyright 1988, 1989 by Carnegie Mellon University
  114. X
  115. X                      All Rights Reserved
  116. X
  117. XPermission to use, copy, modify, and distribute this software and its 
  118. Xdocumentation for any purpose and without fee is hereby granted, 
  119. Xprovided that the above copyright notice appear in all copies and that
  120. Xboth that copyright notice and this permission notice appear in 
  121. Xsupporting documentation, and that the name of CMU not be
  122. Xused in advertising or publicity pertaining to distribution of the
  123. Xsoftware without specific, written prior permission.  
  124. X
  125. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  126. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  127. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  128. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  129. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  130. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  131. XSOFTWARE.
  132. X******************************************************************/
  133. X
  134. X#ifndef EIGHTBIT_SUBIDS
  135. Xtypedef u_long    oid;
  136. X#define MAX_SUBID   0xFFFFFFFF
  137. X#else
  138. Xtypedef u_char    oid;
  139. X#define MAX_SUBID   0xFF
  140. X#endif
  141. X
  142. X#define MAX_OID_LEN        64    /* max subid's in an oid */
  143. X
  144. X#define ASN_BOOLEAN        (0x01)
  145. X#define ASN_INTEGER        (0x02)
  146. X#define ASN_BIT_STR        (0x03)
  147. X#define ASN_OCTET_STR        (0x04)
  148. X#define ASN_NULL        (0x05)
  149. X#define ASN_OBJECT_ID        (0x06)
  150. X#define ASN_SEQUENCE        (0x10)
  151. X#define ASN_SET            (0x11)
  152. X
  153. X#define ASN_UNIVERSAL        (0x00)
  154. X#define ASN_APPLICATION     (0x40)
  155. X#define ASN_CONTEXT        (0x80)
  156. X#define ASN_PRIVATE        (0xC0)
  157. X
  158. X#define ASN_PRIMITIVE        (0x00)
  159. X#define ASN_CONSTRUCTOR        (0x20)
  160. X
  161. X#define ASN_LONG_LEN        (0x80)
  162. X#define ASN_EXTENSION_ID    (0x1F)
  163. X#define ASN_BIT8        (0x80)
  164. X
  165. X#define IS_CONSTRUCTOR(byte)    ((byte) & ASN_CONSTRUCTOR)
  166. X#define IS_EXTENSION_ID(byte)    (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  167. X
  168. Xu_char    *asn_parse_int();
  169. Xu_char    *asn_build_int();
  170. Xu_char    *asn_parse_string();
  171. Xu_char    *asn_build_string();
  172. Xu_char    *asn_parse_header();
  173. Xu_char    *asn_build_header();
  174. Xu_char    *asn_parse_length();
  175. Xu_char    *asn_build_length();
  176. Xu_char    *asn_parse_objid();
  177. Xu_char    *asn_build_objid();
  178. Xu_char    *asn_parse_null();
  179. Xu_char    *asn_build_null();
  180. END_OF_FILE
  181.   if test 2415 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/asn1.h'`; then
  182.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/asn1.h'\" unpacked with wrong size!
  183.   fi
  184.   # end of 'nocol-3.0/src/cmu-snmp/include/asn1.h'
  185. fi
  186. if test -f 'nocol-3.0/src/cmu-snmp/include/snmp.h' -a "${1}" != "-c" ; then 
  187.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/snmp.h'\"
  188. else
  189.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/snmp.h'\" \(2082 characters\)
  190.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/snmp.h' <<'END_OF_FILE'
  191. X/*
  192. X * Definitions for the Simple Network Management Protocol (RFC 1067).
  193. X *
  194. X *
  195. X */
  196. X/***********************************************************
  197. X    Copyright 1988, 1989 by Carnegie Mellon University
  198. X
  199. X                      All Rights Reserved
  200. X
  201. XPermission to use, copy, modify, and distribute this software and its 
  202. Xdocumentation for any purpose and without fee is hereby granted, 
  203. Xprovided that the above copyright notice appear in all copies and that
  204. Xboth that copyright notice and this permission notice appear in 
  205. Xsupporting documentation, and that the name of CMU not be
  206. Xused in advertising or publicity pertaining to distribution of the
  207. Xsoftware without specific, written prior permission.  
  208. X
  209. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  210. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  211. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  212. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  213. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  214. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  215. XSOFTWARE.
  216. X******************************************************************/
  217. X
  218. X#define SNMP_PORT        161
  219. X#define SNMP_TRAP_PORT        162
  220. X
  221. X#define SNMP_MAX_LEN        484
  222. X
  223. X#define SNMP_VERSION_1        0
  224. X
  225. X#define GET_REQ_MSG        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
  226. X#define GETNEXT_REQ_MSG        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
  227. X#define GET_RSP_MSG        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)
  228. X#define SET_REQ_MSG        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3)
  229. X#define TRP_REQ_MSG        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4)
  230. X
  231. X#define SNMP_ERR_NOERROR    (0x0)
  232. X#define SNMP_ERR_TOOBIG        (0x1)
  233. X#define SNMP_ERR_NOSUCHNAME (0x2)
  234. X#define SNMP_ERR_BADVALUE   (0x3)
  235. X#define SNMP_ERR_READONLY   (0x4)
  236. X#define SNMP_ERR_GENERR        (0x5)
  237. X
  238. X#define SNMP_TRAP_COLDSTART        (0x0)
  239. X#define SNMP_TRAP_WARMSTART        (0x1)
  240. X#define SNMP_TRAP_LINKDOWN        (0x2)
  241. X#define SNMP_TRAP_LINKUP        (0x3)
  242. X#define SNMP_TRAP_AUTHFAIL        (0x4)
  243. X#define SNMP_TRAP_EGPNEIGHBORLOSS    (0x5)
  244. X#define SNMP_TRAP_ENTERPRISESPECIFIC    (0x6)
  245. X
  246. END_OF_FILE
  247.   if test 2082 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/snmp.h'`; then
  248.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/snmp.h'\" unpacked with wrong size!
  249.   fi
  250.   # end of 'nocol-3.0/src/cmu-snmp/include/snmp.h'
  251. fi
  252. if test -f 'nocol-3.0/src/cmu-snmp/include/snmp_client.h' -a "${1}" != "-c" ; then 
  253.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/snmp_client.h'\"
  254. else
  255.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/snmp_client.h'\" \(1453 characters\)
  256.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/snmp_client.h' <<'END_OF_FILE'
  257. X/*
  258. X * snmp_client.h
  259. X */
  260. X/***********************************************************
  261. X    Copyright 1988, 1989 by Carnegie Mellon University
  262. X
  263. X                      All Rights Reserved
  264. X
  265. XPermission to use, copy, modify, and distribute this software and its 
  266. Xdocumentation for any purpose and without fee is hereby granted, 
  267. Xprovided that the above copyright notice appear in all copies and that
  268. Xboth that copyright notice and this permission notice appear in 
  269. Xsupporting documentation, and that the name of CMU not be
  270. Xused in advertising or publicity pertaining to distribution of the
  271. Xsoftware without specific, written prior permission.  
  272. X
  273. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  274. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  275. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  276. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  277. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  278. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  279. XSOFTWARE.
  280. X******************************************************************/
  281. Xstruct synch_state {
  282. X    int    waiting;
  283. X    int status;
  284. X/* status codes */
  285. X#define STAT_SUCCESS    0
  286. X#define STAT_ERROR    1
  287. X#define STAT_TIMEOUT 2
  288. X    int reqid;
  289. X    struct snmp_pdu *pdu;
  290. X};
  291. X
  292. Xextern struct synch_state snmp_synch_state;
  293. X
  294. Xstruct snmp_pdu    *snmp_pdu_create();
  295. Xstruct snmp_pdu *snmp_fix_pdu();
  296. Xchar *snmp_errstring();
  297. END_OF_FILE
  298.   if test 1453 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/snmp_client.h'`; then
  299.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/snmp_client.h'\" unpacked with wrong size!
  300.   fi
  301.   # end of 'nocol-3.0/src/cmu-snmp/include/snmp_client.h'
  302. fi
  303. if test -f 'nocol-3.0/src/cmu-snmp/include/snmp_vars.h.kip' -a "${1}" != "-c" ; then 
  304.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/snmp_vars.h.kip'\"
  305. else
  306.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/snmp_vars.h.kip'\" \(1789 characters\)
  307.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/snmp_vars.h.kip' <<'END_OF_FILE'
  308. X/*
  309. X * Definitions for SNMP (RFC 1067) agent variable finder.
  310. X *
  311. X *
  312. X */
  313. X/***********************************************************
  314. X    Copyright 1988, 1989 by Carnegie Mellon University
  315. X
  316. X                      All Rights Reserved
  317. X
  318. XPermission to use, copy, modify, and distribute this software and its 
  319. Xdocumentation for any purpose and without fee is hereby granted, 
  320. Xprovided that the above copyright notice appear in all copies and that
  321. Xboth that copyright notice and this permission notice appear in 
  322. Xsupporting documentation, and that the name of CMU not be
  323. Xused in advertising or publicity pertaining to distribution of the
  324. Xsoftware without specific, written prior permission.  
  325. X
  326. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  327. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  328. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  329. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  330. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  331. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  332. XSOFTWARE.
  333. X******************************************************************/
  334. X
  335. X#define        MAX_INTERFACES    2
  336. Xextern    struct mib_ifEntry  mib_ifEntry[MAX_INTERFACES];
  337. Xextern    struct mib_ip        mib_ip;
  338. X#define        ROUTE_ENTRIES    2
  339. Xextern    struct mib_udp        mib_udp;
  340. Xextern    long    mib_icmpInMsgs;
  341. Xextern    long    mib_icmpOutMsgs;
  342. Xextern    long    mib_icmpInErrors;    /* not checked in KIP */
  343. Xextern    long    mib_icmpOutErrors;    /* not checked in KIP */
  344. Xextern    long    mib_icmpInCount[];
  345. Xextern    long    mib_icmpOutCount[];
  346. X
  347. Xu_char    *var_system();
  348. Xu_char    *var_ifEntry();
  349. Xu_char    *var_atEntry();
  350. Xu_char    *var_ip();
  351. Xu_char    *var_ipAddrEntry();
  352. Xu_char    *var_ipRouteEntry();
  353. Xu_char    *var_icmp();
  354. Xu_char    *var_udp();
  355. Xu_char    *getStatPtr();
  356. X
  357. X
  358. END_OF_FILE
  359.   if test 1789 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/snmp_vars.h.kip'`; then
  360.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/snmp_vars.h.kip'\" unpacked with wrong size!
  361.   fi
  362.   # end of 'nocol-3.0/src/cmu-snmp/include/snmp_vars.h.kip'
  363. fi
  364. if test -f 'nocol-3.0/src/cmu-snmp/snmplib/asn1.h' -a "${1}" != "-c" ; then 
  365.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/snmplib/asn1.h'\"
  366. else
  367.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/snmplib/asn1.h'\" \(2415 characters\)
  368.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/snmplib/asn1.h' <<'END_OF_FILE'
  369. X/*
  370. X * Definitions for Abstract Syntax Notation One, ASN.1
  371. X * As defined in ISO/IS 8824 and ISO/IS 8825
  372. X *
  373. X *
  374. X */
  375. X/***********************************************************
  376. X    Copyright 1988, 1989 by Carnegie Mellon University
  377. X
  378. X                      All Rights Reserved
  379. X
  380. XPermission to use, copy, modify, and distribute this software and its 
  381. Xdocumentation for any purpose and without fee is hereby granted, 
  382. Xprovided that the above copyright notice appear in all copies and that
  383. Xboth that copyright notice and this permission notice appear in 
  384. Xsupporting documentation, and that the name of CMU not be
  385. Xused in advertising or publicity pertaining to distribution of the
  386. Xsoftware without specific, written prior permission.  
  387. X
  388. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  389. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  390. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  391. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  392. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  393. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  394. XSOFTWARE.
  395. X******************************************************************/
  396. X
  397. X#ifndef EIGHTBIT_SUBIDS
  398. Xtypedef u_long    oid;
  399. X#define MAX_SUBID   0xFFFFFFFF
  400. X#else
  401. Xtypedef u_char    oid;
  402. X#define MAX_SUBID   0xFF
  403. X#endif
  404. X
  405. X#define MAX_OID_LEN        64    /* max subid's in an oid */
  406. X
  407. X#define ASN_BOOLEAN        (0x01)
  408. X#define ASN_INTEGER        (0x02)
  409. X#define ASN_BIT_STR        (0x03)
  410. X#define ASN_OCTET_STR        (0x04)
  411. X#define ASN_NULL        (0x05)
  412. X#define ASN_OBJECT_ID        (0x06)
  413. X#define ASN_SEQUENCE        (0x10)
  414. X#define ASN_SET            (0x11)
  415. X
  416. X#define ASN_UNIVERSAL        (0x00)
  417. X#define ASN_APPLICATION     (0x40)
  418. X#define ASN_CONTEXT        (0x80)
  419. X#define ASN_PRIVATE        (0xC0)
  420. X
  421. X#define ASN_PRIMITIVE        (0x00)
  422. X#define ASN_CONSTRUCTOR        (0x20)
  423. X
  424. X#define ASN_LONG_LEN        (0x80)
  425. X#define ASN_EXTENSION_ID    (0x1F)
  426. X#define ASN_BIT8        (0x80)
  427. X
  428. X#define IS_CONSTRUCTOR(byte)    ((byte) & ASN_CONSTRUCTOR)
  429. X#define IS_EXTENSION_ID(byte)    (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  430. X
  431. Xu_char    *asn_parse_int();
  432. Xu_char    *asn_build_int();
  433. Xu_char    *asn_parse_string();
  434. Xu_char    *asn_build_string();
  435. Xu_char    *asn_parse_header();
  436. Xu_char    *asn_build_header();
  437. Xu_char    *asn_parse_length();
  438. Xu_char    *asn_build_length();
  439. Xu_char    *asn_parse_objid();
  440. Xu_char    *asn_build_objid();
  441. Xu_char    *asn_parse_null();
  442. Xu_char    *asn_build_null();
  443. END_OF_FILE
  444.   if test 2415 -ne `wc -c <'nocol-3.0/src/cmu-snmp/snmplib/asn1.h'`; then
  445.     echo shar: \"'nocol-3.0/src/cmu-snmp/snmplib/asn1.h'\" unpacked with wrong size!
  446.   fi
  447.   # end of 'nocol-3.0/src/cmu-snmp/snmplib/asn1.h'
  448. fi
  449. if test -f 'nocol-3.0/src/cmu-snmp/snmplib/snmp_client.h' -a "${1}" != "-c" ; then 
  450.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_client.h'\"
  451. else
  452.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_client.h'\" \(1453 characters\)
  453.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/snmplib/snmp_client.h' <<'END_OF_FILE'
  454. X/*
  455. X * snmp_client.h
  456. X */
  457. X/***********************************************************
  458. X    Copyright 1988, 1989 by Carnegie Mellon University
  459. X
  460. X                      All Rights Reserved
  461. X
  462. XPermission to use, copy, modify, and distribute this software and its 
  463. Xdocumentation for any purpose and without fee is hereby granted, 
  464. Xprovided that the above copyright notice appear in all copies and that
  465. Xboth that copyright notice and this permission notice appear in 
  466. Xsupporting documentation, and that the name of CMU not be
  467. Xused in advertising or publicity pertaining to distribution of the
  468. Xsoftware without specific, written prior permission.  
  469. X
  470. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  471. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  472. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  473. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  474. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  475. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  476. XSOFTWARE.
  477. X******************************************************************/
  478. Xstruct synch_state {
  479. X    int    waiting;
  480. X    int status;
  481. X/* status codes */
  482. X#define STAT_SUCCESS    0
  483. X#define STAT_ERROR    1
  484. X#define STAT_TIMEOUT 2
  485. X    int reqid;
  486. X    struct snmp_pdu *pdu;
  487. X};
  488. X
  489. Xextern struct synch_state snmp_synch_state;
  490. X
  491. Xstruct snmp_pdu    *snmp_pdu_create();
  492. Xstruct snmp_pdu *snmp_fix_pdu();
  493. Xchar *snmp_errstring();
  494. END_OF_FILE
  495.   if test 1453 -ne `wc -c <'nocol-3.0/src/cmu-snmp/snmplib/snmp_client.h'`; then
  496.     echo shar: \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_client.h'\" unpacked with wrong size!
  497.   fi
  498.   # end of 'nocol-3.0/src/cmu-snmp/snmplib/snmp_client.h'
  499. fi
  500. if test -f 'nocol-3.0/src/cmu-snmp/snmplib/snmp_vars.h.kip' -a "${1}" != "-c" ; then 
  501.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_vars.h.kip'\"
  502. else
  503.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_vars.h.kip'\" \(1789 characters\)
  504.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/snmplib/snmp_vars.h.kip' <<'END_OF_FILE'
  505. X/*
  506. X * Definitions for SNMP (RFC 1067) agent variable finder.
  507. X *
  508. X *
  509. X */
  510. X/***********************************************************
  511. X    Copyright 1988, 1989 by Carnegie Mellon University
  512. X
  513. X                      All Rights Reserved
  514. X
  515. XPermission to use, copy, modify, and distribute this software and its 
  516. Xdocumentation for any purpose and without fee is hereby granted, 
  517. Xprovided that the above copyright notice appear in all copies and that
  518. Xboth that copyright notice and this permission notice appear in 
  519. Xsupporting documentation, and that the name of CMU not be
  520. Xused in advertising or publicity pertaining to distribution of the
  521. Xsoftware without specific, written prior permission.  
  522. X
  523. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  524. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  525. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  526. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  527. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  528. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  529. XSOFTWARE.
  530. X******************************************************************/
  531. X
  532. X#define        MAX_INTERFACES    2
  533. Xextern    struct mib_ifEntry  mib_ifEntry[MAX_INTERFACES];
  534. Xextern    struct mib_ip        mib_ip;
  535. X#define        ROUTE_ENTRIES    2
  536. Xextern    struct mib_udp        mib_udp;
  537. Xextern    long    mib_icmpInMsgs;
  538. Xextern    long    mib_icmpOutMsgs;
  539. Xextern    long    mib_icmpInErrors;    /* not checked in KIP */
  540. Xextern    long    mib_icmpOutErrors;    /* not checked in KIP */
  541. Xextern    long    mib_icmpInCount[];
  542. Xextern    long    mib_icmpOutCount[];
  543. X
  544. Xu_char    *var_system();
  545. Xu_char    *var_ifEntry();
  546. Xu_char    *var_atEntry();
  547. Xu_char    *var_ip();
  548. Xu_char    *var_ipAddrEntry();
  549. Xu_char    *var_ipRouteEntry();
  550. Xu_char    *var_icmp();
  551. Xu_char    *var_udp();
  552. Xu_char    *getStatPtr();
  553. X
  554. X
  555. END_OF_FILE
  556.   if test 1789 -ne `wc -c <'nocol-3.0/src/cmu-snmp/snmplib/snmp_vars.h.kip'`; then
  557.     echo shar: \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_vars.h.kip'\" unpacked with wrong size!
  558.   fi
  559.   # end of 'nocol-3.0/src/cmu-snmp/snmplib/snmp_vars.h.kip'
  560. fi
  561. if test -f 'nocol-3.0/src/doc/nocol-utility.8' -a "${1}" != "-c" ; then 
  562.   echo shar: Will not clobber existing file \"'nocol-3.0/src/doc/nocol-utility.8'\"
  563. else
  564.   echo shar: Extracting \"'nocol-3.0/src/doc/nocol-utility.8'\" \(1276 characters\)
  565.   sed "s/^X//" >'nocol-3.0/src/doc/nocol-utility.8' <<'END_OF_FILE'
  566. X.\"$Header: /home/aggarwal/lsrc/nocol/src/doc/RCS/nocol-utility.8,v 1.1 1993/10/28 16:38:03 aggarwal Exp $"
  567. X.\"
  568. X.TH NOCOL-UTILITY 8 "Oct 1, 1993
  569. X.SH NAME
  570. XMiscellanous nocol utility programs.
  571. X.SH DESCRIPTION
  572. X.LP
  573. XThere are a number of utility programs for NOCOL. These are described
  574. Xbelow:
  575. X.RS
  576. X.IP keepalive_monitors
  577. XThis is a simple shell script which makes sure that the various nocol
  578. Xmonitors are running and if not, restarts them. Edit the script and
  579. Xconfigure the various variables like who gets email when a monitor
  580. Xis restarted, which host should run which monitor, etc.
  581. X.IP notifier
  582. XThis is a simple example of how people can be notified (or problems
  583. Xescalated) when sites are in critical condition for extended periods
  584. Xof time. It uses the 
  585. X.I eventselect
  586. Xprogram to specify the time window and the severity and then sends email
  587. X(but it could as easily do troubleshooting or page someone).
  588. X.IP display_nocol_datafile
  589. XThis program can be used to display a NOCOL format datafile (specified
  590. Xon the command line).
  591. X.RE
  592. X.\"------------------------------------
  593. X.SH AUTHOR
  594. XVikas Aggarwal, vikas@jvnc.net
  595. X.SH SEE ALSO
  596. Xnocol(1) nocol-prog(3) perlnocol(3)
  597. Xeventselect(8) genmon(8) noclogd(8) nocol-overview(8)
  598. Xnocol-utility(8) nsmon(8) pingmon(8) portmon(8) 
  599. Xtpmon(8) trapmon(8)
  600. X
  601. END_OF_FILE
  602.   if test 1276 -ne `wc -c <'nocol-3.0/src/doc/nocol-utility.8'`; then
  603.     echo shar: \"'nocol-3.0/src/doc/nocol-utility.8'\" unpacked with wrong size!
  604.   fi
  605.   # end of 'nocol-3.0/src/doc/nocol-utility.8'
  606. fi
  607. if test -f 'nocol-3.0/src/doc/nsmon.8' -a "${1}" != "-c" ; then 
  608.   echo shar: Will not clobber existing file \"'nocol-3.0/src/doc/nsmon.8'\"
  609. else
  610.   echo shar: Extracting \"'nocol-3.0/src/doc/nsmon.8'\" \(2327 characters\)
  611.   sed "s/^X//" >'nocol-3.0/src/doc/nsmon.8' <<'END_OF_FILE'
  612. X.\"$Header: /home/aggarwal/lsrc/nocol/src/doc/RCS/nsmon.8,v 1.4 1993/10/30 03:10:51 aggarwal Exp $"
  613. X.\"
  614. X.TH NSMON 8 "June 9, 1992"
  615. X.SH NAME
  616. Xnsmon \- Nameserver monitor
  617. X.SH SYNOPSIS
  618. X.B nsmon
  619. X[
  620. X.B \-d
  621. X] [
  622. X.B \-o
  623. X.I output-file
  624. X]
  625. X.I config-file
  626. X.SH DESCRIPTION
  627. X.LP
  628. X.B nsmon
  629. Xis part of the NOCOL network monitoring package from JvNCnet, used for
  630. Xtesting the nameserver status 
  631. X.RI ( named
  632. X) for a list of hosts.
  633. X
  634. XThe program reads in the list of sites to test from a config file at startup
  635. Xand then does a nameserver query from the hosts periodically. If the server
  636. Xdoes not resolve the query, the
  637. X.I named
  638. Xprocess is assumed to be down or unavailable and a CRITICAL message is logged
  639. Xin the output file.
  640. X
  641. XThe query type is SOA. Other resolver options set in the query are 
  642. XRES_RECURSE off (no recursion), RES_DNSRCH off
  643. X(parent, etc not searched) and RES_AAONLY (only accept authoritative
  644. Xanswers). Note however, that the server implementation may choose to ignore
  645. Xany of these options. 
  646. XThe servers are queried every POLLINTERVAL (default 60) seconds.
  647. X.\"
  648. X.SH OPTIONS
  649. X.TP 16
  650. X.B \-d
  651. Xselects verbose debugging output mode
  652. X.TP
  653. X.BI "\-o" " output file"
  654. XName of the file to which to write the output.  This file is 
  655. X.I not
  656. Xin human-readable format, and is intended to be processed by the 
  657. X.BR nocol (1)
  658. Xdisplay program.
  659. X.TP
  660. X.I config-file
  661. XThis file lists the hosts to be queried for the nameserver.
  662. XThe format of this file is:
  663. X.RS
  664. X.sp
  665. X.DS
  666. XPOLLINTERVAL    secs
  667. X.br
  668. XDOMAINNAME      name-string
  669. X.br
  670. X<SiteName>   <IPaddress>
  671. X.DE
  672. X.RE
  673. X.sp
  674. X.IP
  675. XThe 
  676. X.I sitename
  677. Xis only for the operator's benefit and thus does not have to be a full
  678. Xinternet name. The second column is the site's IP address.
  679. X.\"------------------------------------
  680. X.SH AUTHOR
  681. XS. Spencer Sun (spencer@phoenix.princeton.edu) for JvNCnet.
  682. X.SH CAVEATS
  683. XThe program uses the low level 
  684. X.B res_mkquery
  685. Xcall for querying the nameserver. Unfortunately, discrepancies in the data
  686. Xstructures exist between vendors, so slight modifications to the source might
  687. Xbe necessary on some systems.
  688. X.LP
  689. XThe server queried can choose to ignore the various flags (like NORECURSIVE,
  690. XAAONLY) that the client sets in the query.
  691. X.SH SEE ALSO
  692. Xnocol(1) nocol-prog(3) perlnocol(3)
  693. Xeventselect(8) genmon(8) noclogd(8) nocol-overview(8)
  694. Xnocol-utility(8) nsmon(8) pingmon(8) portmon(8) 
  695. Xtpmon(8) trapmon(8)
  696. X
  697. END_OF_FILE
  698.   if test 2327 -ne `wc -c <'nocol-3.0/src/doc/nsmon.8'`; then
  699.     echo shar: \"'nocol-3.0/src/doc/nsmon.8'\" unpacked with wrong size!
  700.   fi
  701.   # end of 'nocol-3.0/src/doc/nsmon.8'
  702. fi
  703. if test -f 'nocol-3.0/src/doc/portmon.8' -a "${1}" != "-c" ; then 
  704.   echo shar: Will not clobber existing file \"'nocol-3.0/src/doc/portmon.8'\"
  705. else
  706.   echo shar: Extracting \"'nocol-3.0/src/doc/portmon.8'\" \(2071 characters\)
  707.   sed "s/^X//" >'nocol-3.0/src/doc/portmon.8' <<'END_OF_FILE'
  708. X.\"$Header: /home/aggarwal/lsrc/nocol/src/doc/RCS/portmon.8,v 1.1 1993/10/28 16:38:03 aggarwal Exp $
  709. X.\"
  710. X.TH PORTMON 8 "October 1, 1993"
  711. X.SH NAME
  712. Xportmon \- NOCOL monitor for TCP ports.
  713. X.SH SYNOPSIS
  714. X.B portmon
  715. X[
  716. X.B \-d
  717. X.I (debug)
  718. X] [
  719. X.B \-f
  720. X.I <config-file>
  721. X]
  722. X.\"
  723. X.SH DESCRIPTION
  724. X.LP
  725. X.B portmon
  726. Xconnects to a list of specified TCP ports on specified systems and
  727. Xchecks to see if connections are accepted on the port. It can send
  728. Xa string and then parse the output against a list of responses. Each
  729. Xresponse can be assigned a severity level.
  730. X
  731. X.SH CONFIG FILE
  732. XThe configuration file format is:
  733. X.RS
  734. X.sp .5
  735. X.nf
  736. X# Config file for portmon nocol monitor
  737. X#
  738. X# Order is important... the first substring match will return and NOT
  739. X# test the remaining strings.
  740. X#
  741. X# Format:
  742. X#    POLLINTERVAL  600
  743. X#    HOST <name> <addr>  <variable>  <port#> <failseverity> [send-string]
  744. X#    [maxseverity    response]
  745. X#    [maxseverity    response]
  746. X#    HOST ....
  747. X# Severity levels are: critical | error | warning | info
  748. X##
  749. XPOLLINTERVAL  3600
  750. X#
  751. X# for innd. Checking for 'no space'  'expire running' 'bad article file'
  752. XHOST  c3po    192.41.171.5    NEWSport  119    Critical
  753. Xcrit    space
  754. Xinfo    expire
  755. Xcrit    Cannot write active
  756. Xinfo    posting ok
  757. X#
  758. XHOST  nisc    128.121.50.7    SMTPport  25    Critical  helo
  759. Xinfo    250
  760. X#
  761. X.fi
  762. X.RE
  763. X.LP
  764. XThe program checks for sub-strings in the responses, and is case sensiive.
  765. XThe first match returns, and the remaining list of responses is not tested.
  766. XThe
  767. X.I send-string 
  768. Xis optional, and the initial connect response is discarded if this is
  769. Xpresent.
  770. XThe 
  771. X.I default-severity
  772. Xis the severity if none of the responses match or if a connect fails.
  773. XThe severity is escalated in each pass until they reach the levels
  774. Xspecified in the config file.
  775. X.\"------------------------------------
  776. X.SH CAVEATS
  777. XThe response strings and match tests are case sensitive (done using
  778. X.I strstr()
  779. Xlibrary call).
  780. X.SH AUTHOR
  781. XVikas Aggarwal, JvNCnet (vikas@jvnc.net).
  782. X.SH SEE ALSO
  783. Xnocol(1) nocol-prog(3) perlnocol(3)
  784. Xeventselect(8) genmon(8) noclogd(8) nocol-overview(8)
  785. Xnocol-utility(8) nsmon(8) pingmon(8) portmon(8) 
  786. Xtpmon(8) trapmon(8)
  787. X
  788. END_OF_FILE
  789.   if test 2071 -ne `wc -c <'nocol-3.0/src/doc/portmon.8'`; then
  790.     echo shar: \"'nocol-3.0/src/doc/portmon.8'\" unpacked with wrong size!
  791.   fi
  792.   # end of 'nocol-3.0/src/doc/portmon.8'
  793. fi
  794. if test -f 'nocol-3.0/src/genmon/Makefile' -a "${1}" != "-c" ; then 
  795.   echo shar: Will not clobber existing file \"'nocol-3.0/src/genmon/Makefile'\"
  796. else
  797.   echo shar: Extracting \"'nocol-3.0/src/genmon/Makefile'\" \(1416 characters\)
  798.   sed "s/^X//" >'nocol-3.0/src/genmon/Makefile' <<'END_OF_FILE'
  799. X# $Id: Makefile,v 1.2 1993/10/30 03:19:34 aggarwal Exp $
  800. X#
  801. X# Makefile for 'nocold'
  802. X#
  803. X# 
  804. X
  805. X## SET THIS
  806. X# Directories needed by the Makefile
  807. XTOP =         /usr/nocol
  808. XSRCDIR =    $(TOP)/src
  809. X
  810. XBINDIR =     $(TOP)/bin
  811. XETCDIR =     $(TOP)/etc
  812. XINCLUDEDIR =     $(SRCDIR)/include
  813. XLIBDIR =    $(SRCDIR)/lib 
  814. X
  815. XINSTALL =    install
  816. X
  817. X## SET THIS
  818. X# Directories needed during compile time
  819. X#    DATADIR        location of nocol data files
  820. X#
  821. XDATADIR =    $(TOP)/data
  822. X
  823. X## SET THIS
  824. X# Set the various defines for compile time defines:
  825. X#
  826. XSYSDEFS = 
  827. X
  828. X####
  829. X#### Can leave the rest alone #######
  830. X####
  831. X
  832. X##
  833. X# The various directories that are needed in the program. Should NOT
  834. X# have trailing '/'.
  835. XDIRDEFS =    -DETCDIR=\"$(ETCDIR)\"  \
  836. X        -DDATADIR=\"$(DATADIR)\"
  837. X
  838. X# Compilation definitions
  839. XCC =         cc
  840. XCDEFS =        $(DIRDEFS) $(SYSDEFS)
  841. XLIBS =         -lnocol $(SYSLIBS)
  842. XCFLAGS =     -g -I$(INCLUDEDIR) -I../include -L$(LIBDIR) -L../lib
  843. X
  844. XTARG =        genmon
  845. XOBJECTS =     genmon.o
  846. X
  847. X$(TARG):    $(OBJECTS) Makefile
  848. X    $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o $@
  849. X
  850. X.c.o:
  851. X    $(CC) $(CFLAGS) -c  $(CDEFS) $<
  852. X
  853. X## The dependencies in case 'mkdep' not used
  854. X#
  855. X$(OBJECTS): $(INCLUDEDIR)/nocol.h
  856. X
  857. Xinstall:    $(TARG)
  858. X    @[ -d $(TOP) ] || mkdir  $(TOP)
  859. X    @[ -d $(ETCDIR) ] || mkdir $(ETCDIR)
  860. X    @[ -d $(BINDIR) ] || mkdir $(BINDIR)
  861. X    $(INSTALL) -c -m 751 $(TARG)  $(BINDIR)/
  862. X
  863. Xclean:
  864. X    /bin/rm -f $(OBJECTS) $(TARG) *.o core a.out
  865. X
  866. Xrcs:
  867. X    @echo "Doing 'rcs' in $(TARG)"
  868. X    @-for i in $(OBJS); do \
  869. X        $(CO) -q `basename $$i .o`.c ;\
  870. X      done
  871. X
  872. END_OF_FILE
  873.   if test 1416 -ne `wc -c <'nocol-3.0/src/genmon/Makefile'`; then
  874.     echo shar: \"'nocol-3.0/src/genmon/Makefile'\" unpacked with wrong size!
  875.   fi
  876.   # end of 'nocol-3.0/src/genmon/Makefile'
  877. fi
  878. if test -f 'nocol-3.0/src/include/pingmon.h' -a "${1}" != "-c" ; then 
  879.   echo shar: Will not clobber existing file \"'nocol-3.0/src/include/pingmon.h'\"
  880. else
  881.   echo shar: Extracting \"'nocol-3.0/src/include/pingmon.h'\" \(2450 characters\)
  882.   sed "s/^X//" >'nocol-3.0/src/include/pingmon.h' <<'END_OF_FILE'
  883. X/*
  884. X** $Header: /home/aggarwal/lsrc/nocol/src/include/RCS/pingmon.h,v 1.12 1993/10/30 03:04:17 aggarwal Exp $
  885. X*/
  886. X
  887. X#include "nocol.h"
  888. X
  889. X/*
  890. X *        FILE DEFINITIONS
  891. X *
  892. X * DATADIR is the location of the datafile. The name is prepended to
  893. X * PINGOUTPUT to create the output filename.
  894. X *
  895. X * NODESFILE is the full name of the file containing the list of hosts
  896. X * and ip addresses.
  897. X *
  898. X * The program needs to know the location of the 'ping' progam that is
  899. X * to be used.
  900. X */
  901. X
  902. X#ifndef DATADIR
  903. X#define DATADIR        "../../data"
  904. X#endif
  905. X
  906. X#ifndef NODESFILE
  907. X#define NODESFILE    "../../etc/ipnodes"
  908. X#endif
  909. X
  910. X/*
  911. X * If using IP, then you might like to use the 'multiping' program which
  912. X * pings multiple sites synchronously. If defined, it defines the PING
  913. X * value also.
  914. X */
  915. X#ifndef IP
  916. X# undef MULTIPING        /* undef so poll_sites.c okay */
  917. X#endif  /* IP */
  918. X
  919. X#ifdef MULTIPING
  920. X#  ifndef BATCHSIZE
  921. X#    define BATCHSIZE 32    /* number of sites to ping at a time */
  922. X#  endif            /* less than limit MAXBATCH in multiping.c */
  923. X#  ifndef PING
  924. X#    define PING     "multiping"    /* the multi ping command to use */
  925. X#  endif    /* PING */
  926. X#else
  927. X#  define BATCHSIZE 1            /* for standard ping programs */
  928. X#endif /* MULTIPING */
  929. X
  930. X
  931. X/*
  932. X * The progam automatically fills in its own name in the EVENT.sender
  933. X * field. If you want to over-ride this name with your own, then define
  934. X * SENDER
  935. X */
  936. X/* #define SENDER    "pingmon"    /* */
  937. X
  938. X
  939. X/*************** Rest is standard and need not be touched ***********/
  940. X
  941. X#ifndef PING
  942. X#  ifdef sun
  943. X#    define PING    "/usr/etc/ping"
  944. X#  else
  945. X#    define PING    "/etc/ping"
  946. X#  endif    /* sun */
  947. X#endif    /* PING */
  948. X
  949. X/*
  950. X * Extension of the output datafile. DATADIR/prognm is tacked onto this name.
  951. X */
  952. X#define    PINGOUTPUTEXT  "-output"
  953. X
  954. X/*
  955. X *        CONSTANTS
  956. X*/
  957. X#ifndef BUFSIZ                      /* in stdio.h */
  958. X#define BUFSIZ 1024
  959. X#endif /* BUFSIZ */
  960. X
  961. X#define MAXLINE        127    /* Randomly selected string lengths */
  962. X#define    DATALEN        100    /* Size of ping packets    (bytes) */
  963. X#define    NPACKETS    10    /* Number of ping packets sent */
  964. X#define PING_THRES      3    /* If more than this pkts lost, then down */
  965. X#define POLLINTERVAL    180    /* secs between starting next poll */
  966. X
  967. X#define VARNM        "Reachability"    /* for EVENT.var.name field    */
  968. X#define VARUNITS    "Pkts"        /* Units name */
  969. X#define DEBUG_FLG "NOCOL_DEBUG"        /* to run in debug mode    if set    */
  970. X
  971. X/*
  972. X * Global variables
  973. X */
  974. Xint debug ;
  975. Xchar *prognm ;                /* Program name            */
  976. Xchar *sender ;                /* Name used in the v.sender field */
  977. Xchar *ping ;                /* which ping to use        */
  978. X
  979. END_OF_FILE
  980.   if test 2450 -ne `wc -c <'nocol-3.0/src/include/pingmon.h'`; then
  981.     echo shar: \"'nocol-3.0/src/include/pingmon.h'\" unpacked with wrong size!
  982.   fi
  983.   # end of 'nocol-3.0/src/include/pingmon.h'
  984. fi
  985. if test -f 'nocol-3.0/src/include/portmon.h' -a "${1}" != "-c" ; then 
  986.   echo shar: Will not clobber existing file \"'nocol-3.0/src/include/portmon.h'\"
  987. else
  988.   echo shar: Extracting \"'nocol-3.0/src/include/portmon.h'\" \(1384 characters\)
  989.   sed "s/^X//" >'nocol-3.0/src/include/portmon.h' <<'END_OF_FILE'
  990. X/* $Header: /home/aggarwal/lsrc/nocol/src/include/RCS/portmon.h,v 1.1 1993/10/30 03:04:41 aggarwal Exp $  */
  991. X
  992. X#include "nocol.h"
  993. X
  994. X#include <sys/types.h>
  995. X#include <stdio.h>
  996. X#include <string.h>
  997. X#include <ctype.h>
  998. X#include <errno.h>
  999. X
  1000. X#include <unistd.h>        /* for lseek */
  1001. X#include <sys/file.h>
  1002. X#include <sys/stat.h>
  1003. X#include <fcntl.h>
  1004. X
  1005. X#include <sys/socket.h>
  1006. X#include <sys/un.h>
  1007. X#include <sys/wait.h>
  1008. X#include <sys/time.h>
  1009. X#include <signal.h>
  1010. X#include <netdb.h>
  1011. X
  1012. X
  1013. X#ifndef ETCDIR
  1014. X#  define ETCDIR         "../../etc"
  1015. X#endif
  1016. X
  1017. X#ifndef DATADIR
  1018. X#  define DATADIR         "../../data"
  1019. X#endif
  1020. X
  1021. X#ifndef CONFIGFILE
  1022. X# define CONFIGFILE       "../../etc/portmon-confg"
  1023. X#endif
  1024. X
  1025. X#define OUTPUTEXT    "-output"
  1026. X#define VARUNITS    "Port"
  1027. X
  1028. X#define MAXLINE        128         /* Randomly selected string length */
  1029. X#define MAXHOSTS      128
  1030. X#define TIMEOUT        30        /* secs in 'connect' timeouts */
  1031. X#define POLLINTERVAL      60*15        /* seconds between passes */
  1032. X
  1033. X
  1034. Xstruct _response
  1035. X{
  1036. X    char  *response;
  1037. X    int   severity;
  1038. X} ;
  1039. X
  1040. Xstruct _harray
  1041. X{
  1042. X    char  *hname ;        /* Name for nocol struct */
  1043. X    char  *ipaddr ;        /* IP name (or address) */
  1044. X    char  *send ;        /* string to send remote site */
  1045. X    int   port ;        /* port number being tested */
  1046. X    int      maxseverity ;
  1047. X    struct _response  responses[20] ;    /* max number of chat strings */
  1048. X} hostarray[MAXHOSTS] ;
  1049. X
  1050. X
  1051. X#define RTIMEOUT  60        /* seconds for socket read() timeout */
  1052. X
  1053. END_OF_FILE
  1054.   if test 1384 -ne `wc -c <'nocol-3.0/src/include/portmon.h'`; then
  1055.     echo shar: \"'nocol-3.0/src/include/portmon.h'\" unpacked with wrong size!
  1056.   fi
  1057.   # end of 'nocol-3.0/src/include/portmon.h'
  1058. fi
  1059. if test -f 'nocol-3.0/src/lib/Makefile' -a "${1}" != "-c" ; then 
  1060.   echo shar: Will not clobber existing file \"'nocol-3.0/src/lib/Makefile'\"
  1061. else
  1062.   echo shar: Extracting \"'nocol-3.0/src/lib/Makefile'\" \(1348 characters\)
  1063.   sed "s/^X//" >'nocol-3.0/src/lib/Makefile' <<'END_OF_FILE'
  1064. X#
  1065. X# Makefile for nocol lib
  1066. X#
  1067. X
  1068. X## SET THIS
  1069. X# Directories needed by the Makefile
  1070. XTOP =         /usr/nocol
  1071. XSRCDIR =    $(TOP)/src
  1072. X
  1073. XBINDIR =     $(TOP)/bin
  1074. XETCDIR =     $(TOP)/etc
  1075. XINCLUDEDIR =     $(SRCDIR)/include
  1076. XLIBDIR =    $(SRCDIR)/lib
  1077. X
  1078. X## SET THIS
  1079. X#     NLOG_HOST        host where the noclogd logging daemon runs
  1080. X#
  1081. XNLOG_HOST =    noclog.jvnc.net
  1082. X
  1083. X## SET THIS
  1084. X# Set the various defines for compile time defines:
  1085. X#
  1086. XSYSDEFS =
  1087. XRANLIB  =  ranlib
  1088. XINSTALL    =  install
  1089. X
  1090. X####
  1091. X#### Can leave the rest alone #######
  1092. X####
  1093. X
  1094. X##
  1095. X# The various directories that are needed in the program. Should NOT
  1096. X# have trailing '/'.
  1097. XDIRDEFS =    -DETCDIR=\"$(ETCDIR)\" \
  1098. X        -DNLOG_HOST=\"$(NLOG_HOST)\"
  1099. X
  1100. X
  1101. X# Compilation definitions
  1102. XCC =         cc
  1103. XCDEFS =        $(DIRDEFS) $(SYSDEFS)
  1104. XCFLAGS =     -g -I$(INCLUDEDIR) -I../include
  1105. X
  1106. XTARG =    libnocol.a
  1107. XOBJS=    eventlog.o event_utils.o fgetline.o getdate.o standalone.o $(NEEDOBJS)
  1108. X
  1109. X$(TARG):    $(OBJS)
  1110. X    /bin/rm -f $(TARG)
  1111. X    ar r $(TARG) $(OBJS)
  1112. X    $(RANLIB)  $(TARG)
  1113. X    @echo "Created $(TARG) in `pwd`"
  1114. X
  1115. X## For testing, to make a standalone version using -DTEST
  1116. Xgetdate: getdate.y 
  1117. X    @/bin/rm -f y.tab.c
  1118. X    yacc getdate.y 
  1119. X    cc $(CFLAGS) -DTEST y.tab.c -o $@
  1120. X    @/bin/rm -f y.tab.c
  1121. X
  1122. X.c.o:
  1123. X    $(CC) $(CFLAGS) -c  $(CDEFS) $<
  1124. X
  1125. X## The dependencies in case 'mkdep' not used
  1126. X#
  1127. X$(OBJS): $(INCLUDEDIR)/nocol.h $(INCLUDEDIR)/noclogd.h
  1128. X
  1129. Xinstall: $(TARG)
  1130. X    
  1131. Xclean:
  1132. X    rm -f $(OBJS) $(TARG) core a.out getdate
  1133. END_OF_FILE
  1134.   if test 1348 -ne `wc -c <'nocol-3.0/src/lib/Makefile'`; then
  1135.     echo shar: \"'nocol-3.0/src/lib/Makefile'\" unpacked with wrong size!
  1136.   fi
  1137.   # end of 'nocol-3.0/src/lib/Makefile'
  1138. fi
  1139. if test -f 'nocol-3.0/src/lib/ftime.c' -a "${1}" != "-c" ; then 
  1140.   echo shar: Will not clobber existing file \"'nocol-3.0/src/lib/ftime.c'\"
  1141. else
  1142.   echo shar: Extracting \"'nocol-3.0/src/lib/ftime.c'\" \(2339 characters\)
  1143.   sed "s/^X//" >'nocol-3.0/src/lib/ftime.c' <<'END_OF_FILE'
  1144. X/*-
  1145. X * Copyright (c) 1980, 1991 The Regents of the University of California.
  1146. X * All rights reserved.
  1147. X *
  1148. X * Redistribution and use in source and binary forms, with or without
  1149. X * modification, are permitted provided that the following conditions
  1150. X * are met:
  1151. X * 1. Redistributions of source code must retain the above copyright
  1152. X *    notice, this list of conditions and the following disclaimer.
  1153. X * 2. Redistributions in binary form must reproduce the above copyright
  1154. X *    notice, this list of conditions and the following disclaimer in the
  1155. X *    documentation and/or other materials provided with the distribution.
  1156. X * 3. All advertising materials mentioning features or use of this software
  1157. X *    must display the following acknowledgement:
  1158. X *    This product includes software developed by the University of
  1159. X *    California, Berkeley and its contributors.
  1160. X * 4. Neither the name of the University nor the names of its contributors
  1161. X *    may be used to endorse or promote products derived from this software
  1162. X *    without specific prior written permission.
  1163. X *
  1164. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1165. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1166. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1167. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1168. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1169. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1170. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1171. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1172. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1173. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1174. X * SUCH DAMAGE.
  1175. X */
  1176. X
  1177. X#ifndef lint
  1178. Xstatic char rcsid[] = "ftime.c,v 1.2 1993/08/02 17:50:05 mycroft Exp";
  1179. X#endif /* not lint */
  1180. X
  1181. X#include <sys/types.h>
  1182. X#include <sys/time.h>
  1183. X#include <sys/timeb.h>
  1184. X
  1185. Xftime(tbp)
  1186. X        struct timeb *tbp;
  1187. X{
  1188. X        struct timezone tz;
  1189. X        struct timeval t;
  1190. X
  1191. X        if (gettimeofday(&t, &tz) < 0)
  1192. X                return (-1);
  1193. X        tbp->millitm = t.tv_usec / 1000;
  1194. X        tbp->time = t.tv_sec;
  1195. X        tbp->timezone = tz.tz_minuteswest;
  1196. X        tbp->dstflag = tz.tz_dsttime;
  1197. X
  1198. X    return (0);
  1199. X}
  1200. END_OF_FILE
  1201.   if test 2339 -ne `wc -c <'nocol-3.0/src/lib/ftime.c'`; then
  1202.     echo shar: \"'nocol-3.0/src/lib/ftime.c'\" unpacked with wrong size!
  1203.   fi
  1204.   # end of 'nocol-3.0/src/lib/ftime.c'
  1205. fi
  1206. if test -f 'nocol-3.0/src/lib/putenv.c' -a "${1}" != "-c" ; then 
  1207.   echo shar: Will not clobber existing file \"'nocol-3.0/src/lib/putenv.c'\"
  1208. else
  1209.   echo shar: Extracting \"'nocol-3.0/src/lib/putenv.c'\" \(2015 characters\)
  1210.   sed "s/^X//" >'nocol-3.0/src/lib/putenv.c' <<'END_OF_FILE'
  1211. X/*    @(#)putenv.c    1.2    */
  1212. X/*    LINTLIBRARY    */
  1213. X/*    putenv - change environment variables
  1214. X
  1215. X    input - char *change = a pointer to a string of the form
  1216. X                   "name=value"
  1217. X
  1218. X    output - 0, if successful
  1219. X         1, otherwise
  1220. X*/
  1221. X#define NULL 0
  1222. Xextern char **environ;        /* pointer to enviroment */
  1223. Xstatic reall = 0;        /* flag to reallocate space, if putenv is called
  1224. X                   more than once */
  1225. X
  1226. Xint
  1227. Xputenv(change)
  1228. Xchar *change;
  1229. X{
  1230. X    char **newenv;            /* points to new environment */
  1231. X    register int which;        /* index of variable to replace */
  1232. X    char *realloc(), *malloc(); /* memory alloc routines */
  1233. X
  1234. X    if ((which = find(change)) < 0)  {
  1235. X        /* if a new variable */
  1236. X        /* which is negative of table size, so invert and
  1237. X           count new element */
  1238. X        which = (-which) + 1;
  1239. X        if (reall)  {
  1240. X            /* we have expanded environ before */
  1241. X            newenv = (char **)realloc(environ,
  1242. X                  which*sizeof(char *));
  1243. X            if (newenv == NULL)  return -1;
  1244. X            /* now that we have space, change environ */
  1245. X            environ = newenv;
  1246. X        } else {
  1247. X            /* environ points to the original space */
  1248. X            reall++;
  1249. X            newenv = (char **)malloc(which*sizeof(char *));
  1250. X            if (newenv == NULL)  return -1;
  1251. X            (void)memcpy((char *)newenv, (char *)environ,
  1252. X                 (int)(which*sizeof(char *)));
  1253. X            environ = newenv;
  1254. X        }
  1255. X        environ[which-2] = change;
  1256. X        environ[which-1] = NULL;
  1257. X    }  else  {
  1258. X        /* we are replacing an old variable */
  1259. X        environ[which] = change;
  1260. X    }
  1261. X    return 0;
  1262. X}
  1263. X
  1264. X/*    find - find where s2 is in environ
  1265. X *
  1266. X *    input - str = string of form name=value
  1267. X *
  1268. X *    output - index of name in environ that matches "name"
  1269. X *         -size of table, if none exists
  1270. X*/
  1271. Xstatic
  1272. Xfind(str)
  1273. Xregister char *str;
  1274. X{
  1275. X    register int ct = 0;    /* index into environ */
  1276. X
  1277. X    while(environ[ct] != NULL)   {
  1278. X        if (match(environ[ct], str)  != 0)
  1279. X            return ct;
  1280. X        ct++;
  1281. X    }
  1282. X    return -(++ct);
  1283. X}
  1284. X/*
  1285. X *    s1 is either name, or name=value
  1286. X *    s2 is name=value
  1287. X *    if names match, return value of 1,
  1288. X *    else return 0
  1289. X */
  1290. X
  1291. Xstatic
  1292. Xmatch(s1, s2)
  1293. Xregister char *s1, *s2;
  1294. X{
  1295. X    while(*s1 == *s2++)  {
  1296. X        if (*s1 == '=')
  1297. X            return 1;
  1298. X        s1++;
  1299. X    }
  1300. X    return 0;
  1301. X}
  1302. END_OF_FILE
  1303.   if test 2015 -ne `wc -c <'nocol-3.0/src/lib/putenv.c'`; then
  1304.     echo shar: \"'nocol-3.0/src/lib/putenv.c'\" unpacked with wrong size!
  1305.   fi
  1306.   # end of 'nocol-3.0/src/lib/putenv.c'
  1307. fi
  1308. if test -f 'nocol-3.0/src/netmon/Makefile' -a "${1}" != "-c" ; then 
  1309.   echo shar: Will not clobber existing file \"'nocol-3.0/src/netmon/Makefile'\"
  1310. else
  1311.   echo shar: Extracting \"'nocol-3.0/src/netmon/Makefile'\" \(1871 characters\)
  1312.   sed "s/^X//" >'nocol-3.0/src/netmon/Makefile' <<'END_OF_FILE'
  1313. X# $Id: Makefile,v 1.5 1993/10/30 03:49:49 aggarwal Exp $
  1314. X#
  1315. X# Makefile for 'netmon'
  1316. X#
  1317. X# 
  1318. X# ETC is used for dumping the HELPFILE in that directory
  1319. X
  1320. X## SET THIS
  1321. X# Directories needed by the Makefile
  1322. XTOP =         /usr/nocol
  1323. XSRCDIR =    $(TOP)/src
  1324. X
  1325. XBINDIR =     $(TOP)/bin
  1326. XETCDIR =     $(TOP)/etc
  1327. XINCLUDEDIR =     $(SRCDIR)/include
  1328. XLIBDIR =    $(SRCDIR)/lib
  1329. X
  1330. X## SET THIS
  1331. X# Directories needed by the program.
  1332. XDATADIR =     $(TOP)/data
  1333. XMSGSDIR =    $(TOP)/msgs
  1334. XHELPFILE =     $(ETCDIR)/nocol-help
  1335. X
  1336. X## SET THIS
  1337. X# The special system definitions. Define:
  1338. X#    -DNETLOG        If you want to enable invoking netlog from
  1339. X#                within 'netmon'
  1340. XSYSDEFS =
  1341. XINSTALL =    install
  1342. X
  1343. X####
  1344. X#### Can leave the rest alone #######
  1345. X####
  1346. X
  1347. X##
  1348. X# The various directories that are needed in the program. Should NOT
  1349. X# have trailing '/'.
  1350. XDIRDEFS =    -DDATADIR=\"$(DATADIR)\" \
  1351. X        -DMSGSDIR=\"$(MSGSDIR)\" \
  1352. X        -DHELPFILE=\"$(HELPFILE)\"
  1353. X
  1354. X# Compilation definitions
  1355. XCC =         cc
  1356. XCDEFS =        $(DIRDEFS) $(SYSDEFS)
  1357. XLIBS =         -lcurses -ltermcap -lnocol $(SYSLIBS)
  1358. XCFLAGS =     -g -I$(INCLUDEDIR) -L$(LIBDIR)
  1359. X
  1360. XTARG =        netmon
  1361. XOBJECTS =     build_display.o event_dpy.o fill_window.o filter.o \
  1362. X        help_page.o  msg_dpy.o netmon.o parse_input.o \
  1363. X        poll_input.o read_filter.o setup_display.o utils.o
  1364. X
  1365. X
  1366. X$(TARG):    $(OBJECTS) Makefile
  1367. X    $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o $@
  1368. X
  1369. X.c.o:
  1370. X    $(CC) $(CFLAGS) -c  $(CDEFS) $<
  1371. X
  1372. X## The dependencies in case 'mkdep' not used
  1373. X#
  1374. X$(OBJECTS): $(INCLUDEDIR)/nocol.h $(INCLUDEDIR)/netmon.h
  1375. X
  1376. Xinstall:    netmon
  1377. X    @[ -d $(TOP) ] || mkdir  $(TOP)
  1378. X    @[ -d $(DATADIR) ] || mkdir $(DATADIR)
  1379. X    @[ -d $(ETCDIR) ] || mkdir $(ETCDIR)
  1380. X    @[ -d $(BINDIR) ] || mkdir $(BINDIR)
  1381. X    @-[ -d $(MSGSDIR) ] || mkdir $(MSGSDIR)
  1382. X    $(INSTALL) -c -m 751 netmon $(BINDIR)/nocol
  1383. X    $(INSTALL) -c -m 0444 nocol-help $(HELPFILE)
  1384. X
  1385. X
  1386. Xclean:
  1387. X    /bin/rm -f $(OBJECTS) $(TARG) core a.out
  1388. X
  1389. X
  1390. Xrcs:
  1391. X    @echo "Doing 'rcs' in $(TARG)"
  1392. X    @-for i in $(OBJS); do \
  1393. X        $(CO) -q `basename $$i .o`.c ;\
  1394. X      done
  1395. X
  1396. END_OF_FILE
  1397.   if test 1871 -ne `wc -c <'nocol-3.0/src/netmon/Makefile'`; then
  1398.     echo shar: \"'nocol-3.0/src/netmon/Makefile'\" unpacked with wrong size!
  1399.   fi
  1400.   # end of 'nocol-3.0/src/netmon/Makefile'
  1401. fi
  1402. if test -f 'nocol-3.0/src/netmon/nocol-help' -a "${1}" != "-c" ; then 
  1403.   echo shar: Will not clobber existing file \"'nocol-3.0/src/netmon/nocol-help'\"
  1404. else
  1405.   echo shar: Extracting \"'nocol-3.0/src/netmon/nocol-help'\" \(1995 characters\)
  1406.   sed "s/^X//" >'nocol-3.0/src/netmon/nocol-help' <<'END_OF_FILE'
  1407. XThis program displays the output from various Network monitoring programs. 
  1408. XIt displays the value of monitored variables and their state.
  1409. X
  1410. X    USAGE:    nocol  [-d (debug)] [-q (quiet)] [-w (wide display)]
  1411. X        [-l <level 1:4>] [alternate data directory]
  1412. X
  1413. XPrompt options:
  1414. X
  1415. X    b        - Bell on/off (toggle)
  1416. X    c        - Contract size of event display screen
  1417. X    d        - Debug mode (toggle)
  1418. X    f        - Freeze screen (toggle)
  1419. X    h        - help screen (this display)
  1420. X    l <level>    - set new display Level (from 1 to 4)
  1421. X    q        - Quit
  1422. X    r        - Refresh screen
  1423. X    s or /        - Search filter on event screen
  1424. X    x        - eXpand size of event display screen
  1425. X    w        - toggle Wide display mode
  1426. X    any key        - for next screen
  1427. X
  1428. XThe User Screen:
  1429. X---------------
  1430. XThe screen is divided into two sections- the EVENT section and the MESSAGES
  1431. Xsection. All site events are displayed in the EVENT section and any text
  1432. Xmessages are displayed in the MESSAGES section. These messages are displayed
  1433. Xin rotation and scroll in each screenful.
  1434. X
  1435. XBy default the screen is updated every 15 seconds. However, by using
  1436. Xthe 'freeze' option, the screen is updated only when the user hits
  1437. Xa key.
  1438. X
  1439. XThe size of the 'event' window can be manipulated using the 'c' and
  1440. X'x' options. The message window grows correspondingly larger as
  1441. Xthe event window shrinks in size.
  1442. X
  1443. XOutput Display Filter
  1444. X---------------------
  1445. XThe output for the events can be filtered and only events matching a string
  1446. Xbe displayed on the screen. The syntax of the search pattern is:
  1447. X
  1448. X    word1 & word2 | word3
  1449. X
  1450. Xso that only the events that have 'word1' and 'word2' (both together) OR
  1451. Xword3 will be displayed. Regular expressions are not supported. All words
  1452. Xare converted to lowercase for case insensetive matching.
  1453. X
  1454. X
  1455. XTerminal Type
  1456. X-------------
  1457. XIf your terminal type is unsuitable, you are prompted for the type
  1458. Xwhen you start the program. Common terminal types are:
  1459. X
  1460. X    vt100, vtxxx            DEC terminals
  1461. X    vt100-w, vt200-w        DEC terminals in 132 col mode
  1462. X    xterm                for X window terminal emulator
  1463. X
  1464. XMail comments / suggestions to nocol@jvnc.net
  1465. END_OF_FILE
  1466.   if test 1995 -ne `wc -c <'nocol-3.0/src/netmon/nocol-help'`; then
  1467.     echo shar: \"'nocol-3.0/src/netmon/nocol-help'\" unpacked with wrong size!
  1468.   fi
  1469.   # end of 'nocol-3.0/src/netmon/nocol-help'
  1470. fi
  1471. if test -f 'nocol-3.0/src/netmon/poll_input.c' -a "${1}" != "-c" ; then 
  1472.   echo shar: Will not clobber existing file \"'nocol-3.0/src/netmon/poll_input.c'\"
  1473. else
  1474.   echo shar: Extracting \"'nocol-3.0/src/netmon/poll_input.c'\" \(1744 characters\)
  1475.   sed "s/^X//" >'nocol-3.0/src/netmon/poll_input.c' <<'END_OF_FILE'
  1476. X/*+ 
  1477. X** $Header: /home/aggarwal/lsrc/nocol/src/netmon/RCS/poll_input.c,v 1.5 1993/10/30 03:53:49 aggarwal Exp $
  1478. X**/
  1479. X
  1480. X/* Copyright 1993 JvNCnet, Global Enterprise Services */
  1481. X
  1482. X/*+
  1483. X** 
  1484. X** FUNCTION:
  1485. X**    It polls for the user input asynchronously and returns the
  1486. X** user input (integer = character). If there is no user input for as
  1487. X** long as PAUSE (defined in the netmon.h include file), it returns a
  1488. X** '0' value.
  1489. X**
  1490. X** Uses the 'select' function.
  1491. X**
  1492. X** AUTHOR
  1493. X**    Vikas Aggarwal
  1494. X**
  1495. X**/
  1496. X
  1497. X/*+ 
  1498. X * $Log: poll_input.c,v $
  1499. X * Revision 1.5  1993/10/30  03:53:49  aggarwal
  1500. X * Added typecasting to avoid compilers complaining.
  1501. X *
  1502. X * Revision 1.4  1992/06/18  21:07:22  aggarwal
  1503. X * Cleaned up the include file stuff
  1504. X *
  1505. X * Revision 1.3  1992/04/22  22:59:58  aggarwal
  1506. X * Lot of cleaning up for releasing. Organized things right.
  1507. X *
  1508. X * Revision 1.2  1990/03/09  12:14:44  aggarwal
  1509. X * Added the 'frozen' option where the poll waits indefinitely for a user
  1510. X * input (instead of the default PAUSE seconds).
  1511. X *
  1512. X * Revision 1.1  89/11/08  12:22:19  aggarwal
  1513. X * Initial revision
  1514. X * 
  1515. X */
  1516. X
  1517. X#include "netmon.h"
  1518. X
  1519. X#ifndef PAUSE
  1520. X#define PAUSE 15        /* wait for 15 seconds for user input    */
  1521. X#endif
  1522. X
  1523. Xpoll_input ()
  1524. X{
  1525. X    extern bool frozen ;            /* Defined in netmon.h    */
  1526. X    struct timeval tim_v;
  1527. X    char   reply;
  1528. X    int       read_mask = 1 ;            /* For 'select' routine */
  1529. X
  1530. X    tim_v.tv_sec = PAUSE;            /* init poll delay    */
  1531. X    tim_v.tv_usec = 0;
  1532. X
  1533. X    if (frozen)
  1534. X      reply = select (2, (fd_set *)&read_mask, (fd_set *)0, (fd_set *)0, NULL) ;
  1535. X    else
  1536. X      reply = select (2, (fd_set *)&read_mask, (fd_set *)0,(fd_set *)0, &tim_v);
  1537. X
  1538. X    if (!(reply && read_mask))            /* no input, timed out    */
  1539. X      return(0); 
  1540. X    else
  1541. X      return (getchar()) ;            /* return the input     */
  1542. X}
  1543. END_OF_FILE
  1544.   if test 1744 -ne `wc -c <'nocol-3.0/src/netmon/poll_input.c'`; then
  1545.     echo shar: \"'nocol-3.0/src/netmon/poll_input.c'\" unpacked with wrong size!
  1546.   fi
  1547.   # end of 'nocol-3.0/src/netmon/poll_input.c'
  1548. fi
  1549. if test -f 'nocol-3.0/src/noclog/Makefile' -a "${1}" != "-c" ; then 
  1550.   echo shar: Will not clobber existing file \"'nocol-3.0/src/noclog/Makefile'\"
  1551. else
  1552.   echo shar: Extracting \"'nocol-3.0/src/noclog/Makefile'\" \(1870 characters\)
  1553.   sed "s/^X//" >'nocol-3.0/src/noclog/Makefile' <<'END_OF_FILE'
  1554. X# $Id: Makefile,v 1.2 1993/10/30 03:44:36 aggarwal Exp $
  1555. X#
  1556. X# Makefile for 'nocold'
  1557. X#
  1558. X# 
  1559. X# ETC is used for the config file and error log file.
  1560. X# Also EDIT THE ../include/noclogd.h for setting host and other information.
  1561. X
  1562. X## SET THIS
  1563. X# Directories needed by the Makefile
  1564. XTOP =         /usr/nocol
  1565. XSRCDIR =    $(TOP)/src
  1566. X
  1567. XBINDIR =     $(TOP)/bin
  1568. XETCDIR =     $(TOP)/etc
  1569. XINCLUDEDIR =     $(SRCDIR)/include
  1570. XLIBDIR =    $(SRCDIR)/lib 
  1571. X
  1572. X## SET THIS
  1573. X#     NLOG_HOST        host where the noclogd logging daemon runs
  1574. X#
  1575. XNLOG_HOST =    noclog.jvnc.net
  1576. X
  1577. X## SET THIS
  1578. X# Set the various defines for compile time defines:
  1579. X#
  1580. XSYSDEFS = 
  1581. XINSTALL =    install
  1582. X
  1583. X####
  1584. X#### Can leave the rest alone #######
  1585. X####
  1586. X
  1587. X##
  1588. X# The various directories that are needed in the program. Should NOT
  1589. X# have trailing '/'.
  1590. XDIRDEFS =    -DETCDIR=\"$(ETCDIR)\" \
  1591. X        -DNLOG_HOST=\"$(NLOG_HOST)\"
  1592. X
  1593. X# Compilation definitions
  1594. XCC =         cc
  1595. XCDEFS =        $(DIRDEFS) $(SYSDEFS)
  1596. XLIBS =         -lnocol $(SYSLIBS)
  1597. XCFLAGS =     -g -I$(INCLUDEDIR) -I../include -L$(LIBDIR) -L../lib
  1598. X
  1599. XTARG =        noclogd
  1600. XOBJECTS =     noclogd.o
  1601. X
  1602. X$(TARG):    $(OBJECTS) Makefile
  1603. X    $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o $(TARG)
  1604. X
  1605. Xall:    $(TARG)  stress_noclogd  newtest
  1606. X
  1607. Xstress_noclogd: stress_noclogd.o Makefile
  1608. X    $(CC) $(CFLAGS) -o  stress_noclogd stress_noclogd.o $(LIBS)
  1609. X
  1610. Xnewtest: newtest.o Makefile
  1611. X    $(CC) $(CFLAGS) -o newtest newtest.o $(LIBS)
  1612. X
  1613. X.c.o:
  1614. X    $(CC) $(CFLAGS) -c  $(CDEFS) $<
  1615. X
  1616. X## The dependencies in case 'mkdep' not used
  1617. X#
  1618. X$(OBJECTS): $(INCLUDEDIR)/nocol.h $(INCLUDEDIR)/noclogd.h
  1619. X
  1620. Xinstall:    $(TARG)
  1621. X    @[ -d $(TOP) ] || mkdir  $(TOP)
  1622. X    @[ -d $(ETCDIR) ] || mkdir $(ETCDIR)
  1623. X    @[ -d $(BINDIR) ] || mkdir $(BINDIR)
  1624. X    $(INSTALL) -c -m 751 $(TARG)  $(BINDIR)/
  1625. X    @echo "___Update config file for logging daemon in $(ETCDIR) ___"
  1626. X
  1627. Xclean:
  1628. X    /bin/rm -f $(OBJECTS) $(TARG) *.o stress_noclogd newtest core a.out
  1629. X
  1630. Xrcs:
  1631. X    @echo "Doing 'rcs' in $(TARG)"
  1632. X    @-for i in $(OBJS); do \
  1633. X        $(CO) -q `basename $$i .o`.c ;\
  1634. X      done
  1635. X
  1636. END_OF_FILE
  1637.   if test 1870 -ne `wc -c <'nocol-3.0/src/noclog/Makefile'`; then
  1638.     echo shar: \"'nocol-3.0/src/noclog/Makefile'\" unpacked with wrong size!
  1639.   fi
  1640.   # end of 'nocol-3.0/src/noclog/Makefile'
  1641. fi
  1642. if test -f 'nocol-3.0/src/nsmon/Makefile' -a "${1}" != "-c" ; then 
  1643.   echo shar: Will not clobber existing file \"'nocol-3.0/src/nsmon/Makefile'\"
  1644. else
  1645.   echo shar: Extracting \"'nocol-3.0/src/nsmon/Makefile'\" \(1985 characters\)
  1646.   sed "s/^X//" >'nocol-3.0/src/nsmon/Makefile' <<'END_OF_FILE'
  1647. X# $Id: Makefile,v 1.6 1993/10/02 05:39:34 aggarwal Exp aggarwal $
  1648. X#
  1649. X# Makefile for 'nsmon'
  1650. X#
  1651. X# ETC is used for dumping the HELPFILE in that directory
  1652. X
  1653. X## SET THIS
  1654. X# Directories needed by the Makefile. See description in ../Makefile
  1655. XTOP =         /usr/nocol
  1656. XSRCDIR =    $(TOP)/src
  1657. X
  1658. XBINDIR =     $(TOP)/bin
  1659. XETCDIR =     $(TOP)/etc
  1660. XINCLUDEDIR =     $(SRCDIR)/include
  1661. XLIBDIR =    $(SRCDIR)/lib
  1662. X
  1663. X## SET THIS
  1664. X# Directories needed by the program.
  1665. X#    DATADIR            for creating the NSMON-OUTPUT
  1666. X#    NODESFILE        config file for list of nodes to be monitored
  1667. X#    DOMAINNAME        your host's domain name (berkeley.edu) for
  1668. X#                which the nameservers tested are authoratative
  1669. XDATADIR =     $(TOP)/data
  1670. XNODESFILE =    $(ETCDIR)/nsmon-confg
  1671. XDOMAINNAME =    jvnc.net
  1672. X
  1673. X## SET THIS
  1674. X# Set the various defines for compile time defines:
  1675. X#
  1676. XSYSDEFS =
  1677. X
  1678. X####
  1679. X#### Can leave the rest alone #######
  1680. X####
  1681. X
  1682. X##
  1683. X# The various directories that are needed in the program. Should NOT
  1684. X# have trailing '/'.
  1685. XDIRDEFS =    -DETCDIR=\"$(ETCDIR)\" \
  1686. X        -DDATADIR=\"$(DATADIR)\" \
  1687. X        -DNODESFILE=\"$(NODESFILE)\" \
  1688. X        -DQUERYDATA=\"$(DOMAINNAME)\"
  1689. X
  1690. X# Compilation definitions
  1691. X# The 'libresolv' lib might be needed here...
  1692. X# SYSLIBS = -lresolv
  1693. XCC =        cc
  1694. XCDEFS =        $(DIRDEFS) $(SYSDEFS)
  1695. XLIBS =        -lnocol $(SYSLIBS)
  1696. XCFLAGS =     -g -I$(INCLUDEDIR) -L$(LIBDIR) -I../include -L../lib
  1697. X
  1698. XTARG    =    nsmon
  1699. XOBJECTS =     main.o nsmon.o poll_sites.o
  1700. X
  1701. X
  1702. X$(TARG): $(OBJECTS) Makefile
  1703. X    $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o $@
  1704. X
  1705. X######
  1706. X# small testing program to demonstrate the throughput() function
  1707. X###
  1708. Xtest nstest:    nstest.o nsmon.o
  1709. X    $(CC) $(CFLAGS) -o nstest nsmon.o nstest.o
  1710. X
  1711. X.c.o:
  1712. X    $(CC) -c $(CFLAGS) $(CDEFS) $<
  1713. X
  1714. X## The dependencies in case 'mkdep' not used
  1715. X#
  1716. X$(OBJECTS): $(INCLUDEDIR)/nocol.h  $(INCLUDEDIR)/nsmon.h
  1717. X
  1718. Xinstall: $(TARG)
  1719. X    $(INSTALL) -c -m 751 $(TARG) $(BINDIR)/
  1720. X    @echo "___Update $(NODESFILE) with nameserver test information___"
  1721. X
  1722. Xclean:
  1723. X    /bin/rm -f $(TARG) $(OBJECTS) core a.out
  1724. X
  1725. Xrcs:
  1726. X    @echo "Doing 'rcs' in $(TARG)"
  1727. X    @-for i in $(OBJS); do \
  1728. X        $(CO) -q `basename $$i .o`.c ;\
  1729. X      done
  1730. END_OF_FILE
  1731.   if test 1985 -ne `wc -c <'nocol-3.0/src/nsmon/Makefile'`; then
  1732.     echo shar: \"'nocol-3.0/src/nsmon/Makefile'\" unpacked with wrong size!
  1733.   fi
  1734.   # end of 'nocol-3.0/src/nsmon/Makefile'
  1735. fi
  1736. if test -f 'nocol-3.0/src/nsmon/nsmon-confg' -a "${1}" != "-c" ; then 
  1737.   echo shar: Will not clobber existing file \"'nocol-3.0/src/nsmon/nsmon-confg'\"
  1738. else
  1739.   echo shar: Extracting \"'nocol-3.0/src/nsmon/nsmon-confg'\" \(504 characters\)
  1740.   sed "s/^X//" >'nocol-3.0/src/nsmon/nsmon-confg' <<'END_OF_FILE'
  1741. X# $Id: nsmon-confg,v 1.2 1993/10/30 03:43:33 aggarwal Exp $
  1742. X#
  1743. X# Config file for 'nsmon'. Set the list of servers that are to be
  1744. X# monitored for their nameserver process over here.
  1745. X#
  1746. X# The query type is for SOA and the query name (domain) is hardcoded
  1747. X# in the include file.
  1748. X#
  1749. X#    POLLINTERVAL    <secs>
  1750. X#    DOMAINNAME    <string>    <- over-rides compile time default
  1751. X#
  1752. X# hostname    ipaddress
  1753. X#
  1754. XPOLLINTERVAL    600
  1755. X#
  1756. XDOMAINNAME    jvnc.net
  1757. X#
  1758. Xnisc        128.121.50.7
  1759. Xr2d2        128.121.50.2
  1760. Xdumbo        128.121.50.147
  1761. Xcolumbia    128.59.40.142
  1762. END_OF_FILE
  1763.   if test 504 -ne `wc -c <'nocol-3.0/src/nsmon/nsmon-confg'`; then
  1764.     echo shar: \"'nocol-3.0/src/nsmon/nsmon-confg'\" unpacked with wrong size!
  1765.   fi
  1766.   # end of 'nocol-3.0/src/nsmon/nsmon-confg'
  1767. fi
  1768. if test -f 'nocol-3.0/src/nsmon/nstest.c' -a "${1}" != "-c" ; then 
  1769.   echo shar: Will not clobber existing file \"'nocol-3.0/src/nsmon/nstest.c'\"
  1770. else
  1771.   echo shar: Extracting \"'nocol-3.0/src/nsmon/nstest.c'\" \(1577 characters\)
  1772.   sed "s/^X//" >'nocol-3.0/src/nsmon/nstest.c' <<'END_OF_FILE'
  1773. X/* $Header: /home/aggarwal/lsrc/nocol/src/nsmon/RCS/nstest.c,v 1.3 1993/10/30 03:43:07 aggarwal Exp $ */
  1774. X
  1775. X/* Copyright 1993 JvNCnet, Global Enterprise Services */
  1776. X
  1777. X/*+ 
  1778. X * FUNCTION:
  1779. X *     Small standalone program to test nsmon().
  1780. X *
  1781. X * AUTHOR:
  1782. X *    S. Spencer Sun, spencer@phoenix.princeton.edu
  1783. X */
  1784. X
  1785. X#include <stdio.h>
  1786. X#include <sys/types.h>
  1787. X#include <arpa/nameser.h>
  1788. X#include "nsmon.h"
  1789. X
  1790. Xusage()
  1791. X{
  1792. X  fprintf(stderr,
  1793. X    "Usage: nstest [ -d ] [ -C query class ] [ -T query type ]\n");
  1794. X  fprintf(stderr, "\t[ -t timeout (secs) ] nameserver [ nameserver ...  ]\n");
  1795. X  exit(1);
  1796. X}
  1797. X
  1798. Xmain(argc, argv)
  1799. X  int argc;
  1800. X  char *argv[];
  1801. X{
  1802. X  int class, type, timeout, ch;
  1803. X  int aaonly = 0, debug = 0;
  1804. X  extern char *optarg;
  1805. X  extern int optind;
  1806. X
  1807. X  class = C_IN; type = T_SOA; timeout = 15;
  1808. X
  1809. X  while ((ch = getopt(argc, argv, "AC:dT:t:")) != EOF) {
  1810. X    switch (ch) {
  1811. X      case 'A':
  1812. X        aaonly = 1; break;
  1813. X      case 'C':
  1814. X        class = atoi(optarg); break;
  1815. X      case 'd':
  1816. X        debug++ ; break;
  1817. X      case 'T':
  1818. X        type = atoi(optarg); break;
  1819. X      case 't':
  1820. X        timeout = atoi(optarg); break;
  1821. X      default:
  1822. X        usage(); break;
  1823. X    }
  1824. X  }
  1825. X  argc -= optind;
  1826. X  if (argc < 1) {
  1827. X    fprintf(stderr, "nstest: no servers/requests were specified\n");
  1828. X    usage() ;
  1829. X    return 1;
  1830. X  }
  1831. X  for (argv += optind; argc >=2; argc -=2, argv +=2) {
  1832. X    printf("Server: %s  Request: %s  return code: %d\n",
  1833. X       argv[0], argv[1], 
  1834. X       nsmon(argv[0], argv[1], class, type, timeout, aaonly, debug));
  1835. X  }
  1836. X  if (argc) 
  1837. X    fprintf(stderr, "nsmon: last server did not have a request\n");
  1838. X  return 0;
  1839. X}
  1840. END_OF_FILE
  1841.   if test 1577 -ne `wc -c <'nocol-3.0/src/nsmon/nstest.c'`; then
  1842.     echo shar: \"'nocol-3.0/src/nsmon/nstest.c'\" unpacked with wrong size!
  1843.   fi
  1844.   # end of 'nocol-3.0/src/nsmon/nstest.c'
  1845. fi
  1846. if test -f 'nocol-3.0/src/perlnocol/README' -a "${1}" != "-c" ; then 
  1847.   echo shar: Will not clobber existing file \"'nocol-3.0/src/perlnocol/README'\"
  1848. else
  1849.   echo shar: Extracting \"'nocol-3.0/src/perlnocol/README'\" \(2121 characters\)
  1850.   sed "s/^X//" >'nocol-3.0/src/perlnocol/README' <<'END_OF_FILE'
  1851. X## $Header$
  1852. X##
  1853. X## Perlnocol README
  1854. X#
  1855. X## A few perl routines that can be used with Nocol.
  1856. X#
  1857. Xarmon        - appletalk route monitor (requires Cisco router & rcisco)
  1858. Xbpmon        - bootp monitor (requires bootpquery program)
  1859. Xmkarmon        - program to build armon configuration lines
  1860. Xmodemmon    - cisco terminal server modem line usage monitor
  1861. Xnocollib.pl    - perl library with nocol-oriented routines
  1862. Xnovellmon    - IPX service monitor (requires Cisco router & rcisco)
  1863. Xrcisco        - execute a Cisco command remotely (requires sockets.ph)
  1864. X
  1865. XThese routines require coding your router's  p a s s w o r d  in the perl 
  1866. Xcode which introduces a security risk (this is for 'rcisco' to log into
  1867. Xyour cisco).
  1868. X
  1869. XRead the comments in the files and the code to learn how to use these.
  1870. XI can offer only minimal help.
  1871. X
  1872. X -John Wobus
  1873. X  9/21/93
  1874. X
  1875. XADDITIONAL NOTES:
  1876. X----------------
  1877. X
  1878. XUsing the samples (mainly  armon/modemmon/novellmon) you can build
  1879. Xnew monitors in Perl fairly easily. Your monitor just needs to call
  1880. Xthe 'nocollib.pl'  module which has NOCOL utility routines.
  1881. X
  1882. X
  1883. XINSTALLATION
  1884. X------------
  1885. X
  1886. XEdit 'nocollib.pl' and set the '$nocolroot' and '$NLOG_HOST' variables
  1887. Xat the top of the file.
  1888. X
  1889. XIf you want to use the supplied monitors, edit them also and insert
  1890. Xthe location of the various required files (like rcisco) at the top
  1891. Xof the files. Then copy these into the nocol hierarchy (nocol/bin) andcreate
  1892. Xthe config files in nocol/etc and start them up.
  1893. X
  1894. X  armon:    This monitors AppleTalk routes from a cisco router.
  1895. X        Can be changed to use CAP's atlook instead (see notes
  1896. X        in the top of the file).
  1897. X
  1898. X  bgpmon:    Checks cisco routers to see if the various BGP peers
  1899. X        are in a connected state.
  1900. X
  1901. X  bpmon:    Checks bootp daemon on various systems.
  1902. X
  1903. X  nrmon:    Monitors Novell routes from a cisco router (similar to
  1904. X        armon).
  1905. X
  1906. X  novellmon:    Monitors Novell *services* from a cisco router.
  1907. X
  1908. X  modemmon:    Checks number of modem lines used on a cisco terminal server
  1909. X        by doing a 'who' and counting number of users on tty
  1910. X        lines.
  1911. X
  1912. X snmp-modemmon:    An SNMP version of modemmon. Requires CMU-snmp code
  1913. X        (distributed with the NOCOL code).
  1914. X
  1915. X
  1916. X
  1917. X -Vikas Aggarwal
  1918. X  vikas@jvnc.net
  1919. X
  1920. END_OF_FILE
  1921.   if test 2121 -ne `wc -c <'nocol-3.0/src/perlnocol/README'`; then
  1922.     echo shar: \"'nocol-3.0/src/perlnocol/README'\" unpacked with wrong size!
  1923.   fi
  1924.   # end of 'nocol-3.0/src/perlnocol/README'
  1925. fi
  1926. if test -f 'nocol-3.0/src/portmon/Makefile' -a "${1}" != "-c" ; then 
  1927.   echo shar: Will not clobber existing file \"'nocol-3.0/src/portmon/Makefile'\"
  1928. else
  1929.   echo shar: Extracting \"'nocol-3.0/src/portmon/Makefile'\" \(1713 characters\)
  1930.   sed "s/^X//" >'nocol-3.0/src/portmon/Makefile' <<'END_OF_FILE'
  1931. X# $Id: Makefile,v 1.1 1993/10/30 03:37:06 aggarwal Exp $
  1932. X#
  1933. X# Makefile for 'portmon'
  1934. X#
  1935. X# 
  1936. X# ETC is used for the config file and error log file.
  1937. X# DATA is used for the data directory
  1938. X
  1939. X## SET THIS
  1940. X# Directories needed by the Makefile
  1941. XTOP =         /usr/nocol
  1942. XSRCDIR =    $(TOP)/src
  1943. X
  1944. XBINDIR =     $(TOP)/bin
  1945. XETCDIR =     $(TOP)/etc
  1946. XINCLUDEDIR =     $(SRCDIR)/include
  1947. XLIBDIR =    $(SRCDIR)/lib 
  1948. X
  1949. X## SET THIS
  1950. X# Directories needed by the program.
  1951. X#     DATADIR        for creating the data OUTPUT file
  1952. X#    CONFIGFILE    location of the config file
  1953. XDATADIR =       $(TOP)/data
  1954. XCONFIGFILE =    $(ETCDIR)/portmon-confg
  1955. X
  1956. X## SET THIS
  1957. X# Set the various defines for compile time defines:
  1958. X#
  1959. XSYSDEFS =
  1960. XINSTALL =    install
  1961. X
  1962. X####
  1963. X#### Can leave the rest alone #######
  1964. X####
  1965. X
  1966. X##
  1967. X# The various directories that are needed in the program. Should NOT
  1968. X# have trailing '/'.
  1969. XDIRDEFS =    -DETCDIR=\"$(ETCDIR)\" \
  1970. X        -DDATADIR=\"$(DATADIR)\" \
  1971. X        -DCONFIGFILE=\"$(CONFIGFILE)\"
  1972. X
  1973. X# Compilation definitions
  1974. XCC =         cc
  1975. XCDEFS =        $(DIRDEFS) $(SYSDEFS)
  1976. XLIBS =         -lnocol $(SYSLIBS)
  1977. XCFLAGS =     -g -I$(INCLUDEDIR) -I../include -L$(LIBDIR) -L../lib
  1978. X
  1979. XTARG =        portmon
  1980. XOBJECTS =     portmon.o
  1981. X
  1982. X$(TARG):    $(OBJECTS)  Makefile
  1983. X    $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o $(TARG)
  1984. X
  1985. X.c.o:
  1986. X    $(CC) $(CFLAGS) -c  $(CDEFS) $<
  1987. X
  1988. X## The dependencies in case 'mkdep' not used
  1989. X#
  1990. X$(OBJECTS): $(INCLUDEDIR)/nocol.h $(INCLUDEDIR)/noclogd.h
  1991. X
  1992. Xinstall:    $(TARG)
  1993. X    @[ -d $(TOP) ] || mkdir  $(TOP)
  1994. X    @[ -d $(ETCDIR) ] || mkdir $(ETCDIR)
  1995. X    @[ -d $(BINDIR) ] || mkdir $(BINDIR)
  1996. X    $(INSTALL) -c -m 751 $(TARG)  $(BINDIR)/
  1997. X    @echo "___Update config file for $(TARG) daemon in $(ETCDIR) ___"
  1998. X
  1999. Xclean:
  2000. X    /bin/rm -f $(TARG) *.o core a.out
  2001. X
  2002. Xrcs:
  2003. X    @echo "Doing 'rcs' in $(TARG)"
  2004. X    @-for i in $(OBJS); do \
  2005. X        $(CO) -q `basename $$i .o`.c ;\
  2006. X      done
  2007. X
  2008. END_OF_FILE
  2009.   if test 1713 -ne `wc -c <'nocol-3.0/src/portmon/Makefile'`; then
  2010.     echo shar: \"'nocol-3.0/src/portmon/Makefile'\" unpacked with wrong size!
  2011.   fi
  2012.   # end of 'nocol-3.0/src/portmon/Makefile'
  2013. fi
  2014. if test -f 'nocol-3.0/src/support/mping/msummary.dat' -a "${1}" != "-c" ; then 
  2015.   echo shar: Will not clobber existing file \"'nocol-3.0/src/support/mping/msummary.dat'\"
  2016. else
  2017.   echo shar: Extracting \"'nocol-3.0/src/support/mping/msummary.dat'\" \(2411 characters\)
  2018.   sed "s/^X//" >'nocol-3.0/src/support/mping/msummary.dat' <<'END_OF_FILE'
  2019. X#
  2020. X# Format:
  2021. X#
  2022. X# name    address    [options]
  2023. X#
  2024. X# If given, <options> is one or more comma-separated fields in the order:
  2025. X#
  2026. X#    size,pattern,numToGet,retry,timeout
  2027. X#
  2028. X# This parses option fields left to right, as indicated by commas.  Missing
  2029. X# or empty fields use the default value (see below).  For example, the
  2030. X# option string to specify just the size (128) and pattern (0x15) would be
  2031. X# "128,0x15": the remaining fields would default.  To specify a size (128)
  2032. X# and a retry count (2), the option field would be "128,,,2".  To specify
  2033. X# just a timeout of 2 seconds, the option string would be ",,,,2000".
  2034. X#
  2035. X#
  2036. X#  size [default: 56]:        Decimal number giving the size of the ICMP
  2037. X#                data portion of the packet.  The actual IP
  2038. X#                packet will be at least 8 octets larger.
  2039. X#
  2040. X# pattern [default: 0x0]:    A hex number specifying a byte value to
  2041. X#                initialize the ICMP data portion of the
  2042. X#                packet.
  2043. X#
  2044. X# numToGet [default: 1]:    Number of return packets to require.
  2045. X#
  2046. X# retry [default: 5]:        Number of retries to make before declaring
  2047. X#                a packet lost.  Note that if <numToGet> is
  2048. X#                greater than 1, the retry limit applies to
  2049. X#                each attempt.  That is if the first attempt
  2050. X#                requires 4 tries before a successful return,
  2051. X#                then next attempt will still make up to 5
  2052. X#                tries.
  2053. X#
  2054. X# timeout [default: 1000]    Number of milliseconds to wait before
  2055. X#                assuming packet lost and retrying.  The
  2056. X#                default timeout is fine within an all
  2057. X#                ethernet environment, but you need a longer
  2058. X#                one for WAN links.
  2059. X#
  2060. X# The <name> field is not used for anything except producing the report.
  2061. X#
  2062. X# The <address> field can be either an IP address in any of the notations
  2063. X# acceptable to the inet_addr() function, or it can be a domain name.
  2064. X# If a domain name is used, and the gethostbyname() function returns
  2065. X# more than one address, it is treated like multiple configuration lines,
  2066. X# one for each address.  For example the configuration line:
  2067. X#
  2068. X#    NS-NIC    ns.nic.ddn.mil    56,0,2
  2069. X#
  2070. X# is treated as if read:
  2071. X#
  2072. X#    NS-NIC    192.112.36.4    56,0,2
  2073. X#    NS-NIC    192.67.67.53    56,0,2
  2074. X#
  2075. X#
  2076. X
  2077. X
  2078. X# Just for samples
  2079. Xenvy.net-ether0    130.132.1.19    128,0,2
  2080. Xenvy.net-ether1    130.132.19.1    128,0,2
  2081. Xenvy.net-ether2    128.36.0.2    128,0,2
  2082. Xenvy.net-ether3    130.132.32.1    128,0,2
  2083. Xenvy.net-ether4    130.132.80.1    128,0,2
  2084. X
  2085. X# Now monitor the JvNCnet NSS, use pattern 0xAA
  2086. X# (binary 10101010) and be a bit more patient than the default
  2087. Xnss.jvnc.net    192.12.211.1    256,0xaa,2,5,2000
  2088. END_OF_FILE
  2089.   if test 2411 -ne `wc -c <'nocol-3.0/src/support/mping/msummary.dat'`; then
  2090.     echo shar: \"'nocol-3.0/src/support/mping/msummary.dat'\" unpacked with wrong size!
  2091.   fi
  2092.   # end of 'nocol-3.0/src/support/mping/msummary.dat'
  2093. fi
  2094. if test -f 'nocol-3.0/src/support/multiping/pingmisc.c' -a "${1}" != "-c" ; then 
  2095.   echo shar: Will not clobber existing file \"'nocol-3.0/src/support/multiping/pingmisc.c'\"
  2096. else
  2097.   echo shar: Extracting \"'nocol-3.0/src/support/multiping/pingmisc.c'\" \(2026 characters\)
  2098.   sed "s/^X//" >'nocol-3.0/src/support/multiping/pingmisc.c' <<'END_OF_FILE'
  2099. X/*
  2100. X * pingmisc.c -- auxiliary routines for multiping.c
  2101. X */
  2102. X
  2103. X#include <sys/param.h>
  2104. X#include <sys/types.h>
  2105. X#include <sys/socket.h>
  2106. X#include <netinet/in.h>
  2107. X#include <values.h>
  2108. X#include <stdio.h>
  2109. X#include <stdlib.h>
  2110. X#include <netdb.h>
  2111. X
  2112. X#undef GLOBALS
  2113. X#include "multiping.h"
  2114. X#include "vars.h"
  2115. X
  2116. X/*
  2117. X * Initialize some stuff
  2118. X */
  2119. Xstartup()
  2120. X{
  2121. X  int i;
  2122. X
  2123. X  numsites = 0;
  2124. X  for (i = 0; i < MAXREMOTE; i++)
  2125. X    dest[i] = NULL;
  2126. X  datalen = DEFDATALEN;
  2127. X}
  2128. X
  2129. X/*
  2130. X * allocates a destrec and initializes its fields
  2131. X */ 
  2132. Xdestrec *dest_malloc()
  2133. X{
  2134. X  destrec *p;
  2135. X  int i;
  2136. X
  2137. X  p = (destrec *)malloc(sizeof(destrec));
  2138. X  if ((p == NULL) || ((p->rcvd_tbl = malloc(MAX_DUP_CHK / 8)) == NULL)) {
  2139. X    fprintf(stderr, "ping: dest_malloc: out of memory\n");
  2140. X    exit(1);
  2141. X  }
  2142. X  for (i = 0; i < MAX_DUP_CHK / 8; i++)
  2143. X    p->rcvd_tbl[i] = 0;
  2144. X  p->nreceived = p->nrepeats = p->ntransmitted = (char)0;
  2145. X  p->hostname[0] = '\0';
  2146. X  p->tmax = p->tsum = 0;
  2147. X  p->tmin = MAXSHORT;
  2148. X  return p;
  2149. X}  
  2150. X
  2151. X/*
  2152. X * Takes a host name like 'phoenix.princeton.edu' or an IP address
  2153. X * like '128.112.120.1' and creates an entry for that host in the
  2154. X * dest[] array.
  2155. X */
  2156. Xsetup_sockaddr(addr)
  2157. X  char *addr;
  2158. X{
  2159. X  destrec *dst;
  2160. X  struct sockaddr_in *to;
  2161. X  struct hostent *hp;
  2162. X
  2163. X  dst = dest_malloc();
  2164. X  bzero((char*)&(dst->sockad), sizeof(struct sockaddr_in));
  2165. X  to = &dst->sockad;
  2166. X  to->sin_family = PF_INET;
  2167. X  to->sin_addr.s_addr = inet_addr(addr);
  2168. X  if (to->sin_addr.s_addr != (u_int)-1)
  2169. X    strcpy(dst->hostname, addr);
  2170. X  else {
  2171. X    hp = gethostbyname(addr);
  2172. X    if (hp == NULL) {
  2173. X      fprintf(stderr, "ping: unknown host %s\n", addr);
  2174. X      exit(1);
  2175. X    }
  2176. X    to->sin_family = hp->h_addrtype;
  2177. X    bcopy(hp->h_addr, (caddr_t)&to->sin_addr, hp->h_length);
  2178. X    strncpy(dst->hostname, hp->h_name, MAXHOSTNAMELEN-1);
  2179. X  }
  2180. X  dest[numsites++] = dst;
  2181. X  if (to->sin_family == PF_INET)
  2182. X    printf("PING %s (%s): %d data bytes\n", pr_addr(to->sin_addr.s_addr),
  2183. X      inet_ntoa(*(struct in_addr *)&to->sin_addr.s_addr), datalen);
  2184. X  else
  2185. X    printf("PING %s: %d data bytes", dst->hostname, datalen);
  2186. X}
  2187. END_OF_FILE
  2188.   if test 2026 -ne `wc -c <'nocol-3.0/src/support/multiping/pingmisc.c'`; then
  2189.     echo shar: \"'nocol-3.0/src/support/multiping/pingmisc.c'\" unpacked with wrong size!
  2190.   fi
  2191.   # end of 'nocol-3.0/src/support/multiping/pingmisc.c'
  2192. fi
  2193. if test -f 'nocol-3.0/src/tpmon/Makefile' -a "${1}" != "-c" ; then 
  2194.   echo shar: Will not clobber existing file \"'nocol-3.0/src/tpmon/Makefile'\"
  2195. else
  2196.   echo shar: Extracting \"'nocol-3.0/src/tpmon/Makefile'\" \(1691 characters\)
  2197.   sed "s/^X//" >'nocol-3.0/src/tpmon/Makefile' <<'END_OF_FILE'
  2198. X# $Id: Makefile,v 1.5 1993/10/30 03:27:06 aggarwal Exp $
  2199. X#
  2200. X# Makefile for 'tpmon' (thruput monitor)
  2201. X#
  2202. X
  2203. X## SET THIS
  2204. X# Directories needed by the Makefile. See description in ../Makefile
  2205. XTOP =         /usr/nocol
  2206. XSRCDIR =    $(TOP)/src
  2207. X
  2208. XBINDIR =     $(TOP)/bin
  2209. XETCDIR =     $(TOP)/etc
  2210. XINCLUDEDIR =     $(SRCDIR)/include
  2211. XLIBDIR =    $(SRCDIR)/lib
  2212. X
  2213. X## SET THIS
  2214. X# Directories needed by the program.
  2215. X#    DATADIR            for creating the TPMON-OUTPUT
  2216. X#    NODESFILE        config file for list of nodes to be monitored
  2217. XDATADIR =     $(TOP)/data
  2218. XNODESFILE =    $(ETCDIR)/tpmon-confg
  2219. X
  2220. X## SET THIS
  2221. X# Set the various defines for compile time defines:
  2222. X#
  2223. X#
  2224. XSYSDEFS =
  2225. XINSTALL =    install
  2226. X
  2227. X####
  2228. X#### Can leave the rest alone #######
  2229. X####
  2230. X
  2231. X##
  2232. X# The various directories that are needed in the program. Should NOT
  2233. X# have trailing '/'.
  2234. XDIRDEFS =    -DETCDIR=\"$(ETCDIR)\" \
  2235. X        -DDATADIR=\"$(DATADIR)\" \
  2236. X        -DNODESFILE=\"$(NODESFILE)\"
  2237. X
  2238. X# Compilation definitions
  2239. XCC =        cc
  2240. XCDEFS =        $(DIRDEFS) $(SYSDEFS)
  2241. XLIBS =        -lnocol $(SYSLIBS)
  2242. XCFLAGS =     -g -I$(INCLUDEDIR) -L$(LIBDIR)
  2243. X
  2244. XTARG    =    tpmon
  2245. XOBJECTS =     main.o poll_sites.o tpmon.o
  2246. X
  2247. X
  2248. X$(TARG): $(OBJECTS) Makefile
  2249. X    $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o $@
  2250. X
  2251. X######
  2252. X# small testing program to demonstrate the throughput() function
  2253. X###
  2254. Xtest tptest:    tptest.o tpmon.o tptest.h
  2255. X    $(CC) $(CFLAGS) -o tptest tpmon.o tptest.o
  2256. X
  2257. X.c.o:
  2258. X    $(CC) -c $(CFLAGS) $(CDEFS) $<
  2259. X
  2260. X## The dependencies in case 'mkdep' not used
  2261. X#
  2262. X$(OBJECTS): $(INCLUDEDIR)/nocol.h  $(INCLUDEDIR)/tpmon.h
  2263. X
  2264. Xinstall: $(TARG)
  2265. X    $(INSTALL) -c -m 751 $(TARG) $(BINDIR)/
  2266. X    @echo "___Update config file in $(ETCDIR)___"
  2267. X
  2268. Xclean:
  2269. X    /bin/rm -f $(TARG) *.o core a.out tptest
  2270. X
  2271. Xrcs:
  2272. X    @echo "Doing 'rcs' in $(TARG)"
  2273. X    @-for i in $(OBJS); do \
  2274. X        $(CO) -q `basename $$i .o`.c ;\
  2275. X      done
  2276. END_OF_FILE
  2277.   if test 1691 -ne `wc -c <'nocol-3.0/src/tpmon/Makefile'`; then
  2278.     echo shar: \"'nocol-3.0/src/tpmon/Makefile'\" unpacked with wrong size!
  2279.   fi
  2280.   # end of 'nocol-3.0/src/tpmon/Makefile'
  2281. fi
  2282. if test -f 'nocol-3.0/src/tpmon/tptest.h' -a "${1}" != "-c" ; then 
  2283.   echo shar: Will not clobber existing file \"'nocol-3.0/src/tpmon/tptest.h'\"
  2284. else
  2285.   echo shar: Extracting \"'nocol-3.0/src/tpmon/tptest.h'\" \(1700 characters\)
  2286.   sed "s/^X//" >'nocol-3.0/src/tpmon/tptest.h' <<'END_OF_FILE'
  2287. X/*
  2288. X * $Header: /nocol/src/tpmon/RCS/tptest.h,v 1.1 1992/06/12 21:01:19 aggarwal Exp $
  2289. X */
  2290. X
  2291. X/*
  2292. X * tptest.h -- #include this file to interface with tpmon.c
  2293. X *
  2294. X * This header file is NOT part of the tpmon/netmon package.  It is
  2295. X * simply an interface file that you can #include to use the
  2296. X * throughput() routine, should you wish to use it in any of your
  2297. X * own programs.
  2298. X *
  2299. X * See tptest.c and 'make tptest' for an example.
  2300. X *
  2301. X * === NOTE === tpmon.c expects an extern char *prognm which points to
  2302. X * the program's name, so that it can stick this in error messages
  2303. X */
  2304. X
  2305. X#ifndef __TP_H__
  2306. X#define __TP_H__
  2307. X
  2308. X/* these variables are exported in case you're interested in them */
  2309. X
  2310. X/*
  2311. X * throughput -- finds throughput of a remote site
  2312. X *
  2313. X * parameters:
  2314. X *   addr is the address of the site to be tested.  It can be either
  2315. X *     a name (e.g. phoenix.princeton.edu) or an IP # (e.g. 128.112.128.43)
  2316. X *   port is the port number, and defaults to 9 (discard port)
  2317. X *   numblocks is the number of blocks to send
  2318. X *   blocksize is the blocksize to be used
  2319. X *   pattern is a pattern of bytes which will be used to fill the data block
  2320. X *     (set it to NULL for random characters)
  2321. X *   time is the duration of the test in seconds
  2322. X *   verbose enables verbose output mode
  2323. X *
  2324. X *   if both numblocks and time are nonzero, then the test will last until
  2325. X *   either numblocks blocks have been sent, or time seconds have elapsed,
  2326. X *   whichever comes first
  2327. X *
  2328. X * return values:
  2329. X *   a double representing the throughput in bits per second
  2330. X *   -1.0 if an error occured
  2331. X */
  2332. X
  2333. Xdouble throughput(/* char *addr, short int port, int numblocks, int blocksize,
  2334. X                  char *pattern, int time, int verbose */);
  2335. X
  2336. X#endif
  2337. END_OF_FILE
  2338.   if test 1700 -ne `wc -c <'nocol-3.0/src/tpmon/tptest.h'`; then
  2339.     echo shar: \"'nocol-3.0/src/tpmon/tptest.h'\" unpacked with wrong size!
  2340.   fi
  2341.   # end of 'nocol-3.0/src/tpmon/tptest.h'
  2342. fi
  2343. if test -f 'nocol-3.0/src/utility/keepalive_monitors' -a "${1}" != "-c" ; then 
  2344.   echo shar: Will not clobber existing file \"'nocol-3.0/src/utility/keepalive_monitors'\"
  2345. else
  2346.   echo shar: Extracting \"'nocol-3.0/src/utility/keepalive_monitors'\" \(1702 characters\)
  2347.   sed "s/^X//" >'nocol-3.0/src/utility/keepalive_monitors' <<'END_OF_FILE'
  2348. X#!/bin/csh  -f
  2349. X#
  2350. X# $Header: /home/aggarwal/lsrc/nocol/src/utility/RCS/keepalive_monitors,v 1.7 1993/10/30 03:32:24 aggarwal Exp $
  2351. X#
  2352. X# Make sure that the various nocol programs are doing their job and are
  2353. X# not dead.
  2354. X#
  2355. X# Can run this from the crontab every so often/
  2356. X#
  2357. X# For special montitors that require command line arguments, treat them
  2358. X# specially in the 'if' statement (see 'trapmon')
  2359. X#
  2360. X#     Vikas, Nov 30, 1989
  2361. X#    Vikas, Oct 1,  1993
  2362. X#
  2363. Xumask 002
  2364. X
  2365. Xset BIN = /nocol/bin
  2366. Xset ETC = /nocol/etc
  2367. Xset OPS = noc@nisc.jvnc.net        # mail on restarting
  2368. Xset MAIL = /usr/ucb/mail
  2369. Xset PROGRAMS = ""            # initially null
  2370. Xset path = (${BIN} /bin /etc /usr/bin /usr/ucb /usr/lib)
  2371. Xset HOST = `hostname`
  2372. X
  2373. X##
  2374. X# Which program should run on which host.
  2375. Xif ( ${HOST} == "minnie.jvnc.net" ) then
  2376. X    set PROGRAMS = "noclogd ippingmon nsmon tpmon"
  2377. Xelse if ( ${HOST} == "mickey.jvnc.net" ) then
  2378. X    set PROGRAMS = "trapmon"
  2379. Xelse
  2380. X    exit 0
  2381. Xendif
  2382. X
  2383. Xcd $BIN
  2384. X
  2385. X## Account for the programs that have a pid file, and those that don't.
  2386. X#  See which monitors are running.
  2387. Xforeach p ( ${PROGRAMS}  )
  2388. X  set START = "0"        #initial value
  2389. X
  2390. X  if ( -e ${ETC}/${p}.pid ) then
  2391. X    set pid = `head -1 ${ETC}/${p}.pid`
  2392. X    if ( `ps ${pid} | grep ${p} | wc -l` == 0 && -x $p ) set START = "1"
  2393. X  else
  2394. X    set lc = `ps -ax |egrep "${BIN}/${p}" |grep -v grep`
  2395. X    if ( "$lc" == "" && -x $p ) set START = "1"
  2396. X  endif
  2397. X
  2398. X  ## Now start the monitors
  2399. X  if ( ${START} == "1" ) then
  2400. X    if ( $?prompt ) echo "Starting $p at `date` on `hostname`"
  2401. X    if ( ${p} == "trapmon" ) then
  2402. X        ( ${BIN}/trapmon -n ) >>&! ${ETC}/${p}.error &
  2403. X    else
  2404. X        ( ${BIN}/${p} ) >>&! ${ETC}/${p}.error &
  2405. X    endif
  2406. X    echo " -keepalive" |${MAIL} -s "NOCOL Restarted ${p} on ${HOST}" $OPS
  2407. X  endif
  2408. X
  2409. Xend # of foreach()
  2410. X
  2411. X####
  2412. END_OF_FILE
  2413.   if test 1702 -ne `wc -c <'nocol-3.0/src/utility/keepalive_monitors'`; then
  2414.     echo shar: \"'nocol-3.0/src/utility/keepalive_monitors'\" unpacked with wrong size!
  2415.   fi
  2416.   chmod +x 'nocol-3.0/src/utility/keepalive_monitors'
  2417.   # end of 'nocol-3.0/src/utility/keepalive_monitors'
  2418. fi
  2419. echo shar: End of archive 25 \(of 26\).
  2420. cp /dev/null ark25isdone
  2421. MISSING=""
  2422. 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
  2423.     if test ! -f ark${I}isdone ; then
  2424.     MISSING="${MISSING} ${I}"
  2425.     fi
  2426. done
  2427. if test "${MISSING}" = "" ; then
  2428.     echo You have unpacked all 26 archives.
  2429.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2430. else
  2431.     echo You still must unpack the following archives:
  2432.     echo "        " ${MISSING}
  2433. fi
  2434. exit 0
  2435. exit 0 # Just in case...
  2436.