SNMP agent attached to SPI slave

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
lorcansmith
Date:
Thu Sep 06 12:52:48 2012 +0000
Parent:
1:bbae6f16a449
Commit message:
Open source version 1.a

Changed in this revision

IO_file.h Show annotated file Show diff for this revision Revisions of this file
lwip/core/snmp/mib2.c Show annotated file Show diff for this revision Revisions of this file
lwip/core/snmp/msg_in.c Show annotated file Show diff for this revision Revisions of this file
lwip/core/snmp/msg_out.c Show annotated file Show diff for this revision Revisions of this file
lwip/core/snmp/private_mib.c Show annotated file Show diff for this revision Revisions of this file
lwip/core/snmp/private_mib.h Show annotated file Show diff for this revision Revisions of this file
lwip/include/lwip/opt.h Show annotated file Show diff for this revision Revisions of this file
lwip/include/lwip/snmp_msg.h Show annotated file Show diff for this revision Revisions of this file
lwip/include/lwip/snmp_structs.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/IO_file.h	Mon Sep 03 10:46:04 2012 +0000
+++ b/IO_file.h	Thu Sep 06 12:52:48 2012 +0000
@@ -1,9 +1,9 @@
 /*****************************************************************************
-*                     Copyright Field Electronics Ltd
+*                     Copyright SEEC Ltd
 * File:             IO_file.h
-* Reference:        1000PX-BM1660-HDR-IO_file
+* Reference:        A3600-HDR-IO_file
 * Content:          Defines & declarations for HTTP server
-* Version:          1.2
+* Version:          1.1
 * System:           mbed
 * Target Hardware:  mbed                                  
 * Amendment Record:    
@@ -14,15 +14,12 @@
   0.3   22/12/11    Add new_cmd_idx to indicate which parameter has been set. 
   0.4   27/12/11    Add RUN_SCAN_CMD as index for writing wiring scan enable. 
   0.5   29/12/11    Add net_addrs_set for writing net address to file. 
-  0.6   06/01/12    Change 3000 index for version & add indices for net addresses 
+  0.6   06/01/12    Change main CPU index for version & add indices for net addresses 
   0.7   09/01/12    #define NET_ADDRESS_CHANGE to flag net address changes 
   0.8   30/01/12    Add get_SPI_count() & #define SPI_COUNT = 1752
   0.9   03/05/12    Add definitions used for trap handling
   1.0   15/06/12    Make TRAP_HOST_ADDRESS contiguous with SNMP net addresses
   1.1   18/06/12    Add get_hex_mask for updates from SNMP
-  1.2   09/08/12    #define MSG_LNGTH  16. #define NUM_MASK  8 
-                    Declare extern char alarm_msg[NUM_MASK][MSG_LNGTH]
-                    Declare extern unsigned long io_mask[]
 */
 /****************************************************************************/
 
@@ -33,36 +30,33 @@
 #define __DEBUG
 #include "dbg/dbg.h"
 #include "ipaddr.h"
-#include "private_mib.h"
 //#include "rpc.h"
 
-#define H_H_LINK_MSBYTE     62        // index to 3000 head-head link status ms byte
+#define H_H_LINK_MSBYTE     62        // index to main CPU head-head link status ms byte
 #define H_H_LINK_LSBYTE     63        // DEBUG head-head link status ls byte should be 63
 #define MAX_IO_REG_BYTE     63        // Maximum I/O byte checked for changes
 
-#define NET_IP_ADDRESS      1704      // index to 3000 firmware IP addresses
-#define NET_ADDRESS_MASK    1708      // index to 3000 firmware address mask
-#define NET_GATEWAY_ADDRS   1712      // index to 3000 firmware gateway address
-#define NET_DNS_ADDRESS     1716      // index to 3000 firmware DNS address
-#define TRAP_HOST_ADDRESS   1720      // index to 3000 firmware address for trap host
-#define NET_ADDRESS_CHANGE  1736      // index to 3000 address change flag
-#define SPI_COUNT     1752            // index to 3000 SPI write count (activity indicator)
-#define VERSION_IDX   1754            // index to 3000 firmware version number
-#define RUN_SCAN_IDX  1758            // index to wiring scan enable in 3000 unit 
-#define NUM_CARD_IDX  2045            // index to number of card in 3000 unit
-#define COMMS_IDX     2046            // index to 3000 Modbus comms type and speed
-#define UNIT_ID_IDX   2047            // index to 3000 Modbus comms unit ident
+#define NET_IP_ADDRESS      1704      // index to main CPU firmware IP addresses
+#define NET_ADDRESS_MASK    1708      // index to main CPU firmware address mask
+#define NET_GATEWAY_ADDRS   1712      // index to main CPU firmware gateway address
+#define NET_DNS_ADDRESS     1716      // index to main CPU firmware DNS address
+#define TRAP_HOST_ADDRESS   1720      // index to main CPU firmware address for trap host
+#define NET_ADDRESS_CHANGE  1736      // index to main CPU address change flag
+#define SPI_COUNT     1752            // index to main CPU SPI write count (activity indicator)
+#define VERSION_IDX   1754            // index to main CPU firmware version number
+#define RUN_SCAN_IDX  1758            // index to wiring scan enable in main CPU unit 
+#define NUM_CARD_IDX  2045            // index to number of card in main CPU unit
+#define COMMS_IDX     2046            // index to main CPU Modbus comms type and speed
+#define UNIT_ID_IDX   2047            // index to main CPU Modbus comms unit ident
 #define MAX_RAM       2048            // size of RAM to copy
 #define UNIT_ID_CMD   1               // index to command for Modbus comms unit ident
 #define RUN_SCAN_CMD  2               // index to command for 1000PX run scan enable
 
-/* v0.9: Trap definitions added */
-#define ONLY_TRAP       0               // index for trap when only one used
+/* v0.9: Trap definitions addeds */
+#define ONLY_TRAP       0           // index for trap when only one used
 #define DISABLED        0
 #define ENABLED         1
 
