#!/bin/sh # This is `snmp2.10' (part 10 of snmp2). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `snmp2/apps/snmpnetstat/main.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" != 10; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping snmp2/apps/snmpnetstat/main.c' else echo 'x - continuing file snmp2/apps/snmpnetstat/main.c' sed 's/^X//' << 'SHAR_EOF' >> 'snmp2/apps/snmpnetstat/main.c' && X Session = snmp_open(&session); X if (Session == NULL){ X printf("Couldn't open snmp\n"); X return(-1); X } X if (pflag) { X if (tp->pr_stats) X (*tp->pr_stats)(); X else X printf("%s: no stats routine\n", tp->pr_name); X return(0); X } X X X X /* X * Keep file descriptors open to avoid overhead X * of open/close on each call to get* routines. X */ X sethostent(1); X setnetent(1); X if (iflag) { X intpr(interval); X return(0); X } X if (rflag) { X if (sflag) X rt_stats(); X else X routepr(); X return(0); X } X X setprotoent(1); X setservent(1); X while (p = getprotoent()) { X X for (tp = protox; tp->pr_name; tp++) X if (strcmp(tp->pr_name, p->p_name) == 0) X break; X if (tp->pr_name == 0 || tp->pr_wanted == 0) X continue; X if (sflag) { X if (tp->pr_stats) X (*tp->pr_stats)(); X } else X if (tp->pr_cblocks) X (*tp->pr_cblocks)(); X } X endprotoent(); X return(0); } X char * plural(n) X int n; { X X return (n != 1 ? "s" : ""); } X /* X * Find the protox for the given "well-known" name. X */ struct protox * knownname(name) X char *name; { X struct protox *tp; X X for (tp = protox; tp->pr_name; tp++) X if (strcmp(tp->pr_name, name) == 0) X return(tp); X return(NULLPROTOX); } X /* X * Find the protox corresponding to name. X */ struct protox * name2protox(name) X char *name; { X struct protox *tp; X char **alias; /* alias from p->aliases */ X struct protoent *p; X X /* X * Try to find the name in the list of "well-known" names. If that X * fails, check if name is an alias for an Internet protocol. X */ X if (tp = knownname(name)) X return(tp); X X setprotoent(1); /* make protocol lookup cheaper */ X while (p = getprotoent()) { X /* assert: name not same as p->name */ X for (alias = p->p_aliases; *alias; alias++) X if (strcmp(name, *alias) == 0) { X endprotoent(); X return(knownname(p->p_name)); X } X } X endprotoent(); X return(NULLPROTOX); } SHAR_EOF echo 'File snmp2/apps/snmpnetstat/main.c is complete' && $shar_touch -am 1015123593 'snmp2/apps/snmpnetstat/main.c' && chmod 0644 'snmp2/apps/snmpnetstat/main.c' || echo 'restore of snmp2/apps/snmpnetstat/main.c failed' shar_count="`wc -c < 'snmp2/apps/snmpnetstat/main.c'`" test 12868 -eq "$shar_count" || echo "snmp2/apps/snmpnetstat/main.c: original size 12868, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/snmpnetstat/main.h ============== if test -f 'snmp2/apps/snmpnetstat/main.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/snmpnetstat/main.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/snmpnetstat/main.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/snmpnetstat/main.h' && X #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif X X extern char *community; extern struct sockaddr_in address; extern int reqid; extern int sd; SHAR_EOF $shar_touch -am 1015123593 'snmp2/apps/snmpnetstat/main.h' && chmod 0644 'snmp2/apps/snmpnetstat/main.h' || echo 'restore of snmp2/apps/snmpnetstat/main.h failed' shar_count="`wc -c < 'snmp2/apps/snmpnetstat/main.h'`" test 151 -eq "$shar_count" || echo "snmp2/apps/snmpnetstat/main.h: original size 151, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/snmpnetstat/route.c ============== if test -f 'snmp2/apps/snmpnetstat/route.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/snmpnetstat/route.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/snmpnetstat/route.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/snmpnetstat/route.c' && /***************************************************************** X Copyright 1989, 1991, 1992 by Carnegie Mellon University 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 not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. X CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CMU 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 * Copyright (c) 1983,1988 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that this notice is preserved and that due credit is given X * to the University of California at Berkeley. The name of the University X * may not be used to endorse or promote products derived from this X * software without specific prior written permission. This software X * is provided ``as is'' without express or implied warranty. X */ X #include X #ifndef VXWORKS #include #endif /* VXWORKS */ X #include X #ifndef VXWORKS #include #endif /* VXWORKS */ X #include X #include #define LOOPBACKNET 127 X #ifdef VXWORKS #include #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include "main.h" #include "asn1.h" #include "snmp.h" #include "snmp_impl.h" #include "snmp_api.h" #include "snmp_client.h" #include "mib.h" X extern int nflag; extern char *routename(), *netname(), *plural(); extern char *malloc(); extern struct snmp_session *Session; extern struct variable_list *getvarbyname(); extern int print_errors; X X struct route_entry { X oid instance[4]; X struct in_addr destination; X int set_destination; X struct in_addr gateway; X int set_gateway; X int interface; X int set_interface; X int type; X int set_type; X int proto; X int set_proto; X char ifname[64]; X int set_name; }; X X X #define RTDEST 1 #define RTIFINDEX 2 #define RTNEXTHOP 7 #define RTTYPE 8 #define RTPROTO 9 static oid oid_rttable[] = {1, 3, 6, 1, 2, 1, 4, 21, 1}; static oid oid_rtdest[] = {1, 3, 6, 1, 2, 1, 4, 21, 1, 1}; static oid oid_rtifindex[] = {1, 3, 6, 1, 2, 1, 4, 21, 1, 2}; static oid oid_rtnexthop[] = {1, 3, 6, 1, 2, 1, 4, 21, 1, 7}; static oid oid_rttype[] = {1, 3, 6, 1, 2, 1, 4, 21, 1, 8}; static oid oid_rtproto[] = {1, 3, 6, 1, 2, 1, 4, 21, 1, 9}; static oid oid_ifdescr[] = {1, 3, 6, 1, 2, 1, 2, 2, 1, 2}; static oid oid_ipnoroutes[] = {1, 3, 6, 1, 2, 1, 4, 12, 0}; X X /* X * Print routing tables. X */ routepr() { X struct route_entry route, *rp = &route; X struct snmp_pdu *request, *response; X struct variable_list *vp; X char name[16], *flags; X oid *instance, type; X int toloopback, status; X char ch; X X printf("Routing tables\n"); X printf("%-16.16s %-18.18s %-6.6s %s\n", X "Destination", "Gateway", X "Flags", "Interface"); X X X request = snmp_pdu_create(GETNEXT_REQ_MSG); X X snmp_add_null_var(request, oid_rtdest, sizeof(oid_rtdest)/sizeof(oid)); X snmp_add_null_var(request, oid_rtifindex, sizeof(oid_rtifindex)/sizeof(oid)); X snmp_add_null_var(request, oid_rtnexthop, sizeof(oid_rtnexthop)/sizeof(oid)); X snmp_add_null_var(request, oid_rttype, sizeof(oid_rttype)/sizeof(oid)); X snmp_add_null_var(request, oid_rtproto, sizeof(oid_rtproto)/sizeof(oid)); X X while(request){ X status = snmp_synch_response(Session, request, &response); X if (status != STAT_SUCCESS || response->errstat != SNMP_ERR_NOERROR){ X fprintf(stderr, "SNMP request failed\n"); X break; X } X instance = NULL; X request = NULL; X rp->set_destination = 0; X rp->set_interface = 0; X rp->set_gateway = 0; X rp->set_type = 0; X rp->set_proto = 0; X for(vp = response->variables; vp; vp = vp->next_variable){ X if (vp->name_length != 14 || X bcmp((char *)vp->name, (char *)oid_rttable, sizeof(oid_rttable))){ X continue; /* if it isn't in this subtree, just continue */ X } X X if (instance != NULL){ X oid *ip, *op; X int count; X X ip = instance; X op = vp->name + 10; X for(count = 0; count < 4; count++){ X if (*ip++ != *op++) X break; X } X if (count < 4) X continue; /* not the right instance, ignore */ X } else { X instance = vp->name + 10; X } X /* X * At this point, this variable is known to be in the routing table X * subtree, and is of the right instance for this transaction. X */ X X if (request == NULL) X request = snmp_pdu_create(GETNEXT_REQ_MSG); X snmp_add_null_var(request, vp->name, vp->name_length); X X type = vp->name[9]; X switch ((char)type){ X case RTDEST: X bcopy((char *)vp->val.string, (char *)&rp->destination, sizeof(u_long)); X rp->set_destination = 1; X break; X case RTIFINDEX: X rp->interface = *vp->val.integer; X rp->set_interface = 1; X break; X case RTNEXTHOP: X bcopy((char *)vp->val.string, (char *)&rp->gateway, sizeof(u_long)); X rp->set_gateway = 1; X break; X case RTTYPE: X rp->type = *vp->val.integer; X rp->set_type = 1; X break; X case RTPROTO: X rp->proto = *vp->val.integer; X rp->set_proto = 1; X break; X } X } X if (!(rp->set_destination && rp->set_gateway X && rp->set_type && rp->set_interface)){ X if (request) X snmp_free_pdu(request); X request = 0; X continue; X } X toloopback = *(char *)&rp->gateway == LOOPBACKNET; X printf("%-16.16s ", X (rp->destination.s_addr == 0) ? "default" : X (toloopback) ? X routename(rp->destination) : netname(rp->destination, 0L)); X printf("%-18.18s ", routename(rp->gateway)); X flags = name; X *flags++ = 'U'; /* route is in use */ X /* this !toloopback shouldnt be necessary */ X if (!toloopback && rp->type == MIB_IPROUTETYPE_REMOTE) X *flags++ = 'G'; X if (toloopback) X *flags++ = 'H'; X if (rp->proto == MIB_IPROUTEPROTO_ICMP) X *flags++ = 'D'; /* redirect */ X *flags = '\0'; X printf("%-6.6s ", name); X get_ifname(rp->ifname, rp->interface); X ch = rp->ifname[strlen(rp->ifname) - 1]; X ch = '5'; /* force the if statement */ X if (isdigit(ch)) X printf(" %.32s\n", rp->ifname); X else X printf(" %.32s%d\n", rp->ifname, rp->interface); X X } } X struct iflist { X int index; X char name[64]; X struct iflist *next; } *Iflist = NULL; X get_ifname(name, index) X char *name; X int index; { X struct snmp_pdu *pdu, *response; X struct variable_list *vp; X struct iflist *ip; X oid varname[32]; X int status; X X for(ip = Iflist; ip; ip = ip->next){ X if (ip->index == index) X break; X } X if (ip){ X strcpy(name, ip->name); X return; X } X ip = (struct iflist *)malloc(sizeof(struct iflist)); X ip->next = Iflist; X Iflist = ip; X ip->index = index; X pdu = snmp_pdu_create(GET_REQ_MSG); X bcopy((char *)oid_ifdescr, (char *)varname, sizeof(oid_ifdescr)); X varname[10] = (oid)index; X snmp_add_null_var(pdu, varname, sizeof(oid_ifdescr)/sizeof(oid) + 1); X status = snmp_synch_response(Session, pdu, &response); X if (status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR){ X vp = response->variables; X bcopy((char *)vp->val.string, ip->name, vp->val_len); X ip->name[vp->val_len] = '\0'; X } else { X sprintf(ip->name, "if%d", index); X } X strcpy(name, ip->name); } X char * routename(in) X struct in_addr in; { X register char *cp; X static char line[MAXHOSTNAMELEN + 1]; X struct hostent *hp; X static char domain[MAXHOSTNAMELEN + 1]; X static int first = 1; X char *index(); X X if (first) { X first = 0; X if (gethostname(domain, MAXHOSTNAMELEN) == 0 && X (cp = index(domain, '.'))) X (void) strcpy(domain, cp + 1); X else X domain[0] = 0; X } X cp = 0; X if (!nflag) { X hp = gethostbyaddr((char *)&in, sizeof (struct in_addr), X AF_INET); X if (hp) { X if ((cp = index(hp->h_name, '.')) && X !strcmp(cp + 1, domain)) X *cp = 0; X cp = hp->h_name; X } X } X if (cp) X strncpy(line, cp, sizeof(line) - 1); X else { #define C(x) ((x) & 0xff) X in.s_addr = ntohl(in.s_addr); X sprintf(line, "%u.%u.%u.%u", C(in.s_addr >> 24), X C(in.s_addr >> 16), C(in.s_addr >> 8), C(in.s_addr)); X } X return (line); } X /* X * Return the name of the network whose address is given. X * The address is assumed to be that of a net or subnet, not a host. X */ char * netname(in, mask) X struct in_addr in; X u_long mask; { X char *cp = 0; X static char line[MAXHOSTNAMELEN + 1]; X struct netent *np = 0; X u_long net; X register i; X int subnetshift; X X i = ntohl(in.s_addr); X if (!nflag && i) { X if (mask == 0) { X if (IN_CLASSA(i)) { X mask = IN_CLASSA_NET; X subnetshift = 8; X } else if (IN_CLASSB(i)) { X mask = IN_CLASSB_NET; X subnetshift = 8; X } else { X mask = IN_CLASSC_NET; X subnetshift = 4; X } X /* X * If there are more bits than the standard mask X * would suggest, subnets must be in use. X * Guess at the subnet mask, assuming reasonable X * width subnet fields. X */ X while (i &~ mask) X mask = (long)mask >> subnetshift; X } X net = i & mask; X while ((mask & 1) == 0) X mask >>= 1, net >>= 1; X np = getnetbyaddr(net, AF_INET); X if (np) X cp = np->n_name; X } X if (cp) X strncpy(line, cp, sizeof(line) - 1); X else if ((i & 0xffffff) == 0) X sprintf(line, "%u", C(i >> 24)); X else if ((i & 0xffff) == 0) X sprintf(line, "%u.%u", C(i >> 24) , C(i >> 16)); X else if ((i & 0xff) == 0) X sprintf(line, "%u.%u.%u", C(i >> 24), C(i >> 16), C(i >> 8)); X else X sprintf(line, "%u.%u.%u.%u", C(i >> 24), X C(i >> 16), C(i >> 8), C(i)); X return (line); } X /* X * Print routing statistics X */ rt_stats() { X struct variable_list *var; X X printf("routing:\n"); X var = getvarbyname(Session, oid_ipnoroutes, sizeof(oid_ipnoroutes) / sizeof(oid)); X if (var){ X printf("\t%u destination%s found unreachable\n", X *var->val.integer, plural((int)*var->val.integer)); X } else { X printf("\tCouldn't get ipOutNoRoutes variable\n"); X } } X /* X * Request a variable with a GET REQUEST message on the given X * session. The session must have been opened as a synchronous X * session (synch_setup_session()). If the variable is found, a X * pointer to a struct variable_list object will be returned. X * Otherwise, NULL is returned. The caller must free the returned X * variable_list object when done with it. X */ struct variable_list * getvarbyname(sp, name, len) X struct snmp_session *sp; X oid *name; X int len; { X struct snmp_pdu *request, *response; X struct variable_list *var = NULL, *vp; X int status; X X request = snmp_pdu_create(GET_REQ_MSG); X X snmp_add_null_var(request, name, len); X X status = snmp_synch_response(sp, request, &response); X X if (status == STAT_SUCCESS){ X if (response->errstat == SNMP_ERR_NOERROR){ X for(var = response->variables; var; var = var->next_variable){ X if (var->name_length == len && !bcmp(name, var->name, len * sizeof(oid))) X break; /* found our match */ X } X if (var != NULL){ X /* X * Now unlink this var from pdu chain so it doesn't get freed. X * The caller will free the var. X */ X if (response->variables == var){ X response->variables = var->next_variable; X } else { X for(vp = response->variables; vp; vp = vp->next_variable){ X if (vp->next_variable == var){ X vp->next_variable = var->next_variable; X break; X } X } X } X } X } X } X if (response) X snmp_free_pdu(response); X return var; } SHAR_EOF $shar_touch -am 1015123593 'snmp2/apps/snmpnetstat/route.c' && chmod 0644 'snmp2/apps/snmpnetstat/route.c' || echo 'restore of snmp2/apps/snmpnetstat/route.c failed' shar_count="`wc -c < 'snmp2/apps/snmpnetstat/route.c'`" test 12031 -eq "$shar_count" || echo "snmp2/apps/snmpnetstat/route.c: original size 12031, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/snmptrapd.c ============== if test -f 'snmp2/apps/snmptrapd.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/snmptrapd.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/snmptrapd.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/snmptrapd.c' && /* X * snmptrapd.c - receive and log snmp traps X * X */ /***************************************************************** X Copyright 1989, 1991, 1992 by Carnegie Mellon University 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 not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. X CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CMU 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. ******************************************************************/ #include #include #include #include X #ifdef VXWORKS #include #else /* VXWORKS */ #include #endif /* VXWORKS */ X #ifndef VXWORKS #include #endif X #include X #ifdef VXWORKS #include #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include #include X #include "snmp.h" #include "asn1.h" #include "snmp_impl.h" #include "snmp_api.h" #include "snmp_client.h" #include "party.h" #include "view.h" #include "acl.h" X #ifndef BSD4_3 #define BSD4_2 #endif X #ifndef FD_SET X typedef long fd_mask; #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ X #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) #endif X extern int errno; int snmp_dump_packet = 0; int Print = 0; int Event = 0; int Syslog = 0; struct timeval Now; X char * trap_description(trap) X int trap; { X switch(trap){ X case SNMP_TRAP_COLDSTART: X return "Cold Start"; X case SNMP_TRAP_WARMSTART: X return "Warm Start"; X case SNMP_TRAP_LINKDOWN: X return "Link Down"; X case SNMP_TRAP_LINKUP: X return "Link Up"; X case SNMP_TRAP_AUTHFAIL: X return "Authentication Failure"; X case SNMP_TRAP_EGPNEIGHBORLOSS: X return "EGP Neighbor Loss"; X case SNMP_TRAP_ENTERPRISESPECIFIC: X return "Enterprise Specific"; X default: X return "Unknown Type"; X } } X char * uptime_string(timeticks, buf) X register u_long timeticks; X char *buf; { X int seconds, minutes, hours, days; X X timeticks /= 100; X days = timeticks / (60 * 60 * 24); X timeticks %= (60 * 60 * 24); X X hours = timeticks / (60 * 60); X timeticks %= (60 * 60); X X minutes = timeticks / 60; X seconds = timeticks % 60; X X if (days == 0){ X sprintf(buf, "%d:%02d:%02d", hours, minutes, seconds); X } else if (days == 1) { X sprintf(buf, "%d day, %d:%02d:%02d", days, hours, minutes, seconds); X } else { X sprintf(buf, "%d days, %d:%02d:%02d", days, hours, minutes, seconds); X } X return buf; } X struct snmp_pdu * snmp_clone_pdu2(pdu, command) X struct snmp_pdu *pdu; X int command; { X struct variable_list *var, *newvar; X struct snmp_pdu *newpdu; X X /* clone the pdu */ X newpdu = (struct snmp_pdu *)malloc(sizeof(struct snmp_pdu)); X bcopy((char *)pdu, (char *)newpdu, sizeof(struct snmp_pdu)); X newpdu->variables = 0; X newpdu->command = command; X newpdu->reqid = pdu->reqid; X newpdu->errstat = SNMP_DEFAULT_ERRSTAT; X newpdu->errindex = SNMP_DEFAULT_ERRINDEX; X var = pdu->variables; X X newpdu->variables = newvar = (struct variable_list *)malloc(sizeof(struct variable_list)); X bcopy((char *)var, (char *)newvar, sizeof(struct variable_list)); X if (var->name != NULL){ X newvar->name = (oid *)malloc(var->name_length * sizeof(oid)); X bcopy((char *)var->name, (char *)newvar->name, var->name_length * sizeof(oid)); X } X if (var->val.string != NULL){ X newvar->val.string = (u_char *)malloc(var->val_len); X bcopy((char *)var->val.string, (char *)newvar->val.string, var->val_len); X } X newvar->next_variable = 0; X X while(var->next_variable){ X var = var->next_variable; X newvar->next_variable = (struct variable_list *)malloc(sizeof(struct variable_list)); X newvar = newvar->next_variable; X bcopy((char *)var, (char *)newvar, sizeof(struct variable_list)); X if (var->name != NULL){ X newvar->name = (oid *)malloc(var->name_length * sizeof(oid)); X bcopy((char *)var->name, (char *)newvar->name, var->name_length * sizeof(oid)); X } X if (var->val.string != NULL){ X newvar->val.string = (u_char *)malloc(var->val_len); X bcopy((char *)var->val.string, (char *)newvar->val.string, var->val_len); X } X newvar->next_variable = 0; X } X return newpdu; } X static oid risingAlarm[] = {1, 3, 6, 1, 6, 3, 2, 1, 1, 3, 1}; static oid fallingAlarm[] = {1, 3, 6, 1, 6, 3, 2, 1, 1, 3, 2}; static oid unavailableAlarm[] = {1, 3, 6, 1, 6, 3, 2, 1, 1, 3, 3}; X event_input(vp) X struct variable_list *vp; { X int eventid; X oid variable[MAX_NAME_LEN]; X int variablelen; X u_long destip; X int sampletype; X int value; X int threshold; X X oid *op; X X vp = vp->next_variable; /* skip sysUptime */ X if (vp->val_len != sizeof(risingAlarm) X || !bcmp((char *)vp->val.objid, (char *)risingAlarm, X sizeof(risingAlarm))) X eventid = 1; X else if (vp->val_len != sizeof(risingAlarm) X || !bcmp((char *)vp->val.objid, (char *)fallingAlarm, X sizeof(fallingAlarm))) X eventid = 2; X else if (vp->val_len != sizeof(risingAlarm) X || !bcmp((char *)vp->val.objid, (char *)unavailableAlarm, X sizeof(unavailableAlarm))) X eventid = 3; X else X printf("unknown event\n"); X X vp = vp->next_variable; X bcopy((char *)vp->val.objid, (char *)variable, vp->val_len * sizeof(oid)); X variablelen = vp->val_len; X op = vp->name + 22; X destip = 0; X destip |= (*op++) << 24; X destip |= (*op++) << 16; X destip |= (*op++) << 8; X destip |= *op++; X X vp = vp->next_variable; X sampletype = *vp->val.integer; X X vp = vp->next_variable; X value= *vp->val.integer; X X vp = vp->next_variable; X threshold = *vp->val.integer; X X printf("%d: 0x%02X %d %d %d\n", eventid, destip, sampletype, value, threshold); X } X X int snmp_input(op, session, reqid, pdu, magic) X int op; X struct snmp_session *session; X int reqid; X struct snmp_pdu *pdu; X void *magic; { X struct variable_list *vars; X char buf[64]; X struct snmp_pdu *reply; X X if (op == RECEIVED_MESSAGE){ X if (pdu->command == TRP_REQ_MSG){ X if (Print){ X printf("%s: %s Trap (%d) Uptime: %s\n", X inet_ntoa(pdu->agent_addr.sin_addr), X trap_description(pdu->trap_type), pdu->specific_type, X uptime_string(pdu->time, buf)); X for(vars = pdu->variables; vars; vars = vars->next_variable) X print_variable(vars->name, vars->name_length, vars); X } X if (Syslog){ X syslog(LOG_WARNING, "%s: %s Trap (%d) Uptime: %s\n", X inet_ntoa(pdu->agent_addr.sin_addr), X trap_description(pdu->trap_type), pdu->specific_type, X uptime_string(pdu->time, buf)); X } X } else if (pdu->command == TRP2_REQ_MSG X || pdu->command == INFORM_REQ_MSG){ X if (Print){ X printf("------------------------------- Notification -------------------------------\n"); X for(vars = pdu->variables; vars; vars = vars->next_variable) X print_variable(vars->name, vars->name_length, vars); X } X if (Event) { X event_input(pdu->variables); X } X if (pdu->command == INFORM_REQ_MSG){ X if (!(reply = snmp_clone_pdu2(pdu, GET_RSP_MSG))){ X printf("Couldn't clone PDU for response\n"); X return; X } X reply->errstat = 0; X reply->errindex = 0; X reply->address = pdu->address; X if (!snmp_send(session, reply)){ X printf("Couldn't respond to inform pdu\n"); X } X } X } X } else if (op == TIMED_OUT){ X printf("Timeout: This shouldn't happen!\n"); X } } X #define NUM_NETWORKS 32 /* max number of interfaces to check */ X #ifndef IFF_LOOPBACK #define IFF_LOOPBACK 0 #endif #define LOOPBACK 0x7f000001 u_long get_myaddr(){ X int sd; X struct ifconf ifc; X struct ifreq conf[NUM_NETWORKS], *ifrp, ifreq; X struct sockaddr_in *in_addr; X int count; X int interfaces; /* number of interfaces returned by ioctl */ X X if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) X return 0; X ifc.ifc_len = sizeof(conf); X ifc.ifc_buf = (caddr_t)conf; X if (ioctl(sd, SIOCGIFCONF, (char *)&ifc) < 0){ X close(sd); X return 0; X } X ifrp = ifc.ifc_req; X interfaces = ifc.ifc_len / sizeof(struct ifreq); X for(count = 0; count < interfaces; count++, ifrp++){ X ifreq = *ifrp; X if (ioctl(sd, SIOCGIFFLAGS, (char *)&ifreq) < 0) X continue; X in_addr = (struct sockaddr_in *)&ifrp->ifr_addr; X if ((ifreq.ifr_flags & IFF_UP) X && (ifreq.ifr_flags & IFF_RUNNING) X && !(ifreq.ifr_flags & IFF_LOOPBACK) X && in_addr->sin_addr.s_addr != LOOPBACK){ X close(sd); X return in_addr->sin_addr.s_addr; X } X } X close(sd); X return 0; } X X #ifdef VXWORKS snmptrapd #else /* VXWORKS */ main #endif X (argc, argv) int argc; char *argv []; { X struct snmp_session session, *ss; X int arg; X int count, numfds, block; X fd_set fdset; X struct timeval timeout, *tvp; X int version = 2; X u_long myaddr; X oid src[MAX_NAME_LEN], dst[MAX_NAME_LEN], context[MAX_NAME_LEN]; X int srclen, dstlen, contextlen; X int local_port = 0, port_flag; X char *config_file = NULL; X struct config_module *dp; X int sd; X struct sockaddr_in me; X X init_syslog(); X init_mib(); X /* X * usage: snmptrapd [-v 1] [-P #] [-p] [-s] [-d] X */ X for(arg = 1; arg < argc; arg++){ X if (argv[arg][0] == '-'){ X switch(argv[arg][1]){ X case 'c': X /* config file name */ X if (++arg >= argc) { X printf("-c: no config file name\n"); X break; X } X config_file = argv[arg]; X break; X case 'd': X snmp_dump_packet++; X break; X case 'P': X port_flag++; X local_port = atoi(argv[++arg]); X break; X case 'p': X Print++; X break; X case 'e': X Event++; X break; X case 's': X Syslog++; X break; X case 'v': X version = atoi(argv[++arg]); X if (version < 1 || version > 2){ X fprintf(stderr, "Invalid version\n"); X X printf("Usage: snmptrapd [-v 1] [-P #] [-p] [-s] [-e] [-d]\n"); X return(1); X } X break; X default: X printf("invalid option: -%c\n", argv[arg][1]); X printf("Usage: snmptrapd [-v 1] [-P #] [-p ] [-s] [-e] [-d]\n"); X break; X } X continue; X } X } X X myaddr = get_myaddr(); X srclen = dstlen = contextlen = MAX_NAME_LEN; X ms_party_init(myaddr, src, &srclen, dst, &dstlen, X context, &contextlen); X X if (version == 2){ X if (read_party_database("/etc/party.conf") > 0){ X fprintf(stderr, X "Couldn't read party database from /etc/party.conf\n"); X return(0); X } X if (read_context_database("/etc/context.conf") > 0){ X fprintf(stderr, X "Couldn't read context database from /etc/context.conf\n"); X return(0); X } X if (read_acl_database("/etc/acl.conf") > 0){ X fprintf(stderr, X "Couldn't read access control database from /etc/acl.conf\n"); X return(0); X } X } X X bzero((char *)&session, sizeof(struct snmp_session)); X session.peername = NULL; X if (version == 1){ X session.version = SNMP_VERSION_1; X } else if (version == 2){ X session.version = SNMP_VERSION_2; X } X session.srcPartyLen = 0; X session.dstPartyLen = 0; X session.retries = SNMP_DEFAULT_RETRIES; X session.timeout = SNMP_DEFAULT_TIMEOUT; X session.authenticator = NULL; X session.callback = snmp_input; X session.callback_magic = NULL; X if (port_flag) X session.local_port = local_port; X else X session.local_port = SNMP_TRAP_PORT; X ss = snmp_open(&session); X if (ss == NULL){ X printf("Couldn't open snmp\n"); X return(-1); X } X X while(1){ X numfds = 0; X FD_ZERO(&fdset); X numfds = sd + 1; X FD_SET(sd, &fdset); X block = 0; X tvp = &timeout; X timerclear(tvp); X tvp->tv_sec = 5; X snmp_select_info(&numfds, &fdset, tvp, &block); X if (block == 1) X tvp = NULL; /* block without timeout */ X count = select(numfds, &fdset, 0, 0, tvp); X gettimeofday(&Now, 0); X if (count > 0){ X snmp_read(&fdset); X } else switch(count){ X case 0: X snmp_timeout(); X break; X case -1: X if (errno == EINTR){ X continue; X } else { X perror("select"); X } X return -1; X default: X printf("select returned %d\n", count); X return -1; X } X } } X init_syslog(){ /* X * These definitions handle 4.2 systems without additional syslog facilities. X */ #ifndef LOG_CONS #define LOG_CONS 0 /* Don't bother if not defined... */ #endif #ifndef LOG_LOCAL0 #define LOG_LOCAL0 0 #endif X /* X * All messages will be logged to the local0 facility and will be sent to X * the console if syslog doesn't work. X */ X openlog("snmptrapd", LOG_CONS, LOG_LOCAL0); X syslog(LOG_INFO, "Starting snmptrapd"); } SHAR_EOF $shar_touch -am 1015123593 'snmp2/apps/snmptrapd.c' && chmod 0644 'snmp2/apps/snmptrapd.c' || echo 'restore of snmp2/apps/snmptrapd.c failed' shar_count="`wc -c < 'snmp2/apps/snmptrapd.c'`" test 13712 -eq "$shar_count" || echo "snmp2/apps/snmptrapd.c: original size 13712, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/Makefile.unix ============== if test -f 'snmp2/apps/Makefile.unix' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/Makefile.unix (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/Makefile.unix (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/Makefile.unix' && # # Makefile for snmpget, snmpwalk, snmpbulkwalk, snmptest, snmptranslate, # snmptrapd, snmptable # TARG= snmpwalk snmpbulkwalk snmptest snmptranslate snmpget snmptrapd LIBS= ../lib/libsnmp.a CFLAGS=-g -I../snmplib ${INCLUDES} -DDEBUG X all: $(TARG) X snmpwalk: snmpwalk.o ${LIBS} X ${CC} -o $@ snmpwalk.o ${LIBS} X snmpbulkwalk: snmpbulkwalk.o ${LIBS} X ${CC} -o $@ snmpbulkwalk.o ${LIBS} X snmptranslate: snmptranslate.o ${LIBS} X ${CC} -o $@ snmptranslate.o ${LIBS} X snmpget: snmpget.o ${LIBS} X ${CC} -o $@ snmpget.o ${LIBS} X snmptest: snmptest.o ${LIBS} X ${CC} -o $@ snmptest.o ${LIBS} X snmptrapd: snmptrapd.o ${LIBS} X ${CC} -o $@ snmptrapd.o ${LIBS} X clean: X rm -f *.o ${TARG} X install: X cp ${TARG} ../bin X snmpbulkwalk.o: ../snmplib/party.h snmpget.o: ../snmplib/party.h snmptest.o: ../snmplib/party.h snmptranslate.o: ../snmplib/party.h snmpwalk.o: ../snmplib/party.h snmptest.o: ../snmplib/party.h snmptable.o: ../snmplib/party.h SHAR_EOF $shar_touch -am 1015123593 'snmp2/apps/Makefile.unix' && chmod 0644 'snmp2/apps/Makefile.unix' || echo 'restore of snmp2/apps/Makefile.unix failed' shar_count="`wc -c < 'snmp2/apps/Makefile.unix'`" test 952 -eq "$shar_count" || echo "snmp2/apps/Makefile.unix: original size 952, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/Makefile.vxWorks ============== if test -f 'snmp2/apps/Makefile.vxWorks' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/Makefile.vxWorks (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/Makefile.vxWorks (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/Makefile.vxWorks' && # # Makefile for snmpget, snmpwalk, snmpbulkwalk, snmptest, snmptranslate, # snmptrapd, snmptable # TARG= snmpwalk snmpbulkwalk snmptest snmptranslate snmpget snmptrapd #LIBS= inet_vx.o random.o syslog.o strcasecmp.o ../lib/libsnmp.a LIBS= INCLUDES=-I${VXWORKS}/h -I../snmplib CFLAGS = -g ${INCLUDES} -DDEBUG -DCPU=MC68040 -DVXWORKS -c CC = cc68k X all: snmpget.o snmpwalk.o snmptest.o snmpbulkwalk.o # snmptrapd.o snmptranslate.o X X.c.o : X $(CC) $(CFLAGS) $< X X snmpwalk: snmpwalk.o ${LIBS} X ${CC} -o $@ snmpwalk.o ${LIBS} X snmpbulkwalk: snmpbulkwalk.o ${LIBS} X ${CC} -o $@ snmpbulkwalk.o ${LIBS} X snmptranslate: snmptranslate.o ${LIBS} X ${CC} -o $@ snmptranslate.o ${LIBS} X snmpget: snmpget.o ${LIBS} X ${CC} -o $@ snmpget.o ${LIBS} X snmptest: snmptest.o ${LIBS} X ${CC} -o $@ snmptest.o ${LIBS} X snmptrapd: snmptrapd.o ${LIBS} X ${CC} -o $@ snmptrapd.o ${LIBS} X clean: X rm -f *.o ${TARG} X install: X cp ${TARG} ../bin X snmpbulkwalk.o: ../snmplib/party.h snmpget.o: ../snmplib/party.h snmptest.o: ../snmplib/party.h snmptranslate.o: ../snmplib/party.h snmpwalk.o: ../snmplib/party.h snmptest.o: ../snmplib/party.h snmptable.o: ../snmplib/party.h SHAR_EOF $shar_touch -am 1015123593 'snmp2/apps/Makefile.vxWorks' && chmod 0644 'snmp2/apps/Makefile.vxWorks' || echo 'restore of snmp2/apps/Makefile.vxWorks failed' shar_count="`wc -c < 'snmp2/apps/Makefile.vxWorks'`" test 1164 -eq "$shar_count" || echo "snmp2/apps/Makefile.vxWorks: original size 1164, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/exec.c ============== if test -f 'snmp2/apps/exec.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/exec.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/exec.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/exec.c' && #include "vxWorks.h" /* vxWorks - specific definitions */ #include "symbol.h" /* symbol table definitions */ #include "symLib.h" /* symLib interface definitions */ #include "taskLib.h" /* task control block definitions */ #include "taskHookLib.h" /* task delete hook interface definitions */ #include "stdio.h" /* sprintf */ #include "string.h" /* strlen, strtok, etc. */ X IMPORT SYMTAB_ID sysSymTbl; /* The Id of the symbol table containing entry points */ X int nice(int tid, int priority){ X return taskPrioritySet(tid, priority); } X static const char *WHITE_SPACE = " \t\n"; X static void deleteHook(WIND_TCB *pTcb){ X (void)free((char *) pTcb->spare1); X (void)free((char *) pTcb->spare2); } X int exec( X char *commandLine /* command line to be executed */ X ){ X X /* Let's allocate some space for the arg vector and the locally-used entryName */ X char **argv = (char **) malloc(sizeof(argv[0])); /* start off with enough room for one pointer */ X char *entryName = (char *) malloc(strlen(commandLine)+1); /* keep an extra char for a '_' */ X X int retVal, argc = 0; /* the saved return value and the arg count */ X X SYM_TYPE dummy; /* We don't care about the symbol type */ X FUNCPTR entry; /* But we *do* need the entry point */ X X if(argv == NULL || entryName == NULL) /* any problems? barf */ X goto clean; X X sprintf(entryName, "_%s", commandLine); X X /* This is the sort of ugly code that the C language promotes*/ X /* We need to tokenize the command line, supstituting the NULL X character for white space. We also need to keep a count of the X tokens in argc, and a set of pointers to the tokens in argv. X We need to keep doing this until there are no more tokens, X in addition, we need to watch out in case we run out of X heap in the middle of the whole process. X */ X X argv[argc++] = (char *) strtok(&entryName[1], WHITE_SPACE); X do argv=(char**)realloc(argv, (argc+1)*sizeof(*argv)); X while(argv != NULL && (argv[argc++] = (char *) strtok(NULL, WHITE_SPACE)) != NULL); X X /* if we're out of memory */ X if(argv == NULL) X goto clean; X X /* Can't find the entry point? barf */ X if(symFindByName (sysSymTbl, entryName, (char **) &entry, &dummy) == ERROR) X goto clean; X X /* add delete hooks to clean up dynamic memory */ X /* This implementation is questionable, since we don't know X if spare 1 & 2 are already in use. X */ X taskTcb(taskIdSelf())->spare1 = (int) argv; X taskTcb(taskIdSelf())->spare2 = (int) entryName; X X if(taskDeleteHookAdd((FUNCPTR) deleteHook)==ERROR) X goto clean; X X /* fire up the routine */ X retVal = (*entry)(argc, argv); X X /* If the routine returns OK, we can free up the memory ourselves, X rather than waitin for the task hook */ X (void)taskDeleteHookDelete((FUNCPTR)deleteHook); X (void)free(argv); X (void)free(entryName); X X return retVal; X clean : X if(argv != NULL) free(argv); X if(entryName != NULL) free(entryName); X return ERROR; } SHAR_EOF $shar_touch -am 1015123593 'snmp2/apps/exec.c' && chmod 0644 'snmp2/apps/exec.c' || echo 'restore of snmp2/apps/exec.c failed' shar_count="`wc -c < 'snmp2/apps/exec.c'`" test 2987 -eq "$shar_count" || echo "snmp2/apps/exec.c: original size 2987, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/lib/.pure ============== if test ! -d 'snmp2/lib'; then echo 'x - creating directory snmp2/lib' mkdir 'snmp2/lib' fi if test -f 'snmp2/lib/.pure' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/lib/.pure (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/lib/.pure (empty)' > 'snmp2/lib/.pure' && $shar_touch -am 1015123593 'snmp2/lib/.pure' && chmod 0644 'snmp2/lib/.pure' || echo 'restore of snmp2/lib/.pure failed' shar_count="`wc -c < 'snmp2/lib/.pure'`" test 0 -eq "$shar_count" || echo "snmp2/lib/.pure: original size 0, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/Makefile ============== if test -f 'snmp2/Makefile' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/Makefile (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/Makefile (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/Makefile' && 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' && chmod 0644 'snmp2/Makefile' || echo 'restore of snmp2/Makefile failed' shar_count="`wc -c < 'snmp2/Makefile'`" test 1040 -eq "$shar_count" || echo "snmp2/Makefile: original size 1040, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/README ============== if test -f 'snmp2/README' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/README (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/README (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/README' && This code has been tested on a sparcstation (SUNOS4.1.1). It may not run on other Unix systems (but then again it may). When porting to a new processor architecture, read the first page of snmplib/md5.c and define LOWBYTEFIRST according to the instruction. X Run "make all install". X edit etc/acl.conf, etc/party.conf, etc/view.conf and /etc/context.conf to create parties for your site. Then copy these files to /etc on the each system that will be running either applications or agents. X setenv MIBFILE $root/mib.txt Where $root is the root directory of the SMP distribution. X The applications are in $root/bin and the documentation is in $root/man. X "setenv SUFFIX" changes the output format of many of the apps in a helpful manner. Try it. X X SNMP TCL X X If you want to use and/or compile SNMP TCL, read the README file in the snmptcl directory. SHAR_EOF $shar_touch -am 1015123693 'snmp2/README' && chmod 0644 'snmp2/README' || echo 'restore of snmp2/README failed' shar_count="`wc -c < 'snmp2/README'`" test 853 -eq "$shar_count" || echo "snmp2/README: original size 853, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/mib.txt ============== if test -f 'snmp2/mib.txt' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/mib.txt (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/mib.txt (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/mib.txt' && RFC1155-SMI DEFINITIONS ::= BEGIN; X nullOID OBJECT IDENTIFIER ::= { ccitt 0 } X internet OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 } X directory OBJECT IDENTIFIER ::= { internet 1 } X mgmt OBJECT IDENTIFIER ::= { internet 2 } X experimental OBJECT IDENTIFIER ::= { internet 3 } X private OBJECT IDENTIFIER ::= { internet 4 } X enterprises OBJECT IDENTIFIER ::= { private 1 } END X RFC1213-MIB DEFINITIONS ::= BEGIN X X IMPORTS X mgmt, NetworkAddress, IpAddress, Counter, Gauge, X TimeTicks X FROM RFC1155-SMI X OBJECT-TYPE X FROM RFC-1212; X X -- This MIB module uses the extended OBJECT-TYPE macro as X -- defined in [14]; X X -- MIB-II (same prefix as MIB-I) X X mib-2 OBJECT IDENTIFIER ::= { mgmt 1 } X X -- textual conventions X X DisplayString ::= X OCTET STRING X -- This data type is used to model textual information taken X -- from the NVT ASCII character set. By convention, objects X -- with this syntax are declared as having X X X -- X -- SIZE (0..255) X X PhysAddress ::= X OCTET STRING X -- This data type is used to model media addresses. For many X -- types of media, this will be in a binary representation. X -- For example, an ethernet address would be represented as X -- a string of 6 octets. X X -- groups in MIB-II X X system OBJECT IDENTIFIER ::= { mib-2 1 } X X interfaces OBJECT IDENTIFIER ::= { mib-2 2 } X X at OBJECT IDENTIFIER ::= { mib-2 3 } X X ip OBJECT IDENTIFIER ::= { mib-2 4 } X X icmp OBJECT IDENTIFIER ::= { mib-2 5 } X X tcp OBJECT IDENTIFIER ::= { mib-2 6 } X X udp OBJECT IDENTIFIER ::= { mib-2 7 } X X egp OBJECT IDENTIFIER ::= { mib-2 8 } X X -- historical (some say hysterical) X -- cmot OBJECT IDENTIFIER ::= { mib-2 9 } X X transmission OBJECT IDENTIFIER ::= { mib-2 10 } X X snmp OBJECT IDENTIFIER ::= { mib-2 11 } X X -- the System group X X -- Implementation of the System group is mandatory for all X -- systems. If an agent is not configured to have a value X -- for any of these variables, a string of length 0 is X -- returned. X X sysDescr OBJECT-TYPE X SYNTAX DisplayString (SIZE (0..255)) X ACCESS read-only X STATUS mandatory X X X DESCRIPTION X "A textual description of the entity. This value X should include the full name and version X identification of the system's hardware type, X software operating-system, and networking X software. It is mandatory that this only contain X printable ASCII characters." X ::= { system 1 } X X sysObjectID OBJECT-TYPE X SYNTAX OBJECT IDENTIFIER X ACCESS read-only X STATUS mandatory X DESCRIPTION X "The vendor's authoritative identification of the X network management subsystem contained in the X entity. This value is allocated within the SMI X enterprises subtree (1.3.6.1.4.1) and provides an X easy and unambiguous means for determining `what X kind of box' is being managed. For example, if X vendor `Flintstones, Inc.' was assigned the X subtree 1.3.6.1.4.1.4242, it could assign the X identifier 1.3.6.1.4.1.4242.1.1 to its `Fred X Router'." X ::= { system 2 } X X sysUpTime OBJECT-TYPE X SYNTAX TimeTicks X ACCESS read-only X STATUS mandatory X DESCRIPTION X "The time (in hundredths of a second) since the X network management portion of the system was last X re-initialized." X ::= { system 3 } X X sysContact OBJECT-TYPE X SYNTAX DisplayString (SIZE (0..255)) X ACCESS read-write X STATUS mandatory X DESCRIPTION X "The textual identification of the contact person X for this managed node, together with information X on how to contact this person." SHAR_EOF : || echo 'restore of snmp2/mib.txt failed' fi echo 'End of snmp2 part 10' echo 'File snmp2/mib.txt is continued in part 11' echo 11 > _sharseq.tmp exit 0