#!/bin/sh # This is `snmp2.07' (part 7 of snmp2). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `snmp2/snmplib/md5.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" != 7; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping snmp2/snmplib/md5.c' else echo 'x - continuing file snmp2/snmplib/md5.c' sed 's/^X//' << 'SHAR_EOF' >> 'snmp2/snmplib/md5.c' && X ff(A , B , C , D , 8 , fs1 , 1770035416); X ff(D , A , B , C , 9 , fs2 , 2336552879); X ff(C , D , A , B , 10 , fs3 , 4294925233); X ff(B , C , D , A , 11 , fs4 , 2304563134); X ff(A , B , C , D , 12 , fs1 , 1804603682); X ff(D , A , B , C , 13 , fs2 , 4254626195); X ff(C , D , A , B , 14 , fs3 , 2792965006); X ff(B , C , D , A , 15 , fs4 , 1236535329); X gg(A , B , C , D , 1 , gs1 , 4129170786); /* Round 2 */ X gg(D , A , B , C , 6 , gs2 , 3225465664); X gg(C , D , A , B , 11 , gs3 , 643717713); X gg(B , C , D , A , 0 , gs4 , 3921069994); X gg(A , B , C , D , 5 , gs1 , 3593408605); X gg(D , A , B , C , 10 , gs2 , 38016083); X gg(C , D , A , B , 15 , gs3 , 3634488961); X gg(B , C , D , A , 4 , gs4 , 3889429448); X gg(A , B , C , D , 9 , gs1 , 568446438); X gg(D , A , B , C , 14 , gs2 , 3275163606); X gg(C , D , A , B , 3 , gs3 , 4107603335); X gg(B , C , D , A , 8 , gs4 , 1163531501); X gg(A , B , C , D , 13 , gs1 , 2850285829); X gg(D , A , B , C , 2 , gs2 , 4243563512); X gg(C , D , A , B , 7 , gs3 , 1735328473); X gg(B , C , D , A , 12 , gs4 , 2368359562); X hh(A , B , C , D , 5 , hs1 , 4294588738); /* Round 3 */ X hh(D , A , B , C , 8 , hs2 , 2272392833); X hh(C , D , A , B , 11 , hs3 , 1839030562); X hh(B , C , D , A , 14 , hs4 , 4259657740); X hh(A , B , C , D , 1 , hs1 , 2763975236); X hh(D , A , B , C , 4 , hs2 , 1272893353); X hh(C , D , A , B , 7 , hs3 , 4139469664); X hh(B , C , D , A , 10 , hs4 , 3200236656); X hh(A , B , C , D , 13 , hs1 , 681279174); X hh(D , A , B , C , 0 , hs2 , 3936430074); X hh(C , D , A , B , 3 , hs3 , 3572445317); X hh(B , C , D , A , 6 , hs4 , 76029189); X hh(A , B , C , D , 9 , hs1 , 3654602809); X hh(D , A , B , C , 12 , hs2 , 3873151461); X hh(C , D , A , B , 15 , hs3 , 530742520); X hh(B , C , D , A , 2 , hs4 , 3299628645); X ii(A , B , C , D , 0 , is1 , 4096336452); /* Round 4 */ X ii(D , A , B , C , 7 , is2 , 1126891415); X ii(C , D , A , B , 14 , is3 , 2878612391); X ii(B , C , D , A , 5 , is4 , 4237533241); X ii(A , B , C , D , 12 , is1 , 1700485571); X ii(D , A , B , C , 3 , is2 , 2399980690); X ii(C , D , A , B , 10 , is3 , 4293915773); X ii(B , C , D , A , 1 , is4 , 2240044497); X ii(A , B , C , D , 8 , is1 , 1873313359); X ii(D , A , B , C , 15 , is2 , 4264355552); X ii(C , D , A , B , 6 , is3 , 2734768916); X ii(B , C , D , A , 13 , is4 , 1309151649); X ii(A , B , C , D , 4 , is1 , 4149444226); X ii(D , A , B , C , 11 , is2 , 3174756917); X ii(C , D , A , B , 2 , is3 , 718787259); X ii(B , C , D , A , 9 , is4 , 3951481745); X X MDp->buffer[0] += A; X MDp->buffer[1] += B; X MDp->buffer[2] += C; X MDp->buffer[3] += D; } X /* MDupdate(MDp,X,count) ** Input: MDp -- an MDptr ** X -- a pointer to an array of unsigned characters. ** count -- the number of bits of X to use. ** (if not a multiple of 8, uses high bits of last byte.) ** Update MDp using the number of bits of X given by count. ** This is the basic input routine for an MD5 user. ** The routine completes the MD computation when count < 512, so ** every MD computation should end with one call to MDupdate with a ** count less than 512. A call with count 0 will be ignored if the ** MD has already been terminated (done != 0), so an extra call with count ** 0 can be given as a ``courtesy close'' to force termination if desired. */ void MDupdate(MDp,X,count) MDptr MDp; unsigned char *X; unsigned int count; { unsigned int i, tmp, bit, byte, mask; X unsigned char XX[64]; X unsigned char *p; X /* return with no error if this is a courtesy close with count X ** zero and MDp->done is true. X */ X if (count == 0 && MDp->done) return; X /* check to see if MD is already done and report error */ X if (MDp->done) { printf("\nError: MDupdate MD already done."); return; } X /* Add count to MDp->count */ X tmp = count; X p = MDp->count; X while (tmp) X { tmp += *p; X *p++ = tmp; X tmp = tmp >> 8; X } X /* Process data */ X if (count == 512) X { /* Full block of data to handle */ X MDblock(MDp,(unsigned int *)X); X } X else if (count > 512) /* Check for count too large */ X { printf("\nError: MDupdate called with illegal count value %d.",count); X return; X } X else /* partial block -- must be last block so finish up */ X { /* Find out how many bytes and residual bits there are */ X byte = count >> 3; X bit = count & 7; X /* Copy X into XX since we need to modify it */ X for (i=0;i<=byte;i++) XX[i] = X[i]; X for (i=byte+1;i<64;i++) XX[i] = 0; X /* Add padding '1' bit and low-order zeros in last byte */ X mask = 1 << (7 - bit); X XX[byte] = (XX[byte] | mask) & ~( mask - 1); X /* If room for bit count, finish up with this block */ X if (byte <= 55) X { for (i=0;i<8;i++) XX[56+i] = MDp->count[i]; X MDblock(MDp,(unsigned int *)XX); X } X else /* need to do two blocks to finish up */ X { MDblock(MDp,(unsigned int *)XX); X for (i=0;i<56;i++) XX[i] = 0; X for (i=0;i<8;i++) XX[56+i] = MDp->count[i]; X MDblock(MDp,(unsigned int *)XX); X } X /* Set flag saying we're done with MD computation */ X MDp->done = 1; X } } X /* ** End of md5.c ****************************(cut)*****************************************/ SHAR_EOF echo 'File snmp2/snmplib/md5.c is complete' && $shar_touch -am 1015123593 'snmp2/snmplib/md5.c' && chmod 0644 'snmp2/snmplib/md5.c' || echo 'restore of snmp2/snmplib/md5.c failed' shar_count="`wc -c < 'snmp2/snmplib/md5.c'`" test 10642 -eq "$shar_count" || echo "snmp2/snmplib/md5.c: original size 10642, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/md5.h ============== if test -f 'snmp2/snmplib/md5.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/md5.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/md5.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/md5.h' && /* ** ************************************************************************** ** md5.h -- Header file for implementation of MD5 Message Digest Algorithm ** ** Updated: 2/13/90 by Ronald L. Rivest ** ** (C) 1990 RSA Data Security, Inc. ** ** ************************************************************************** */ X /* MDstruct is the data structure for a message digest computation. */ typedef struct { X unsigned int buffer[4]; /* Holds 4-word result of MD computation */ X unsigned char count[8]; /* Number of bits processed so far */ X unsigned int done; /* Nonzero means MD computation finished */ } MDstruct, *MDptr; X /* MDbegin(MD) ** Input: MD -- an MDptr ** Initialize the MDstruct prepatory to doing a message digest computation. */ extern void MDbegin(); X /* MDupdate(MD,X,count) ** Input: MD -- an MDptr ** X -- a pointer to an array of unsigned characters. ** count -- the number of bits of X to use (an unsigned int). ** Updates MD using the first ``count'' bits of X. ** The array pointed to by X is not modified. ** If count is not a multiple of 8, MDupdate uses high bits of last byte. ** This is the basic input routine for a user. ** The routine terminates the MD computation when count < 512, so ** every MD computation should end with one call to MDupdate with a ** count less than 512. Zero is OK for a count. */ extern void MDupdate(); X /* MDprint(MD) ** Input: MD -- an MDptr ** Prints message digest buffer MD as 32 hexadecimal digits. ** Order is from low-order byte of buffer[0] to high-order byte of buffer[3]. ** Each byte is printed with high-order hexadecimal digit first. */ extern void MDprint(); X /* ** End of md5.h ****************************(cut)*****************************************/ SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/md5.h' && chmod 0644 'snmp2/snmplib/md5.h' || echo 'restore of snmp2/snmplib/md5.h failed' shar_count="`wc -c < 'snmp2/snmplib/md5.h'`" test 1844 -eq "$shar_count" || echo "snmp2/snmplib/md5.h: original size 1844, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/context.h ============== if test -f 'snmp2/snmplib/context.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/context.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/context.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/context.h' && /* X contextIdentity Context, X contextIndex INTEGER, X contextViewIndex INTEGER, X contextLocalEntity OCTET STRING, X contextLocalTime OBJECT IDENTIFIER, X contextDstPartyIndex INTEGER, X contextSrcPartyIndex INTEGER, X contextProxyContext OBJECT IDENTIFIER X contextStorageType StorageType, X contextStatus RowStatus X */ X #define CONTEXTIDENTITY 1 #define CONTEXTINDEX 2 #define CONTEXTLOCAL 3 #define CONTEXTVIEWINDEX 4 #define CONTEXTLOCALENTITY 5 #define CONTEXTLOCALTIME 6 #define CONTEXTDSTPARTYINDEX 7 #define CONTEXTSRCPARTYINDEX 8 #define CONTEXTPROXYCONTEXT 9 #define CONTEXTSTORAGETYPE 10 #define CONTEXTSTATUS 11 X #define CONTEXTNONEXISTENT 0 #define CONTEXTACTIVE 1 #define CONTEXTNOTINSERVICE 2 #define CONTEXTNOTREADY 3 #define CONTEXTCREATEANDGO 4 #define CONTEXTCREATEANDWAIT 5 #define CONTEXTDESTROY 6 X X #define CURRENTTIME 1 #define RESTARTTIME 2 #define CACHETIME 3 /* not implemented */ X struct contextEntry { X oid contextIdentity[32]; X int contextIdentityLen; X int contextIndex; X char contextName[64]; /* friendly name */ X int contextLocal; X int contextViewIndex; X u_char contextLocalEntity[64]; X int contextLocalEntityLen; X int contextLocalTime; X int contextDstPartyIndex; X int contextSrcPartyIndex; X oid contextProxyContext[32]; X int contextProxyContextLen; X int contextStorageType; X int contextStatus; X X u_long contextBitMask; X X struct contextEntry *reserved; X struct contextEntry *next; X struct timeval tv; }; X u_char *var_context(); int write_context(); X struct contextEntry * context_getEntry(/* oid *contextID, int contextIDLen */); /* X * Returns a pointer to the contextEntry with the X * same identity as contextID. X * Returns NULL if that entry does not exist. X */ X int context_scanInit(); /* X * Initialized the scan routines so that they will begin at the X * beginning of the list of contextEntries. X * X */ X X struct contextEntry * context_scanNext(); /* X * Returns a pointer to the next contextEntry. X * These entries are returned in no particular order, X * but if N entries exist, N calls to context_scanNext() will X * return all N entries once. X * Returns NULL if all entries have been returned. X * context_scanInit() starts the scan over. X */ X struct contextEntry * context_createEntry(/* oid *contextID, int contextIDLen */); /* X * Creates a contextEntry with the given index X * and returns a pointer to it. X * The status of this entry is created as invalid. X */ X X SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/context.h' && chmod 0644 'snmp2/snmplib/context.h' || echo 'restore of snmp2/snmplib/context.h failed' shar_count="`wc -c < 'snmp2/snmplib/context.h'`" test 2627 -eq "$shar_count" || echo "snmp2/snmplib/context.h: original size 2627, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/context.c ============== if test -f 'snmp2/snmplib/context.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/context.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/context.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/context.c' && #ifdef VXWORKS #include "VXtypes.h" #include "VXtime.h" #else #include #include #endif X #include "asn1.h" #define NULL 0 #include "context.h" X X X static struct contextEntry *List = NULL, *ScanPtr = NULL; static struct contextEntry *cache[2]; static int cachePtr; static int NextIndex = 1; X struct contextEntry * context_getEntry(contextID, contextIDLen) X oid *contextID; X int contextIDLen; { X struct contextEntry *cp; X X /* do I need a cache of two contexts??? */ X cp = cache[0]; X if (cp && contextIDLen == cp->contextIdentityLen X && !bcmp((char *)cp->contextIdentity, (char *)contextID, X contextIDLen * sizeof(oid))){ X return cp; X } X cp = cache[1]; X if (cp && contextIDLen == cp->contextIdentityLen X && !bcmp((char *)cp->contextIdentity, (char *)contextID, X contextIDLen * sizeof(oid))){ X return cp; X } X for(cp = List; cp; cp = cp->next){ X if (contextIDLen == cp->contextIdentityLen X && !bcmp((char *)cp->contextIdentity, (char *)contextID, X contextIDLen * sizeof(oid))){ X cachePtr ^= 1; X cache[cachePtr] = cp; X return cp; X } X } X return NULL; } X context_scanInit() { X ScanPtr = List; } X struct contextEntry * context_scanNext() { X struct contextEntry *returnval; X X returnval = ScanPtr; X if (ScanPtr != NULL) X ScanPtr = ScanPtr->next; X return returnval; } X struct contextEntry * context_createEntry(contextID, contextIDLen) X oid *contextID; X int contextIDLen; { X struct contextEntry *cp; X X cp = (struct contextEntry *)malloc(sizeof(struct contextEntry)); X bzero((char *)cp, sizeof(struct contextEntry)); X X bcopy((char *)contextID, (char *)cp->contextIdentity, X contextIDLen * sizeof(oid)); X cp->contextIdentityLen = contextIDLen; X cp->contextIndex = NextIndex++; X cp->reserved = (struct contextEntry *)malloc(sizeof(struct contextEntry)); X bzero((char *)cp->reserved, sizeof(struct contextEntry)); X X cp->next = List; X List = cp; X return cp; } X context_destroyEntry(contextID, contextIDLen) X oid *contextID; X int contextIDLen; { X struct contextEntry *cp, *lastcp; X X if (List->contextIdentityLen == contextIDLen X && !bcmp((char *)List->contextIdentity, (char *)contextID, X contextIDLen * sizeof(oid))){ X cp = List; X List = List->next; X } else { X for(cp = List; cp; cp = cp->next){ X if (cp->contextIdentityLen == contextIDLen X && !bcmp((char *)cp->contextIdentity, (char *)contextID, X contextIDLen * sizeof(oid))) X break; X lastcp = cp; X } X if (!cp) X return; X lastcp->next = cp->next; X } X if (cp->reserved) X free((char *)cp->reserved); X free(cp); X return; } X SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/context.c' && chmod 0644 'snmp2/snmplib/context.c' || echo 'restore of snmp2/snmplib/context.c failed' shar_count="`wc -c < 'snmp2/snmplib/context.c'`" test 2667 -eq "$shar_count" || echo "snmp2/snmplib/context.c: original size 2667, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/context_parse.c ============== if test -f 'snmp2/snmplib/context_parse.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/context_parse.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/context_parse.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/context_parse.c' && #include #include X #ifdef VXWORKS #include "VXtime.h" #else #include #include #endif X #include #include #include #include #include #include #include "asn1.h" #include "context.h" #include "system.h" X #define TRUE 1 #define FALSE 0 X #define IDENTITY_STATE 1 #define VIEW_STATE 2 #define PROXY_STATE 3 X static error_exit(str, linenumber, filename) X char *str; X int linenumber; X char *filename; { X fprintf(stderr, "%s on line %d of %s\n", str, linenumber, filename); X exit(1); } X int read_context_database(filename) X char *filename; { X FILE *fp; X char buf[256], buf1[256], buf2[256], buf3[256]; X char *cp; X int blank, nonhex; X int linenumber = 0, chars = 0, clock_pos; X int state = IDENTITY_STATE; X oid contextid[64]; X int contextidlen; X int view, entityLen, time; X u_char entity[64]; X int dstParty, srcParty, proxyIdLen; X oid proxyId[64]; X char name[64]; /* friendly name */ X struct contextEntry *cxp, *rp; X u_long myaddr; X int diff; X X fp = fopen(filename, "r"); X if (fp == NULL) X return -1; X while (fgets(buf, 256, fp)){ X linenumber++; X if (strlen(buf) > 250) X error_exit("Line longer than 250 bytes", linenumber, filename); X chars += strlen(buf); X if (buf[0] == '#') X continue; X blank = TRUE; X for(cp = buf; *cp; cp++) X if (!isspace(*cp)){ X blank = FALSE; X break; X } X if (blank) X continue; X switch(state){ X case IDENTITY_STATE: X if (sscanf(buf, "%s %s", name, buf1) != 2) X error_exit("Bad parse", linenumber, filename); X contextidlen = 64; X if (!read_objid(buf1, contextid, &contextidlen)) X error_exit("Bad object identifier", linenumber, filename); X state = VIEW_STATE; X break; X case VIEW_STATE: X if (sscanf(buf, "%s %s %s", buf1, entity, buf3) != 3) X error_exit("Bad parse", linenumber, filename); X for(cp = buf1; *cp; cp++) X if (!isdigit(*cp)) X error_exit("Not a view index", linenumber, filename); X view = atoi(buf1); X if (!strcasecmp(entity, "Null")) X entityLen = 0; X if (!strcasecmp(buf3, "currentTime")) X time = CURRENTTIME; X else if (!strcasecmp(buf3, "restartTime")) X time = RESTARTTIME; X else X error_exit("Bad local time", linenumber, filename); X state = PROXY_STATE; X break; X case PROXY_STATE: X if (sscanf(buf, "%s %s %s", buf1, buf2, buf3) != 3) X error_exit("Bad parse", linenumber, filename); X for(cp = buf1; *cp; cp++) X if (!isdigit(*cp)) X error_exit("Bad destination party index", linenumber, X filename); X dstParty = atoi(buf1); X X for(cp = buf1; *cp; cp++) X if (!isdigit(*cp)) X error_exit("Bad source party index", linenumber, filename); X srcParty = atoi(buf2); X X proxyIdLen = 64; X if (!read_objid(buf3, proxyId, &proxyIdLen)) X error_exit("Bad object identifier", linenumber, filename); X X state = IDENTITY_STATE; X X cxp = context_getEntry(contextid, contextidlen); X if (!cxp) X cxp = context_createEntry(contextid, contextidlen); X rp = cxp->reserved; X strcpy(cxp->contextName, name); X myaddr = get_myaddr(); X /* XXX It's bogus to figure out if it is local X by testing the ipaddress in the context - fix this XXX */ X diff = ((myaddr & 0xFF000000) >> 24) ^ contextid[9]; X diff |= ((myaddr & 0x00FF0000) >> 16) ^ contextid[10]; X diff |= ((myaddr & 0x0000FF00) >> 8) ^ contextid[11]; X diff |= (myaddr & 0x000000FF) ^ contextid[12]; X if (!diff){ X /* context is local */ X cxp->contextLocal = 1; /* TRUE */ X } else { X cxp->contextLocal = 2; /* FALSE */ X } X cxp->contextViewIndex = view; X bcopy(entity, cxp->contextLocalEntity, entityLen); X cxp->contextLocalEntityLen = entityLen; X cxp->contextLocalTime = time; X cxp->contextDstPartyIndex = dstParty; X cxp->contextSrcPartyIndex = srcParty; X bcopy(proxyId, cxp->contextProxyContext, proxyIdLen * sizeof(oid)); X cxp->contextProxyContextLen = proxyIdLen; X cxp->contextStorageType = 2; X cxp->contextStatus = rp->contextStatus = CONTEXTACTIVE; #define CONTEXTCOMPLETE_MASK 0x03FF X /* all collumns - from context_vars.c XXX */ X cxp->contextBitMask = rp->contextBitMask = CONTEXTCOMPLETE_MASK; X break; X default: X error_exit("unknown state", linenumber, filename); X } X } X if (state != IDENTITY_STATE) X error_exit("Unfinished entry at EOF", linenumber, filename); X fclose(fp); X return 0; } SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/context_parse.c' && chmod 0644 'snmp2/snmplib/context_parse.c' || echo 'restore of snmp2/snmplib/context_parse.c failed' shar_count="`wc -c < 'snmp2/snmplib/context_parse.c'`" test 4536 -eq "$shar_count" || echo "snmp2/snmplib/context_parse.c: original size 4536, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/system.c ============== if test -f 'snmp2/snmplib/system.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/system.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/system.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/system.c' && /*********************************************************** X Copyright 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 * System dependent routines go here X */ #include X #ifdef VXWORKS #include "VXtime.h" #else #include #endif X #include #include #include #include X #ifdef VXWORKS #if 0 #include "VXnlist.h" #include #endif #else #include #include #endif X #include "system.h" 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 #ifdef VXWORKS /* X * Returns uptime in centiseconds(!). X */ long get_uptime() { X return ((tickGet () * 100) / sysClkRateGet ()); X } X #else struct nlist nl[] = { X { "_boottime" }, X { "" } }; X /* X * Returns uptime in centiseconds(!). X */ long get_uptime(){ X struct timeval boottime, now, diff; X int kmem; X X if ((kmem = open("/dev/kmem", 0)) < 0) X return 0; X nlist("/vmunix", nl); X if (nl[0].n_type == 0){ X close(kmem); X return 0; X } X X lseek(kmem, (long)nl[0].n_value, L_SET); X read(kmem, &boottime, sizeof(boottime)); X close(kmem); X X gettimeofday(&now, 0); X now.tv_sec--; X now.tv_usec += 1000000L; X diff.tv_sec = now.tv_sec - boottime.tv_sec; X diff.tv_usec = now.tv_usec - boottime.tv_usec; X if (diff.tv_usec > 1000000L){ X diff.tv_usec -= 1000000L; X diff.tv_sec++; X } X return ((diff.tv_sec * 100) + (diff.tv_usec / 10000)); } #endif X X SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/system.c' && chmod 0644 'snmp2/snmplib/system.c' || echo 'restore of snmp2/snmplib/system.c failed' shar_count="`wc -c < 'snmp2/snmplib/system.c'`" test 3628 -eq "$shar_count" || echo "snmp2/snmplib/system.c: original size 3628, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/system.h ============== if test -f 'snmp2/snmplib/system.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/system.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/system.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/system.h' && /*********************************************************** X Copyright 1993 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 * Definitions for the system dependent library file X */ u_long get_myaddr(); long get_uptime(); SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/system.h' && chmod 0644 'snmp2/snmplib/system.h' || echo 'restore of snmp2/snmplib/system.h failed' shar_count="`wc -c < 'snmp2/snmplib/system.h'`" test 1202 -eq "$shar_count" || echo "snmp2/snmplib/system.h: original size 1202, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/.pure ============== if test -f 'snmp2/snmplib/.pure' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/.pure (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/.pure (empty)' > 'snmp2/snmplib/.pure' && $shar_touch -am 1015123593 'snmp2/snmplib/.pure' && chmod 0644 'snmp2/snmplib/.pure' || echo 'restore of snmp2/snmplib/.pure failed' shar_count="`wc -c < 'snmp2/snmplib/.pure'`" test 0 -eq "$shar_count" || echo "snmp2/snmplib/.pure: original size 0, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/Makefile.vxWorks ============== if test -f 'snmp2/snmplib/Makefile.vxWorks' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/Makefile.vxWorks (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/Makefile.vxWorks (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/Makefile.vxWorks' && # # Makefile for snmplib # TARG= libsnmp.a CSRCS= snmp_client.c mib.c parse.c snmp_api.c snmp.c snmp_auth.c asn1.c md5.c party.c context.c acl.c view.c party_parse.c context_parse.c acl_parse.c system.c OBJS= snmp_client.o mib.o parse.o snmp_api.o snmp.o snmp_auth.o asn1.o md5.o party.o context.o acl.o view.o party_parse.o context_parse.o acl_parse.o system.o X INCLUDES = -I$(VXWORKS)/h CFLAGS=-g -DDEBUG $(INCLUDES) -DCPU=MC68040 -DVXWORKS -c X CC = cc68k LNK = ld68k LDFLAGS = -X -r AOUT_CONVERT = /bin/cat X all: $(TARG) X X.c.o : X $(CC) $(CFLAGS) $< X libsnmp.a: ${OBJS} # $(LNK) $(LDFLAGS) -y __iob $(OBJS) # ver 5.0 X $(LNK) $(LDFLAGS) $(OBJS) # ver 5.1 X $(AOUT_CONVERT) < a.out > $@ X rm -f a.out X install: ../lib/libsnmp.a X X../lib/libsnmp.a: libsnmp.a X cp libsnmp.a ../lib # ranlib ../lib/libsnmp.a X X lint: X lint -nhx $(CSRCS) X clean: X rm -f ${OBJS} ${TARG} X rm -f ../lib/${TARG} X asn1.o: ./asn1.h mib.o: ./asn1.h mib.o: ./snmp_impl.h mib.o: ./snmp_api.h mib.o: ./parse.h parse.o: ./parse.h snmp.o: ./asn1.h snmp.o: ./snmp.h snmp.o: ./snmp_impl.h snmp.o: ./mib.h snmp_api.o: ./asn1.h snmp_api.o: ./snmp.h snmp_api.o: ./snmp_impl.h snmp_api.o: ./snmp_api.h snmp_auth.o: ./asn1.h snmp_auth.o: ./snmp.h snmp_auth.o: ./snmp_impl.h snmp_auth.o: ./party.h snmp_auth.o: ./context.h snmp_auth.o: ./md5.h snmp_client.o: ./asn1.h snmp_client.o: ./snmp.h snmp_client.o: ./snmp_impl.h snmp_client.o: ./snmp_api.h snmp_client.o: ./snmp_client.h md5.o: ./md5.h party.o: ./party.h ./asn1.h acl.o: ./acl.h ./asn1.h view.o: ./view.h ./asn1.h party_parse.o: ./asn1.h ./party.h context_parse.o: ./asn1.h ./context.h acl_parse.o: ./asn1.h ./acl.h system.o: ./system.h SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/Makefile.vxWorks' && chmod 0644 'snmp2/snmplib/Makefile.vxWorks' || echo 'restore of snmp2/snmplib/Makefile.vxWorks failed' shar_count="`wc -c < 'snmp2/snmplib/Makefile.vxWorks'`" test 1657 -eq "$shar_count" || echo "snmp2/snmplib/Makefile.vxWorks: original size 1657, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/Makefile.unix ============== if test -f 'snmp2/snmplib/Makefile.unix' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/Makefile.unix (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/Makefile.unix (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/Makefile.unix' && # # Makefile for snmplib # TARG= libsnmp.a CSRCS= snmp_client.c mib.c parse.c snmp_api.c snmp.c snmp_auth.c asn1.c md5.c party.c context.c acl.c view.c party_parse.c context_parse.c acl_parse.c system.c OBJS= snmp_client.o mib.o parse.o snmp_api.o snmp.o snmp_auth.o asn1.o md5.o party.o context.o acl.o view.o party_parse.o context_parse.o acl_parse.o system.o CFLAGS=-g -DDEBUG CC = cc X all: $(TARG) X libsnmp.a: ${OBJS} X ar r libsnmp.a ${OBJS} X ranlib libsnmp.a X install: ../lib/libsnmp.a X X../lib/libsnmp.a: libsnmp.a X cp libsnmp.a ../lib X ranlib ../lib/libsnmp.a X X lint: X lint -nhx $(CSRCS) X clean: X rm -f ${OBJS} ${TARG} X rm -f ../lib/${TARG} X asn1.o: ./asn1.h mib.o: ./asn1.h mib.o: ./snmp_impl.h mib.o: ./snmp_api.h mib.o: ./parse.h parse.o: ./parse.h snmp.o: ./asn1.h snmp.o: ./snmp.h snmp.o: ./snmp_impl.h snmp.o: ./mib.h snmp_api.o: ./asn1.h snmp_api.o: ./snmp.h snmp_api.o: ./snmp_impl.h snmp_api.o: ./snmp_api.h snmp_auth.o: ./asn1.h snmp_auth.o: ./snmp.h snmp_auth.o: ./snmp_impl.h snmp_auth.o: ./party.h snmp_auth.o: ./context.h snmp_auth.o: ./md5.h snmp_client.o: ./asn1.h snmp_client.o: ./snmp.h snmp_client.o: ./snmp_impl.h snmp_client.o: ./snmp_api.h snmp_client.o: ./snmp_client.h md5.o: ./md5.h party.o: ./party.h ./asn1.h acl.o: ./acl.h ./asn1.h view.o: ./view.h ./asn1.h party_parse.o: ./asn1.h ./party.h context_parse.o: ./asn1.h ./context.h acl_parse.o: ./asn1.h ./acl.h system.o: ./system.h SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/Makefile.unix' && chmod 0644 'snmp2/snmplib/Makefile.unix' || echo 'restore of snmp2/snmplib/Makefile.unix failed' shar_count="`wc -c < 'snmp2/snmplib/Makefile.unix'`" test 1418 -eq "$shar_count" || echo "snmp2/snmplib/Makefile.unix: original size 1418, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/VXnetdb.h ============== if test -f 'snmp2/snmplib/VXnetdb.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/VXnetdb.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/VXnetdb.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/VXnetdb.h' && /* X * VXnetdb.h X * X * since netdb functions are not supported by vxWorks, X * our own implementations are provided for the calls X * needed. This is a subset of the UNIX netdb.h that X * defines the support routines necessary for this code. X */ X /* X * Structures returned by network X * data base library. All addresses X * are supplied in host order, and X * returned in network order (suitable X * for use in system calls). X */ struct hostent { X char *h_name; /* official name of host */ X char **h_aliases; /* alias list */ X int h_addrtype; /* host address type */ X int h_length; /* length of address */ X char **h_addr_list; /* list of addresses from name server */ #define h_addr h_addr_list[0] /* address, for backward compatiblity */ }; X struct servent { X char *s_name; /* official service name */ X char **s_aliases; /* alias list */ X int s_port; /* port # */ X char *s_proto; /* protocol to use */ }; X struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent(); struct servent *getservbyname(), *getservbyport(), *getservent(); SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/VXnetdb.h' && chmod 0644 'snmp2/snmplib/VXnetdb.h' || echo 'restore of snmp2/snmplib/VXnetdb.h failed' shar_count="`wc -c < 'snmp2/snmplib/VXnetdb.h'`" test 1041 -eq "$shar_count" || echo "snmp2/snmplib/VXnetdb.h: original size 1041, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/VXnlist.h ============== if test -f 'snmp2/snmplib/VXnlist.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/VXnlist.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/VXnlist.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/VXnlist.h' && /* X * VXnlist.h X * X * vxworks does not supply nlist.h. This is a subset. X */ #ifndef _VXnlist_h #define _VXnlist_h X struct nlist { X char *n_name; /* for use when in-core */ X unsigned char n_type; /* type flag, i.e. N_TEXT etc; see below */ X char n_other; /* unused */ X short n_desc; /* see */ X unsigned long n_value; /* value of this symbol (or sdb offset) */ }; #define n_hash n_desc /* used internally by ld */ X #endif SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/VXnlist.h' && chmod 0644 'snmp2/snmplib/VXnlist.h' || echo 'restore of snmp2/snmplib/VXnlist.h failed' shar_count="`wc -c < 'snmp2/snmplib/VXnlist.h'`" test 512 -eq "$shar_count" || echo "snmp2/snmplib/VXnlist.h: original size 512, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/VXtime.h ============== if test -f 'snmp2/snmplib/VXtime.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/VXtime.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/VXtime.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/VXtime.h' && /* X * VXtime.h X * X * wrapper for vxworks times.h and additional functionality that X * is not provided by the vxworks header file. X */ X #ifndef _VXtime_h #define _VXtime_h X #include #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) #define timercmp(tvp, uvp, cmp) \ X ((tvp)->tv_sec cmp (uvp)->tv_sec || \ X (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 X #endif SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/VXtime.h' && chmod 0644 'snmp2/snmplib/VXtime.h' || echo 'restore of snmp2/snmplib/VXtime.h failed' shar_count="`wc -c < 'snmp2/snmplib/VXtime.h'`" test 469 -eq "$shar_count" || echo "snmp2/snmplib/VXtime.h: original size 469, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/VXtypes.h ============== if test -f 'snmp2/snmplib/VXtypes.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/VXtypes.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/VXtypes.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/VXtypes.h' && /* X * VXtypes.h X * X * wrapper for vxWorks 5.1 types.h so that it defines the X * needed values for this code. X */ #ifndef _VXtypes_h #define _VXtypes_h X #include #include X #endif SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/VXtypes.h' && chmod 0644 'snmp2/snmplib/VXtypes.h' || echo 'restore of snmp2/snmplib/VXtypes.h failed' shar_count="`wc -c < 'snmp2/snmplib/VXtypes.h'`" test 203 -eq "$shar_count" || echo "snmp2/snmplib/VXtypes.h: original size 203, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/VXif_ether.h ============== if test -f 'snmp2/snmplib/VXif_ether.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/VXif_ether.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/VXif_ether.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/VXif_ether.h' && /* X * VXif_ether.h X * X * wrapper for vxWorks if_ether.h to include stuff not defined by WRS X */ X /* definition of ether_addr, for ethers(3n) */ struct ether_addr { X u_char ether_addr_octet[6]; }; X #include SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/VXif_ether.h' && chmod 0644 'snmp2/snmplib/VXif_ether.h' || echo 'restore of snmp2/snmplib/VXif_ether.h failed' shar_count="`wc -c < 'snmp2/snmplib/VXif_ether.h'`" test 229 -eq "$shar_count" || echo "snmp2/snmplib/VXif_ether.h: original size 229, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/VXparam.h ============== if test -f 'snmp2/snmplib/VXparam.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/VXparam.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/VXparam.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/VXparam.h' && /* X * VXparam.h X * X * impementation of needed values from param.h to make snmpd port to vxWorks. X */ #define CLSIZE 1 #define NBPG 4096 SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/VXparam.h' && chmod 0644 'snmp2/snmplib/VXparam.h' || echo 'restore of snmp2/snmplib/VXparam.h failed' shar_count="`wc -c < 'snmp2/snmplib/VXparam.h'`" test 138 -eq "$shar_count" || echo "snmp2/snmplib/VXparam.h: original size 138, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/#snmp_impl.h# ============== if test -f 'snmp2/snmplib/#snmp_impl.h#' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/#snmp_impl.h# (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/#snmp_impl.h# (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/#snmp_impl.h#' && /* X * Definitions for SNMP (RFC 1067) implementation. X * X * X */ /*********************************************************** X Copyright 1988, 1989 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 X #if (defined vax) || (defined (mips)) /* X * This is a fairly bogus thing to do, but there seems to be no better way for X * compilers that don't understand void pointers. X */ #define void char #endif X /* X * Error codes: X */ /* X * These must not clash with SNMP error codes (all positive). X */ #define PARSE_ERROR -1 #define BUILD_ERROR -2 X #define COMMUNITY_MAX_LEN 64 #define MAX_NAME_LEN 128 /* number of subid's in a objid */ X #ifndef NULL #define NULL 0 #endif X #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif X struct packet_info { X int version; X u_char pdutype; X X /* community based authentication */ X u_char community[COMMUNITY_MAX_LEN + 1]; X int community_len; X int community_id; X X /* snmp security based authentication */ X oid srcParty[64]; X oid dstParty[64]; X oid context[64]; X int srcPartyLength; X int dstPartyLength; X int contextLength; X struct partyEntry *srcp, *dstp; X struct contextEntry *cxp; X X u_char *packet_end; }; X #define READ 1 #define WRITE 0 X #define RESERVE1 0 #define RESERVE2 1 #define COMMIT 2 #define ACTION 3 #define FREE 4 X /* See important comment in snmp_vars.c relating to a change X in the way the access control word is interpreted */ #define RONLY 0xAAAA /* read access for everyone */ #define RWRITE 0xAABB /* add write access for community private */ #define NOACCESS 0x0000 /* no access for anybody */ X #define INTEGER ASN_INTEGER #define STRING ASN_OCTET_STR #define OBJID ASN_OBJECT_ID #define NULLOBJ ASN_NULL #define BITSTRING ASN_BIT_STR X /* defined types (from the SMI, RFC 1157) */ #define IPADDRESS (ASN_APPLICATION | 0) #define COUNTER (ASN_APPLICATION | 1) #define GAUGE (ASN_APPLICATION | 2) #define TIMETICKS (ASN_APPLICATION | 3) #define OPAQUE (ASN_APPLICATION | 4) X /* defined types (from the SMI, RFC ????) */ #define NSAP (ASN_APPLICATION | 5) #define COUNTER64 (ASN_APPLICATION | 6) #define UINTEGER (ASN_APPLICATION | 7) X struct trapVar { X oid *varName; X int varNameLen; X u_char varType; X int varLen; X u_char *varVal; X struct trapVar *next; }; X #ifdef DEBUG X #define ERROR(string) printf("%s(%d): %s\n",__FILE__, __LINE__, string); #else #define ERROR(string) #endif X /* from snmp.c*/ extern u_char sid[]; /* size SID_MAX_LEN */ X u_char *snmp_parse_var_op(); u_char *snmp_build_var_op(); X /* X * For calling secauth_build, FIRST_PASS is an indication that a new nonce X * and lastTimeStamp should be recorded. LAST_PASS is an indication that X * the packet should be checksummed and encrypted if applicable, in X * preparation for transmission. X * 0 means do neither, FIRST_PASS | LAST_PASS means do both. X * For secauth_parse, FIRST_PASS means decrypt the packet, otherwise leave it X * alone. LAST_PASS is ignored. X */ #define FIRST_PASS 1 #define LAST_PASS 2 u_char *snmp_auth_parse(); u_char *snmp_auth_build(); X u_char *snmp_secauth_parse(); u_char *snmp_secauth_build(); X X int has_access(); SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/#snmp_impl.h#' && chmod 0644 'snmp2/snmplib/#snmp_impl.h#' || echo 'restore of snmp2/snmplib/#snmp_impl.h# failed' shar_count="`wc -c < 'snmp2/snmplib/#snmp_impl.h#'`" test 4222 -eq "$shar_count" || echo "snmp2/snmplib/#snmp_impl.h#: original size 4222, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/Makefile ============== if test ! -d 'snmp2/apps'; then echo 'x - creating directory snmp2/apps' mkdir 'snmp2/apps' fi if test -f 'snmp2/apps/Makefile' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/Makefile (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/Makefile (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/Makefile' && # # 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' && chmod 0644 'snmp2/apps/Makefile' || echo 'restore of snmp2/apps/Makefile failed' shar_count="`wc -c < 'snmp2/apps/Makefile'`" test 952 -eq "$shar_count" || echo "snmp2/apps/Makefile: original size 952, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/apps/snmpget.c ============== if test -f 'snmp2/apps/snmpget.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/apps/snmpget.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/apps/snmpget.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/apps/snmpget.c' && /* X * snmpget.c - send snmp GET requests to a network entity. X * X */ /*********************************************************************** X Copyright 1988, 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 "VXtime.h" #else /* VXWORKS */ #include #endif /* VXWORKS */ X #ifdef VXWORKS #include "VXnetdb.h" #else /* VXWORKS */ #include #endif /* VXWORKS */ X #include "snmp.h" #include "asn1.h" #include "snmp_impl.h" #include "snmp_api.h" #include "snmp_client.h" SHAR_EOF : || echo 'restore of snmp2/apps/snmpget.c failed' fi echo 'End of snmp2 part 7' echo 'File snmp2/apps/snmpget.c is continued in part 8' echo 8 > _sharseq.tmp exit 0