-#define MSG_LNGTH       16              // length of strings for alarm & location messages
-#define NUM_MASK        8               // MAX_ALARM_ID # of io_masks available for alarms
 
 class SPI_Server
 {
@@ -104,20 +98,12 @@
 extern unsigned char dns_ad[];
 extern unsigned char th_ad[];
 extern unsigned char net_addrs_set;     // flags net address change
-extern unsigned char alarm_str_set;     // flags alarm string update from SNMP
 
 extern unsigned char blink_led;
 
-extern char alarm_msg[NUM_MASK][MSG_LNGTH];  // alarm messages associated with io_masks
-extern unsigned long io_mask[];           // masks for alarms on IO registers 
-extern unsigned long mask4_IO_registers;  // mask for IO regs ignoring IO31 & 32
-
-
 extern SPI_Server fsvr;
 extern void check4write_offset( char * req );
-extern char * get_hex_mask( unsigned long bit_mask );
-extern char * get_alarm_string(unsigned char alarm_idx);
-extern int read_alarm_from_file(unsigned char alarm_idx);
+extern char * get_hex_mask( void );
 
 extern IpAddr mip;
 
--- a/lwip/core/snmp/mib2.c	Mon Sep 03 10:46:04 2012 +0000
+++ b/lwip/core/snmp/mib2.c	Thu Sep 06 12:52:48 2012 +0000
@@ -1,5 +1,5 @@
 /*****************************************************************************
-*                   Field Electronics Ltd
+*                   SEEC Ltd
 * File:             mib2.c
 * Reference:        Enet_SPI\lwip\core\snmp\mib2.c
 * Content:          Header file for private MIB tree structures
--- a/lwip/core/snmp/msg_in.c	Mon Sep 03 10:46:04 2012 +0000
+++ b/lwip/core/snmp/msg_in.c	Thu Sep 06 12:52:48 2012 +0000
@@ -1,7 +1,7 @@
 /*****************************************************************************
-*                     Copyright Field Electronics Ltd
+*                     Copyright SEEC Ltd
 * File:             msg_in.c
-* Reference:        3000-A3600-SRC-msg_in
+* Reference:        A3600-SRC-msg_in
 * Content:          Parse incoming SNMP messages
 * Version:          0.3
 * System:           mbed gnu compiler
--- a/lwip/core/snmp/msg_out.c	Mon Sep 03 10:46:04 2012 +0000
+++ b/lwip/core/snmp/msg_out.c	Thu Sep 06 12:52:48 2012 +0000
@@ -1,9 +1,9 @@
 /*****************************************************************************
-*                     Copyright Field Electronics Ltd
+*                     Copyright SEEC Ltd
 * File:             msg_out.c
-* Reference:        3000-A3600-HDR-msg_out
+* Reference:        A3600-HDR-msg_out
 * Content:          Builds SNMP output messages
-* Version:          0.5
+* Version:          0.3
 * System:           mbed gnu compiler
 * Target Hardware:  mbed LPC1768                                  
 * Amendment Record:    
@@ -16,10 +16,6 @@
   Define snmp_linkdown_trap() & snmp_linkup_trap()
 * 0.3         19/06/12: L. Smith
   Define snmp_SPIdown_trap() & snmp_SPIup_trap() and f3kIOchange_trap()
-* 0.4         25/07/12: L. Smith
-  Declare struct snmp_varbind io_var for sending f3kIOchange_trap() 
-* 0.5         03/08/12: L. Smith
-  Add f3kIOalarm_trap() and struct snmp_varbind io_alarm for IO alarm messages
 *******************************************************************************/
 /**
  * @file
@@ -76,9 +72,6 @@
 #include "lwip/snmp_msg.h"
 #include "private_mib.h"
 
-/** v0.5: enterprise ID for enterprise specific TRAPs */
-const struct snmp_obj_id snmptrap_id = {7,{1,3,6,1,4,1,SNMP_ENTERPRISE_ID}};
-
 struct snmp_trap_dst
 {
   /* destination IP address in network order */
@@ -91,12 +84,6 @@
 /** TRAP message structure */
 struct snmp_msg_trap trap_msg;
 
-/** v0.4: TRAP IO variable structure */
-struct snmp_varbind io_var;
-/** v0.5: TRAP IO alarm message variable structures */
-struct snmp_varbind al_var;
-struct snmp_varbind io_alarm;
-
 static u16_t snmp_resp_header_sum(struct snmp_msg_pstat *m_stat, u16_t vb_len);
 static u16_t snmp_trap_header_sum(struct snmp_msg_trap *m_trap, u16_t vb_len);
 static u16_t snmp_varbind_list_sum(struct snmp_varbind_root *root);
@@ -261,7 +248,7 @@
 
   for (i=0, td = &trap_dst[0]; i<SNMP_TRAP_DESTINATIONS; i++, td++)
   {
-printf("\r\nsnmp_send_trap: generic trap %d, %d \r\n", generic_trap, specific_trap );
+printf("\r\nsnmp_send_trap: generic trap %d\r\n", generic_trap );
     if ((td->enable != 0) && !ip_addr_isany(&td->dip))
     {
       /* network order trap destination */
@@ -275,7 +262,7 @@
       trap_msg.sip_raw[1] = ip4_addr2(&dst_ip);
       trap_msg.sip_raw[2] = ip4_addr3(&dst_ip);
       trap_msg.sip_raw[3] = ip4_addr4(&dst_ip);
-//printf("snmp_send_trap: source ip %d.%d.%d.%d\r\n", trap_msg.sip_raw[0], trap_msg.sip_raw[1], trap_msg.sip_raw[2], trap_msg.sip_raw[3]);
+printf("snmp_send_trap: source ip %d.%d.%d.%d\r\n", trap_msg.sip_raw[0], trap_msg.sip_raw[1], trap_msg.sip_raw[2], trap_msg.sip_raw[3]);
       trap_msg.gen_trap = generic_trap;
       trap_msg.spc_trap = specific_trap;
       if (generic_trap == SNMP_GENTRAP_ENTERPRISESPC)
@@ -293,7 +280,6 @@
       /* pass 0, calculate length fields */
       tot_len = snmp_varbind_list_sum(&trap_msg.outvb);
       tot_len = snmp_trap_header_sum(&trap_msg, tot_len);
-//printf("\r\nsnmp_send_trap: tot_len inc header %d", tot_len);
 
       /* allocate pbuf(s) */
       p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL);
@@ -385,7 +371,7 @@
 
 /****************************************************************************/ 
 /*              f3kIOchange_trap: v0.3
-* Description:  sends general IO changed trap message
+* Description:  sends SPIdown trap message
 * Globals used: trap_msg
 * Parameters:   NONE
 * Returns:      NONE
@@ -393,10 +379,10 @@
 /****************************************************************************/ 
 void f3kIOchange_trap( void )
 {
-  trap_msg.outvb.head = &io_var;
-  trap_msg.outvb.tail = &io_var;
-  trap_msg.outvb.count = 1;
-  snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, (snmp_obj_id *)&snmptrap_id, SNMP_SPCTRAP_IO_CHANGE);
+  trap_msg.outvb.head = NULL;
+  trap_msg.outvb.tail = NULL;
+  trap_msg.outvb.count = 0;
+  snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, &snmptrap_id, SNMP_SPCTRAP_IO_CHANGE);
 }
 
 /****************************************************************************/ 
@@ -412,7 +398,7 @@
   trap_msg.outvb.head = NULL;
   trap_msg.outvb.tail = NULL;
   trap_msg.outvb.count = 0;
-  snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, (snmp_obj_id *)&snmptrap_id, SNMP_SPCTRAP_SPI_DOWN);
+  snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, &snmptrap_id, SNMP_SPCTRAP_SPI_DOWN);
 }
 
 /****************************************************************************/ 
@@ -428,23 +414,7 @@
   trap_msg.outvb.head = NULL;
   trap_msg.outvb.tail = NULL;
   trap_msg.outvb.count = 0;
-  snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, (snmp_obj_id *)&snmptrap_id, SNMP_SPCTRAP_SPI_UP);
-}
-
-/****************************************************************************/ 
-/*              f3kIOalarm_trap: v0.5
-* Description:  sends alarm trap message
-* Globals used: trap_msg
-* Parameters:   NONE
-* Returns:      NONE
-*/
-/****************************************************************************/ 
-void f3kIOalarm_trap( void )
-{
-  trap_msg.outvb.head = &al_var;
-  trap_msg.outvb.tail = &io_alarm;
-  trap_msg.outvb.count = 1;
-  snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, (snmp_obj_id *)&snmptrap_id, SNMP_SPCTRAP_IO_ALARM);
+  snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, &snmptrap_id, SNMP_SPCTRAP_SPI_UP);
 }
 
 
@@ -753,16 +723,16 @@
   ofs += m_trap->thl.tslen;
 
 /* DEBUG code */
-//printf("\r\nsnmp_trap_header_enc: ");
+printf("\r\nsnmp_trap_header_enc: ");
   raw_ptr = (u8_t*)p->payload;
   raw_ptr += dbug_ofs;
   while ( dbug_ofs < ofs )
   {
-//printf("%d.", *raw_ptr);
+printf("%d.", *raw_ptr);
     raw_ptr++;
     dbug_ofs++;
   }
-//printf("\r\nsnmp_trap_header_enc: ofs %d\r\n", ofs);
+printf("\r\nsnmp_trap_header_enc: ofs %d\r\n", ofs);
   return ofs;
 }
 
@@ -838,15 +808,16 @@
     vb = vb->next;
   }
 /* DEBUG code */
-//printf("\r\nsnmp_varbind_list_enc: ");
+printf("\r\nsnmp_varbind_list_enc: ");
   raw_ptr = (u8_t*)p->payload;
   raw_ptr += dbug_ofs;
   while ( dbug_ofs < ofs )
   {
-//printf("%d.", *raw_ptr);
+printf("%d.", *raw_ptr);
     raw_ptr++;
     dbug_ofs++;
   }
+printf("\r\nsnmp_varbind_list_enc: end ofs %d\r\n", ofs);
   return ofs;
 }
 
--- a/lwip/core/snmp/private_mib.c	Mon Sep 03 10:46:04 2012 +0000
+++ b/lwip/core/snmp/private_mib.c	Thu Sep 06 12:52:48 2012 +0000
@@ -1,9 +1,9 @@
 /*****************************************************************************
-*                   Copyright Field Electronics Ltd
+*                   Copyright SEEC Ltd
 * File:             private_mib.c
-* Reference:        3000-A3600-SRC-private_mib
+* Reference:        A3600-SRC-private_mib
 * Content:          Header file for private MIB tree structures
-* Version:          1.6
+* Version:          1.4
 * System:           mbed gnu compiler
 * Target Hardware:  mbed LPC1768                                  
 * Amendment Record:    
@@ -14,11 +14,11 @@
 * 0.2         28/11/11: L. Smith
   Add f3k_cpu_version & f3k_mbed_version to scalar values 
 * 0.3         01/12/11: L. Smith
-  Replace lwIP SNMP_ENTERPRISE_ID by Field PEN - see http://www.iana.org/assignments/enterprise-numbers
+  Replace lwIP SNMP_ENTERPRISE_ID - see http://www.iana.org/assignments/enterprise-numbers
 * 0.4         13/12/11: L. Smith
   Increase function calls for number of I/O nodes to 32 
 * 0.5         21/12/11: L. Smith
-  Increase f3k_system nodes from 3 to 5
+  Increase f3k_system nodes from 3 to 7
 * 0.6         22/12/11: L. Smith
   Add f3k_comms_set_value() and f3k_comms_set_test() to enable UID change
 * 0.7         27/12/11: L. Smith
@@ -36,11 +36,7 @@
 * 1.3         19/06/12: L. Smith
   Add f3k_IO_mask as R/W f3k_sys_object 7 - hex formatted string
 * 1.4         20/06/12: L. Smith
-  Add snmp_trh_addrs[4] as R/W f3k_comms 8 - trap host SNMP_ASN1_IPADDR
-* 1.5         25/07/12: L. Smith
-  Add snmp_publiccommunity as 9th f3k_comms variable with R/W ability
-* 1.6         08/08/12: L. Smith
-  Add f3k_IO_alarm & f3k_al_mask nodes for I/O alarm strings
+  Add snmp_trh_addrs[4] as R/W f3k_comms 8 - trap host 
 *******************************************************************************/
 
 #include "lwip/opt.h"
