#!/bin/sh # This is `snmp2.05' (part 5 of snmp2). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `snmp2/snmplib/snmp_client.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" != 5; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping snmp2/snmplib/snmp_client.c' else echo 'x - continuing file snmp2/snmplib/snmp_client.c' sed 's/^X//' << 'SHAR_EOF' >> 'snmp2/snmplib/snmp_client.c' && X } X newvar->next_variable = 0; X } X } X state->status = STAT_SUCCESS; X } else if (op == TIMED_OUT){ X state->pdu = NULL; X state->status = STAT_TIMEOUT; X } X return 1; } X X /* X * If there was an error in the input pdu, creates a clone of the pdu X * that includes all the variables except the one marked by the errindex. X * The command is set to the input command and the reqid, errstat, and X * errindex are set to default values. X * If the error status didn't indicate an error, the error index didn't X * indicate a variable, the pdu wasn't a get response message, or there X * would be no remaining variables, this function will return NULL. X * If everything was successful, a pointer to the fixed cloned pdu will X * be returned. X */ struct snmp_pdu * snmp_fix_pdu(pdu, command) X struct snmp_pdu *pdu; X int command; { X struct variable_list *var, *newvar; X struct snmp_pdu *newpdu; X int index, copied = 0; X X if (pdu->command != GET_RSP_MSG || pdu->errstat == SNMP_ERR_NOERROR || pdu->errindex <= 0) X return NULL; 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 = SNMP_DEFAULT_REQID; X newpdu->errstat = SNMP_DEFAULT_ERRSTAT; X newpdu->errindex = SNMP_DEFAULT_ERRINDEX; X var = pdu->variables; X index = 1; X if (pdu->errindex == index){ /* skip first variable */ X var = var->next_variable; X index++; X } X if (var != NULL){ 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 copied++; X X while(var->next_variable){ X var = var->next_variable; X if (++index == pdu->errindex) X continue; 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 copied++; X } X } X if (index < pdu->errindex || copied == 0){ X snmp_free_pdu(newpdu); X return NULL; X } X return newpdu; } X X /* X * Creates (allocates and copies) a clone of the input PDU. X */ struct snmp_pdu * snmp_clone_pdu(pdu) X struct snmp_pdu *pdu; { X struct variable_list *var, *newvar; X struct snmp_pdu *newpdu; X int index; 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 var = pdu->variables; X index = 1; X if (var != NULL){ X newpdu->variables = newvar = X (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, X 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, X var->val_len); X } X newvar->next_variable = 0; X X while(var->next_variable){ X var = var->next_variable; X newvar->next_variable = X (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, X 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, X var->val_len); X } X newvar->next_variable = 0; X } X } X return newpdu; } X X int snmp_synch_response(ss, pdu, response) X struct snmp_session *ss; X struct snmp_pdu *pdu; X struct snmp_pdu **response; { X struct synch_state *state = &snmp_synch_state; X int numfds, count; X fd_set fdset; X struct timeval timeout, *tvp; X int block; X X X if ((state->reqid = snmp_send(ss, pdu)) == 0){ X *response = NULL; X snmp_free_pdu(pdu); X return STAT_ERROR; X } X state->waiting = 1; X X while(state->waiting){ X numfds = 0; X FD_ZERO(&fdset); X block = 1; X tvp = &timeout; X timerclear(tvp); 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 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 /* FALLTHRU */ X default: X *response = NULL; X return STAT_ERROR; X } X } X *response = state->pdu; X return state->status; } X snmp_synch_setup(session) X struct snmp_session *session; { X session->callback = snmp_synch_input; X session->callback_magic = (void *)&snmp_synch_state; } X char *error_string[18] = { X "No Error", X "Response message would have been too large.", X "There is no such variable name in this MIB.", X "The value given has the wrong type or length.", X "The two parties used do not have access to use the specified SNMP PDU.", X "A general failure occured", X "noAccess", X "wrongType", X "wrongLength", X "wrongEncoding", X "wrongValue", X "noCreation", X "inconsistentValue", X "resourceUnavailable", X "commitFailed", X "undoFailed", X "authorizationError", X "notWritable" }; X char * snmp_errstring(errstat) X int errstat; { X if (errstat <= SNMP_ERR_NOTWRITABLE && errstat >= SNMP_ERR_NOERROR){ X return error_string[errstat]; X } else { X return "Unknown Error"; X } } X /* X * In: Dest IP address, src, dst parties and lengths and context and contextlen X * Initializes a noAuth/noPriv party pair, a context, and 2 acl entries. X * (Are two acl entries really needed?) X * Out: returns 0 if OK, -1 if an error occurred. X */ ms_party_init(destaddr, src, srclen, dst, dstlen, context, contextlen) X u_long destaddr; X oid *src, *dst, *context; X int *srclen, *dstlen, *contextlen; { X u_long addr; X u_short port; X struct partyEntry *pp1, *pp2, *rp; X struct contextEntry *cxp, *rxp; X int viewIndex; X oid viewSubtree[64]; X int viewSubtreeLen; X struct viewEntry *vwp; X struct aclEntry *ap; X int oneIndex, twoIndex, cxindex; X X X if (!read_objid(".1.3.6.1.6.3.3.1.3.128.2.35.55.1", X dst, dstlen)){ X fprintf(stderr, "Bad object identifier: %s\n", ".1.3.6.1.6.3.3.1.3.128.2.35.55.1"); X return -1; X } X dst[9] = (destaddr & 0xFF000000) >> 24; X dst[10] = (destaddr & 0x00FF0000) >> 16; X dst[11] = (destaddr & 0x0000FF00) >> 8; X dst[12] = (destaddr & 0x000000FF); X dst[13] = 1; X X pp1 = party_getEntry(dst, *dstlen); X if (!pp1){ X pp1 = party_createEntry(dst, *dstlen); X X rp = pp1->reserved; X strcpy(pp1->partyName, "noAuthAgent"); X pp1->partyTDomain = rp->partyTDomain = DOMAINSNMPUDP; X addr = htonl(destaddr); X port = htons(161); X bcopy((char *)&addr, pp1->partyTAddress, sizeof(addr)); X bcopy((char *)&port, pp1->partyTAddress + 4, sizeof(port)); X bcopy(pp1->partyTAddress, rp->partyTAddress, 6); X pp1->partyTAddressLen = rp->partyTAddressLen = 6; X pp1->partyAuthProtocol = rp->partyAuthProtocol = NOAUTH; X pp1->partyAuthClock = rp->partyAuthClock = 0; X pp1->tv.tv_sec = pp1->partyAuthClock; X pp1->partyAuthPublicLen = 0; X pp1->partyAuthLifetime = rp->partyAuthLifetime = 0; X pp1->partyPrivProtocol = rp->partyPrivProtocol = NOPRIV; X pp1->partyPrivPublicLen = 0; X pp1->partyMaxMessageSize = rp->partyMaxMessageSize = 1500; X pp1->partyLocal = 2; /* FALSE */ X pp1->partyAuthPrivateLen = rp->partyAuthPrivateLen = 0; X pp1->partyPrivPrivateLen = rp->partyPrivPrivateLen = 0; X pp1->partyStorageType = 2; /* volatile */ X pp1->partyStatus = rp->partyStatus = PARTYACTIVE; #define PARTYCOMPLETE_MASK 65535 X /* all collumns - from party_vars.c XXX */ X pp1->partyBitMask = rp->partyBitMask = PARTYCOMPLETE_MASK; X } X oneIndex = pp1->partyIndex; X X if (!read_objid(".1.3.6.1.6.3.3.1.3.128.2.35.55.1", X src, srclen)){ X fprintf(stderr, "Bad object identifier: %s\n", ".1.3.6.1.6.3.3.1.3.128.2.35.55.1"); X return -1; X } X src[9] = (destaddr & 0xFF000000) >> 24; X src[10] = (destaddr & 0x00FF0000) >> 16; X src[11] = (destaddr & 0x0000FF00) >> 8; X src[12] = (destaddr & 0x000000FF); X src[13] = 2; X pp2 = party_getEntry(src, *srclen); X if (!pp2){ X pp2 = party_createEntry(src, *srclen); X X rp = pp2->reserved; X strcpy(pp2->partyName, "noAuthMS"); X pp2->partyTDomain = rp->partyTDomain = DOMAINSNMPUDP; X bzero(pp2->partyTAddress, 6); X bcopy(pp2->partyTAddress, rp->partyTAddress, 6); X pp2->partyTAddressLen = rp->partyTAddressLen = 6; X pp2->partyAuthProtocol = rp->partyAuthProtocol = NOAUTH; X pp2->partyAuthClock = rp->partyAuthClock = 0; X pp2->tv.tv_sec = pp2->partyAuthClock; X pp2->partyAuthPublicLen = 0; X pp2->partyAuthLifetime = rp->partyAuthLifetime = 0; X pp2->partyPrivProtocol = rp->partyPrivProtocol = NOPRIV; X pp2->partyPrivPublicLen = 0; X pp2->partyMaxMessageSize = rp->partyMaxMessageSize = 484; /* ??? */ X pp2->partyLocal = 2; /* FALSE */ X pp2->partyAuthPrivateLen = rp->partyAuthPrivateLen = 0; X pp2->partyPrivPrivateLen = rp->partyPrivPrivateLen = 0; X pp2->partyStorageType = 2; /* volatile */ X pp2->partyStatus = rp->partyStatus = PARTYACTIVE; #define PARTYCOMPLETE_MASK 65535 X /* all collumns - from party_vars.c XXX */ X pp2->partyBitMask = rp->partyBitMask = PARTYCOMPLETE_MASK; X } X twoIndex = pp2->partyIndex; X X if (!read_objid(".1.3.6.1.6.3.3.1.4.128.2.35.55.1", X context, contextlen)){ X fprintf(stderr, "Bad object identifier: %s\n", ".1.3.6.1.6.3.3.1.4.128.2.35.55.1"); X return -1; X } X context[9] = (destaddr & 0xFF000000) >> 24; X context[10] = (destaddr & 0x00FF0000) >> 16; X context[11] = (destaddr & 0x0000FF00) >> 8; X context[12] = (destaddr & 0x000000FF); X context[13] = 1; X cxp = context_getEntry(context, *contextlen); X if (!cxp){ X cxp = context_createEntry(context, *contextlen); X rxp = cxp->reserved; X strcpy(cxp->contextName, "noAuthContext"); X cxp->contextLocal = 2; /* FALSE */ X cxp->contextViewIndex = -1; /* unknown */ X cxp->contextLocalEntityLen = 0; X cxp->contextLocalTime = CURRENTTIME; X cxp->contextProxyContextLen = 0; X cxp->contextStorageType = 2; X cxp->contextStatus = rxp->contextStatus = CONTEXTACTIVE; #define CONTEXTCOMPLETE_MASK 0x03FF X /* all collumns - from context_vars.c XXX */ X cxp->contextBitMask = rxp->contextBitMask = CONTEXTCOMPLETE_MASK; X } X cxindex = cxp->contextIndex; X X ap = acl_getEntry(oneIndex, twoIndex, cxindex); X if (!ap){ X ap = acl_createEntry(oneIndex, twoIndex, cxindex); X ap->aclPriveleges = 132; X ap->aclStorageType = 2; /* volatile */ X ap->aclStatus = ACLACTIVE; #define ACLCOMPLETE_MASK 0x3F X /* all collumns - from acl_vars.c XXX */ X ap->aclBitMask = ACLCOMPLETE_MASK; X ap->reserved->aclBitMask = ap->aclBitMask; X } return 0; /* SUCCESS */ } X SHAR_EOF echo 'File snmp2/snmplib/snmp_client.c is complete' && $shar_touch -am 1015123593 'snmp2/snmplib/snmp_client.c' && chmod 0644 'snmp2/snmplib/snmp_client.c' || echo 'restore of snmp2/snmplib/snmp_client.c failed' shar_count="`wc -c < 'snmp2/snmplib/snmp_client.c'`" test 17251 -eq "$shar_count" || echo "snmp2/snmplib/snmp_client.c: original size 17251, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/asn1.h ============== if test -f 'snmp2/snmplib/asn1.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/asn1.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/asn1.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/asn1.h' && /* X * Definitions for Abstract Syntax Notation One, ASN.1 X * As defined in ISO/IS 8824 and ISO/IS 8825 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 #ifndef EIGHTBIT_SUBIDS typedef u_long oid; #define MAX_SUBID 0xFFFFFFFF #else typedef u_char oid; #define MAX_SUBID 0xFF #endif X #define MAX_OID_LEN 64 /* max subid's in an oid */ X #define ASN_BOOLEAN (0x01) #define ASN_INTEGER (0x02) #define ASN_BIT_STR (0x03) #define ASN_OCTET_STR (0x04) #define ASN_NULL (0x05) #define ASN_OBJECT_ID (0x06) #define ASN_SEQUENCE (0x10) #define ASN_SET (0x11) X #define ASN_UNIVERSAL (0x00) #define ASN_APPLICATION (0x40) #define ASN_CONTEXT (0x80) #define ASN_PRIVATE (0xC0) X #define ASN_PRIMITIVE (0x00) #define ASN_CONSTRUCTOR (0x20) X #define ASN_LONG_LEN (0x80) #define ASN_EXTENSION_ID (0x1F) #define ASN_BIT8 (0x80) X #define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR) #define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID) X u_char *asn_parse_int(); u_char *asn_build_int(); u_char *asn_parse_unsigned_int(); u_char *asn_build_unsigned_int(); u_char *asn_parse_string(); u_char *asn_build_string(); u_char *asn_parse_header(); u_char *asn_build_header(); u_char *asn_build_sequence(); u_char *asn_parse_length(); u_char *asn_build_length(); u_char *asn_parse_objid(); u_char *asn_build_objid(); u_char *asn_parse_null(); u_char *asn_build_null(); u_char *asn_parse_bitstring(); u_char *asn_build_bitstring(); u_char *asn_parse_unsigned_int64(); u_char *asn_build_unsigned_int64(); X struct counter64 { X u_long high; X u_long low; }; X SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/asn1.h' && chmod 0644 'snmp2/snmplib/asn1.h' || echo 'restore of snmp2/snmplib/asn1.h failed' shar_count="`wc -c < 'snmp2/snmplib/asn1.h'`" test 2704 -eq "$shar_count" || echo "snmp2/snmplib/asn1.h: original size 2704, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/mib.h ============== if test -f 'snmp2/snmplib/mib.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/mib.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/mib.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/mib.h' && /* X * Definitions for the variables as defined in the MIB 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 struct mib_system { X char sysDescr[32]; /* textual description */ X u_char sysObjectID[16];/* OBJECT IDENTIFIER of system */ X u_char ObjIDLen; /* length of sysObjectID */ X u_long sysUpTime; /* Uptime in 100/s of a second */ }; X struct mib_interface { X long ifNumber; /* number of interfaces */ }; X struct mib_ifEntry { X long ifIndex; /* index of this interface */ X char ifDescr[32]; /* english description of interface */ X long ifType; /* network type of device */ X long ifMtu; /* size of largest packet in bytes */ X u_long ifSpeed; /* bandwidth in bits/sec */ X u_char ifPhysAddress[11]; /* interface's address */ X u_char PhysAddrLen; /* length of physAddr */ X long ifAdminStatus; /* desired state of interface */ X long ifOperStatus; /* current operational status */ X u_long ifLastChange; /* value of sysUpTime when current state entered */ X u_long ifInOctets; /* number of octets received on interface */ X u_long ifInUcastPkts; /* number of unicast packets delivered */ X u_long ifInNUcastPkts; /* number of broadcasts or multicasts */ X u_long ifInDiscards; /* number of packets discarded with no error */ X u_long ifInErrors; /* number of packets containing errors */ X u_long ifInUnknownProtos; /* number of packets with unknown protocol */ X u_long ifOutOctets; /* number of octets transmitted */ X u_long ifOutUcastPkts; /* number of unicast packets sent */ X u_long ifOutNUcastPkts;/* number of broadcast or multicast pkts */ X u_long ifOutDiscards; /* number of packets discarded with no error */ X u_long ifOutErrors; /* number of pkts discarded with an error */ X u_long ifOutQLen; /* number of packets in output queue */ }; X struct mib_atEntry { X long atIfIndex; /* interface on which this entry maps */ X u_char atPhysAddress[11]; /* physical address of destination */ X u_char PhysAddressLen; /* length of atPhysAddress */ X u_long atNetAddress; /* IP address of physical address */ }; X struct mib_ip { X long ipForwarding; /* 1 if gateway, 2 if host */ X long ipDefaultTTL; /* default TTL for pkts originating here */ X u_long ipInReceives; /* no. of IP packets received from interfaces */ X u_long ipInHdrErrors; /* number of pkts discarded due to header errors */ X u_long ipInAddrErrors; /* no. of pkts discarded due to bad address */ X u_long ipForwDatagrams;/* number pf pkts forwarded through this entity */ X u_long ipInUnknownProtos;/* no. of local-addressed pkts w/unknown proto */ X u_long ipInDiscards; /* number of error-free packets discarded */ X u_long ipInDelivers; /* number of datagrams delivered to upper level */ X u_long ipOutRequests; /* number of IP datagrams originating locally */ X u_long ipOutDiscards; /* number of error-free output IP pkts discarded */ X u_long ipOutNoRoutes; /* number of IP pkts discarded due to no route */ X long ipReasmTimeout; /* seconds fragment is held awaiting reassembly */ X u_long ipReasmReqds; /* no. of fragments needing reassembly (here) */ X u_long ipReasmOKs; /* number of fragments reassembled */ X u_long ipReasmFails; /* number of failures in IP reassembly */ X u_long ipFragOKs; /* number of datagrams fragmented here */ X u_long ipFragFails; /* no. pkts unable to be fragmented here */ X u_long ipFragCreates; /* number of IP fragments created here */ }; X struct mib_ipAddrEntry { X u_long ipAdEntAddr; /* IP address of this entry */ X long ipAdEntIfIndex; /* IF for this entry */ X u_long ipAdEntNetMask; /* subnet mask of this entry */ X long ipAdEntBcastAddr;/* read the MIB for this one */ }; X struct mib_ipRouteEntry { X u_long ipRouteDest; /* destination IP addr for this route */ X long ipRouteIfIndex; /* index of local IF for this route */ X long ipRouteMetric1; /* Primary routing metric */ X long ipRouteMetric2; /* Alternate routing metric */ X long ipRouteMetric3; /* Alternate routing metric */ X long ipRouteMetric4; /* Alternate routing metric */ X u_long ipRouteNextHop; /* IP addr of next hop */ X long ipRouteType; /* Type of this route */ X long ipRouteProto; /* How this route was learned */ X long ipRouteAge; /* No. of seconds since updating this route */ }; X struct mib_icmp { X u_long icmpInMsgs; /* Total of ICMP msgs received */ X u_long icmpInErrors; /* Total of ICMP msgs received with errors */ X u_long icmpInDestUnreachs; X u_long icmpInTimeExcds; X u_long icmpInParmProbs; X u_long icmpInSrcQuenchs; X u_long icmpInRedirects; X u_long icmpInEchos; X u_long icmpInEchoReps; X u_long icmpInTimestamps; X u_long icmpInTimestampReps; X u_long icmpInAddrMasks; X u_long icmpInAddrMaskReps; X u_long icmpOutMsgs; X u_long icmpOutErrors; X u_long icmpOutDestUnreachs; X u_long icmpOutTimeExcds; X u_long icmpOutParmProbs; X u_long icmpOutSrcQuenchs; X u_long icmpOutRedirects; X u_long icmpOutEchos; X u_long icmpOutEchoReps; X u_long icmpOutTimestamps; X u_long icmpOutTimestampReps; X u_long icmpOutAddrMasks; X u_long icmpOutAddrMaskReps; }; X struct mib_tcp { X long tcpRtoAlgorithm; /* retransmission timeout algorithm */ X long tcpRtoMin; /* minimum retransmission timeout (mS) */ X long tcpRtoMax; /* maximum retransmission timeout (mS) */ X long tcpMaxConn; /* maximum tcp connections possible */ X u_long tcpActiveOpens; /* number of SYN-SENT -> CLOSED transitions */ X u_long tcpPassiveOpens; /* number of SYN-RCVD -> LISTEN transitions */ X u_long tcpAttemptFails;/*(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN*/ X u_long tcpEstabResets; /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */ X u_long tcpCurrEstab; /* number in ESTABLISHED or CLOSE-WAIT state */ X u_long tcpInSegs; /* number of segments received */ X u_long tcpOutSegs; /* number of segments sent */ X u_long tcpRetransSegs; /* number of retransmitted segments */ }; X struct mib_tcpConnEntry { X long tcpConnState; /* State of this connection */ X u_long tcpConnLocalAddress;/* local IP address for this connection */ X long tcpConnLocalPort; /* local port for this connection */ X u_long tcpConnRemAddress; /* remote IP address for this connection */ X long tcpConnRemPort; /* remote port for this connection */ }; X struct mib_udp { X u_long udpInDatagrams; /* No. of UDP datagrams delivered to users */ X u_long udpNoPorts; /* No. of UDP datagrams to port with no listener */ X u_long udpInErrors; /* No. of UDP datagrams unable to be delivered */ X u_long udpOutDatagrams;/* No. of UDP datagrams sent from this entity */ }; X struct mib_egp { X u_long egpInMsgs; /* No. of EGP msgs received without error */ X u_long egpInErrors;/* No. of EGP msgs received with error */ X u_long egpOutMsgs; /* No. of EGP msgs sent */ X u_long egpOutErrors;/* No. of (outgoing) EGP msgs dropped due to error */ }; X struct mib_egpNeighEntry { X long egpNeighState; /* local EGP state with this entry's neighbor */ X u_long egpNeighAddr; /* IP address of this entry's neighbor */ }; X #define MIB 1, 3, 6, 1, 2, 1 X #define MIB_IFTYPE_OTHER 1 #define MIB_IFTYPE_REGULAR1822 2 #define MIB_IFTYPE_HDH1822 3 #define MIB_IFTYPE_DDNX25 4 #define MIB_IFTYPE_RFC877X25 5 #define MIB_IFTYPE_ETHERNETCSMACD 6 #define MIB_IFTYPE_ISO88023CSMACD 7 #define MIB_IFTYPE_ISO88024TOKENBUS 8 #define MIB_IFTYPE_ISO88025TOKENRING 9 #define MIB_IFTYPE_ISO88026MAN 10 #define MIB_IFTYPE_STARLAN 11 #define MIB_IFTYPE_PROTEON10MBIT 12 #define MIB_IFTYPE_PROTEON80MBIT 13 #define MIB_IFTYPE_HYPERCHANNEL 14 #define MIB_IFTYPE_FDDI 15 #define MIB_IFTYPE_LAPB 16 #define MIB_IFTYPE_SDLC 17 #define MIB_IFTYPE_T1CARRIER 18 #define MIB_IFTYPE_CEPT 19 #define MIB_IFTYPE_BASICISDN 20 #define MIB_IFTYPE_PRIMARYISDN 21 #define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL 22 X #define MIB_IFSTATUS_UP 1 #define MIB_IFSTATUS_DOWN 2 #define MIB_IFSTATUS_TESTING 3 X #define MIB_FORWARD_GATEWAY 1 #define MIB_FORWARD_HOST 2 X #define MIB_IPROUTETYPE_OTHER 1 #define MIB_IPROUTETYPE_INVALID 2 #define MIB_IPROUTETYPE_DIRECT 3 #define MIB_IPROUTETYPE_REMOTE 4 X #define MIB_IPROUTEPROTO_OTHER 1 #define MIB_IPROUTEPROTO_LOCAL 2 #define MIB_IPROUTEPROTO_NETMGMT 3 #define MIB_IPROUTEPROTO_ICMP 4 #define MIB_IPROUTEPROTO_EGP 5 #define MIB_IPROUTEPROTO_GGP 6 #define MIB_IPROUTEPROTO_HELLO 7 #define MIB_IPROUTEPROTO_RIP 8 #define MIB_IPROUTEPROTO_ISIS 9 #define MIB_IPROUTEPROTO_ESIS 10 #define MIB_IPROUTEPROTO_CISCOIGRP 11 #define MIB_IPROUTEPROTO_BBNSPFIGP 12 #define MIB_IPROUTEPROTO_OIGP 13 X #define MIB_TCPRTOALG_OTHER 1 #define MIB_TCPRTOALG_CONSTANT 2 #define MIB_TCPRTOALG_RSRE 3 #define MIB_TCPRTOALG_VANJ 4 X #define MIB_TCPCONNSTATE_CLOSED 1 #define MIB_TCPCONNSTATE_LISTEN 2 #define MIB_TCPCONNSTATE_SYNSENT 3 #define MIB_TCPCONNSTATE_SYNRECEIVED 4 #define MIB_TCPCONNSTATE_ESTABLISHED 5 #define MIB_TCPCONNSTATE_FINWAIT1 6 #define MIB_TCPCONNSTATE_FINWAIT2 7 #define MIB_TCPCONNSTATE_CLOSEWAIT 8 #define MIB_TCPCONNSTATE_LASTACK 9 #define MIB_TCPCONNSTATE_CLOSING 10 #define MIB_TCPCONNSTATE_TIMEWAIT 11 X #define MIB_EGPNEIGHSTATE_IDLE 1 #define MIB_EGPNEIGHSTATE_AQUISITION 2 #define MIB_EGPNEIGHSTATE_DOWN 3 #define MIB_EGPNEIGHSTATE_UP 4 #define MIB_EGPNEIGHSTATE_CEASE 5 X X X SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/mib.h' && chmod 0444 'snmp2/snmplib/mib.h' || echo 'restore of snmp2/snmplib/mib.h failed' shar_count="`wc -c < 'snmp2/snmplib/mib.h'`" test 10793 -eq "$shar_count" || echo "snmp2/snmplib/mib.h: original size 10793, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/parse.h ============== if test -f 'snmp2/snmplib/parse.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/parse.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/parse.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/parse.h' && /*********************************************************** X Copyright 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 * parse.h X */ X #define MAXLABEL 64 /* maximum characters in a label */ #define MAXTOKEN 64 /* maximum characters in a token */ #define MAXQUOTESTR 512 /* maximum characters in a quoted string */ X X X /* X * A linked list of tag-value pairs for enumerated integers. X */ struct enum_list { X struct enum_list *next; X int value; X char *label; }; X /* X * A linked list of nodes. X */ struct node { X struct node *next; X char label[MAXLABEL]; /* This node's (unique) textual name */ X u_long subid; /* This node's integer subidentifier */ X char parent[MAXLABEL];/* The parent's textual name */ X int type; /* The type of object this represents */ X struct enum_list *enums; /* (optional) list of enumerated integers (otherwise NULL) */ X char *description; /* description (a quoted string) */ }; X /* X * A tree in the format of the tree structure of the MIB. X */ struct tree { X struct tree *child_list; /* list of children of this node */ X struct tree *next_peer; /* Next node in list of peers */ X struct tree *parent; X char label[MAXLABEL]; /* This node's textual name */ X u_long subid; /* This node's integer subidentifier */ X int type; /* This node's object type */ X struct enum_list *enums; /* (optional) list of enumerated integers (otherwise NULL) */ X void (*printer)(); /* Value printing function */ X char *description; /* description (a quoted string) */ }; X /* non-aggregate types for tree end nodes */ #define TYPE_OTHER 0 #define TYPE_OBJID 1 #define TYPE_OCTETSTR 2 #define TYPE_INTEGER 3 #define TYPE_NETADDR 4 #define TYPE_IPADDR 5 #define TYPE_COUNTER 6 #define TYPE_GAUGE 7 #define TYPE_TIMETICKS 8 #define TYPE_OPAQUE 9 #define TYPE_NULL 10 #define TYPE_COUNTER64 11 #define TYPE_BITSTRING 12 #define TYPE_NSAPADDRESS 13 #define TYPE_UINTEGER 14 X struct tree *read_mib(); X SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/parse.h' && chmod 0644 'snmp2/snmplib/parse.h' || echo 'restore of snmp2/snmplib/parse.h failed' shar_count="`wc -c < 'snmp2/snmplib/parse.h'`" test 3009 -eq "$shar_count" || echo "snmp2/snmplib/parse.h: original size 3009, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/snmp.h ============== if test -f 'snmp2/snmplib/snmp.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/snmp.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/snmp.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/snmp.h' && /* X * Definitions for the Simple Network Management Protocol (RFC 1067). 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 #define SNMP_PORT 161 #define SNMP_TRAP_PORT 162 X #define SNMP_MAX_LEN 1500 X #define SNMP_VERSION_1 0 #define SNMP_SECURITY_1 1 #define SNMP_VERSION_2 2 X #define GET_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) #define GETNEXT_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) #define GET_RSP_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) #define SET_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) #define TRP_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) #define BULK_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) #define INFORM_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) #define TRP2_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) X #define SNMP_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) #define SNMP_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) #define SNMP_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) X #define SNMP_ERR_NOERROR (0x0) #define SNMP_ERR_TOOBIG (0x1) #define SNMP_ERR_NOSUCHNAME (0x2) #define SNMP_ERR_BADVALUE (0x3) #define SNMP_ERR_READONLY (0x4) #define SNMP_ERR_GENERR (0x5) X #define SNMP_ERR_NOACCESS (6) #define SNMP_ERR_WRONGTYPE (7) #define SNMP_ERR_WRONGLENGTH (8) #define SNMP_ERR_WRONGENCODING (9) #define SNMP_ERR_WRONGVALUE (10) #define SNMP_ERR_NOCREATION (11) #define SNMP_ERR_INCONSISTENTVALUE (12) #define SNMP_ERR_RESOURCEUNAVAILABLE (13) #define SNMP_ERR_COMMITFAILED (14) #define SNMP_ERR_UNDOFAILED (15) #define SNMP_ERR_AUTHORIZATIONERROR (16) #define SNMP_ERR_NOTWRITABLE (17) X #define SNMP_TRAP_COLDSTART (0x0) #define SNMP_TRAP_WARMSTART (0x1) #define SNMP_TRAP_LINKDOWN (0x2) #define SNMP_TRAP_LINKUP (0x3) #define SNMP_TRAP_AUTHFAIL (0x4) #define SNMP_TRAP_EGPNEIGHBORLOSS (0x5) #define SNMP_TRAP_ENTERPRISESPECIFIC (0x6) X SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/snmp.h' && chmod 0644 'snmp2/snmplib/snmp.h' || echo 'restore of snmp2/snmplib/snmp.h failed' shar_count="`wc -c < 'snmp2/snmplib/snmp.h'`" test 2959 -eq "$shar_count" || echo "snmp2/snmplib/snmp.h: original size 2959, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/snmp_api.h ============== if test -f 'snmp2/snmplib/snmp_api.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/snmp_api.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/snmp_api.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/snmp_api.h' && /*********************************************************** X Copyright 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 * snmp_api.h - API for access to snmp. X */ X X typedef struct sockaddr_in ipaddr; X struct snmp_session { X u_char *community; /* community for outgoing requests. */ X int community_len; /* Length of community name. */ X int retries; /* Number of retries before timeout. */ X long timeout; /* Number of uS until first timeout, then exponential backoff */ X char *peername; /* Domain name or dotted IP address of default peer */ X u_short remote_port;/* UDP port number of peer. */ X u_short local_port; /* My UDP port number, 0 for default, picked randomly */ X /* Authentication function or NULL if null authentication is used */ X u_char *(*authenticator)(); X int (*callback)(); /* Function to interpret incoming data */ X /* Pointer to data that the callback function may consider important */ X void *callback_magic; X int version; X oid *srcParty; X int srcPartyLen; X oid *dstParty; X int dstPartyLen; X oid *context; X int contextLen; }; X /* X * Set fields in session and pdu to the following to get a default or unconfigured value. X */ #define SNMP_DEFAULT_COMMUNITY_LEN 0 /* to get a default community name */ #define SNMP_DEFAULT_RETRIES -1 #define SNMP_DEFAULT_TIMEOUT -1 #define SNMP_DEFAULT_REMPORT 0 #define SNMP_DEFAULT_REQID 0 #define SNMP_DEFAULT_ERRSTAT -1 #define SNMP_DEFAULT_ERRINDEX -1 #define SNMP_DEFAULT_ADDRESS 0 #define SNMP_DEFAULT_PEERNAME NULL #define SNMP_DEFAULT_ENTERPRISE_LENGTH 0 #define SNMP_DEFAULT_TIME 0 #define SNMP_DEFAULT_VERSION -1 X extern int snmp_errno; /* Error return values */ #define SNMPERR_GENERR -1 #define SNMPERR_BAD_LOCPORT -2 /* local port was already in use */ #define SNMPERR_BAD_ADDRESS -3 #define SNMPERR_BAD_SESSION -4 #define SNMPERR_TOO_LONG -5 X #define non_repeaters errstat #define max_repetitions errindex X struct snmp_pdu { X int version; X X ipaddr address; /* Address of peer */ X oid *srcParty; X int srcPartyLen; X oid *dstParty; X int dstPartyLen; X oid *context; X int contextLen; X X u_char *community; /* community for outgoing requests. */ X int community_len; /* Length of community name. */ X X int command; /* Type of this PDU */ X X long reqid; /* Request id */ X long errstat; /* Error status (non_repeaters in GetBulk) */ X long errindex; /* Error index (max_repetitions in GetBulk) */ X X /* Trap information */ X oid *enterprise;/* System OID */ X int enterprise_length; X ipaddr agent_addr; /* address of object generating trap */ X int trap_type; /* trap type */ X int specific_type; /* specific type */ X u_long time; /* Uptime */ X X struct variable_list *variables; }; X X struct variable_list { X struct variable_list *next_variable; /* NULL for last variable */ X oid *name; /* Object identifier of variable */ X int name_length; /* number of subid's in name */ X u_char type; /* ASN type of variable */ X union { /* value of variable */ X long *integer; X u_char *string; X oid *objid; X u_char *bitstring; X struct counter64 *counter64; X } val; X int val_len; }; X /* X * struct snmp_session *snmp_open(session) X * struct snmp_session *session; X * X * Sets up the session with the snmp_session information provided X * by the user. Then opens and binds the necessary UDP port. X * A handle to the created session is returned (this is different than X * the pointer passed to snmp_open()). On any error, NULL is returned X * and snmp_errno is set to the appropriate error code. X */ struct snmp_session *snmp_open(); X /* X * int snmp_close(session) X * struct snmp_session *session; X * X * Close the input session. Frees all data allocated for the session, X * dequeues any pending requests, and closes any sockets allocated for X * the session. Returns 0 on error, 1 otherwise. X */ int snmp_close(); X X /* X * int snmp_send(session, pdu) X * struct snmp_session *session; X * struct snmp_pdu *pdu; X * X * Sends the input pdu on the session after calling snmp_build to create X * a serialized packet. If necessary, set some of the pdu data from the X * session defaults. Add a request corresponding to this pdu to the list X * of outstanding requests on this session, then send the pdu. X * Returns the request id of the generated packet if applicable, otherwise 1. X * On any error, 0 is returned. X * The pdu is freed by snmp_send() unless a failure occured. X */ int snmp_send(); X X /* X * void snmp_read(fdset) X * fd_set *fdset; X * X * Checks to see if any of the fd's set in the fdset belong to X * snmp. Each socket with it's fd set has a packet read from it X * and snmp_parse is called on the packet received. The resulting pdu X * is passed to the callback routine for that session. If the callback X * routine returns successfully, the pdu and it's request are deleted. X */ void snmp_read(); X X /* X * void X * snmp_free_pdu(pdu) X * struct snmp_pdu *pdu; X * X * Frees the pdu and any malloc'd data associated with it. X */ void snmp_free_pdu(); X /* X * int snmp_select_info(numfds, fdset, timeout, block) X * int *numfds; X * fd_set *fdset; X * struct timeval *timeout; X * int *block; X * X * Returns info about what snmp requires from a select statement. X * numfds is the number of fds in the list that are significant. X * All file descriptors opened for SNMP are OR'd into the fdset. X * If activity occurs on any of these file descriptors, snmp_read X * should be called with that file descriptor set. X * X * The timeout is the latest time that SNMP can wait for a timeout. The X * select should be done with the minimum time between timeout and any other X * timeouts necessary. This should be checked upon each invocation of select. X * If a timeout is received, snmp_timeout should be called to check if the X * timeout was for SNMP. (snmp_timeout is idempotent) X * X * Block is 1 if the select is requested to block indefinitely, rather than time out. X * If block is input as 1, the timeout value will be treated as undefined, but it must X * be available for setting in snmp_select_info. On return, if block is true, the value X * of timeout will be undefined. X * X * snmp_select_info returns the number of open sockets. (i.e. The number of sessions open) X */ int snmp_select_info(); X /* X * void snmp_timeout(); X * X * snmp_timeout should be called whenever the timeout from snmp_select_info expires, X * but it is idempotent, so snmp_timeout can be polled (probably a cpu expensive X * proposition). snmp_timeout checks to see if any of the sessions have an X * outstanding request that has timed out. If it finds one (or more), and that X * pdu has more retries available, a new packet is formed from the pdu and is X * resent. If there are no more retries available, the callback for the session X * is used to alert the user of the timeout. X */ void snmp_timeout(); X X /* X * This routine must be supplied by the application: X * X * u_char *authenticator(pdu, length, community, community_len) X * u_char *pdu; The rest of the PDU to be authenticated X * int *length; The length of the PDU (updated by the authenticator) X * u_char *community; The community name to authenticate under. X * int community_len The length of the community name. X * X * Returns the authenticated pdu, or NULL if authentication failed. X * If null authentication is used, the authenticator in snmp_session can be X * set to NULL(0). X */ X /* X * This routine must be supplied by the application: X * X * int callback(operation, session, reqid, pdu, magic) X * int operation; X * struct snmp_session *session; The session authenticated under. X * int reqid; The request id of this pdu (0 for TRAP) X * struct snmp_pdu *pdu; The pdu information. X * void *magic A link to the data for this routine. X * X * Returns 1 if request was successful, 0 if it should be kept pending. X * Any data in the pdu must be copied because it will be freed elsewhere. X * Operations are defined below: X */ #define RECEIVED_MESSAGE 1 #define TIMED_OUT 2 X X extern int snmp_dump_packet; SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/snmp_api.h' && chmod 0644 'snmp2/snmplib/snmp_api.h' || echo 'restore of snmp2/snmplib/snmp_api.h failed' shar_count="`wc -c < 'snmp2/snmplib/snmp_api.h'`" test 9216 -eq "$shar_count" || echo "snmp2/snmplib/snmp_api.h: original size 9216, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmplib/snmp_client.h ============== if test -f 'snmp2/snmplib/snmp_client.h' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmplib/snmp_client.h (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmplib/snmp_client.h (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmplib/snmp_client.h' && /* X * snmp_client.h 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. ******************************************************************/ struct synch_state { X int waiting; X int status; /* status codes */ #define STAT_SUCCESS 0 #define STAT_ERROR 1 #define STAT_TIMEOUT 2 X int reqid; X struct snmp_pdu *pdu; }; X extern struct synch_state snmp_synch_state; X struct snmp_pdu *snmp_pdu_create(); struct snmp_pdu *snmp_fix_pdu(); struct snmp_pdu *snmp_clone_pdu(); char *snmp_errstring(); SHAR_EOF $shar_touch -am 1015123593 'snmp2/snmplib/snmp_client.h' && chmod 0644 'snmp2/snmplib/snmp_client.h' || echo 'restore of snmp2/snmplib/snmp_client.h failed' shar_count="`wc -c < 'snmp2/snmplib/snmp_client.h'`" test 1488 -eq "$shar_count" || echo "snmp2/snmplib/snmp_client.h: original size 1488, 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' && /* SHAR_EOF : || echo 'restore of snmp2/snmplib/snmp_impl.h failed' fi echo 'End of snmp2 part 5' echo 'File snmp2/snmplib/snmp_impl.h is continued in part 6' echo 6 > _sharseq.tmp exit 0