Index: README.hpux
diff -c /dev/null README.hpux:1.1.2.1
*** /dev/null	Tue Mar 14 09:44:01 1995
--- README.hpux	Tue Mar 14 09:40:42 1995
***************
*** 0 ****
--- 1,60 ----
+ This package contains a port of the cmu snmp v2.1.2.1 package for
+ hp-ux 700 series 9.0.5 OS computers.  Note that version 2.1.2.1 did
+ NOT work out of the box.  I had to hack snmplib/parse.c to get it to
+ correctly read the mib.txt file without seg-faulting.  Having now
+ looked at the code in parse.c, I fail to see how it worked under
+ 2.1.2.  Actually, it would probably work fine providing you either had
+ a zero length mib.txt file and/or had no DESCRIPTION fields in it.
+ Below is my short change log:
+ 
+ hardaker 14 Dec 94 15:43:23
+     Initial CMU snmp code, version 2.1.2
+ 
+ hardaker 14 Dec 94 16:55:13
+     HP-UX port of the CMU code
+ 
+ hardaker 14 Dec 94 17:02:37
+     Added hpux.c (random/srandom interfaces)
+ 
+ hardaker  8 Mar 95 16:09:02
+     New release of CMU's 2.1.2.1 code:
+       -- See README for specific details
+       -- snmpset,snmpgetnext added
+       -- -q flag added "quick print"
+       -- bug fixes
+       -- Man pages updated
+ 
+ hardaker  9 Mar 95 13:22:29
+     CMU 2.1.2 -> 2.1.2.1 Merge.
+ 
+ hardaker 10 Mar 95 13:19:22
+     #include <socketio.h> is not needed on HPUX
+ 
+ hardaker 10 Mar 95 13:30:21
+   Major hacking to parse() to work at all.
+     -- Now I don't unstand why it ever successfully parsed the mib.txt file.
+     -- get_token was constantly called to read DESCRIPTION strings into
+        a char array of either 64 (MAXTOKEN) or 4096 (MAXQUOTESTR) in
+        length.  MANY of the DESCRIPTION strings are longer than this.
+     -- Hacked parseQuotedString to make sure returned are strings < MAXQUOTESTR
+ 
+ hardaker 10 Mar 95 13:34:30
+     Added /etc as another path to search when looking for mib.txt
+ 
+ hardaker 13 Mar 95 16:20:58
+     2.1.2.1 port to hp-ux.
+ 
+ I personally use a modified version of this code with limited
+ extensibility supported, which I will release if enough people bug me
+ and once it evolves into a more usable form.
+ 
+ I know it compiles and works, but I haven't quiet tested everything.
+ If you find something which breaks, you can either fix it and send me
+ a patch or tell me and I'll attempt to fix it myself.
+                                                                 _____
+ 			        			       / ___ \
+ Wes Hardaker		             		       	      / /   \/
+ Department of Electrical and Computer Engineering            \--/     /\
+ University of California at Davis	 __________________   \/     /--\
+ Davis CA  95616                         /     Recycle      \    /\___/ /
+ (hardaker@ece.ucdavis.edu)             / It's not too late! \   \_____/
Index: agent/Makefile
diff -c agent/Makefile:1.1.1.2 agent/Makefile:1.1.2.2
*** agent/Makefile:1.1.1.2	Wed Mar  8 16:06:53 1995
--- agent/Makefile	Tue Mar 14 09:26:49 1995
***************
*** 7,16 ****
  OSFLAGS=
  CFLAGS=-g -I../snmplib ${INCLUDES} -DDEBUG ${OSFLAGS}
  CC =cc
! all: $(TARG)
  
! snmpd:	snmpd.o kernel.o ${LIBS} snmp_agent.o snmp_vars.o snmp_var_route.o party_vars.o context_vars.o acl_vars.o view_vars.o view_parse.o alarm.o event.o route_write.o
! 	${CC} -o $@ snmpd.o kernel.o snmp_agent.o snmp_vars.o snmp_var_route.o party_vars.o context_vars.o acl_vars.o view_vars.o view_parse.o alarm.o event.o route_write.o ${LIBS} ${LDFLAGS}
  
  sabersnmpd:	snmpd.c kernel.o snmp_agent.c snmp_vars.o snmp_var_route.o party_vars.c context_vars.c acl_vars.c view_vars.c view_parse.c ../snmplib/acl.c ../snmplib/acl_parse.o ../snmplib/asn1.c ../snmplib/md5.o ../snmplib/mib.o ../snmplib/parse.o ../snmplib/party.c ../snmplib/context.c ../snmplib/party_parse.o ../snmplib/context_parse.o ../snmplib/snmp.c ../snmplib/snmp_api.c ../snmplib/snmp_auth.c ../snmplib/snmp_client.o ../snmplib/view.c alarm.c event.c route_write.c ../snmplib/system.o ../lib/libdes.a /lib/libc.a
  	#load $(CFLAGS) snmpd.c kernel.o snmp_agent.c snmp_vars.o snmp_var_route.o party_vars.c context_vars.c acl_vars.c view_vars.c view_parse.c ../snmplib/acl.c ../snmplib/acl_parse.o ../snmplib/asn1.c ../snmplib/md5.o ../snmplib/mib.o ../snmplib/parse.o ../snmplib/party.c ../snmplib/context.c ../snmplib/party_parse.o ../snmplib/context_parse.o ../snmplib/snmp.c ../snmplib/snmp_api.c ../snmplib/snmp_auth.c ../snmplib/snmp_client.o ../snmplib/view.c alarm.c event.c route_write.c ../snmplib/system.o ../lib/libdes.a /lib/libc.a