@@ -85,14 +81,6 @@
 //static char snmp_trh_addrs[ 4 ] = {0,0,0,0};    // v1.4: Trap host address
 
 
-static void f3k_amask_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void f3k_amask_get_value(struct obj_def *od, u16_t len, void *value);
-static u8_t f3k_amask_set_test(struct obj_def *od, u16_t len, void *value);
-static void f3k_amask_set_value(struct obj_def *od, u16_t len, void *value);
-static void f3k_alarm_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void f3k_alarm_get_value(struct obj_def *od, u16_t len, void *value);
-static u8_t f3k_alarm_set_test(struct obj_def *od, u16_t len, void *value);
-static void f3k_alarm_set_value(struct obj_def *od, u16_t len, void *value);
 static void f3k_IO_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
 static void f3k_IO_get_value(struct obj_def *od, u16_t len, void *value);
 static void f3k_comms_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
@@ -155,68 +143,6 @@
 };
 */
 
-/* f3k_al_mask nodes */
-const mib_scalar_node f3k_amask_scalar = {
-  &f3k_amask_get_object_def,
-  &f3k_amask_get_value,
-  &f3k_amask_set_test,
-  &f3k_amask_set_value,
-  MIB_NODE_SC,
-  0
-};
-
-const s32_t f3k_amask_ids[MAX_ALARM_ID] = { 1, 2, 3, 4, 5, 6, 7, MAX_ALARM_ID };
-struct mib_node* const f3k_amask_nodes[MAX_ALARM_ID] = {
-  (struct mib_node*)&f3k_amask_scalar, (struct mib_node*)&f3k_amask_scalar,
-  (struct mib_node*)&f3k_amask_scalar, (struct mib_node*)&f3k_amask_scalar,
-  (struct mib_node*)&f3k_amask_scalar, (struct mib_node*)&f3k_amask_scalar,
-  (struct mib_node*)&f3k_amask_scalar, (struct mib_node*)&f3k_amask_scalar
-};
-
-/* v1.6: f3k_al_mask .1.3.6.1.4.1.SNMP_ENTERPRISE_ID.mib_f3k */
-const struct mib_array_node f3k_al_mask = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  MAX_ALARM_ID,
-  f3k_amask_ids,
-  f3k_amask_nodes
-};
-
-
-/* f3k_IO_alarm nodes */
-const mib_scalar_node f3k_alarm_scalar = {
-  &f3k_alarm_get_object_def,
-  &f3k_alarm_get_value,
-  &f3k_alarm_set_test,
-  &f3k_alarm_set_value,
-  MIB_NODE_SC,
-  0
-};
-
-const s32_t f3k_alarm_ids[MAX_ALARM_ID] = { 1, 2, 3, 4, 5, 6, 7, MAX_ALARM_ID };
-struct mib_node* const f3k_alarm_nodes[MAX_ALARM_ID] = {
-  (struct mib_node*)&f3k_alarm_scalar, (struct mib_node*)&f3k_alarm_scalar,
-  (struct mib_node*)&f3k_alarm_scalar, (struct mib_node*)&f3k_alarm_scalar,
-  (struct mib_node*)&f3k_alarm_scalar, (struct mib_node*)&f3k_alarm_scalar,
-  (struct mib_node*)&f3k_alarm_scalar, (struct mib_node*)&f3k_alarm_scalar
-};
-
-/* v1.6: f3k_IO_alarm .1.3.6.1.4.1.SNMP_ENTERPRISE_ID.mib_f3k */
-const struct mib_array_node f3k_IO_alarm = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  MAX_ALARM_ID,
-  f3k_alarm_ids,
-  f3k_alarm_nodes
-};
-
-
 /* f3k_IO nodes */
 const mib_scalar_node f3k_IO_scalar = {
   &f3k_IO_get_object_def,
@@ -272,13 +198,12 @@
   0
 };
 
-const s32_t f3k_comms_ids[MAX_COMMS_ID] = { 1, 2, 3, 4, 5, 6, 7, 8, MAX_COMMS_ID };
-struct mib_node* const f3k_comms_nodes[MAX_COMMS_ID] = {
+const s32_t f3k_comms_ids[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+struct mib_node* const f3k_comms_nodes[8] = {
   (struct mib_node*)&f3k_comms_scalar, (struct mib_node*)&f3k_comms_scalar,
   (struct mib_node*)&f3k_comms_scalar, (struct mib_node*)&f3k_comms_scalar,
   (struct mib_node*)&f3k_comms_scalar, (struct mib_node*)&f3k_comms_scalar,
-  (struct mib_node*)&f3k_comms_scalar, (struct mib_node*)&f3k_comms_scalar,
-  (struct mib_node*)&f3k_comms_scalar
+  (struct mib_node*)&f3k_comms_scalar, (struct mib_node*)&f3k_comms_scalar
 };
 /* v0.3: f3k_comms .1.3.6.1.4.1.SNMP_ENTERPRISE_ID.mib_f3k */
 const struct mib_array_node f3k_comms = {
@@ -287,7 +212,7 @@
   &noleafs_set_test,
   &noleafs_set_value,
   MIB_NODE_AR,
-  MAX_COMMS_ID,
+  8,
   f3k_comms_ids,
   f3k_comms_nodes
 };
@@ -323,14 +248,11 @@
   f3k_sys_nodes
 };
 
-/* 1.6  Add f3k_IO_alarm & f3k_al_mask nodes for I/O alarm strings */
-const s32_t f3k_ids[5] = { 1, 2, 3, 4, 5 };
-struct mib_node* const f3k_nodes[5] = {
+const s32_t f3k_ids[5] = { 1, 2, 3 };
+struct mib_node* const f3k_nodes[3] = {
   (struct mib_node*)&f3k_system,
   (struct mib_node*)&f3k_comms,
-  (struct mib_node*)&f3k_IO,
-  (struct mib_node*)&f3k_IO_alarm,
-  (struct mib_node*)&f3k_al_mask
+  (struct mib_node*)&f3k_IO
 };
 /* v0.3: mib_f3k .1.3.6.1.4.1.SNMP_ENTERPRISE_ID */
 /* f3k private node called from mib_array_node mib_link */
@@ -340,7 +262,7 @@
   &noleafs_set_test,
   &noleafs_set_value,
   MIB_NODE_AR,
-  5,
+  3,
   f3k_ids,
   f3k_nodes
 };
@@ -397,7 +319,7 @@
   f3k_num_cards = (u16_t)fsvr.get_byte( NUM_CARD_IDX );
   f3k_SPI_count = fsvr.get_SPI_count();
   f3k_run_scan = (u16_t)fsvr.get_byte( RUN_SCAN_IDX );
-  strncpy( f3k_IO_mask, get_hex_mask( mask4_IO_registers ), 8 );  // v1.3: copy mask4_IO_registers as hex
+  strncpy( f3k_IO_mask, get_hex_mask(), 8 );  // v1.3: copy mask4_IO_registers as hex
   f3k_uid  = (u16_t)fsvr.get_byte( UNIT_ID_IDX );
   comm_cfg  = (u8_t)fsvr.get_byte( COMMS_IDX );
   f3k_protocol  = (u16_t)(comm_cfg / 16);
@@ -582,13 +504,13 @@
   ident -= 1;
   LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 7));
   if ((ident_len == 2) &&
-      (ident[0] > 0) && (ident[0] <= MAX_PRIVATE_ID))
+      (ident[0] > 0) && (ident[0] < MAX_PRIVATE_ID))
   {
     od->id_inst_len = ident_len;
     od->id_inst_ptr = ident;
 
     id = (u8_t)ident[0];
-//    printf("\r\nf3k_sys_get_object_def: ident_len %d, id %d\r\n", ident_len, id);
+    printf("\r\nf3k_sys_get_object_def: ident_len %d, id %d\r\n", ident_len, id);
     switch (id)
     {
       case 1: /* f3k_fw_version */
@@ -659,7 +581,8 @@
   LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_PRIVATE_ID));
   snmp_get_f3k_data();                  // read the data from the SPI array
   id = (u8_t)od->id_inst_ptr[0];
-  switch ( id )
+  printf("\r\nf3k_sys_set_test:  id %d, len %d\r\n", id, len);
+  switch (id)
   {
     case 1: /* f3k_fw_version */
       while (i < len) {
@@ -711,7 +634,7 @@
   set_ok = 0;
   LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 7));
   id = (u8_t)od->id_inst_ptr[0];
-//  printf("\r\nf3k_sys_set_test:  id %d\r\n", id);
+  printf("\r\nf3k_sys_set_test:  id %d\r\n", id);
   if ( id == 6 )
   {                                 /* f3k_run_scan */
     s32_t *sint_ptr = (s32_t*)value;
@@ -752,6 +675,7 @@
 f3k_sys_set_value(struct obj_def *od, u16_t len, void *value)
 {
   u8_t id;
+  u8_t i = 0;               
   u8_t * uc_ptr  = (u8_t*)value;        // char pointer to first byte in value
 
 //  LWIP_UNUSED_ARG(len);
@@ -766,7 +690,7 @@
   }
   else if ( id == 7 )
   {                                     /* v1.3: f3k_IO_mask */
-    mask4_IO_registers = convert2decimal( uc_ptr, len );
+    convert2decimal( uc_ptr, len );
     net_addrs_set = true;               // save mask to file system
   }
 }
