#!/bin/sh # This is `snmp2.29' (part 29 of snmp2). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `snmp2/snmptcl/tcl_snmp.c' is being continued... # touch -am 1231235999 $$.touch >/dev/null 2>&1 if test ! -f 1231235999 && test -f $$.touch; then shar_touch=touch else shar_touch=: echo echo 'WARNING: not restoring timestamps. Consider getting and' echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 1231235999 $$.touch # if test ! -r _sharseq.tmp; then echo 'Please unpack part 1 first!' exit 1 fi shar_sequence=`cat _sharseq.tmp` if test "$shar_sequence" != 29; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping snmp2/snmptcl/tcl_snmp.c' else echo 'x - continuing file snmp2/snmptcl/tcl_snmp.c' sed 's/^X//' << 'SHAR_EOF' >> 'snmp2/snmptcl/tcl_snmp.c' && X return SnmpPrettyOid(interp,argc,argv,cd2); X } X IFW("close") X /*XX close */ X { X CHKNARG(1,1,cd2->where); X return SnmpClose(interp,argc,argv,cd2); X } X X IFW("retries") X /*XX retries [num] */ X { X CHKNARG(2, 2, cd2->where); X cd2->sess->retries = atoi(argv[2]); X printf("SNMP retries set to %d.\n", cd2->sess->retries); X return 0; X } X X IFW("timeout") X /*XX timeout [num] */ X { X CHKNARG(2, 2, cd2->where); X cd2->sess->timeout = atoi(argv[2]); X printf("SNMP timeout set to %d uS.\n", cd2->sess->timeout); X return 0; X } X X return HUH(interp,cd2->where); } SHAR_EOF echo 'File snmp2/snmptcl/tcl_snmp.c is complete' && $shar_touch -am 1015123693 'snmp2/snmptcl/tcl_snmp.c' && chmod 0644 'snmp2/snmptcl/tcl_snmp.c' || echo 'restore of snmp2/snmptcl/tcl_snmp.c failed' shar_count="`wc -c < 'snmp2/snmptcl/tcl_snmp.c'`" test 36338 -eq "$shar_count" || echo "snmp2/snmptcl/tcl_snmp.c: original size 36338, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/wish.c ============== if test -f 'snmp2/snmptcl/wish.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/wish.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/wish.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/wish.c' && /* X * main.c -- X * X * A simple program to test the toolkit facilities. X * X * Copyright 1990-1992 Regents of the University of California. X * Permission to use, copy, modify, and distribute this X * software and its documentation for any purpose and without X * fee is hereby granted, provided that the above copyright X * notice appear in all copies. The University of California X * makes no representations about the suitability of this X * software for any purpose. It is provided "as is" without X * express or implied warranty. X */ X #ifndef lint static char rcsid[]= "$Header: /usr/user/tcl_snmp/RCS/kish.c,v 1.2 1992/10/25 00:08:51 jc79 Exp $ SPRITE (Berkeley)"; X #endif X #ifndef notdef #include #include #include #include #include #else #include "tkConfig.h" #include "tkInt.h" #endif /* X * Declarations for library procedures: X */ X extern int isatty (); X extern Tcl_CmdProc GraphCmd; extern Tcl_CmdProc HypertextCmd; X /* extern Tcl_CmdProc Tk_TextCmd; */ X /* X * Command used to initialize wish: X */ X char initCmd[]= "source $tk_library/wish.tcl"; X Tk_Window w; /* NULL means window has been deleted. */ Tk_TimerToken timeToken = 0; int idleHandler = 0; Tcl_Interp *interp; int x, y; Tcl_CmdBuf buffer; int tty; extern int Tk_SquareCmd _ANSI_ARGS_ ((ClientData clientData, X Tcl_Interp * interp, int argc, char **argv)); X /* X * Information for testing out command-line options: X */ X int synchronize = 0; char *fileName = NULL; char *name = NULL; char *display = NULL; char *geometry = NULL; static int debug = 0; X Tk_ArgvInfo argTable[]= { X {"-file", TK_ARGV_STRING, (char *)NULL, (char *)&fileName, X "File from which to read commands"}, X {"-geometry", TK_ARGV_STRING, (char *)NULL, (char *)&geometry, X "Initial geometry for window"}, X {"-display", TK_ARGV_STRING, (char *)NULL, (char *)&display, X "Display to use"}, X {"-debug", TK_ARGV_INT, (char *)NULL, (char *)&debug, X "Debugging level to use"}, X {"-name", TK_ARGV_STRING, (char *)NULL, (char *)&name, X "Name to use for application"}, X {"-sync", TK_ARGV_CONSTANT, (char *)1, (char *)&synchronize, X "Use synchronous mode for display server"}, X {(char *)NULL, TK_ARGV_END, (char *)NULL, (char *)NULL, X (char *)NULL} }; X X /* ARGSUSED */ void StdinProc (clientData, mask) X ClientData clientData; /* Not used. */ X int mask; { X char line[200]; X static int gotPartial = 0; X char *cmd; X int result; X X if (mask & TK_READABLE) { X if (fgets (line, 200, stdin) == NULL) { X if (!gotPartial) { X if (tty) { X Tcl_Eval (interp, "destroy .", 0, (char **)NULL); X exit (0); X } else { X Tk_DeleteFileHandler (0); X } X return; X } else { X line[0] = 0; X } X } X cmd = Tcl_AssembleCmd (buffer, line); X if (cmd == NULL) { X gotPartial = 1; X return; X } X gotPartial = 0; X result = Tcl_RecordAndEval (interp, cmd, 0); X if (*interp->result != 0) { X if ((result != TCL_OK) || (tty)) { X printf ("%s\n", interp->result); X } X } X if (tty) { X printf ("Wish: "); X fflush (stdout); X } X } } X X /* ARGSUSED */ static void StructureProc (clientData, eventPtr) X ClientData clientData; /* Information about window. */ X XEvent *eventPtr; /* Information about event. */ { X if (eventPtr->type == DestroyNotify) { X w = NULL; X } } X /* X * Procedure to map initial window. This is invoked as a do-when-idle X * handler. Wait for all other when-idle handlers to be processed X * before mapping the window, so that the window's correct geometry X * has been determined. X */ X X /* ARGSUSED */ static void DelayedMap (clientData) X ClientData clientData; /* Not used. */ { X X while (Tk_DoOneEvent (1) != 0) { X /* Empty loop body. */ X } X if (w == NULL) { X return; X } X Tk_MapWindow (w); } X X /* ARGSUSED */ int MapCmd (tkwin, interp, argc, argv) X Tk_Window tkwin; /* Application window. */ X Tcl_Interp *interp; /* Current interpreter. */ X int argc; /* Number of arguments. */ X char **argv; /* Argument strings. */ { X Tk_Window window; X X if (argc != 2) { X Tcl_AppendResult (interp, "wrong # args: should be \"", argv[0], X " window\"", (char *)NULL); X return TCL_ERROR; X } X window = Tk_NameToWindow (interp, argv[1], tkwin); X if (window == NULL) { X return TCL_ERROR; X } X Tk_MapWindow (window); X return TCL_OK; } X static void DebugProc (clientData, interp, level, command, cmdProc, X cmdClientData, argc, argv) X ClientData clientData; /* Data passed to debugr */ X Tcl_Interp *interp; /* Interpreter */ X int level; /* Current level */ X char *command; /* Command before substitution */ X int (*cmdProc) (); /* Address of command procedure to be called */ X ClientData cmdClientData;/* Data passed to this procedure */ X int argc; X char **argv; /* Command afer processing */ { X register int i; X X fprintf (stderr, "%3d> %s\n ", level, command); X for (i = 0; i < argc; i++) X fprintf (stderr, "%s ", argv[i]); X fprintf (stderr, "\n"); } X static int DebugCmd (clientData, interp, argc, argv) X ClientData clientData; X Tcl_Interp *interp; X int argc; X char **argv; { X static int debug_on = False; X static Tcl_Trace debug_token; X static int debug_level; X int new_level; X X if (argc > 2) { X sprintf (interp->result, "Wrong number of arguments\n\tUsage: %s level", X argv[0]); X return (TCL_ERROR); X } X if (argc == 1) { X char buf[30]; X X sprintf (buf, "is %d", debug_level); X Tcl_SetResult (interp, buf, TCL_VOLATILE); X return (TCL_OK); X } X if (Tcl_GetInt (interp, argv[1], &new_level) != TCL_OK) X return (TCL_ERROR); X X if (debug_on) { X Tcl_DeleteTrace (interp, debug_token); X debug_on = False; X } X debug_level = new_level; X if (debug_level > 0) { X debug_token = Tcl_CreateTrace (interp, debug_level, X (void (*)())DebugProc, NULL); X debug_on = True; X } X return (TCL_OK); } X X /* ARGSUSED */ int DotCmd (dummy, interp, argc, argv) X ClientData dummy; /* Not used. */ X Tcl_Interp *interp; /* Current interpreter. */ X int argc; /* Number of arguments. */ X char **argv; /* Argument strings. */ { X int x, y; X X if (argc != 3) { X Tcl_AppendResult (interp, "wrong # args: should be \"", argv[0], X " x y\"", (char *)NULL); X return TCL_ERROR; X } X x = strtol (argv[1], (char **)NULL, 0); X y = strtol (argv[2], (char **)NULL, 0); X Tk_MakeWindowExist (w); X XDrawPoint (Tk_Display (w), Tk_WindowId (w), X DefaultGCOfScreen (Tk_Screen (w)), x, y); X return TCL_OK; } X X /* ARGSUSED */ int MovetoCmd (dummy, interp, argc, argv) X ClientData dummy; /* Not used. */ X Tcl_Interp *interp; /* Current interpreter. */ X int argc; /* Number of arguments. */ X char **argv; /* Argument strings. */ { X if (argc != 3) { X Tcl_AppendResult (interp, "wrong # args: should be \"", argv[0], X " x y\"", (char *)NULL); X return TCL_ERROR; X } X x = strtol (argv[1], (char **)NULL, 0); X y = strtol (argv[2], (char **)NULL, 0); X return TCL_OK; } X X /* ARGSUSED */ int LinetoCmd (dummy, interp, argc, argv) X ClientData dummy; /* Not used. */ X Tcl_Interp *interp; /* Current interpreter. */ X int argc; /* Number of arguments. */ X char **argv; /* Argument strings. */ { X int newX, newY; X X if (argc != 3) { X Tcl_AppendResult (interp, "wrong # args: should be \"", argv[0], X " x y\"", (char *)NULL); X return TCL_ERROR; X } X newX = strtol (argv[1], (char **)NULL, 0); X newY = strtol (argv[2], (char **)NULL, 0); X Tk_MakeWindowExist (w); X XDrawLine (Tk_Display (w), Tk_WindowId (w), X DefaultGCOfScreen (Tk_Screen (w)), x, y, newX, newY); X x = newX; X y = newY; X return TCL_OK; } X int main (argc, argv) X int argc; X char **argv; { X char *args, *p, *msg; X char buf[20]; X int result; X Tk_3DBorder border; X X interp = Tcl_CreateInterp (); X X snmp_init(interp); X X #ifdef TCL_MEM_DEBUG X Tcl_InitMemory (interp); #endif X if (Tk_ParseArgv (interp, (Tk_Window) NULL, &argc, argv, argTable, 0) X != TCL_OK) { X fprintf (stderr, "%s\n", interp->result); X exit (1); X } X if (name == NULL) { X if (fileName != NULL) { X p = fileName; X } else { X p = argv[0]; X } X name = strrchr (p, '/'); X if (name != NULL) { X name++; X } else { X name = p; X } X } X w = Tk_CreateMainWindow (interp, display, name); X if (w == NULL) { X fprintf (stderr, "%s\n", interp->result); X exit (1); X } X Tk_SetClass (w, "Tk"); X Tk_CreateEventHandler (w, StructureNotifyMask, StructureProc, X (ClientData) NULL); X Tk_DoWhenIdle (DelayedMap, (ClientData) NULL); X tty = isatty (0); X X args = Tcl_Merge (argc, argv); X Tcl_SetVar (interp, "argv", args, TCL_GLOBAL_ONLY); X ckfree (args); X sprintf (buf, "%d", argc); X Tcl_SetVar (interp, "argc", buf, TCL_GLOBAL_ONLY); X X if (synchronize) { X XSynchronize (Tk_Display (w), True); X } X Tk_GeometryRequest (w, 200, 200); X border = Tk_Get3DBorder (interp, w, None, "#4eee94"); X if (border == NULL) { X Tcl_SetResult (interp, (char *)NULL, TCL_STATIC); X Tk_SetWindowBackground (w, WhitePixelOfScreen (Tk_Screen (w))); X } else { X Tk_SetBackgroundFromBorder (w, border); X } X XSetForeground (Tk_Display (w), DefaultGCOfScreen (Tk_Screen (w)), X BlackPixelOfScreen (Tk_Screen (w))); X X Tcl_CreateCommand (interp, "debug", DebugCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "htext", HypertextCmd, (ClientData) w, X (void (*)())NULL); /* Tcl_CreateCommand(interp, "text", Tk_TextCmd, (ClientData) w, X (void (*)()) NULL); X */ X Tcl_CreateCommand (interp, "xygraph", GraphCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "barchart", GraphCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "map", MapCmd, (ClientData) w, X (void (*)())NULL); X X Tcl_CreateCommand (interp, "dot", DotCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "lineto", LinetoCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "moveto", MovetoCmd, (ClientData) w, X (void (*)())NULL); #ifdef SQUARE_DEMO X Tcl_CreateCommand (interp, "square", Tk_SquareCmd, (ClientData) w, X (void (*)())NULL); #endif X if (debug > 0) { X char buf[80]; X X sprintf (buf, "debug %d", debug); X Tcl_Eval (interp, buf, 0, 0); X } X if (geometry != NULL) { X Tcl_SetVar (interp, "geometry", geometry, TCL_GLOBAL_ONLY); X } X result = Tcl_Eval (interp, initCmd, 0, (char **)NULL); X if (result != TCL_OK) { X goto error; X } X if (fileName != NULL) { X result = Tcl_VarEval (interp, "source ", fileName, (char *)NULL); X if (result != TCL_OK) { X goto error; X } X tty = 0; X } else { X tty = isatty (0); X Tk_CreateFileHandler (0, TK_READABLE | TK_EXCEPTION, StdinProc, X (ClientData) 0); X if (tty) { X printf ("Wish: "); X } X } X fflush (stdout); X buffer = Tcl_CreateCmdBuf (); X (void)Tcl_Eval (interp, "update", 0, (char **)NULL); X X Tk_MainLoop (); X Tcl_DeleteInterp (interp); X Tcl_DeleteCmdBuf (buffer); X exit (0); X X error: X msg = Tcl_GetVar (interp, "errorInfo", TCL_GLOBAL_ONLY); X if (msg == NULL) { X msg = interp->result; X } X fprintf (stderr, "%s\n", msg); X Tcl_Eval (interp, "destroy .", 0, (char **)NULL); X exit (1); X return 0; } X X SHAR_EOF $shar_touch -am 1015123693 'snmp2/snmptcl/wish.c' && chmod 0644 'snmp2/snmptcl/wish.c' || echo 'restore of snmp2/snmptcl/wish.c failed' shar_count="`wc -c < 'snmp2/snmptcl/wish.c'`" test 11473 -eq "$shar_count" || echo "snmp2/snmptcl/wish.c: original size 11473, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/tcl_misc.h ============== if test -f 'snmp2/snmptcl/tcl_misc.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/tcl_misc.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/tcl_misc.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/tcl_misc.h' && /* tcl_misc.h X * Small usefull things for tcl-packages. X * X * Poul-Henning Kamp, phk@data.fls.dk X * 920318 0.00 X * 920319 0.01 X * 920324 0.02 X */ X static int Error(interp,where,why) X Tcl_Interp *interp; X char *where; X char *why; X { X Tcl_AddErrorInfo(interp,where); X Tcl_AddErrorInfo(interp,": "); X Tcl_AddErrorInfo(interp,why); X return TCL_ERROR; X } X #define CHKNARG(min,max,where) {\ X if(argcmax) return Error(interp,where,"too many args.");\ X } X static int Failed(interp,where,why) X Tcl_Interp *interp; X char *where; X char *why; X { X Tcl_AddErrorInfo(interp,where); X Tcl_AddErrorInfo(interp,": "); X if(why) X { X Tcl_AddErrorInfo(interp,why); X Tcl_AddErrorInfo(interp," failed."); X } X else X Tcl_AddErrorInfo(interp,"failed."); X return TCL_ERROR; X } X #define IFW(st) if(**argv==*st && !strcmp(*argv,st)) X #define HUH(interp,where) Error(interp,where,"Huh ?") SHAR_EOF $shar_touch -am 1015123693 'snmp2/snmptcl/tcl_misc.h' && chmod 0444 'snmp2/snmptcl/tcl_misc.h' || echo 'restore of snmp2/snmptcl/tcl_misc.h failed' shar_count="`wc -c < 'snmp2/snmptcl/tcl_misc.h'`" test 986 -eq "$shar_count" || echo "snmp2/snmptcl/tcl_misc.h: original size 986, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/snmpgraph.ps ============== if test -f 'snmp2/snmptcl/snmpgraph.ps' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/snmpgraph.ps (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/snmpgraph.ps (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/snmpgraph.ps' && %!PS-Adobe-3.0 EPSF-3.0 %%Title: (snmpgraph.ps) %%Pages: 1 %%DocumentNeededResources: font Helvetica Courier %%BoundingBox: 72 252 540 720 %%Creator: .top.graph (Tk version 2.3) %%CreationDate: Mon Jun 14 13:51:33 1993 %%EndComments %%BeginSetup /Line { % Draw solid line X % Stack: x1 y1 x2 y2 X /y2 exch def X /x2 exch def X /y1 exch def X /x1 exch def X newpath X x1 y1 moveto X x2 y2 lineto X closepath X stroke } def /Box { % Create filled rectangle X % Stack: x y w h X gsave X /h exch def X /w exch def X /y exch def X /x exch def X newpath X x y moveto X w 0 rlineto X 0 h rlineto X w neg 0 rlineto X closepath X fill X grestore } def /RText { % Draw rotated text X % Stack: s x y r X gsave X /r exch def X /y exch def X /x exch def X /s exch def X x y translate X 0 0 moveto X 1 -1 scale X r 90 mul rotate X s show X grestore } def /Text { % Draw text X % Stack: s x y X gsave X /y exch def X /x exch def X /s exch def X newpath X x y moveto X 1 -1 scale X closepath X s show X grestore } def /solidLineStyle { % Set solid line style X [] 0 setdash } def /dashedLineStyle { % Set dashed line style X [5 2] 0 setdash } def /dottedLineStyle { % Set dotted line style X [1 1] 0 setdash } def /solid { % Draw solid line X % Stack: x y r X /r exch def X /y exch def X /x exch def X [] 0 setdash X x r sub y moveto X x r add y lineto X stroke } def /dashed { % Draw dashed line X % Stack: x y r X /r exch def X /y exch def X /x exch def X [5 2] 0 setdash X x r sub y moveto X x r add y lineto X stroke } def /dotted { % Draw dotted line X % Stack: x y r X /r exch def X /y exch def X /x exch def X [1 1] 0 setdash X x r sub y moveto X x r add y lineto X stroke } def /cross { % Draw cross X % Stack: x y r X /r exch def X /y exch def X /x exch def X x r sub y r sub moveto X x r add y r add lineto X stroke X x r sub y r add moveto X x r add y r sub lineto X stroke } def /plus { % Draw plus X % Stack: x y r X /r exch def X /y exch def X /x exch def X x r sub y moveto X x r add y lineto X stroke X x y r sub moveto X x y r add lineto X stroke } def /square { % Draw filled square X % Stack: x y r X /r exch def X /y exch def X /x exch def X x r sub y r sub moveto X x y r r Box } def /circle { % Draw filled circle X % Stack: x y r X /r exch def X /y exch def X /x exch def X x y moveto X newpath X x y r 0 360 arc X closepath X fill } def /diamond { % Draw filled diamond X % Stack: x y r X /r exch def X /y exch def X /x exch def X newpath X x r sub y moveto X x y r sub lineto X x r add y lineto X x y r add lineto X x r sub y lineto X closepath X fill } def /point { % Draw filled point X % Stack: x y r X /r exch def X /y exch def X /x exch def X x 0.5 sub y 0.5 sub moveto X x y 0.5 0.5 Box } def /SetFgColor { % Set foreground color X % Stack: r g b X isMonochrome 1 eq { X 0 0 0 pop pop pop X } if X setrgbcolor } def /SetBgColor { % Set background color X % Stack: r g b X isMonochrome 1 eq { X 1 1 1 pop pop pop X } if X setrgbcolor } def /isMonochrome 0 def 0 setlinewidth 1 setlinecap solidLineStyle /NewCenturySchlbk-Roman findfont 14 scalefont setfont 72 720 translate 1.56 -1.56 scale X %%EndSetup 0.690186 0.768616 0.870575 SetBgColor 0 0 300 300 Box 0 0 0.501953 SetFgColor 0.678421 0.847046 0.901947 SetBgColor 169 30 126 24 Box 0 0 0.999985 SetFgColor 175 42 2.5 solid 0 0 0.501953 SetFgColor /NewCenturySchlbk-Roman findfont 14 scalefont setfont (ifInUcastPkts.1) 182 46 Text /NewCenturySchlbk-Roman findfont 14 scalefont setfont (cmu-default) 110 26 Text 0 0 0 SetFgColor 0 setlinewidth solidLineStyle 51 257 264 257 Line /NewCenturySchlbk-Roman findfont 14 scalefont setfont (Seconds) 127 291 Text 63 257 63 260 Line 84 257 84 260 Line /Courier findfont 10 scalefont setfont (47600) 91 271 Text 0 0 0 SetFgColor 105 257 105 262 Line 126 257 126 260 Line 148 257 148 260 Line 169 257 169 260 Line 190 257 190 260 Line /Courier findfont 10 scalefont setfont (47700) 198 271 Text 0 0 0 SetFgColor 212 257 212 262 Line 233 257 233 260 Line 254 257 254 260 Line 0 0 0 SetFgColor 0 setlinewidth solidLineStyle 51 257 51 40 Line /NewCenturySchlbk-Roman findfont 14 scalefont setfont 0 0 0 SetFgColor (# Per Second) 19 194 1 RText /Courier findfont 10 scalefont setfont (100) 28 260 Text 51 257 46 257 Line 51 243 48 243 Line 51 228 48 228 Line 51 214 48 214 Line 51 199 48 199 Line /Courier findfont 10 scalefont setfont (200) 28 188 Text 51 185 46 185 Line 51 170 48 170 Line 51 156 48 156 Line 51 141 48 141 Line 51 127 48 127 Line /Courier findfont 10 scalefont setfont (300) 28 115 Text 51 112 46 112 Line 51 98 48 98 Line 51 83 48 83 Line 51 69 48 69 Line 51 54 48 54 Line /Courier findfont 10 scalefont setfont (400) 28 43 Text 51 40 46 40 Line 0 0 0.999985 SetFgColor 0 setlinewidth solidLineStyle 51 134 moveto 51 134 lineto 52 130 lineto 53 117 lineto 54 106 lineto 55 134 lineto 56 179 lineto 57 137 lineto 58 198 lineto 60 164 lineto 61 144 lineto 62 171 lineto 63 181 lineto 64 177 lineto 65 176 lineto 66 196 lineto 67 144 lineto 68 178 lineto 69 174 lineto 70 200 lineto 71 180 lineto 72 185 lineto 73 179 lineto 74 218 lineto 75 176 lineto 77 180 lineto 78 141 lineto 79 141 lineto 80 159 lineto 81 103 lineto 82 126 lineto 83 156 lineto 84 150 lineto 85 144 lineto 86 156 lineto 87 174 lineto 88 197 lineto 89 161 lineto 90 206 lineto 91 187 lineto 92 215 lineto 94 152 lineto 95 144 lineto 96 168 lineto 97 150 lineto 98 142 lineto 99 137 lineto 100 134 lineto 101 177 lineto 102 136 lineto 103 200 lineto 104 182 lineto 105 161 lineto 106 204 lineto 107 180 lineto 108 186 lineto 109 152 lineto 111 146 lineto 112 169 lineto 113 161 lineto 114 169 lineto 115 182 lineto 116 140 lineto 117 200 lineto 118 179 lineto 119 183 lineto 120 211 lineto 121 192 lineto 122 202 lineto 123 200 lineto 124 216 lineto 125 173 lineto 126 166 lineto 128 202 lineto 129 185 lineto 130 184 lineto 131 113 lineto 132 176 lineto 133 140 lineto 134 63 lineto 135 149 lineto 136 187 lineto 137 190 lineto 138 178 lineto 139 179 lineto 140 166 lineto 141 182 lineto 142 173 lineto 143 195 lineto 145 188 lineto 146 158 lineto 147 153 lineto 148 176 lineto 149 163 lineto 150 174 lineto 151 132 lineto 152 160 lineto 153 189 lineto 154 155 lineto 155 124 lineto 156 195 lineto 157 192 lineto 158 191 lineto 159 166 lineto 161 119 lineto 162 127 lineto 163 173 lineto 164 137 lineto 165 118 lineto 166 161 lineto 167 176 lineto 168 158 lineto 169 109 lineto 170 177 lineto 171 166 lineto 172 175 lineto 173 116 lineto 174 108 lineto 175 219 lineto 176 181 lineto 178 124 lineto 179 135 lineto 180 118 lineto 181 140 lineto 182 99 lineto 183 132 lineto 184 164 lineto 185 172 lineto 186 142 lineto 187 115 lineto 188 168 lineto 189 104 lineto 190 140 lineto 191 127 lineto 192 168 lineto 193 144 lineto 195 161 lineto 196 166 lineto 197 206 lineto 198 166 lineto 199 172 lineto 200 183 lineto 201 198 lineto 202 177 lineto 203 168 lineto 204 154 lineto 205 180 lineto 206 155 lineto 207 74 lineto 208 190 lineto 209 204 lineto 210 192 lineto 212 190 lineto 213 214 lineto 214 173 lineto 215 214 lineto 216 213 lineto 217 199 lineto 218 156 lineto 219 69 lineto 220 93 lineto 221 149 lineto 222 158 lineto 223 188 lineto 224 150 lineto 225 166 lineto 226 182 lineto 227 206 lineto 229 174 lineto 230 138 lineto 231 183 lineto 232 170 lineto 233 143 lineto 234 179 lineto 235 173 lineto 236 160 lineto 237 189 lineto 238 153 lineto 239 141 lineto 240 127 lineto 241 140 lineto 242 156 lineto 243 209 lineto 244 155 lineto 246 149 lineto 247 113 lineto 248 138 lineto 249 111 lineto 250 95 lineto 251 161 lineto 252 148 lineto 253 172 lineto 254 174 lineto 255 177 lineto 256 165 lineto 257 92 lineto 258 163 lineto 259 193 lineto 260 195 lineto 261 191 lineto 263 179 lineto stroke showpage %%Trailer %%EOF SHAR_EOF $shar_touch -am 1015123693 'snmp2/snmptcl/snmpgraph.ps' && chmod 0644 'snmp2/snmptcl/snmpgraph.ps' || echo 'restore of snmp2/snmptcl/snmpgraph.ps failed' shar_count="`wc -c < 'snmp2/snmptcl/snmpgraph.ps'`" test 7842 -eq "$shar_count" || echo "snmp2/snmptcl/snmpgraph.ps: original size 7842, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/snmpgraph ============== if test -f 'snmp2/snmptcl/snmpgraph' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/snmpgraph (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/snmpgraph (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/snmpgraph' && #!wish -f # # Monitors an SNMP variable # option add *Background lightsteelblue option add *Button.Background red X option add *XYGraph.foreground navyblue option add *XYGraph.Geometry 300x300 option add *XYGraph.font *New*Century*Bold*R*14* option add *XYGraph.legendBackground lightblue option add *XYGraph.relief sunken option add *XYGraph.borderWidth 4 X set pause 0 set index 0 set samples 0 set interval 1 set delta 1 X set x {} set data {} set zoomed 0 X set trivial 0 X proc usage {} { X puts stderr {Usage: snmpgraph -v 1 hostname community interval objectID or:} X puts stderr {Usage: snmpgraph [-v 2 ] hostname noAuth interval objectID or:} X puts stderr {Usage: snmpgraph [-v 2 ] hostname srcParty dstParty context interval objectID} } X if {$argc<5} { X usage X exit 1 } else { X set interval [lindex $argv [expr $argc-2]] X set variable [lindex $argv [expr $argc-1]] X set authinfo [lrange $argv 1 [expr $argc-3]] X if { [lindex $authinfo 0] == "-v" } { X set hostname [lindex $authinfo 2] X } { X set hostname [lindex $authinfo 0] X } } X X wm title . "SNMP Graph ($hostname)" wm maxsize . 900 900 X frame .top X xygraph .top.graph -title $hostname \ X -xlabel "Seconds" -ylabel "# Per Second" -legendposition @-5,30 \ X -xmin 0 -xmax [expr $interval*20] X proc get.coords { w sx sy xVar yVar } { X # w widget X # sx screen x position X # sy screen y position X X scan [$w locate $sx $sy ] "%s %s" x y X scan [$w limits ] "%s %s %s %s" xmin xmax ymin ymax X if { $x > $xmax } { set x $xmax } X if { $x < $xmin } { set x $xmin } X if { $y > $ymax } { set y $ymax } X if { $y < $ymin } { set y $ymin } X global $xVar $yVar X set $xVar $x X set $yVar $y } X proc swap { var1 var2 } { X global $var1 $var2 X set hold [set $var1] X set $var1 [set $var2] X set $var2 $hold } X proc get.anchor { w sx sy } { X # w widget X # sx screen x position X # sy screen y position X X global x1 y1 x2 y2 X set x2 "" ; set y2 "" X get.coords $w $sx $sy x1 y1 X bind $w { scan.xy %W %x %y } X bind $w { zoom.xy %W %x %y } } X proc box { w x1 y1 x2 y2 } { X $w newtag t1 $x1 $y1 \ X -text [format "(%.4g, %.4g)" $x1 $y1] \ X -fg red -bg grey \ X -font *new*century*140* X $w newtag t2 $x2 $y2 \ X -text [format "(%.4g, %.4g)" $x2 $y2] \ X -fg red -bg grey \ X -font *new*century*140* X $w insert outline \ X -xydata { $x1 $y1 $x1 $y2 $x1 $y1 $x2 $y1 $x2 $y1 $x2 $y2 X $x1 $y2 $x2 $y2 } \ X -symbol dotted -color red -label {} -showretrace true } X proc scan.xy { w sx sy } { X # w widget X # sx screen x position X # sy screen y position X X global x1 y1 x2 y2 X get.coords $w $sx $sy x2 y2 X if { $x1 > $x2 } { X box $w $x2 $y2 $x1 $y1 X if { $y1 > $y2 } { X $w config -cursor { bottom_left_corner red black } X } else { X $w config -cursor { top_left_corner red black } X } X } else { X box $w $x1 $y1 $x2 $y2 X if { $y1 > $y2 } { X $w config -cursor { bottom_right_corner red black } X } else { X $w config -cursor { top_right_corner red black } X } X } } proc zoom.xy { w sx sy } { X # w widget X # sx screen x position X # sy screen y position X X global x1 y1 x2 y2 X # Go back to original bindings X bind $w { get.anchor %W %x %y } X catch "$w untag t1" msg X catch "$w untag t2" msg X bind $w {} X if { $x2 == "" } then { X catch "$w delete outline" msg X $w config -xmin {} -ymin {} -xmax {} -ymax {} X return X } X if { $x1 > $x2 } { X $w config -xmin $x2 -xmax $x1 X } else { X if { $x1 < $x2 } { X $w config -xmin $x1 -xmax $x2 X } X } X if { $y1 > $y2 } { X $w config -ymin $y2 -ymax $y1 X } else { X if { $y1 < $y2 } { X $w config -ymin $y1 -ymax $y2 X } X } X $w config -cursor crosshair X global zoomed X set zoomed 1 } X bind .top.graph { X get.anchor %W %x %y ; %W config -cursor {crosshair red black} } X bind .top.graph { X catch "%W delete outline" msg X %W config -xmin {} -ymin {} -xmax {} -ymax {} X global zoomed X set zoomed 0 } bind .top.graph { X %W config -legendposition @%x,%y } X set data1 1 X snmp open snmppoll [lindex $authinfo 0] [lindex $authinfo 1] [lindex $authinfo 2] [lindex $authinfo 3] [lindex $authinfo 4] [lindex $authinfo 5] X set ret [snmppoll get $variable] if { [lindex [lindex $ret 0] 0] == "Timeout" } { X puts stdout "$hostname not responding." X exit } set odata1 [lindex [lindex $ret 0] 0] set pretty [snmppoll prettyoid] if { [lindex [lindex $ret 0] 1] == "gauge"} { X set delta 0 X .top.graph configure -ylabel "Current Value" } X checkbutton .top.pause -variable pause -text Pause -width 10 -height 1 checkbutton .top.data1 -variable data1 -text $pretty -width 10 -height 1 -command { X if !$data1 { X .top.graph delete $pretty X } else { X .top.graph insert $pretty -xdata $x -ydata $data -symbol solid \ X -color blue X } X } X pack append .top .top.graph {bot fill} pack append .top .top.pause { left expand fillx } pack append .top .top.data1 { left expand fillx } pack append . .top {expand fill} X bind all {exit } bind all p { X .top.graph postscript snmpgraph.ps } X after [expr $interval*1000] X for {} {1} {} { X set ret [snmppoll get $variable] X X if { [lindex [lindex $ret 0] 0] == "Timeout" } { X incr index $interval X after [expr $interval*1000] X continue X } X X set cdata1 [lindex [lindex $ret 0] 0] X X if {$delta == 1} { X if { $cdata1 < $odata1 } { X # should really do this with sysUptime X set odata1 $cdata1 X incr index $interval X after [expr $interval*1000] X continue X } X lappend data [expr ($cdata1-$odata1)/$interval] X } { X lappend data $cdata1 X } X lappend x $index X incr index $interval X X incr samples X X if { $samples > 200 } { X set x [lrange $x 1 200] X set data [lrange $data 1 200] X if { !$pause && !$zoomed } { X .top.graph configure -xmin [lindex $x 0] -xmax $index X } X } else { X if { !$pause && !$zoomed && $index > [expr $interval*20] } { X .top.graph configure -xmax "" X } X } X X if { !$pause } { X if $data1 { X .top.graph insert $pretty -xdata $x -ydata $data -symbol solid \ X -color blue X } X } X set odata1 $cdata1 X X after [expr $interval*1000] } SHAR_EOF $shar_touch -am 1015123693 'snmp2/snmptcl/snmpgraph' && chmod 0755 'snmp2/snmptcl/snmpgraph' || echo 'restore of snmp2/snmptcl/snmpgraph failed' shar_count="`wc -c < 'snmp2/snmptcl/snmpgraph'`" test 6367 -eq "$shar_count" || echo "snmp2/snmptcl/snmpgraph: original size 6367, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/Makefile.vxWorks ============== if test -f 'snmp2/Makefile.vxWorks' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/Makefile.vxWorks (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/Makefile.vxWorks (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/Makefile.vxWorks' && X TARG = bin/snmpget bin/snmpgetnext bin/snmpstatus bin/snmpwalk bin/snmptest bin/snmptrap bin/snmptrapd bin/snmpnetstat bin/snmpmon bin/snmpd X all: makeall X install: apps/snmpget apps/snmpgetnext apps/snmpstatus apps/snmpwalk apps/snmptest apps/snmptrap apps/snmptrapd apps/snmpnetstat/snmpnetstat apps/snmpmon apps/snmpd X cp apps/snmpwalk bin/snmpwalk X cp apps/snmpbulkwalk bin/snmpwalk X cp apps/snmptest bin/snmptest X cp apps/snmptranslate bin/snmptranslate X cp apps/snmpget bin/snmpget X cp apps/snmptrapd bin/snmptrapd X cp apps/snmpnetstat/snmpnetstat bin/snmpnetstat # cp snmptcl/wish bin/wish X cp snmptcl/snmpgraph bin/snmpgraph X apps/snmpget apps/snmpgetnext apps/snmpstatus apps/snmpwalk apps/snmptest apps/snmptrap apps/snmptrapd apps/snmpnetstat/snmpnetstat apps/snmpmon apps/snmpd: makeall X makeall: X cd snmplib; make all install X cd apps; make # cd apps/snmpnetstat; make X cd agent; make all X X clean: X cd snmplib; make clean X cd apps; make clean X cd apps/snmpnetstat; make clean X cd agent; make clean X cd snmptcl; make clean X rm -f bin/* lib/* X X SHAR_EOF $shar_touch -am 1015123693 'snmp2/Makefile.vxWorks' && chmod 0644 'snmp2/Makefile.vxWorks' || echo 'restore of snmp2/Makefile.vxWorks failed' shar_count="`wc -c < 'snmp2/Makefile.vxWorks'`" test 1060 -eq "$shar_count" || echo "snmp2/Makefile.vxWorks: original size 1060, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/Makefile.unix ============== if test -f 'snmp2/Makefile.unix' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/Makefile.unix (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/Makefile.unix (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/Makefile.unix' && X TARG = bin/snmpget bin/snmpgetnext bin/snmpstatus bin/snmpwalk bin/snmptest bin/snmptrap bin/snmptrapd bin/snmpnetstat bin/snmpmon bin/snmpd X all: makeall X install: apps/snmpget apps/snmpgetnext apps/snmpstatus apps/snmpwalk apps/snmptest apps/snmptrap apps/snmptrapd apps/snmpnetstat/snmpnetstat apps/snmpmon apps/snmpd X cp apps/snmpwalk bin/snmpwalk X cp apps/snmpbulkwalk bin/snmpwalk X cp apps/snmptest bin/snmptest X cp apps/snmptranslate bin/snmptranslate X cp apps/snmpget bin/snmpget X cp apps/snmptrapd bin/snmptrapd X cp apps/snmpnetstat/snmpnetstat bin/snmpnetstat # cp snmptcl/wish bin/wish X cp snmptcl/snmpgraph bin/snmpgraph X apps/snmpget apps/snmpgetnext apps/snmpstatus apps/snmpwalk apps/snmptest apps/snmptrap apps/snmptrapd apps/snmpnetstat/snmpnetstat apps/snmpmon apps/snmpd: makeall X makeall: X cd snmplib; make all install X cd apps; make X cd apps/snmpnetstat; make X cd agent; make all X X clean: X cd snmplib; make clean X cd apps; make clean X cd apps/snmpnetstat; make clean X cd agent; make clean X cd snmptcl; make clean X X SHAR_EOF $shar_touch -am 1015123693 'snmp2/Makefile.unix' && chmod 0644 'snmp2/Makefile.unix' || echo 'restore of snmp2/Makefile.unix failed' shar_count="`wc -c < 'snmp2/Makefile.unix'`" test 1040 -eq "$shar_count" || echo "snmp2/Makefile.unix: original size 1040, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/load.vxWorks ============== if test -f 'snmp2/load.vxWorks' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/load.vxWorks (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/load.vxWorks (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/load.vxWorks' && ld < /home/redfox/comms/vxWorks/bsd/qsort.o ld < /home/redfox/comms/vxWorks/bsd/strcasecmp.o ld < /home/redfox/comms/vxWorks/bsd/random.o ld < /home/redfox/comms/vxWorks/obj/inet_vx.o ld < /home/redfox/cwk/src/vxWorks/test/nlist.o ld < /home/redfox/cwk/src/vxWorks/test/gettimeofday.o ld < /home/redfox/cwk/src/vxWorks/test/exec.o X ld < ./snmplib/libsnmp.a ld < ./agent/snmpd snmpdv2 (100) X ld < ./apps/snmpget.o ld < ./apps/snmpwalk.o ld < ./apps/snmpbulkwalk.o ld < ./apps/snmptest.o X SHAR_EOF $shar_touch -am 1015123693 'snmp2/load.vxWorks' && chmod 0644 'snmp2/load.vxWorks' || echo 'restore of snmp2/load.vxWorks failed' shar_count="`wc -c < 'snmp2/load.vxWorks'`" test 487 -eq "$shar_count" || echo "snmp2/load.vxWorks: original size 487, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/agent/snmp_vars.c ============== if test ! -d 'snmp2/agent'; then echo 'x - creating directory snmp2/agent' mkdir 'snmp2/agent' fi if test -f 'snmp2/agent/snmp_vars.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/agent/snmp_vars.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/agent/snmp_vars.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/agent/snmp_vars.c' && /* X * snmp_vars.c - return a pointer to the named variable. X * X * X */ /*********************************************************** X Copyright 1988, 1989, 1990 by Carnegie Mellon University X Copyright 1989 TGV, Incorporated X X All Rights Reserved X Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of CMU and TGV not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. X CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ X #define USE_NAME_AS_DESCRIPTION /*"se0" instead of text */ #define GATEWAY /* MultiNet is always configured this way! */ #include #include #include #include /* #include */ #ifdef VXWORKS #include #include "VXtime.h" #include "VXparam.h" #include #include #include #else #include #include #include #include #include #include #include #endif #include #ifdef VXWORKS #else #include #endif #include #include #include #include #ifdef VXWORKS #include "VXif_ether.h" #else #include #endif #include #ifndef sunV3 #include #endif #include #include #include #include #include #include #include #include #include #include #ifdef VXWORKS #include "VXnlist.h" #define PR_SLOWHZ 2 /* 2 slow timeouts per second */ #define sleep(a) taskDelay(a*sysClkRateGet()) #else #include #include #endif X #ifndef NULL #define NULL 0 #endif #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif X #include "asn1.h" #include "snmp.h" #include "snmp_impl.h" #include "mib.h" #include "snmp_vars.h" X #include "m2m.h" #include "snmp_vars_m2m.h" #include "alarm.h" #include "event.h" X #define PROCESSSLOTINDEX 0 #define PROCESSID 4 #define PROCESSCOMMAND 8 X #include "party.h" #include "context.h" #include "acl.h" #include "view.h" X #ifdef vax11c #define ioctl socket_ioctl #define perror socket_perror #endif vax11c X extern int swap, mem; extern char *Lookup_Device_Annotation(); X #define KNLookup(nl_which, buf, s) (klookup((int) nl[nl_which].n_value, buf, s)) X X static struct nlist nl[] = { X #define N_IPSTAT 0 X { "_ipstat"}, #define N_IPFORWARDING 1 X { "_ipforwarding" }, #define N_TCP_TTL 2 X { "_tcp_ttl"}, #define N_UDPSTAT 3 X { "_udpstat" }, #define N_IN_INTERFACES 4 X { "_in_interfaces" }, #define N_ICMPSTAT 5 X { "_icmpstat" }, #define N_IFNET 6 X { "_ifnet" }, #define N_TCPSTAT 7 X { "_tcpstat" }, #define N_TCB 8 X #ifdef VXWORKS /* for some reason, it has a different name under vxWorks */ X { "_tcpcb" }, #else X { "_tcb" }, #endif X #define N_ARPTAB_SIZE 9 X { "_arptab_size" }, #define N_ARPTAB 10 X { "_arptab" }, #define N_IN_IFADDR 11 X { "_in_ifaddr" }, #define N_BOOTTIME 12 X { "_boottime" }, #define N_PROC 13 X { "_proc" }, #define N_NPROC 14 X { "_nproc" }, #define N_DMMIN 15 X { "_dmmin" }, #define N_DMMAX 16 X { "_dmmax" }, #define N_NSWAP 17 X { "_nswap" }, #define N_USRPTMAP 18 X { "_Usrptmap" }, #define N_USRPT 19 X { "_usrpt" }, #ifdef ibm032 #define N_USERSIZE 20 X { "_userSIZE" }, #endif X 0, }; X /* X * Each variable name is placed in the variable table, without the X * terminating substring that determines the instance of the variable. When X * a string is found that is lexicographicly preceded by the input string, X * the function for that entry is called to find the method of access of the X * instance of the named variable. If that variable is not found, NULL is X * returned, and the search through the table continues (it will probably X * stop at the next entry). If it is found, the function returns a character X * pointer and a length or a function pointer. The former is the address X * of the operand, the latter is a write routine for the variable. X * X * u_char * X * findVar(name, length, exact, var_len, write_method) X * oid *name; IN/OUT - input name requested, output name found X * int length; IN/OUT - number of sub-ids in the in and out oid's X * int exact; IN - TRUE if an exact match was requested. X * int len; OUT - length of variable or 0 if function returned. X * int write_method; OUT - pointer to function to set variable, X * otherwise 0 X * X * The writeVar function is returned to handle row addition or complex X * writes that require boundary checking or executing an action. X * This routine will be called three times for each varbind in the packet. X * The first time for each varbind, action is set to RESERVE1. The type X * and value should be checked during this pass. If any other variables X * in the MIB depend on this variable, this variable will be stored away X * (but *not* committed!) in a place where it can be found by a call to X * writeVar for a dependent variable, even in the same PDU. During X * the second pass, action is set to RESERVE2. If this variable is dependent X * on any other variables, it will check them now. It must check to see X * if any non-committed values have been stored for variables in the same X * PDU that it depends on. Sometimes resources will need to be reserved X * in the first two passes to guarantee that the operation can proceed X * during the third pass. During the third pass, if there were no errors X * in the first two passes, writeVar is called for every varbind with action X * set to COMMIT. It is now that the values should be written. If there X * were errors during the first two passes, writeVar is called in the third X * pass once for each varbind, with the action set to FREE. An opportunity X * is thus provided to free those resources reserved in the first two passes. X * X * writeVar(action, var_val, var_val_type, var_val_len, statP, name, name_len) X * int action; IN - RESERVE1, RESERVE2, COMMIT, or FREE X * u_char *var_val; IN - input or output buffer space X * u_char var_val_type; IN - type of input buffer X * int var_val_len; IN - input and output buffer len X * u_char *statP; IN - pointer to local statistic X * oid *name IN - pointer to name requested X * int name_len IN - number of sub-ids in the name X */ X long long_return; X #ifndef ibm032 u_char return_buf[CLSIZE*NBPG]; #else u_char return_buf[256]; /* nee 64 */ #endif X char version_descr[128] = "Unix 4.3BSD"; char sysContact[128] = "Unknown"; char sysName[128] = "Unknown"; char sysLocation[128] = "Unknown"; #ifdef VXWORKS extern char *vxWorksVersion; X char sscl_agent_version [] = "SSCL SNMPv2 agent version 1.00"; char sscl_port_version [] = "vxWorks Port version 0.00"; X struct ssclrt_system { X unsigned long reboot; /* seconds till CPU reboot */ X unsigned long reboot_vme; /* seconds till VME reboot */ X unsigned long abort_reboot; /* abort a CPU or VME reboot */ X unsigned long silent; /* disable warning messages */ X unsigned long spuriousInts; /* number of spurious Ints */ X }; X static struct ssclrt_system system_struct; X /* X * handleSpurious X * X * count the spurious interrupts X */ static handleSpurious () { X system_struct.spuriousInts++; X } X /* X * X * This task waits a specified number of seconds, then reboots X */ reboot_task () { #if 0 X ssclrt_trap (SSCLRT_TRAP_REBOOT); #endif X X if (!system_struct.silent) X printf ("\n\n* * * * * System rebooting in %d seconds* * * * *\n\n", X system_struct.reboot); X X while (system_struct.reboot-- > 0) X { X if (!system_struct.silent) X { X if (system_struct.reboot < 5) X printf ("\n\n* * * * * System rebooting in %d seconds* * * * *\n\n", X system_struct.reboot); X } X taskDelay (sysClkRateGet ()); X } X X if (!system_struct.silent) X printf ("\n\n* * * * * System rebooting NOW * * * * *\n\n"); X X reboot (); X } X /* X * reboot_vme_task X * X * This task waits a specified number of seconds, then signals X * VME sysReset X */ reboot_vme_task () { #if 0 X ssclrt_trap (SSCLRT_TRAP_REBOOT_VME); #endif X X if (!system_struct.silent) X { X printf ("\n\n* * * * * VME reset in %d seconds* * * * *\n\n", X system_struct.reboot_vme); X } X X while (system_struct.reboot_vme-- > 0) X { X if (!system_struct.silent) X { X if (system_struct.reboot_vme < 5) X printf ("\n\n* * * * * VME reset in %d seconds* * * * *\n\n", X system_struct.reboot_vme); X } X taskDelay (sysClkRateGet ()); X } X X if (!system_struct.silent) X printf ("\n\n* * * * * VME reset NOW * * * * *\n\n"); X X reboot_vme (); X } /* X * reboot_task_create X * X * Create a task to reboot the system X */ int reboot_task_create () { #if 0 X if (-1 != taskNameToId ("REBOOT")) || (-1 != taskNameToId ("REBOOT_VME"))) X { #ifdef DEBUG X printf ("A reboot sequence already active\n"); #endif X return (FALSE); X } #endif X X if (taskSpawn ("REBOOT", 0, 0, 0x1000, reboot_task, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) X { X return (TRUE); X } X else X { X return (FALSE); X } X } X /* X * reboot_vme_task_create X * X * Create a task to reset VME X */ int reboot_vme_task_create () { #if 0 X if ((taskNameToId ("REBOOT")) || (taskNameToId ("REBOOT_VME"))) X { #ifdef DEBUG X printf ("A reboot sequence already active\n"); #endif X return (FALSE); X } #endif X X if (taskSpawn ("REBOOT_VME", 0, 0, 0x1000, reboot_vme_task, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) X { X return (TRUE); X } X else X { X return (FALSE); X } X } X /* X * reboot_task_delete X * X * Create a task to reboot the system X */ int reboot_task_delete () { X int tid; X X if (-1 == (tid = taskNameToId ("REBOOT"))) X { X if (-1 == (tid = taskNameToId ("REBOOT_VME"))) X { X return (FALSE); X } X } X X if (-1 == taskDelete (tid)) X { X return (FALSE); X } X else X { #if 0 X ssclrt_trap (SSCLRT_TRAP_REBOOT_ABORT); #endif X if (!system_struct.silent) X { X printf ("\n\nSystem reboot ABORTED\n\n"); X } X return (TRUE); X } X } X #endif X init_snmp() { X nlist("/vmunix",nl); X init_kmem("/dev/kmem"); X init_routes(); X X #ifdef VXWORKS X sprintf (version_descr, "VxWorks (%s) version %s.\nKernel: %s.\n", SHAR_EOF : || echo 'restore of snmp2/agent/snmp_vars.c failed' fi echo 'End of snmp2 part 29' echo 'File snmp2/agent/snmp_vars.c is continued in part 30' echo 30 > _sharseq.tmp exit 0