--- 7,17 ----
  OSFLAGS=
  CFLAGS=-g -I../snmplib ${INCLUDES} -DDEBUG ${OSFLAGS}
  CC =cc
! all: 
! 	make $(TARG)
  
! snmpd:	snmpd.o kernel.o ${LIBS} snmp_agent.o snmp_vars.o snmp_var_route.o party_vars.o context_vars.o acl_vars.o view_vars.o view_parse.o alarm.o event.o route_write.o ${WESOBJS}
! 	${CC} -o $@ snmpd.o kernel.o snmp_agent.o snmp_vars.o snmp_var_route.o party_vars.o context_vars.o acl_vars.o view_vars.o view_parse.o alarm.o event.o route_write.o   ${WESOBJS} ${LIBS}  ${LDFLAGS}
  
  sabersnmpd:	snmpd.c kernel.o snmp_agent.c snmp_vars.o snmp_var_route.o party_vars.c context_vars.c acl_vars.c view_vars.c view_parse.c ../snmplib/acl.c ../snmplib/acl_parse.o ../snmplib/asn1.c ../snmplib/md5.o ../snmplib/mib.o ../snmplib/parse.o ../snmplib/party.c ../snmplib/context.c ../snmplib/party_parse.o ../snmplib/context_parse.o ../snmplib/snmp.c ../snmplib/snmp_api.c ../snmplib/snmp_auth.c ../snmplib/snmp_client.o ../snmplib/view.c alarm.c event.c route_write.c ../snmplib/system.o ../lib/libdes.a /lib/libc.a
  	#load $(CFLAGS) snmpd.c kernel.o snmp_agent.c snmp_vars.o snmp_var_route.o party_vars.c context_vars.c acl_vars.c view_vars.c view_parse.c ../snmplib/acl.c ../snmplib/acl_parse.o ../snmplib/asn1.c ../snmplib/md5.o ../snmplib/mib.o ../snmplib/parse.o ../snmplib/party.c ../snmplib/context.c ../snmplib/party_parse.o ../snmplib/context_parse.o ../snmplib/snmp.c ../snmplib/snmp_api.c ../snmplib/snmp_auth.c ../snmplib/snmp_client.o ../snmplib/view.c alarm.c event.c route_write.c ../snmplib/system.o ../lib/libdes.a /lib/libc.a
***************
*** 23,29 ****
  
  party_vars.o: ../snmplib/party.h
  context_vars.o: ../snmplib/context.h
! snmp_vars.o: ../snmplib/party.h
  alarm.c:  ../snmplib/party.h
  event.c:  ../snmplib/party.h
  snmpd.c:  ../snmplib/party.h
--- 24,30 ----
  
  party_vars.o: ../snmplib/party.h
  context_vars.o: ../snmplib/context.h
! snmp_vars.o: ../snmplib/party.h 
  alarm.c:  ../snmplib/party.h
  event.c:  ../snmplib/party.h
  snmpd.c:  ../snmplib/party.h
Index: agent/kernel.c
diff -c agent/kernel.c:1.1.1.1 agent/kernel.c:1.1.2.1
*** agent/kernel.c:1.1.1.1	Thu Oct 13 13:55:28 1994
--- agent/kernel.c	Mon Mar 13 16:20:27 1995
***************
*** 19,44 ****
  init_kmem(file)
      char *file;
  {
!     kmem = open(file, 0);
      if (kmem < 0){
  	fprintf(stderr, "cannot open ");
  	perror(file);
  	exit(1);
!     }
! 
      mem = open("/dev/mem",0);    
      if (mem < 0){
  	fprintf(stderr, "cannot open ");
! 	perror(file);
  	exit(1);
      }
      swap = open("/dev/drum",0);
      if (swap < 0){
  	fprintf(stderr, "cannot open ");
! 	perror(file);
  	exit(1);
      }
- 
  }
  
  
--- 19,46 ----
  init_kmem(file)
      char *file;
  {
!   kmem = open(file, 0);
      if (kmem < 0){
  	fprintf(stderr, "cannot open ");
  	perror(file);
  	exit(1);
!     } 
      mem = open("/dev/mem",0);    
      if (mem < 0){
  	fprintf(stderr, "cannot open ");
! 	perror("/dev/mem");
  	exit(1);
      }
+ #ifdef hpux
+     swap = open("/dev/dmem",0);
+ #else
      swap = open("/dev/drum",0);
+ #endif
      if (swap < 0){
  	fprintf(stderr, "cannot open ");
! 	perror("/dev/drum");
  	exit(1);
      }
  }
  
  