@@ -791,12 +715,12 @@
   ident -= 1;
   LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff));
   if ((ident_len == 2) &&
-      (ident[0] > 0) && (ident[0] <= MAX_COMMS_ID)) // v1.5: change from MAX_PRIVATE_ID
+      (ident[0] > 0) && (ident[0] < MAX_PRIVATE_ID))
   {
     od->id_inst_len = ident_len;
     od->id_inst_ptr = ident;
     id = (u8_t)ident[0];
-//    printf("\r\nf3k_comms_get_object_def: ident_len %d, id %d\r\n", ident_len, id);
+    printf("\r\nf3k_comms_get_object_def: ident_len %d, id %d\r\n", ident_len, id);
     snmp_update_net_addrs();
     switch (id)
     {
@@ -840,16 +764,12 @@
       case 8: /* v1.4: Trap host address */
         od->instance = MIB_OBJECT_SCALAR;
         od->access = MIB_OBJECT_READ_WRITE;
+//        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
+//        od->v_len = 4; 
         od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
         od->v_len = snmp_trh_len; 
         break;
-       case 9: /* v1.5: community string */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-        od->v_len = strlen(snmp_publiccommunity); 
-        break;
-   }  // end switch
+    }  // end switch
   }
   else
   {
@@ -876,7 +796,8 @@
   u8_t id;
   u8_t i = 0;
 
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_COMMS_ID));
+//  LWIP_UNUSED_ARG(len);
+  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_PRIVATE_ID));
   snmp_get_f3k_data();                  // read the data from the SPI array
   id = (u8_t)od->id_inst_ptr[0];
   switch (id)
@@ -914,10 +835,6 @@
       while (i < len) {
         *(uchr_ptr++) = snmp_trh_addrs[ i++ ];
       }
-    case 9: /* v1.5: community string */
-      while (i < len) {
-        *(uchr_ptr++) = snmp_publiccommunity[ i++ ];
-      }
       break;
   }
 }
@@ -936,22 +853,23 @@
 {
 u8_t id, set_ok, i;
 u8_t * uc_ptr;
-u16_t *uint_ptr = (u16_t*)value;  // v1.2: changed from s32_t
 char test_addrs[16];
 unsigned char test_ad[4];
 
   set_ok = i = 0;
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_COMMS_ID));
+  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_PRIVATE_ID));
   uc_ptr  = (u8_t*)value;               // char pointer to first byte in value
   id = (u8_t)od->id_inst_ptr[0];
-//  printf("\r\nf3k_comms_set_test: id %d, len %d\r\n", id, len);
+  printf("\r\nf3k_comms_set_test: id %d, len %d\r\n", id, len);
   switch ( id ) 
   {
     case 1: /* RTU unit ID */
+      u16_t *uint_ptr = (u16_t*)value;  // v1.2: changed from s32_t
       if ( *uint_ptr < 255 )
       {
         set_ok = 1;
       }
+//printf("f3k_comms_set_test: value u16 %d, u8 %d, set_ok %d\r\n", *uint_ptr, *uc_ptr, set_ok);
       break;
     case 4: /* IP address */
     case 5: /* net mask */
@@ -967,19 +885,6 @@
         set_ok = update_addrs_from_string( test_addrs, test_ad );
       }
       break;
-    case 9: /* v1.5: community string */
-      if ( (len >= MIN_COMMUNITY) && (len < MAX_COMMUNITY) )
-      {
-        set_ok = 1;
-        while ( i++ < MAX_COMMUNITY ) 
-        {
-          if ( *(uc_ptr++) == ' ' )
-          {
-            set_ok = 0;             // no spaces allowed in community string
-          }
-        }
-      }
-      break;
   }  // end switch
   return set_ok;
 }
@@ -1000,7 +905,7 @@
   u8_t * uc_ptr;
 
   i = 0;
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_COMMS_ID));
+  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_PRIVATE_ID));
   uc_ptr  = (u8_t*)value;               // char pointer to first byte in value
   id = (u8_t)od->id_inst_ptr[0];
   switch (id)
@@ -1046,12 +951,6 @@
       update_addrs_from_string( snmp_trh_addrs, th_ad );
       net_addrs_set = true;
       break;
-    case 9: /* v1.5: community string */
-      while ( i < MAX_COMMUNITY ) {
-        snmp_publiccommunity[ i++ ] = ( i < len ) ? *(uc_ptr++) : 0;
-      }
-      net_addrs_set = true;
-      break;
   }
 }
 
@@ -1118,237 +1017,5 @@
   *uint_ptr = snmp_get_f3k_IO_value( id );
 }
 
-/****************************************************************************/ 
-/*              f3k_alarm_get_object_def: 
-* Description:  get definition for F3000 scalar objects
-*               Called via mib_scalar_node f3k_alarm_scalar
-* Parameters:   IN: u8_t ident_len - length of ID in...
-*               IN: s32_t *ident - array holding ID
-*               OUT: struct obj_def *od - object definition found
-* Returns:      NONE
-*/
-/****************************************************************************/ 
-static void
-f3k_alarm_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-u8_t id;
-
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff));
-  if ((ident_len == 2) &&
-      (ident[0] > 0) && (ident[0] <= MAX_ALARM_ID)) 
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-    id = (u8_t)ident[0];
-    printf("\r\nf3k_alarm_get_object_def: ident_len %d, id %d\r\n", ident_len, id);
-    /* alarm strings */
-    od->instance = MIB_OBJECT_SCALAR;
-    od->access = MIB_OBJECT_READ_WRITE;
-    od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-    od->v_len = strlen( (const char *)alarm_msg[ id-1 ] ); 
-//    printf("f3k_alarm_get_object_def: od->v_len = strlen( get_alarm_string(id-1) ) %d\r\n", od->v_len);
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("f3k_alarm_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-/****************************************************************************/ 
-/*              f3k_alarm_get_value: 
-* Description:  Returns f3k scalar object value
-*               @param ident points to objectname.0 (object id trailer)
-* Parameters:   IN: struct obj_def *od - object definition found
-*               IN: u16_t len - return value space (in bytes)
-*               OUT: void *value - points to (varbind) space to copy value into
-* Returns:      NONE
-*/
-/****************************************************************************/ 
-static void
-f3k_alarm_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t * uchr_ptr = (u8_t*)value;
-  u8_t id;
-  u8_t i = 0;
-
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_ALARM_ID));
-  id = (u8_t)od->id_inst_ptr[0];
-//  printf("\r\nf3k_alarm_get_value: id %d, len %d", id, len );
-  while ( i < len ) {
-    *(uchr_ptr++) = (u8_t)alarm_msg[ id-1 ][ i++ ];
-  }
-}
-
-/****************************************************************************/ 
-/*              f3k_alarm_set_test: 
-* Description:  Test f3k_alarm object value before setting
-* Parameters:   IN: struct obj_def *od - object definition found
-*               IN: u16_t len - return value space (in bytes) - NOT USED
-*               OUT: void *value - points to (varbind) space to copy value from
-* Returns:      Returns set_ok = 1 if able to set value, 0 otherwise
-*/
-/****************************************************************************/ 
-static u8_t
-f3k_alarm_set_test(struct obj_def *od, u16_t len, void *value)
-{
-u8_t id, set_ok;
-
-  LWIP_UNUSED_ARG(value);
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_ALARM_ID));
-  id = (u8_t)od->id_inst_ptr[0];
-  set_ok = (len > 0) && (len < MSG_LNGTH) ? 1 : 0;
-  printf("\r\f3k_alarm_set_test: id %d, len %d set_ok %d\r\n", id, len, set_ok);
-  return set_ok;
-}
-
-/****************************************************************************/ 
-/*              f3k_alarm_set_value: 
-* Description:  Sets f3k_alarm_scalar object value
-* Parameters:   IN: struct obj_def *od - object definition found
-*               IN: u16_t len - return value space (in bytes) - NOT USED
-*               OUT: void *value - points to (varbind) space to copy value from
-* Returns:      NONE
-*/
-/****************************************************************************/ 
-static void
-f3k_alarm_set_value(struct obj_def *od, u16_t len, void *value)
-{
-u8_t id, i;
-u8_t * uc_ptr;
-
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_ALARM_ID));
-  id = (u8_t)od->id_inst_ptr[0];
-  uc_ptr  = (u8_t*)value;               // char pointer to first byte in value
-  i = 0;
-//  printf("\r\f3k_alarm_set_value: id %d, len %d uc_ptr %c\r\n", id, len, *uc_ptr);
-  while ( i < MSG_LNGTH ) {
-    alarm_msg[id-1][i] = ( i < len ) ? *(uc_ptr++) : 0;
-    i++;
-  }
-  alarm_str_set = id;
-}
-
-/****************************************************************************/ 
-/*              f3k_amask_get_object_def: 
-* Description:  get definition for F3000 scalar objects
-*               Called via mib_scalar_node f3k_sys_scalar
-* Parameters:   IN: u8_t ident_len - length of ID in...
-*               IN: s32_t *ident - array holding ID
-*               OUT: struct obj_def *od - object definition found
-* Returns:      NONE
-*/
-/****************************************************************************/ 
-static void
-f3k_amask_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-u8_t id;
-
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= MAX_ALARM_ID));
-  if ((ident_len == 2) &&
-      (ident[0] > 0) && (ident[0] <= MAX_ALARM_ID))
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = (u8_t)ident[0];
-    printf("\r\nf3k_amask_get_object_def: ident_len %d, id %d\r\n", ident_len, id);
-    od->instance = MIB_OBJECT_SCALAR;
-    od->access = MIB_OBJECT_READ_WRITE;
-    od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-    od->v_len = 8;                      // 8 hex chars mask IO channels 1-32
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("\nf3k_amask_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-/****************************************************************************/ 
-/*              f3k_amask_get_value: 
-* Description:  Returns f3k_amask scalar object value
-*               @param ident points to objectname.0 (object id trailer)
-* Parameters:   IN: struct obj_def *od - object definition found
-*               IN: u16_t len - return value space (in bytes)
-*               OUT: void *value - points to (varbind) space to copy value into
-* Returns:      NONE
-*/
-/****************************************************************************/ 
-static void
-f3k_amask_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t * uchr_ptr = (u8_t*)value;
-  u8_t id;
-  u8_t i = 0;
-
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_ALARM_ID));
-  id = (u8_t)od->id_inst_ptr[0];
-  strncpy( f3k_IO_mask, get_hex_mask( io_mask[id-1] ), 8 );  // v1.3: copy numeric io_mask[]
-  while ( i < len ) {
-    *(uchr_ptr++) = f3k_IO_mask[ i++ ];
-  }
-}
-
-/****************************************************************************/ 
-/*              f3k_amask_set_test: 
-* Description:  Test f3k_amask object value before setting
-* Parameters:   IN: struct obj_def *od - object definition found
-*               IN: u16_t len - return value space (in bytes) - NOT USED
-*               OUT: void *value - points to (varbind) space to copy value from
-* Returns:      Returns set_ok = 1 if able to set value, 0 otherwise
-*/
-/****************************************************************************/ 
-static u8_t
-f3k_amask_set_test(struct obj_def *od, u16_t len, void *value)
-{
-u8_t i, id, set_ok;
-u8_t * uc_ptr  = (u8_t*)value;        // char pointer to first byte in value
-
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_ALARM_ID));
-  id = (u8_t)od->id_inst_ptr[0];
-  printf("\r\f3k_amask_set_test: id %d, len %d\r\n", id, len);
-  if ( (len > 0) && (len <= 8) )
-  {                                 // ensure all digits are hexadecimal
-    set_ok = 1;
-    for ( i = 0; i < len; i++ )
-    {
-      if ( !isxdigit( *(uc_ptr++) ) )
-      {
-        set_ok = 0;                 // invalid hexadecimal digit
-        break;                      // so quit
-      }
-    } 
-  }
-  return set_ok;
-}
-
-/****************************************************************************/ 
-/*              f3k_amask_set_value: 
-* Description:  Sets f3k_alarm_scalar object value
-* Parameters:   IN: struct obj_def *od - object definition found
-*               IN: u16_t len - return value space (in bytes) - NOT USED
-*               OUT: void *value - points to (varbind) space to copy value from
-* Returns:      NONE
-*/
-/****************************************************************************/ 
-static void
-f3k_amask_set_value(struct obj_def *od, u16_t len, void *value)
-{
-u8_t id;
-u8_t * uc_ptr  = (u8_t*)value;        // char pointer to first byte in value
-
-  LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= MAX_ALARM_ID));
-  id = (u8_t)od->id_inst_ptr[0];
-
-  io_mask[ id-1 ] = convert2decimal( uc_ptr, len );
-  alarm_str_set = id;
-}
 
 #endif /* LWIP_SNMP */
--- a/lwip/core/snmp/private_mib.h	Mon Sep 03 10:46:04 2012 +0000
+++ b/lwip/core/snmp/private_mib.h	Thu Sep 06 12:52:48 2012 +0000
@@ -1,9 +1,9 @@
 /*****************************************************************************
-*                     Copyright Field Electronics Ltd
+*                     Copyright SEEC Ltd
 * File:             private_mib.H
-* Reference:        3000-A3600-HDR-private_mib
+* Reference:        A3600-HDR-private_mib
 * Content:          Header file for private MIB tree structures
-* Version:          1.0
+* Version:          0.5
 * System:           mbed gnu compiler
 * Target Hardware:  mbed LPC1768                                  
 * Amendment Record:    
@@ -16,20 +16,9 @@
 * 0.3         30/11/11: L. Smith
   Increase ID range for private MIB scalars from 6 to MAX_PRIVATE_ID
 * 0.4         01/12/11: L. Smith
-  Replace lwIP SNMP_ENTERPRISE_ID by Field PEN
+  Replace lwIP SNMP_ENTERPRISE_ID
 * 0.5         19/06/12: L. Smith
   Define snmp_obj_id snmptrap_id for use in msg_out.c
-* 0.6         25/07/12: L. Smith
-  #define MAX_COMMS_ID
-* 0.7         26/07/12: L. Smith
-  Add snmp_obj_id io_change_id to access OID for enterprise specific ioChange TRAPs
-* 0.8         03/08/12: L. Smith
-  Add snmp_obj_id io_alarm_id to access OID for enterprise specific ioAlarm TRAPs
-* 0.9         07/08/12: L. Smith
-  Declare snmp_obj_id snmptrap_id moved to msg_out.c to make const
-  Declare snmp_obj_id io_change_id, io_alarm_id & al_mask_id moved to main.cpp 
-* 1.0         08/08/12: L. Smith
-  #define MAX_ALARM_ID for f3kIOalarm and f3kAlMask MIBs
 *******************************************************************************/
 
 #ifndef __PRIVATE_MIB_H__