***************
*** 84,90 ****
       int     siz;
  {
  
!   klseek(off);      
    if (siz != klread(target, siz)) {
      ERROR("klread\n");
      exit(-1);
--- 86,92 ----
       int     siz;
  {
  
!   klseek(off);
    if (siz != klread(target, siz)) {
      ERROR("klread\n");
      exit(-1);
Index: agent/party_vars.c
diff -c agent/party_vars.c:1.1.1.1 agent/party_vars.c:1.1.2.1
*** agent/party_vars.c:1.1.1.1	Thu Oct 13 13:55:29 1994
--- agent/party_vars.c	Mon Mar 13 16:20:29 1995
***************
*** 610,616 ****
  	}
        case PARTYAUTHCLOCK:
  	gettimeofday(&now, (struct timezone *)0);
! 	(u_long)long_return = now.tv_sec - pp->tv.tv_sec;
  	return (u_char *)&long_return;
        case PARTYAUTHPRIVATE:
  	*var_len = 0;  /* zero length return value */
--- 610,616 ----
  	}
        case PARTYAUTHCLOCK:
  	gettimeofday(&now, (struct timezone *)0);
! 	long_return = (u_long) now.tv_sec - pp->tv.tv_sec;
  	return (u_char *)&long_return;
        case PARTYAUTHPRIVATE:
  	*var_len = 0;  /* zero length return value */
Index: agent/snmp_var_route.c
diff -c agent/snmp_var_route.c:1.1.1.1 agent/snmp_var_route.c:1.1.2.1
*** agent/snmp_var_route.c:1.1.1.1	Thu Oct 13 13:55:28 1994
--- agent/snmp_var_route.c	Mon Mar 13 16:20:30 1995
***************
*** 63,73 ****
  
  static struct nlist nl[] = {
  #define N_RTHOST       0
- 	{ "_rthost" },
  #define N_RTNET        1
- 	{ "_rtnet" },
  #define N_RTHASHSIZE	2
  	{ "_rthashsize" },
  	0,
  };
  
--- 63,79 ----
  
  static struct nlist nl[] = {
  #define N_RTHOST       0
  #define N_RTNET        1
  #define N_RTHASHSIZE	2
+ #ifdef hpux
+ 	{ "rthost" },
+ 	{ "rtnet" },
+ 	{ "rthashsize" },
+ #else 
+ 	{ "_rthost" },
+ 	{ "_rtnet" },
  	{ "_rthashsize" },
+ #endif
  	0,
  };
  
***************
*** 199,209 ****
  }
  
  init_routes(){
  
      nlist("/vmunix",nl);
  }
  
! #if defined(mips)
  
  static Route_Scan_Reload()
  {
--- 205,228 ----
  }
  
  init_routes(){
+ int ret;
+ #ifdef hpux
+   if (nlist("/hp-ux",nl)) {
+     ERROR("nlist");
+     exit(1);
+   }
+   for(ret = 0; nl[ret].n_name != NULL; ret++) {
+     if (nl[ret].n_type == 0) {
+       fprintf(stderr, "nlist err:  %s not found\n",nl[ret].n_name);
+     }
+   }
  
+ #else
      nlist("/vmunix",nl);
+ #endif
  }
  
! #if defined(mips) || defined(hpux)
  
  static Route_Scan_Reload()
  {
Index: agent/snmp_vars.c
diff -c agent/snmp_vars.c:1.1.1.1 agent/snmp_vars.c:1.1.2.1
*** agent/snmp_vars.c:1.1.1.1	Thu Oct 13 13:55:29 1994
--- agent/snmp_vars.c	Mon Mar 13 16:20:32 1995
***************
*** 38,44 ****
  #include <sys/user.h>
  #include <sys/proc.h>
  #include <sys/types.h>
! #include <machine/pte.h>
  #include <sys/vm.h>
  #include <netinet/in.h>
  #include <syslog.h>
--- 38,46 ----
  #include <sys/user.h>
  #include <sys/proc.h>
  #include <sys/types.h>
! /*
!   #include <machine/pte.h>
!   */
  #include <sys/vm.h>
  #include <netinet/in.h>
  #include <syslog.h>
***************
*** 102,154 ****
  #define  KNLookup(nl_which, buf, s)   (klookup((int) nl[nl_which].n_value, buf, s))
  
  
- static struct nlist nl[] = {
- 
  #define N_IPSTAT	0
- 	{ "_ipstat"},
  #define N_IPFORWARDING	1
- 	{ "_ipforwarding" },
  #define N_TCP_TTL	2
- 	{ "_tcp_ttl"},
  #define N_UDPSTAT	3
- 	{ "_udpstat" },
  #define N_IN_INTERFACES 4
- 	{ "_in_interfaces" },
  #define N_ICMPSTAT	5
- 	{ "_icmpstat" },
  #define N_IFNET		6
- 	{ "_ifnet" },
  #define N_TCPSTAT	7
- 	{ "_tcpstat" },
  #define N_TCB		8
- 	{ "_tcb" },
  #define N_ARPTAB_SIZE	9
- 	{ "_arptab_size" },
  #define N_ARPTAB        10
- 	{ "_arptab" },
  #define N_IN_IFADDR     11
- 	{ "_in_ifaddr" },
  #define N_BOOTTIME	12
- 	{ "_boottime" },
  #define N_PROC		13
- 	{ "_proc" },
  #define N_NPROC		14
- 	{ "_nproc" },
  #define N_DMMIN		15
- 	{ "_dmmin" },
  #define N_DMMAX		16
- 	{ "_dmmax" },
  #define N_NSWAP		17
- 	{ "_nswap" },
  #define N_USRPTMAP	18
-  	{ "_Usrptmap" },
  #define N_USRPT		19
  	{ "_usrpt" },
  #ifdef ibm032
  #define N_USERSIZE	20
  	{ "_userSIZE" },
  #endif
! 	0,
  };
  
  /*
--- 104,179 ----
  #define  KNLookup(nl_which, buf, s)   (klookup((int) nl[nl_which].n_value, buf, s))
  
  
  #define N_IPSTAT	0
  #define N_IPFORWARDING	1
  #define N_TCP_TTL	2
  #define N_UDPSTAT	3
  #define N_IN_INTERFACES 4
  #define N_ICMPSTAT	5
  #define N_IFNET		6
  #define N_TCPSTAT	7
  #define N_TCB		8
  #define N_ARPTAB_SIZE	9
  #define N_ARPTAB        10
  #define N_IN_IFADDR     11
  #define N_BOOTTIME	12
  #define N_PROC		13
  #define N_NPROC		14
  #define N_DMMIN		15
  #define N_DMMAX		16
  #define N_NSWAP		17
  #define N_USRPTMAP	18
  #define N_USRPT		19
+ 
+ static struct nlist nl[] = {
+ #ifndef hpux
+ 	{ "_ipstat"},  
+ 	{ "_ipforwarding" },
+ 	{ "_tcp_ttl"},
+ 	{ "_udpstat" },
+ 	{ "_in_interfaces" },
+ 	{ "_icmpstat" },
+ 	{ "_ifnet" },
+ 	{ "_tcpstat" },
+ 	{ "_tcb" },
+ 	{ "arptab_size" }, 
+ 	{ "arptab" },      
+ 	{ "_in_ifaddr" },
+ 	{ "_boottime" },
+ 	{ "_proc" },
+ 	{ "_nproc" },
+ 	{ "_dmmin" },
+ 	{ "_dmmax" },
+ 	{ "_nswap" },
+  	{ "_Usrptmap" },
  	{ "_usrpt" },
+ #else
+ 	{ "ipstat"},  
+ 	{ "ipforwarding" },
+ 	{ "tcpDefaultTTL"},
+ 	{ "udpstat" },
+ 	{ "in_interfaces" },
+ 	{ "icmpstat" },
+ 	{ "ifnet" },
+ 	{ "tcpstat" },
+ 	{ "tcb" },
+ 	{ "arptab_nb" }, 
+ 	{ "arphd" },      
+ 	{ "in_ifaddr" },
+ 	{ "boottime" },
+ 	{ "proc" },
+ 	{ "nproc" },
+ 	{ "dmmin" },
+ 	{ "dmmax" },
+ 	{ "nswap" },
+         { "mpid" },
+         { "hz"},
+ #endif
  #ifdef ibm032
  #define N_USERSIZE	20
  	{ "_userSIZE" },
  #endif
! 	{ 0 },
  };
  
  /*
***************
*** 203,218 ****
  
  long		long_return;
  #ifndef ibm032
! u_char		return_buf[CLSIZE*NBPG];  
  #else
  u_char		return_buf[256]; /* nee 64 */
  #endif
   
  init_snmp()
  {
! 	nlist("/vmunix",nl);
! 	init_kmem("/dev/kmem");
! 	init_routes();
  }
  
  #define CMUMIB 1, 3, 6, 1, 4, 1, 3
--- 228,256 ----
  
  long		long_return;
  #ifndef ibm032
! u_char		return_buf[258];  
  #else
  u_char		return_buf[256]; /* nee 64 */
  #endif
   
  init_snmp()
  {
!   int ret;
! #ifdef hpux
!   if ((ret = nlist("/hp-ux",nl)) == -1) {
!     ERROR("nlist");
!     exit(1);
!   }
!   for(ret = 0; nl[ret].n_name != NULL; ret++) {
!     if (nl[ret].n_type == 0) {
!       fprintf(stderr, "nlist err:  %s not found\n",nl[ret].n_name);
!     }
!   }
! #else
!   nlist("/vmunix",nl);
! #endif
!   init_kmem("/dev/kmem"); 
!   init_routes();
  }
  
  #define CMUMIB 1, 3, 6, 1, 4, 1, 3
***************
*** 289,351 ****
  Export int trapObjUnavailAlarmOidLen = sizeof(trapObjUnavailAlarmOidLen)/sizeof(oid);
  
  
! /*
!  * The subtree structure contains a subtree prefix which applies to
!  * all variables in the associated variable list.
!  * No subtree may be a subtree of another subtree in this list.  i.e.:
!  * 1.2
!  * 1.2.0
!  */
! struct subtree {
!     oid			name[16];	/* objid prefix of subtree */
!     u_char 		namelen;	/* number of subid's in name above */
!     struct variable	*variables;   /* pointer to variables array */
!     int			variables_len;	/* number of entries in above array */
!     int			variables_width; /* sizeof each variable entry */
! };
! 
! /*
!  * This is a new variable structure that doesn't have as much memory
!  * tied up in the object identifier.  It's elements have also been re-arranged
!  * so that the name field can be variable length.  Any number of these
!  * structures can be created with lengths tailor made to a particular
!  * application.  The first 5 elements of the structure must remain constant.
!  */
! struct variable2 {
!     u_char          magic;          /* passed to function as a hint */
!     char            type;           /* type of variable */
!     u_short         acl;            /* access control list for variable */
!     u_char          *(*findVar)();  /* function that finds variable */
!     u_char          namelen;        /* length of name below */
!     oid             name[2];       /* object identifier of variable */
! };
! 
! struct variable4 {
!     u_char          magic;          /* passed to function as a hint */
!     char            type;           /* type of variable */
!     u_short         acl;            /* access control list for variable */
!     u_char          *(*findVar)();  /* function that finds variable */
!     u_char          namelen;        /* length of name below */
!     oid             name[4];       /* object identifier of variable */
! };
! 
! struct variable7 {
!     u_char          magic;          /* passed to function as a hint */
!     char            type;           /* type of variable */
!     u_short         acl;            /* access control list for variable */
!     u_char          *(*findVar)();  /* function that finds variable */
!     u_char          namelen;        /* length of name below */
!     oid             name[7];       /* object identifier of variable */
! };
! 
! struct variable13 {
!     u_char          magic;          /* passed to function as a hint */
!     char            type;           /* type of variable */
!     u_short         acl;            /* access control list for variable */
!     u_char          *(*findVar)();  /* function that finds variable */
!     u_char          namelen;        /* length of name below */
!     oid             name[13];       /* object identifier of variable */
! };
  
  /*
   * ##############################################################
--- 327,333 ----
  Export int trapObjUnavailAlarmOidLen = sizeof(trapObjUnavailAlarmOidLen)/sizeof(oid);
  
  
! #include "var_struct.h"
  
  /*
   * ##############################################################
***************
*** 522,534 ****
      {UDPOUTDATAGRAMS, COUNTER, RONLY, var_udp, 1, {4}}
  };
  
  #ifndef sparc
  struct variable2 process_variables[] = {
      {PROCESSSLOTINDEX, INTEGER, RONLY, var_process, 1, {1}},
!     {PROCESSID, INTEGER, RONLY, var_proces, 1, {2}},
      {PROCESSCOMMAND, STRING, RONLY, var_process, 1, {3}}
  };
  #endif
  
  /*
   * Note that the name field must be larger than any name that might
--- 504,518 ----
      {UDPOUTDATAGRAMS, COUNTER, RONLY, var_udp, 1, {4}}
  };
  
+ #ifndef hpux
  #ifndef sparc
  struct variable2 process_variables[] = {
      {PROCESSSLOTINDEX, INTEGER, RONLY, var_process, 1, {1}},
!     {PROCESSID, INTEGER, RONLY, var_process, 1, {2}},
      {PROCESSCOMMAND, STRING, RONLY, var_process, 1, {3}}
  };
  #endif
+ #endif
  
  /*
   * Note that the name field must be larger than any name that might
***************
*** 931,944 ****
  }
  
  
  
- char version_descr[128] = "Unix 4.3BSD";
  char sysContact[128] = "Unknown";
  char sysName[128] = "Unknown";
  char sysLocation[128] = "Unknown";
  
! 
  oid version_id[] = {1, 3, 6, 1, 4, 1, 3, 1, 1};
  
  u_long
  sysUpTime(){
--- 915,935 ----
  }
  
  
+ #ifdef hpux
+ char version_descr[128] = "HP-UX";
+ #else
+ char version_descr[128] = "Unknown";
+ #endif
  
  char sysContact[128] = "Unknown";
  char sysName[128] = "Unknown";
  char sysLocation[128] = "Unknown";
  
! #ifdef hpux
! oid version_id[] = {1, 3, 6, 1, 4, 1, 11, 2, 3, 2, 5};
! #else
  oid version_id[] = {1, 3, 6, 1, 4, 1, 3, 1, 1};
+ #endif
  
  u_long
  sysUpTime(){
***************
*** 1012,1019 ****
  
          switch (vp->magic) {
                  case HOSTTIMETABADDRESS:
!                         *var_len = sizeof(struct ether_addr);
!                         return (u_char *) "RMONRULES";
                  case HOSTTIMETABCREATIONORDER:
  			long_return = creationOrder;
  			return (u_char *) &long_return;
--- 1003,1011 ----
  
          switch (vp->magic) {
                  case HOSTTIMETABADDRESS:
! /*                  *var_len = sizeof(struct ether_addr); */
!                   *var_len = 6*sizeof(u_char);
!                   return (u_char *) "RMONRULES";
                  case HOSTTIMETABCREATIONORDER:
  			long_return = creationOrder;
  			return (u_char *) &long_return;
***************
*** 1064,1070 ****
  	    *var_len = sizeof(version_id);
  	    return (u_char *)version_id;
  	case UPTIME:
! 	    (u_long)long_return = sysUpTime();
  	    return (u_char *)&long_return;
  	case IFNUMBER:
  	    long_return = Interface_Scan_Get_Count();
--- 1056,1062 ----
  	    *var_len = sizeof(version_id);
  	    return (u_char *)version_id;
  	case UPTIME:
! 	    long_return = (u_long)  sysUpTime();
  	    return (u_char *)&long_return;
  	case IFNUMBER:
  	    long_return = Interface_Scan_Get_Count();
***************
*** 1303,1309 ****
  	    if (cp) long_return = atoi(cp);
  	    else
  #endif
! 	    (u_long)long_return = 1;	/* OTHER */
  	    return (u_char *) &long_return;
  	case IFPHYSADDRESS:
  #if 0
--- 1295,1301 ----
  	    if (cp) long_return = atoi(cp);
  	    else
  #endif
! 	    long_return = (u_long)  1;	/* OTHER */
  	    return (u_char *) &long_return;
  	case IFPHYSADDRESS:
  #if 0
***************
*** 1329,1358 ****
  	    long_return = 0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFINOCTETS:
! 	    (u_long)long_return = ifnet.if_ipackets * 308; /* XXX */
  	    return (u_char *) &long_return;
  	case IFINUCASTPKTS:
! 	    (u_long)long_return = ifnet.if_ipackets;
  	    return (u_char *) &long_return;
  	case IFINNUCASTPKTS:
! 	    (u_long)long_return = 0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFINDISCARDS:
! 	    (u_long)long_return = 0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFINERRORS:
  	    return (u_char *) &ifnet.if_ierrors;
  	case IFINUNKNOWNPROTOS:
! 	    (u_long)long_return = 0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFOUTOCTETS:
! 	    (u_long)long_return = ifnet.if_opackets * 308; /* XXX */
  	    return (u_char *) &long_return;
  	case IFOUTUCASTPKTS:
! 	    (u_long)long_return = ifnet.if_opackets;
  	    return (u_char *) &long_return;
  	case IFOUTNUCASTPKTS:
! 	    (u_long)long_return = 0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFOUTDISCARDS:
  	    return (u_char *) &ifnet.if_snd.ifq_drops;
--- 1321,1350 ----
  	    long_return = 0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFINOCTETS:
! 	    long_return = (u_long)  ifnet.if_ipackets * 308; /* XXX */
  	    return (u_char *) &long_return;
  	case IFINUCASTPKTS:
! 	    long_return = (u_long)  ifnet.if_ipackets;
  	    return (u_char *) &long_return;
  	case IFINNUCASTPKTS:
! 	    long_return = (u_long)  0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFINDISCARDS:
! 	    long_return = (u_long)  0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFINERRORS:
  	    return (u_char *) &ifnet.if_ierrors;
  	case IFINUNKNOWNPROTOS:
! 	    long_return = (u_long)  0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFOUTOCTETS:
! 	    long_return = (u_long)  ifnet.if_opackets * 308; /* XXX */
  	    return (u_char *) &long_return;
  	case IFOUTUCASTPKTS:
! 	    long_return = (u_long)  ifnet.if_opackets;
  	    return (u_char *) &long_return;
  	case IFOUTNUCASTPKTS:
! 	    long_return = (u_long)  0; /* XXX */
  	    return (u_char *) &long_return;
  	case IFOUTDISCARDS:
  	    return (u_char *) &ifnet.if_snd.ifq_drops;
***************
*** 1463,1469 ****
  {
      static struct ipstat ipstat;
      oid newname[MAX_NAME_LEN];
!     int result;
  
      bcopy((char *)vp->name, (char *)newname, (int)vp->namelen * sizeof(oid));
      newname[8] = 0;
--- 1455,1461 ----
  {
      static struct ipstat ipstat;
      oid newname[MAX_NAME_LEN];
!     int result, i;
  
      bcopy((char *)vp->name, (char *)newname, (int)vp->namelen * sizeof(oid));
      newname[8] = 0;
***************
*** 2345,2351 ****
  
  
  
! #if defined(mips) || defined(ibm032) || defined(sunV3)
  
  
  /*
--- 2337,2343 ----
  
  
  
! #if defined(mips) || defined(ibm032) || defined(sunV3) || defined(hpuxx)
  
  
  /*
***************
*** 2356,2363 ****
  struct proc procbuf[PROCBLOC];
  
  
! u_char *
! var_process(vp, name, length, exact, var_len, write_method)
      register struct variable *vp;   /* IN - pointer to variable entry that points here */
      register oid	*name;	    /* IN/OUT - input name requested, output name found */
      register int	*length;    /* IN/OUT - length of input and output oid's */
--- 2348,2354 ----
  struct proc procbuf[PROCBLOC];
  
  
! u_char *var_process(vp, name, length, exact, var_len, write_method)
      register struct variable *vp;   /* IN - pointer to variable entry that points here */
      register oid	*name;	    /* IN/OUT - input name requested, output name found */
      register int	*length;    /* IN/OUT - length of input and output oid's */
Index: agent/var_struct.h
diff -c /dev/null agent/var_struct.h:1.1.4.1
*** /dev/null	Tue Mar 14 09:44:15 1995
--- agent/var_struct.h	Mon Mar 13 16:20:34 1995
***************
*** 0 ****
--- 1,57 ----
+ /*
+  * The subtree structure contains a subtree prefix which applies to
+  * all variables in the associated variable list.
+  * No subtree may be a subtree of another subtree in this list.  i.e.:
+  * 1.2
+  * 1.2.0
+  */
+ struct subtree {
+     oid			name[16];	/* objid prefix of subtree */
+     u_char 		namelen;	/* number of subid's in name above */
+     struct variable	*variables;   /* pointer to variables array */
+     int			variables_len;	/* number of entries in above array */
+     int			variables_width; /* sizeof each variable entry */
+ };
+ 
+ /*
+  * This is a new variable structure that doesn't have as much memory
+  * tied up in the object identifier.  It's elements have also been re-arranged
+  * so that the name field can be variable length.  Any number of these
+  * structures can be created with lengths tailor made to a particular
+  * application.  The first 5 elements of the structure must remain constant.
+  */
+ struct variable2 {
+     u_char          magic;          /* passed to function as a hint */
+     char            type;           /* type of variable */
+     u_short         acl;            /* access control list for variable */
+     u_char          *(*findVar)();  /* function that finds variable */
+     u_char          namelen;        /* length of name below */
+     oid             name[2];       /* object identifier of variable */
+ };
+ 
+ struct variable4 {
+     u_char          magic;          /* passed to function as a hint */
+     char            type;           /* type of variable */
+     u_short         acl;            /* access control list for variable */
+     u_char          *(*findVar)();  /* function that finds variable */
+     u_char          namelen;        /* length of name below */
+     oid             name[4];       /* object identifier of variable */
+ };
+ 
+ struct variable7 {
+     u_char          magic;          /* passed to function as a hint */
+     char            type;           /* type of variable */
+     u_short         acl;            /* access control list for variable */
+     u_char          *(*findVar)();  /* function that finds variable */
+     u_char          namelen;        /* length of name below */
+     oid             name[7];       /* object identifier of variable */
+ };
+ 
+ struct variable13 {
+     u_char          magic;          /* passed to function as a hint */
+     char            type;           /* type of variable */
+     u_short         acl;            /* access control list for variable */
+     u_char          *(*findVar)();  /* function that finds variable */
+     u_char          namelen;        /* length of name below */
+     oid             name[13];       /* object identifier of variable */
+ };
Index: apps/snmptrapd.c
diff -c apps/snmptrapd.c:1.1.1.2 apps/snmptrapd.c:1.1.2.1
*** apps/snmptrapd.c:1.1.1.2	Wed Mar  8 16:07:37 1995
--- apps/snmptrapd.c	Tue Mar 14 09:27:05 1995
***************
*** 25,31 ****
--- 25,33 ----
  ******************************************************************/
  #include <sys/types.h>
  #include <sys/socket.h>
+ #ifndef hpux
  #include <sys/sockio.h>
+ #endif
  #include <netinet/in.h>
  #include <stdio.h>
  #include <sys/time.h>
Index: snmplib/Makefile
diff -c snmplib/Makefile:1.1.1.2 snmplib/Makefile:1.1.2.2
*** snmplib/Makefile:1.1.1.2	Wed Mar  8 16:08:15 1995
--- snmplib/Makefile	Tue Mar 14 09:27:39 1995
***************
*** 2,9 ****
  # 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
  OSFLAGS=
  CFLAGS=-g -DDEBUG ${OSFLAGS}
  CC = cc
--- 2,9 ----
  # 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 hpux.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 hpux.o
  OSFLAGS=
  CFLAGS=-g -DDEBUG ${OSFLAGS}
  CC = cc
Index: snmplib/hpux.c
diff -c /dev/null snmplib/hpux.c:1.1.2.1
*** /dev/null	Tue Mar 14 09:44:42 1995
--- snmplib/hpux.c	Mon Mar 13 16:20:55 1995
***************
*** 0 ****
--- 1,30 ----
+ /* hp-port:  needed random defs and htonl and htons defs */
+ 
+ #ifdef hpux
+ int random()
+ {
+   return(rand());
+ }
+ 
+ void srandom(seed)
+   unsigned int seed;
+ {
+   srand(seed);
+ }
+ 
+ #endif
+ /* hp-port:  needed random defs and htonl and htons defs */
+ 
+ #ifdef hpux
+ int random()
+ {
+   return(rand());
+ }
+ 
+ void srandom(seed)
+   unsigned int seed;
+ {
+   srand(seed);
+ }
+ 
+ #endif
Index: snmplib/mib.c
diff -c snmplib/mib.c:1.1.1.2 snmplib/mib.c:1.1.2.1
*** snmplib/mib.c:1.1.1.2	Wed Mar  8 16:08:30 1995
--- snmplib/mib.c	Tue Mar 14 09:27:51 1995
***************
*** 617,622 ****
--- 617,624 ----
  	Mib = read_mib("mib.txt");
      if (!Mib)
  	Mib = read_mib("/usr/local/lib/mib.txt");
+     if (!Mib)
+ 	Mib = read_mib("/etc/mib.txt");
      if (!Mib){
  	fprintf(stderr, "Couldn't find mib file\n");
  	exit(2);
Index: snmplib/parse.c
diff -c snmplib/parse.c:1.1.1.2 snmplib/parse.c:1.1.2.1
*** snmplib/parse.c:1.1.1.2	Wed Mar  8 16:08:33 1995
--- snmplib/parse.c	Tue Mar 14 09:27:53 1995
***************
*** 747,755 ****
  	return 0;
      } else {
  	if (!strcmp(token, "TEXTUAL-CONVENTION")){
! 	    while (type != SYNTAX)
! 		type = get_token(fp, token);
! 	    type = get_token(fp, token);
  	}
  	/* textual convention */
  	for(i = 0; i < MAXTC; i++){
--- 747,759 ----
  	return 0;
      } else {
  	if (!strcmp(token, "TEXTUAL-CONVENTION")){
!           while (type != SYNTAX) {
!               if (type == DESCRIPTION)
! 		type = get_token(fp, quoted_string_buffer);
!               else
!                 type = get_token(fp, token);
!           }
!           type = get_token(fp, token);
  	}
  	/* textual convention */
  	for(i = 0; i < MAXTC; i++){
***************
*** 1318,1324 ****
      np->description = NULL;        /* default to an empty description */
      type = get_token(fp, token);
      while (type != EQUALS) {
! 	type = get_token(fp, token);
      }
      length = getoid(fp, oid, 32);
      if (length > 1 && length <= 32){
--- 1322,1331 ----
      np->description = NULL;        /* default to an empty description */
      type = get_token(fp, token);
      while (type != EQUALS) {
!       if (type == DESCRIPTION)
!         type = get_token(fp, quoted_string_buffer);
!       else
!         type = get_token(fp, token);
      }
      length = getoid(fp, oid, 32);
      if (length > 1 && length <= 32){
***************
*** 1638,1644 ****
      register char *cp = token;
      register int hash = 0;
      register struct tok *tp;
! 
      *cp = 0;
      ch = last;
      /* skip all white space */
--- 1645,1651 ----
      register char *cp = token;
      register int hash = 0;
      register struct tok *tp;
!     
      *cp = 0;
      ch = last;
      /* skip all white space */
***************
*** 1761,1778 ****
      register char *token;
  {
      register int ch;
!     int eat_space = 0;
  
      ch = getc(fp);
      while(ch != -1) {
! 	if (ch == '\n')
! 	    Line++;
! 	else if (ch == '"') {
! 	    *token = '\0';
! 	    return QUOTESTRING;
! 	}
  	*token++ = ch;
! 	ch = getc(fp);
      }
  
      return NULL;
--- 1768,1789 ----
      register char *token;
  {
      register int ch;
!     int eat_space = 0, count = 0;
  
      ch = getc(fp);
      while(ch != -1) {
!       if (ch == '\n') {
!         Line++;
!       }
!       else if (ch == '"') {
!         *token = '\0';
!         return QUOTESTRING;
!       }
!       /* maximum description length check.  If greater, keep parsing
!          but truncate the string */
!       if (count++ < MAXQUOTESTR)
  	*token++ = ch;
!       ch = getc(fp);
      }
  
      return NULL;
Index: snmplib/party_parse.c
diff -c snmplib/party_parse.c:1.1.1.2 snmplib/party_parse.c:1.1.2.2
*** snmplib/party_parse.c:1.1.1.2	Wed Mar  8 16:08:42 1995
--- snmplib/party_parse.c	Tue Mar 14 09:28:00 1995
***************
*** 4,9 ****
--- 4,13 ----
  #include <sys/time.h>
  #include <fcntl.h>
  #include <unistd.h>
+ #ifdef hpux
+ /* needed for htonl funcs */
+ #include <netinet/in.h>
+ #endif
  #include "asn1.h"
  #include "party.h"
  #include "system.h"
Index: snmplib/snmp_client.c
diff -c snmplib/snmp_client.c:1.1.1.2 snmplib/snmp_client.c:1.1.2.2
*** snmplib/snmp_client.c:1.1.1.2	Wed Mar  8 16:08:53 1995
--- snmplib/snmp_client.c	Tue Mar 14 09:28:08 1995
***************
*** 29,34 ****
--- 29,38 ----
  #include <netinet/in.h>
  #include <sys/time.h>
  #include <errno.h>
+ #ifdef hpux
+ /* needed for htonl funcs */
+ #include <netinet/in.h>
+ #endif
  
  #include "asn1.h"
  #include "snmp.h"
Index: snmplib/system.c
diff -c snmplib/system.c:1.1.1.2 snmplib/system.c:1.1.2.1
*** snmplib/system.c:1.1.1.2	Wed Mar  8 16:08:58 1995
--- snmplib/system.c	Tue Mar 14 09:28:12 1995
***************
*** 26,32 ****
--- 26,34 ----
  #include <sys/time.h>
  #include <netinet/in.h>
  #include <sys/socket.h>
+ #ifndef hpux
  #include <sys/sockio.h>
+ #endif
  #include <net/if.h>
  #include <sys/ioctl.h>
  #include <nlist.h>