@@ -48,16 +37,13 @@
 extern "C" {
 #endif
 
-#define SNMP_ENTERPRISE_ID  39016       // v0.4: replaces lwIP PEN from mib2.c
+#define SNMP_ENTERPRISE_ID  26381       // v0.4: replaces lwIP PEN from mib2.c
 #define MAX_PRIVATE_ID      9           // v0.5: max number of scalars in private MIB
-#define MAX_COMMS_ID        9           // v0.6: max number of scalars in f3kcomms MIB
-#define MAX_ALARM_ID        8           // v1.0: max number of scalars in f3kIOalarm MIB
 #define MAX_IO_TABLE        32          // v0.3: max number of I/O to be shown in table
-#define IO_INDEX            8           // v0.7: index into io_change_id.id for I/O channel
 
-/** v0.5: enterprise ID for enterprise specific TRAPs 
+/** v0.5: enterprise ID for enterprise specific TRAPs */
 static struct snmp_obj_id snmptrap_id = {7,{1,3,6,1,4,1,SNMP_ENTERPRISE_ID}};
-*/
+
 /* MIB object instance      from snmp_structs.h
 #define MIB_OBJECT_NONE 0 
 #define MIB_OBJECT_SCALAR 1
--- a/lwip/include/lwip/opt.h	Mon Sep 03 10:46:04 2012 +0000
+++ b/lwip/include/lwip/opt.h	Thu Sep 06 12:52:48 2012 +0000
@@ -1,7 +1,7 @@
 /*****************************************************************************
-*                     Copyright Field Electronics Ltd
+*                     Copyright SEEC Ltd
 * File:             opt.h
-* Reference:        3000-A3600-HDR-opt
+* Reference:        A3600-HDR-opt
 * Content:          lwIP Options Configuration
 * Version:          0.5
 * System:           mbed gnu compiler
--- a/lwip/include/lwip/snmp_msg.h	Mon Sep 03 10:46:04 2012 +0000
+++ b/lwip/include/lwip/snmp_msg.h	Thu Sep 06 12:52:48 2012 +0000
@@ -1,9 +1,9 @@
 /*****************************************************************************
-*                     Copyright Field Electronics Ltd
+*                     Copyright SEEC Ltd
 * File:             snmp_msg.H
-* Reference:        3000-A3600-HDR-snmp_msg
+* Reference:        A3600-HDR-snmp_msg
 * Content:          Header file for SNMP messages
-* Version:          0.9
+* Version:          0.6
 * System:           mbed gnu compiler
 * Target Hardware:  mbed LPC1768                                  
 * Amendment Record:    
@@ -21,12 +21,6 @@
   Declare f3kIOchange_trap(), snmp_SPIdown_trap(), snmp_SPIup_trap(), convert2decimal()
 * 0.6         20/06/12: L. Smith
   #define enterprise specific traps: SNMP_SPCTRAP_IO_CHANGE, SNMP_SPCTRAP_SPI_DOWN
-* 0.7         26/07/12: L. Smith
-  Decrease snmp_publiccommunity[21] to [16] and allow this to be set from file
-* 0.8         03/08/12: L. Smith
-  #define enterprise specific SNMP_SPCTRAP_IO_ALARM. Declare f3kIOalarm_trap()
-* 0.9         03/08/12: L. Smith
-  Change convert2decimal() declaration to return unsigned long
 *******************************************************************************/
 /**
  * @file
@@ -119,7 +113,6 @@
 #define SNMP_SPCTRAP_IO_CHANGE 101              // v0.6: Enterprise specific traps
 #define SNMP_SPCTRAP_SPI_DOWN  102
 #define SNMP_SPCTRAP_SPI_UP    103
-#define SNMP_SPCTRAP_IO_ALARM  104              // v0.8: Alarm traps
 
 struct snmp_varbind
 {
@@ -330,9 +323,8 @@
 extern const s32_t snmp_version;
 /** Agent default "public" community string 
 extern const char snmp_publiccommunity[7];  v0.2 */
-#define MIN_COMMUNITY   4             // v0.7: max size of community string including \0
-#define MAX_COMMUNITY   16            // v0.7: max size of community string including \0
-extern char snmp_publiccommunity[MAX_COMMUNITY];   // v0.2: Allow changes up to 15 characters
+#define MAX_COMMUNITY   21            // v0.2: max size of community string including \0
+extern char snmp_publiccommunity[MAX_COMMUNITY];   // v0.2: Allow changes up to 20 characters
 
 extern struct snmp_msg_trap trap_msg;
 
@@ -360,9 +352,8 @@
 void f3kIOchange_trap( void );
 void snmp_SPIdown_trap( void );
 void snmp_SPIup_trap( void );
-void f3kIOalarm_trap( void );           // v0.8: declare here for use in main
 
-unsigned long convert2decimal( u8_t * uc_ptr, u16_t len );
+void convert2decimal( u8_t * uc_ptr, u16_t len );
 
 
 #ifdef __cplusplus
--- a/lwip/include/lwip/snmp_structs.h	Mon Sep 03 10:46:04 2012 +0000
+++ b/lwip/include/lwip/snmp_structs.h	Thu Sep 06 12:52:48 2012 +0000
@@ -1,7 +1,7 @@
 /*****************************************************************************
-*                     Copyright Field Electronics Ltd
+*                     Copyright SEEC Ltd
 * File:             snmp_structs.H
-* Reference:        3000-A3600-HDR-snmp_structs
+* Reference:        A3600-HDR-snmp_structs
 * Content:          Header file for SNMP messages
 * Version:          0.2
 * System:           mbed gnu compiler
--- a/main.cpp	Mon Sep 03 10:46:04 2012 +0000
+++ b/main.cpp	Thu Sep 06 12:52:48 2012 +0000
@@ -4,47 +4,29 @@
 
 mbed test software for Ethernet HTTPServer with simultaneous SPI for 4 data byte updates
 
-Send serial message via USB every 1.0 second tick
 Version Date    Author  Change    
 0.2:    06/10/11    LS  Add block checksum character to SPI data
 0.3:    07/10/11    LS  Add SPI read from cmd_buf
 0.4:    13/10/11    LS  Integrated with HTTP server example code
 0.5:    18/10/11    LS  Initial file handling
 0.6:    26/10/11    LS  File IO handled by SPI_server class
-0.64:   04/11/11    LS  RPC bodge added as part of HTTP file handling:
-0.66:   04/11/11    LS  Show register values as hex bytes as well as word value
 0.78:   17/11/11    LS  Add SNMP files for system info reporting, but HTTP svr.bind disabled
-0.79    30/11/11    LS  Add f3kTable as ID 7 in F3000 private MIB
-0.79e   12/12/11    LS  Reads network addresses from file & uses Field enterprise address
+0.79    12/12/11    LS  Reads network addresses from file & uses enterprise address
 0.80    18/12/11    LS  Save last number read in read_addrs_from_file(). 
-                        Add write_addrs_to_file() to testaddrs.txt
 0.81    22/12/11    LS  Add new_cmd_idx to indicate which parameter has been set (0 for none). 
 0.82    22/12/11    LS  Add blinker to show comms activity 
 0.83    23/12/11    LS  Clear cmd_buf[0] after SPI been read 4 times 
 0.84    27/12/11    LS  snmp_fw_version & f3k_fw_version saved as 4 char strings 
 0.85    29/12/11    LS  Update f3k_sys_set_value() & f3k_sys_set_test() to enable net address change
 0.90    29/12/11    LS  Add 3-step routine for passing commands over SPI bus from cmd_buf
-0.92    06/01/12    LS  Change 3000 index for 3000 firmware version
-0.93    09/01/12    LS  Add copy_net_addresses_from() for address updates from 3000 CPU
 0.94    10/01/12    LS  Add led_link  = LPC_GPIO1->FIOPIN & (1<<25) in netservice.cpp
 0.95    11/01/12    LS  Fix f3k_speed reporting error in private_mib.c
 0.96    12/01/12    LS  Move led_link  = LPC_GPIO1->FIOPIN & (1<<25) to eth_poll in eth_drv.cpp
-0.97    30/01/12    LS  Add get_SPI_count() & SPI count to MIB as 3000 CPU activity indicator
 0.98    26/04/12    LS  Increase snmp_publiccommunity[7] to [21] and allow this to be set from file
 0.99    08/06/12    LS  #define SNMP_TRAP_DESTINATIONS 1. Declare th_ad[4] for host trap address
                         Add init_traps() to ensure head-head link status trap is sent
         21/06/12        Add check for changes to IO bytes and chk_SPI_active() every 60 seconds
 1.00    22/06/12    LS  Save SNMP changes to net addresses & mask4_IO_registers in net_adrs.txt
-1.01    25/07/12    LS  Allow snmp_publiccommunity to be modified via SNMP
-1.02    26/07/12    LS  Add changed variable in snmp_varbind io_var to ioChange trap
-1.03    01/08/12    LS  Only monitor ls byte of I/O registers for changes to mask out Monostable O/Ps
-1.04    03/08/12    LS  Add chk_alarms() for monitoring up to NUM_MASK I/O alarms
-1.05    03/08/12    LS  Add struct snmp_varbind io_alarm to pass alarm_msg to f3kIOalarm_trap()
-1.06    07/08/12    LS  Reduce MSG_LNGTH to 16 from 32. Free up more RAM for alarm strings
-1.07    08/08/12    LS  Add SNMP R/W of alarm strings
-1.08    09/08/12    LS  Create array of NUM_MASK alarm strings
-1.09    09/08/12    LS  Correct problems reading alarm strings via SNMP OK with 32 char strings
-1.10    09/08/12    LS  Tested OK with MSG_LNGTH 16 char strings
 
 http://192.168.99.99/rpc/offset,604 writes 604 to reg_offset
 http://192.168.99.99/rpc/led2/write,1 writes 1 to led2
@@ -54,9 +36,8 @@
 #include "mbed.h" 
 #include "EthernetNetIf.h"
 #include "HTTPServer.h"
-#include "snmp_structs.h"
-#include "snmp_msg.h"
-#include "snmp_asn1.h"
+#include "lwip/snmp_structs.h"
+#include "lwip/snmp_msg.h"
 #include "IO_file.h"
 
 #define LPC1768         0x60          // SPI address of LPC1768 module
@@ -70,25 +51,9 @@
 #define NO_UPDATE       0             // NO change to Ethernet addresses
 #define UPDATED         0xff          // Ethernet addresses updated in file
 #define NET_ADRS_FILE   "/webfs/net_adrs.txt"
-#define ALARM_FILE      "/webfs/alarms.txt"
 
 
-const char * snmp_fw_version = "1.10";
-
-/** v0.7: OID for enterprise specific ioChange TRAPs */
-const struct snmp_obj_id io_change_id = {9,{1,3,6,1,4,1,SNMP_ENTERPRISE_ID,3,1}};
-/** v1.08: OID for enterprise specific ioAlarm TRAPs */
-const struct snmp_obj_id io_alarm_id = {9,{1,3,6,1,4,1,SNMP_ENTERPRISE_ID,4,1}};
-//const struct snmp_obj_id al_mask_id = {9,{1,3,6,1,4,1,SNMP_ENTERPRISE_ID,5,1}};
-/* v1.05: structures for enterprise specific TRAPs */
-extern struct snmp_varbind io_var;
-extern struct snmp_varbind al_var;
-extern struct snmp_varbind io_alarm;
-/* v1.02: OID for enterprise specific ioChange & ioAlarm TRAPs */
-unsigned char io_chng_idx;                  // index of changed I/O register
-u32_t io_chng_val;                          // new I/O value if changed
-s32_t io_oid[10];                           // OID for io values used by ioChange & ioAlarm
-s32_t als_oid[10];                          // OID for alarm string
+const char * snmp_fw_version = "1.a";
 
 /* default ethernet address setup */             
 unsigned char ip_ad[4] = {192,168,99,99};
@@ -97,20 +62,15 @@
 unsigned char dns_ad[4] = {192,168,99,253};
 unsigned char th_ad[4] = {146,38,105,49};   // v0.99: host address for SNMP traps
 unsigned char net_addrs_set = false;        // flags net address update from SNMP 
-unsigned char net_addrs_chng = NO_UPDATE;   // flags net address changed in 3000 
+unsigned char net_addrs_chng = NO_UPDATE;   // flags net address changed in main CPU 
 unsigned char byte_changed = false;         // true if any IO regs have changed
 unsigned char all_IO_updated = false;       // true if all 32 IO regs have been read
-unsigned char alarm_str_set = false;        // flags alarm string update from SNMP 
 char hex_mask[12];                          // IO mask as hex string
-char reg_change[NUM_MASK];                  // register changed associated with io_masks
-u32_t new_io_val[NUM_MASK];                 // chnaged IO value associated with io_masks
-unsigned long io_mask[NUM_MASK];            // masks for alarms on IO registers 
 unsigned long mask4_IO_registers = 0x3fffffff;  // mask for IO regs ignoring IO31 & 32
 unsigned long spi_count = 0;                // last SPI_COUNT saved in SPI interrupt
 unsigned char spi_active = true;            // avoid false trap message at start
 
-char alarm_msg[NUM_MASK][MSG_LNGTH];        // alarm messages associated with io_masks
-static u8_t syslocation[MSG_LNGTH];         /* v0.9b */
+static u8_t syslocation[32]; /* v0.9b */
 u8_t sysloc_len;
 
 SPISlave spi_slave(p11, p12, p13, p14); // mosi, miso, sclk, ssel
@@ -120,7 +80,7 @@
 Ticker spi_tick;                      // tick for monitoring SPI activity
 Timeout cold_start_delay;
 
-DigitalOut led1(LED1, "led1");        // mimics head-head link status o/p in 3000 I/O
+DigitalOut led1(LED1, "led1");        // mimics head-head link status o/p in main CPU I/O
 DigitalOut led2(LED2, "led2");
 DigitalOut led3(LED3, "led3");
 DigitalOut led4(LED4, "led4");
@@ -144,7 +104,7 @@
 /****************************************************************************/ 
 /*                      SPI interface data and routines                     */
 /****************************************************************************/
-/* commands sent to 3000 cpu from cmd_buf[0] and 
+/* commands sent to main CPU cpu from cmd_buf[0] and 
    waiting commands stored in higher indices until sent */
 unsigned char cmd_buf[ MAX_CMD ];         // store for commands from Ethernet
 unsigned char new_cmd_idx;
@@ -162,8 +122,8 @@
 {
 int idx;
   for ( idx = 0; idx < MAX_RAM; idx++ )
-  {                         // clear ram_img to minimise traps at start-up
-    ram_img[ idx ] = 0;
+  {
+    ram_img[ idx ] = (MAX_RAM - idx) & 0xff;
   }
   reg_offset = 0;
 }
@@ -260,13 +220,13 @@
 
 unsigned short SPI_Server::get_error( void )
 {
-  // return error register value from Field 3000 CPU 
+  // return error register value from main CPU 
   return (256 * ram_img[ 1786 ]) + ram_img[ 1787 ];
 }
   
 unsigned short SPI_Server::get_SPI_count( void )
 {
-  // return SPI write count from Field 3000 CPU - indicates F3000 running OK 
+  // return SPI write count from main CPU - indicates main CPU running OK 
   return (256 * ram_img[ SPI_COUNT ]) + ram_img[ SPI_COUNT + 1 ];
 }
 
@@ -329,30 +289,6 @@
 }
 
 /****************************************************************************/ 
-/*              chk_alarms: v1.04
-* Description:  called when io_value has changed and checks each io_mask
-*               to see if this mask_idx (IO register - 1) is masked in
-* Globals used: reg_change[], io_mask[], new_io_val[]
-* Parameters:   IN: int mask_idx - 0-based index into mask = (io_reg - 1)
-*               IN: unsigned short io_value - new I/O value for register
-* Returns:      NONE
-*/
-/****************************************************************************/
-void chk_alarms( int mask_idx, unsigned short io_value )
-{
-unsigned char mask;
-
-  for ( mask = 0; mask < NUM_MASK; mask++ )
-  {
-    if ( (reg_change[ mask ] == 0) && ( io_mask[ mask ] & (1 << mask_idx) ) )
-    {                    // masked-in register has changed
-      new_io_val[ mask ] = (u32_t)io_value;
-      reg_change[ mask ]  = mask_idx + 1;
-    }
-  }
-}
-
-/****************************************************************************/ 
 /*              get_SPI_data: 
 * Description:  Implements transaction as SPI slave.
 *               Reads 4 data bytes from SPI bus into destbuf for SPI write, or
@@ -374,7 +310,6 @@
 unsigned char spiv;             // SPI value - initial slave address
 unsigned char bcc = 0;          // received block check character
 unsigned char bcc_ok = false;   // default to reject messages without bcc
-unsigned short io_val;          // first I/O value changed from registers 1-32
 
     spiv = spi_slave.read();   // Read byte from master
     if ( (spiv & 0xfe) == (LPC1768 & 0xfe) )
@@ -384,7 +319,7 @@
         led4 = 1;
         led3 = 0;
         if ( *srcbuf < NO_CMD )
-        {                             // new data to be read by 3000 cpu
+        {                             // new data to be read by main CPU cpu
           if ( ++rd_cnt >= NUM_READ )
           {                           // v0.83: clear data after 4 reads
             spi_slave.reply( NO_CMD );  // put invalid data in SPI buffer
@@ -429,18 +364,14 @@
             for( byte_cnt = 0; byte_cnt < SPI_BYTES; byte_cnt++ )
             {
                idx = buf_idx + byte_cnt;
-               if ( (idx <= MAX_IO_REG_BYTE) && (idx & 1) ) // check only ls byte of IO registers
-               {                        // check ls byte of IO register changed from last saved
-                 if ( spi_buf[ byte_cnt ] != fsvr.get_byte( idx ) ) 
-                 {                      // ls byte of register changed
-                   io_val = spi_buf[ byte_cnt ] + 256 * spi_buf[ byte_cnt - 1 ];
-                   if ( !byte_changed && ( mask4_IO_registers & (1 << (idx/2)) ) )
+               if ( idx <= MAX_IO_REG_BYTE )
+               {                        // check for IO changed from last saved
+                 if ( (spi_buf[ byte_cnt ] != fsvr.get_byte( idx )) && !byte_changed ) 
+                 {
+                   if ( mask4_IO_registers & (1 << (idx/2)) )
                    {                    // masked-in register has changed
-                     io_chng_val = io_val;
-                     io_chng_idx = idx/2 + 1;   // save index of first I/O register to change
                      byte_changed  = true;
                    }
-                   chk_alarms( idx/2, io_val );
                  }
                  if ( idx == MAX_IO_REG_BYTE )
                  {                      // after each I/O scan
@@ -449,7 +380,7 @@
                  }
                }
                else if ( idx == NET_ADDRESS_CHANGE )
-               {                    // v0.93: check for net address update from 3000 CPU
+               {                    // v0.93: check for net address update from main CPU CPU
                  if ( spi_buf[ byte_cnt ] == NO_UPDATE )
                  {
                     net_addrs_chng = NO_UPDATE;
@@ -497,33 +428,33 @@
 
 /****************************************************************************/ 
 /*              get_hex_mask: 
-* Description:  converts long bit_mask to hexadecimal string
-* Globals used: hex_mask
-* Parameters:   IN: unsigned long bit_mask - numeric value of bit mask
+* Description:  converts long mask4_IO_registers to hexadecimal string
+* Globals used: mask4_IO_registers, hex_mask
+* Parameters:   NONE
 * Returns:      pointer to hex_mask
 */
 /****************************************************************************/
-char * get_hex_mask( unsigned long bit_mask )
+char * get_hex_mask( void )
 {
 unsigned char i;
   for ( i = 0; i < 12; i++ )
   {
     hex_mask[ i ] = 0;
   }
-  sprintf(hex_mask, "%08x", bit_mask);
+  sprintf(hex_mask, "%08x", mask4_IO_registers);
   return hex_mask;
 }
 
 /****************************************************************************/ 
 /*              convert2decimal: 
 * Description:  converts hexadecimal string to long mask4_IO_registers
-* Globals used: NONE
+* Globals used: mask4_IO_registers
 * Parameters:   u8_t * uc_ptr: pointer to hex-formatted mask string
 *               u16_t len: length of string
-* Returns:      unsigned long temp_sum
+* Returns:      NONE
 */
 /****************************************************************************/
-unsigned long convert2decimal( u8_t * uc_ptr, u16_t len )
+void convert2decimal( u8_t * uc_ptr, u16_t len )
 {
 char ch, i;
 unsigned long temp_sum = 0;
@@ -551,7 +482,7 @@
     }
     temp_sum = 16 * temp_sum + ch;
   }
-  return temp_sum;
+  mask4_IO_registers = temp_sum;
 }
 
 void send_ram( void )
@@ -776,7 +707,7 @@
     fscanf( fr, "%lu", &mask4_IO_registers );
     fclose(fr);
   } // file opened OK
-  if ( strlen(community) >= MIN_COMMUNITY )
+  if ( strlen(community) > 3 )
   {                                     // string length 4 to 20 characters
     strcpy( snmp_publiccommunity, community );
     pc.printf("community: %s %d \r\n", snmp_publiccommunity, strlen(snmp_publiccommunity) );
@@ -789,49 +720,6 @@
 }
 
 /****************************************************************************/ 
-/*              read_alarm_from_file: 
-* Description:  Reads one alarm_msg from /webfs/alarms.txt if alarm_idx < NUM_MASK
-*               or can read all io_masks as well if alarm_idx >= NUM_MASK
-* Globals used: ALARM_FILE, alarm_msg, io_mask
-* Parameters:   IN: unsigned char alarm_idx - index to alarm message
-* Returns:      0 if OK, 1 if failed to open files
-*/
-/****************************************************************************/
-int read_alarm_from_file(unsigned char alarm_idx)
-{
-unsigned char i;
-
-  FILE *fr = fopen( ALARM_FILE, "r" );
-  if(!fr) {
-    fprintf(stderr, "\r\nFile /webfs/alarm.txt could not be opened!\r\n");
-    exit(1);
-  }
-  else                              // file opened OK
-  {
-    if ( alarm_idx < NUM_MASK )
-    {
-      for ( i = 0; i <= alarm_idx; i++ )
-      {                             // read specified alarm_msg
-        fscanf( fr, "%s", &alarm_msg[ i ] );
-      }
-    } 
-    else                            // read io_masks
-    {
-      for ( i = 0; i < NUM_MASK; i++ )
-      {                             // read all alarm_msg
-        fscanf( fr, "%s", &alarm_msg[ i ] );
-      }
-      for ( i = 0; i < NUM_MASK; i++ )
-      {                             // read all io_masks
-        fscanf( fr, "%lx", &io_mask[ i ] );
-      }
-    }
-    fclose(fr);
-  } // file opened OK
-  return 0;
-} 
-
-/****************************************************************************/ 
 /*              blinker: 
 * Description:  Blinks led_link for 10 calls
 * Globals used: led_link, blink_led,  
@@ -855,92 +743,23 @@
 }
 
 /****************************************************************************/ 
-/*              write_alarms_to_file:  v1.04
-* Description:  Writes alarm messages and masks to /webfs/alarms.txt
-* Globals used: ALARM_FILE, alarm_msg[], io_mask[]
-* Parameters:   NONE
-* Returns:      0 if OK, 1 if failed to open files
-*/
-/****************************************************************************/ 
-int write_alarms_to_file( void )
-{
-u8_t i = 1;                         // return value if failed to write file
-
-  FILE *fp = fopen( ALARM_FILE, "w" );
-  if(!fp) {
-    fprintf(stderr, "\r\nFile /webfs/alarms.txt could not be opened to write!\r\n");
-  }
-  else                              // file opened OK, so save addresses
-  {
-    for ( i = 0; i < NUM_MASK; i++ )
-    {
-      fprintf(fp, "%s\r\n", alarm_msg[ i ] );   
-    }
-    for ( i = 0; i < NUM_MASK; i++ )
-    {
-      fprintf(fp, "%08x\r\n", io_mask[ i ] );
-    }
-    fclose(fp);
-    i = 0;
-  } // file opened OK
-  return i;
-}
-
-/****************************************************************************/ 
 /*              init_traps: 
 * Description:  initialises trap flags and sends cold start trap when done
-* Globals used: led1: mimics state of head-link status output in 3000 I/O
-*               trap_init set true after cold start 
+* Globals used: trap_init set true after cold start 
 * Parameters:   NONE
 * Returns:      NONE
 */
 /****************************************************************************/ 
 void init_traps( void )
 {
-u8_t i = 0;
-
   snmp_coldstart_trap();
-  // force sending trap for head-head link up/down status
-  led1 = fsvr.get_byte( H_H_LINK_LSBYTE ) ? 0 : 1;
-  /* initialise variable binding for f3kIOchange_trap */
-  io_var.next = io_var.prev = NULL;
-  io_var.ident_len = io_change_id.len;
-  io_var.ident = io_oid;
-  do
-  {
-    io_oid[ i ] = io_change_id.id[ i ];
-  } while ( i++ < io_change_id.len );
-  io_var.value_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE);
-  io_var.value_len = sizeof(u32_t);
-  io_var.value = &io_chng_val; 
-  /* initialise variable binding for f3kIOalarm_trap al_var data */
-  al_var.prev = NULL;                   // first in list
-  al_var.next = &io_alarm;              // NULL if only varbind in list
-  al_var.ident_len = io_change_id.len;
-  al_var.ident = io_oid;
-  al_var.value_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE);
-  al_var.value_len = sizeof(u32_t);
-  al_var.value = &new_io_val[ 0 ];
-  /* initialise variable binding for f3kIOalarm_trap string */
-  io_alarm.prev = &al_var;              // after al_var binding
-  io_alarm.next = NULL;                 // always last in list ... al_string_id
-  io_alarm.ident_len = io_alarm_id.len;
-  io_alarm.ident = als_oid;
-  for ( i = 0; i < io_alarm_id.len; i++ )
-  {
-    als_oid[ i ] = io_alarm_id.id[ i ];
-  } 
-  io_alarm.value_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-  io_alarm.value_len = MSG_LNGTH; 
-  io_alarm.value = &alarm_msg[ 0 ];
   trap_init = true;
 }
 
 /****************************************************************************/ 
 /*              check_all_traps: 
 * Description:  test states for all trap events and sends appropriate trap
-* Globals used: led1: mimics state of head-link status output in 3000 I/O
-*               led2: set to ON if SPI not active
+* Globals used: led2: set to ON if SPI not active
 *               byte_changed, all_IO_updated, spi_active
 * Parameters:   NONE
 * Returns:      NONE
@@ -948,8 +767,6 @@
 /****************************************************************************/ 
 void check_all_traps( void )
 {
-unsigned char alm;
-
     if ( !led1 && (fsvr.get_byte( H_H_LINK_LSBYTE ) || fsvr.get_byte( H_H_LINK_MSBYTE )) )
     {                           // change of link state
         led1 = 1;               // flag: link is up when led1 on
@@ -960,10 +777,8 @@
         led1 = 0;
         snmp_linkdown_trap();
     }
-    if ( all_IO_updated && byte_changed )
+    if ( byte_changed && all_IO_updated )
     {                           // any masked-in I/O register changed
-        io_oid[ IO_INDEX ] = io_chng_idx;
-        io_var.value = &io_chng_val; 
         f3kIOchange_trap();
         all_IO_updated = byte_changed = false;
     }
@@ -976,21 +791,7 @@
     {
         led2 = 1;               // flag: SPI is down when led2 on
         snmp_SPIdown_trap();
-    }
-    /* send trap for any changed I/O alarm */
-    for ( alm = 0; alm < NUM_MASK; alm++ )
-    {            
-      if ( reg_change[ alm ] )
-      {                        // any alarmed I/O register changed
-        io_oid[ IO_INDEX ] = reg_change[ alm ];
-        al_var.value = &new_io_val[ alm ]; 
-        als_oid[ IO_INDEX ] = alm + 1;
-        io_alarm.value = &alarm_msg[ alm ];
-        io_alarm.value_len = strlen( (const char * )alarm_msg[ alm ] ); 
-        f3kIOalarm_trap();
-        reg_change[ alm ] = 0;
-      }
-    }
+    }            
 }
 
 
@@ -1004,20 +805,13 @@
   {                                 // put meaningful non-valid data in cmd_buf
     cmd_buf[ idx ] = new_cmd_idx;
   }
-  /* v1.04: clear all alarm trap masks */
-  for ( idx = 0; idx < NUM_MASK; idx++ )
-  {
-    reg_change[ idx ] = 0;            // clear all I/O register changed flags         
-    io_mask[ idx ] = 0;               // clear masks for alarms on IO registers 
-  }
   pc.printf("=================== Version %s ====================\r\n", snmp_fw_version);
 //  pc.printf("Press any key to start...\r\n");
   led3 = 1;
 
-  FSHandler::mount("/webfs", "/files"); // Mount /webfs path on /files web path
-  FSHandler::mount("/webfs", "/");      // Mount /webfs path on web root path
+  FSHandler::mount("/webfs", "/files"); //Mount /webfs path on /files web path
+  FSHandler::mount("/webfs", "/"); //Mount /webfs path on web root path
   read_addrs_from_file();
-  read_alarm_from_file( NUM_MASK );     // read all I/O masks
         
 /* Force fixed Ethernet address */
 EthernetNetIf eth(
@@ -1073,7 +867,7 @@
     spi_slave.format(8,3);        // Setup:  byte data, high steady state clock, 2nd edge capture
   
     sys_tick.attach( &snmp_inc_sysuptime, 0.01 );
-    spi_tick.attach( &chk_SPI_active, 120.0 );
+    spi_tick.attach( &chk_SPI_active, 60.0 );
     comms_tick.attach( &blinker, 0.07 ); // tick to blink activity LED
     cold_start_delay.attach( &init_traps, 30.0 ); // send cold_start trap after 30 seconds
 
@@ -1092,22 +886,11 @@
             // Data available - needs chip select line to activate
             get_SPI_data( cmd_buf );
         } // end if( spi_slave.receive() )
-        if ( (net_addrs_chng == 2) || (net_addrs_chng == 1) )
-        {                               // v0.93: address changed in 3000 CPU
-            copy_net_addresses_from( fsvr.net_address_ptr() );
-            copy_trap_host_address( fsvr.trap_host_ptr() );
-            write_addrs_to_file();
-        }
         if ( net_addrs_set )
         {                               // v0.99: address changed from SNMP i/f
             write_addrs_to_file();
             net_addrs_set = false;
         }
-        if ( alarm_str_set )
-        {
-            write_alarms_to_file();
-            alarm_str_set = false;
-        }
     } // end while ( true )
   
   } // else Ethernet Setup OK