1diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/include/net-snmp/data_access/sensors.h APPLE/include/net-snmp/data_access/sensors.h
2--- SVN/include/net-snmp/data_access/sensors.h
3+++ APPLE/include/net-snmp/data_access/sensors.h
4@@ -0,0 +1,71 @@
5+#ifndef NETSNMP_SENSORS_H
6+#define NETSNMP_SENSORS_H
7+
8+#ifdef  __cplusplus
9+extern "C" {
10+#endif
11+
12+    /*******************************************************************
13+     * Data structure for a sensors entry 
14+     */
15+typedef struct netsnmp_sensor_entry_s {
16+    netsnmp_index   oid_index;
17+
18+    /*
19+     * Index values 
20+     */
21+    oid            index;
22+
23+    /*
24+     * Column values 
25+     */
26+    char            device[255];
27+    int32_t         value;
28+
29+    char            device_len;
30+
31+} netsnmp_sensor_entry;
32+
33+/*
34+ * type constants (based on the oid of the table subtree in the mib)
35+ */
36+#define NETSNMP_SENSOR_TYPE_TEMP      2
37+#define NETSNMP_SENSOR_TYPE_FAN       3
38+#define NETSNMP_SENSOR_TYPE_VOLT      4
39+
40+
41+    /*******************************************************************
42+     * sensors prototypes
43+     */
44+
45+#define NETSNMP_SENSORS_NOFLAGS            0x00000000
46+
47+#define NETSNMP_SENSORS_ALL_OR_NONE        0x00000001
48+#define NETSNMP_SENSORS_DONT_FREE_ITEMS    0x00000002
49+
50+#define NETSNMP_SENSORS_GET_TEMPS          0x00000100
51+#define NETSNMP_SENSORS_GET_FANS           0x00000200
52+#define NETSNMP_SENSORS_GET_VOLTS          0x00000400
53+#define NETSNMP_SENSORS_GET_MISCS          0x00000800
54+
55+    netsnmp_container *
56+    netsnmp_sensors_container_load(netsnmp_container *container, int flags );
57+
58+    void netsnmp_sensors_container_free(netsnmp_container *container,
59+                                        u_int flags);
60+    void netsnmp_sensors_container_free_items(netsnmp_container *container);
61+
62+    void netsnmp_sensors_entry_remove(netsnmp_container * container,
63+                                      netsnmp_sensor_entry *entry);
64+
65+    netsnmp_sensor_entry * netsnmp_sensors_entry_create(int32_t index);
66+    void netsnmp_sensors_entry_free(netsnmp_sensor_entry *entry);
67+
68+
69+
70+#ifdef  __cplusplus
71+}
72+#endif
73+
74+
75+#endif /* NETSNMP_SENSORS_H */
76diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/data_access/sensors.c APPLE/agent/mibgroup/ucd-snmp/data_access/sensors.c
77--- SVN/agent/mibgroup/ucd-snmp/data_access/sensors.c
78+++ APPLE/agent/mibgroup/ucd-snmp/data_access/sensors.c
79@@ -0,0 +1,208 @@
80+/*
81+ * sensors.c : hrSensorsalledTable data access
82+ */
83+#include <net-snmp/net-snmp-config.h>
84+#include <net-snmp/net-snmp-includes.h>
85+#include <net-snmp/agent/net-snmp-agent-includes.h>
86+#include <net-snmp/data_access/sensors.h>
87+
88+#include <stdlib.h>
89+#include <unistd.h>
90+
91+/* ---------------------------------------------------------------------
92+ */
93+
94+static void netsnmp_sensors_entry_free_cb(netsnmp_sensor_entry *, void *);
95+
96+extern void netsnmp_sensors_arch_init(void);
97+extern void netsnmp_sensors_arch_shutdown(void);
98+extern int netsnmp_sensors_arch_load(netsnmp_container *, u_int);
99+
100+void init_sensors( void )
101+{
102+    static int initialized = 0;
103+
104+    DEBUGMSGTL(("sensors:init", "called\n"));
105+
106+    if (initialized)
107+        return; /* already initialized */
108+
109+
110+    /*
111+     * call arch init code
112+     */
113+    netsnmp_sensors_arch_init();
114+}
115+
116+void shutdown_sensors( void )
117+{
118+    DEBUGMSGTL(("sensors:shutdown", "called\n"));
119+
120+    netsnmp_sensors_arch_shutdown();
121+}
122+
123+/* ---------------------------------------------------------------------
124+ */
125+
126+/*
127+ * load a container with sensor info. If user_container is NULL,
128+ * a new container will be allocated and returned, and the caller
129+ * is responsible for releasing the allocated memory when done.
130+ *
131+ * if flags contains NETSNMP_SENSORS_ALL_OR_NONE and any error occurs,
132+ * the container will be completely cleared.
133+ */
134+netsnmp_container *
135+netsnmp_sensors_container_load( netsnmp_container *user_container, int flags )
136+{
137+    netsnmp_container *container = user_container;
138+    int arch_rc;
139+
140+    DEBUGMSGTL(("sensors:container", "load\n"));
141+
142+    /*
143+     * create the container, if needed
144+     */
145+    if (NULL == container) {
146+        container = netsnmp_container_find("sensors:table_container");
147+        if (NULL == container)
148+            return NULL;
149+    }
150+    if (NULL == container->container_name) {
151+        container->container_name = strdup("sensors container");
152+        /** no big deal if name fails... */
153+    }
154+
155+    /*
156+     * call the arch specific code to load the container
157+     */
158+    arch_rc = netsnmp_sensors_arch_load( container, flags );
159+    if (arch_rc && (flags & NETSNMP_SENSORS_ALL_OR_NONE)) {
160+        /*
161+         * caller does not want a partial load, so empty the container.
162+         * if we created the container, destroy it.
163+         */
164+        netsnmp_sensors_container_free_items(container);
165+        if (container != user_container) {
166+            netsnmp_sensors_container_free(container, flags);
167+        }
168+    }
169+    
170+    return container;
171+}
172+
173+void
174+netsnmp_sensors_container_free(netsnmp_container *container, u_int free_flags)
175+{
176+    DEBUGMSGTL(("sensors:container", "free\n"));
177+
178+    if (NULL == container) {
179+        snmp_log(LOG_ERR,
180+                 "invalid container for netsnmp_sensors_container_free\n");
181+        return;
182+    }
183+
184+    if(! (free_flags & NETSNMP_SENSORS_DONT_FREE_ITEMS))
185+        netsnmp_sensors_container_free_items(container);
186+
187+    CONTAINER_FREE(container);
188+}
189+
190+/*
191+ * free a sensors container
192+ */
193+void netsnmp_sensors_container_free_items(netsnmp_container *container)
194+{
195+    DEBUGMSGTL(("sensors:container", "free_items\n"));
196+
197+    if (NULL == container) {
198+        snmp_log(LOG_ERR,
199+                 "invalid container for netsnmp_sensors_container_free_items\n");
200+        return;
201+    }
202+
203+    /*
204+     * free all items.
205+     */
206+    CONTAINER_CLEAR(container,
207+                    (netsnmp_container_obj_func*)netsnmp_sensors_entry_free_cb,
208+                    NULL);
209+}
210+
211+
212+/* ---------------------------------------------------------------------
213+ */
214+
215+/*
216+ * create a new row in the table 
217+ */
218+netsnmp_sensor_entry *
219+netsnmp_sensors_entry_create(int32_t index)
220+{
221+    netsnmp_sensor_entry *entry;
222+
223+    entry = SNMP_MALLOC_TYPEDEF(netsnmp_sensor_entry);
224+    if (!entry)
225+        return NULL;
226+
227+    entry->index = index;
228+    entry->oid_index.len = 1;
229+    entry->oid_index.oids = &entry->index;
230+
231+    return entry;
232+}
233+
234+/*
235+ * free a row
236+ */
237+void
238+netsnmp_sensors_entry_free(netsnmp_sensor_entry *entry)
239+{
240+    SNMP_FREE(entry);
241+}
242+
243+/*
244+ * free a row
245+ */
246+static void
247+netsnmp_sensors_entry_free_cb(netsnmp_sensor_entry *entry, void *context)
248+{
249+    SNMP_FREE(entry);
250+}
251+
252+/*
253+ * remove a row from the table 
254+ */
255+void
256+netsnmp_sensor_entry_remove(netsnmp_container * container,
257+                            netsnmp_sensor_entry *entry)
258+{
259+    DEBUGMSGTL(("sensors:container", "remove\n"));
260+    if (!entry)
261+        return;                 /* Nothing to remove */
262+    CONTAINER_REMOVE(container, entry);
263+}
264+
265+/* ---------------------------------------------------------------------
266+ */
267+
268+#ifdef TEST
269+int main(int argc, char *argv[])
270+{
271+    const char *tokens = getenv("SNMP_DEBUG");
272+
273+    netsnmp_container_init_list();
274+
275+    /** sensors,verbose:sensors */
276+    if (tokens)
277+        debug_register_tokens(tokens);
278+    else
279+        debug_register_tokens("sensors,access:lmSensors");
280+    snmp_set_do_debugging(1);
281+
282+    init_sensors(); /* does a pre-load of all sensors */
283+    shutdown_sensors();
284+
285+    return 0;
286+}
287+#endif
288diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/data_access/sensors.h APPLE/agent/mibgroup/ucd-snmp/data_access/sensors.h
289--- SVN/agent/mibgroup/ucd-snmp/data_access/sensors.h
290+++ APPLE/agent/mibgroup/ucd-snmp/data_access/sensors.h
291@@ -0,0 +1,54 @@
292+/*
293+ * sensors data access header
294+ *
295+ * $Id: lmsensors.patch,v 1.1 2007/08/01 00:03:39 randall Exp $
296+ */
297+#ifndef NETSNMP_ACCESS_SENSORS_CONFIG_H
298+#define NETSNMP_ACCESS_SENSORS_CONFIG_H
299+
300+/**---------------------------------------------------------------------*/
301+/*
302+ * configure required files
303+ *
304+ * Notes:
305+ *
306+ * 1) prefer functionality over platform, where possible. If a method
307+ *    is available for multiple platforms, test that first. That way
308+ *    when a new platform is ported, it won't need a new test here.
309+ *
310+ * 2) don't do detail requirements here. If, for example,
311+ *    HPUX11 had different reuirements than other HPUX, that should
312+ *    be handled in the *_hpux.h header file.
313+ */
314+
315+#ifdef NETSNMP_INCLUDE_LMSENSORS_REWRITES
316+
317+/*
318+ * all platforms use this generic code
319+ */
320+config_require(ucd-snmp/data_access/sensors)
321+
322+
323+#   if defined( darwin )
324+
325+    config_require(ucd-snmp/data_access/sensors_darwin)
326+
327+#   else
328+
329+    config_error(This platform does not yet support lmSensors rewrites)
330+
331+#   endif
332+#endif
333+
334+#ifdef  __cplusplus
335+extern "C" {
336+#endif
337+
338+    void init_sensors( void );
339+    void shutdown_sensors( void );
340+
341+#ifdef  __cplusplus
342+}
343+#endif
344+
345+#endif /* NETSNMP_ACCESS_SENSORS_CONFIG_H */
346diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmSensorsTables.h APPLE/agent/mibgroup/ucd-snmp/lmSensorsTables.h
347--- SVN/agent/mibgroup/ucd-snmp/lmSensorsTables.h
348+++ APPLE/agent/mibgroup/ucd-snmp/lmSensorsTables.h
349@@ -0,0 +1,19 @@
350+/*
351+ * Note: this file originally auto-generated by mib2c using
352+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
353+ */
354+#ifndef LMSENSORSTABLE_H
355+#define LMSENSORSTABLE_H
356+
357+config_exclude(ucd-snmp/lmSensors);
358+
359+config_require(ucd-snmp/data_access/sensors);
360+
361+config_require(ucd-snmp/lmTempSensorsTable);
362+config_require(ucd-snmp/lmFanSensorsTable);
363+config_require(ucd-snmp/lmVoltSensorsTable);
364+config_require(ucd-snmp/lmMiscSensorsTable);
365+
366+config_add_mib(LM-SENSORS-MIB)
367+
368+#endif                          /* LMTEMPSENSORSTABLE_H */
369diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmFanSensorsTable.c APPLE/agent/mibgroup/ucd-snmp/lmFanSensorsTable.c
370--- SVN/agent/mibgroup/ucd-snmp/lmFanSensorsTable.c
371+++ APPLE/agent/mibgroup/ucd-snmp/lmFanSensorsTable.c
372@@ -0,0 +1,210 @@
373+/*
374+ * Note: this file originally auto-generated by mib2c using
375+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
376+ */
377+
378+#include <net-snmp/net-snmp-config.h>
379+#include <net-snmp/net-snmp-includes.h>
380+#include <net-snmp/agent/net-snmp-agent-includes.h>
381+#include <net-snmp/agent/net-snmp-agent-includes.h>
382+#include <net-snmp/agent/table_container.h>
383+#include <net-snmp/data_access/sensors.h>
384+#include "lmTempSensorsTable.h"
385+#include "lmFanSensorsTable.h"
386+
387+/** Initializes the lmFanSensorsTable module */
388+void
389+init_lmFanSensorsTable(void)
390+{
391+    /*
392+     * here we initialize all the tables we're planning on supporting 
393+     */
394+    initialize_table_lmFanSensorsTable();
395+}
396+
397+static void     _cache_free(netsnmp_cache * cache, void *magic);
398+static int      _cache_load(netsnmp_cache * cache, void *vmagic);
399+
400+
401+/** Initialize the lmFanSensorsTable table by defining its contents and how it's structured */
402+void
403+initialize_table_lmFanSensorsTable(void)
404+{
405+    static oid      lmFanSensorsTable_oid[] =
406+        { 1, 3, 6, 1, 4, 1, 2021, 13, 16, 3 };
407+    size_t          lmFanSensorsTable_oid_len =
408+        OID_LENGTH(lmFanSensorsTable_oid);
409+    netsnmp_handler_registration *reg = NULL;
410+    netsnmp_mib_handler *handler = NULL;
411+    netsnmp_container *container = NULL;
412+    netsnmp_table_registration_info *table_info = NULL;
413+    netsnmp_cache  *cache = NULL;
414+
415+    /*
416+     * NOTE: since all the sensor tables have exactly the same
417+     *       structure, we use the lmTempSensorsTable_handler
418+     *       for all the tables. We just have our own container
419+     *       and cache routines.
420+     */
421+    reg =
422+        netsnmp_create_handler_registration("lmFanSensorsTable",
423+                                            lmTempSensorsTable_handler,
424+                                            lmFanSensorsTable_oid,
425+                                            lmFanSensorsTable_oid_len,
426+                                            HANDLER_CAN_RONLY);
427+    if (NULL == reg) {
428+        snmp_log(LOG_ERR,
429+                 "error creating handler registration for lmFanSensorsTable\n");
430+        goto bail;
431+    }
432+
433+    container =
434+        netsnmp_container_find("lmFanSensorsTable:table_container");
435+    if (NULL == container) {
436+        snmp_log(LOG_ERR,
437+                 "error creating container for lmFanSensorsTable\n");
438+        goto bail;
439+    }
440+
441+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
442+    if (NULL == table_info) {
443+        snmp_log(LOG_ERR,
444+                 "error allocating table registration for lmFanSensorsTable\n");
445+        goto bail;
446+    }
447+    netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,   /* index: lmFanSensorsIndex */
448+                                     0);
449+    table_info->min_column = COLUMN_LMTEMPSENSORSINDEX;
450+    table_info->max_column = COLUMN_LMTEMPSENSORSVALUE;
451+
452+    /*************************************************
453+     *
454+     * inject container_table helper
455+     */
456+    handler = netsnmp_container_table_handler_get(table_info, container,
457+                                                  TABLE_CONTAINER_KEY_NETSNMP_INDEX);
458+    if (NULL == handler) {
459+        snmp_log(LOG_ERR,
460+                 "error allocating table registration for lmFanSensorsTable\n");
461+        goto bail;
462+    }
463+    if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
464+        snmp_log(LOG_ERR,
465+                 "error injecting container_table handler for lmFanSensorsTable\n");
466+        goto bail;
467+    }
468+    handler = NULL;             /* reg has it, will reuse below */
469+
470+    /*************************************************
471+     *
472+     * inject cache helper
473+     */
474+    cache = netsnmp_cache_create(30,    /* timeout in seconds */
475+                                 _cache_load, _cache_free,
476+                                 lmFanSensorsTable_oid,
477+                                 lmFanSensorsTable_oid_len);
478+
479+    if (NULL == cache) {
480+        snmp_log(LOG_ERR, "error creating cache for lmFanSensorsTable\n");
481+        goto bail;
482+    }
483+    cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
484+    cache->magic = container;
485+
486+    handler = netsnmp_cache_handler_get(cache);
487+    if (NULL == handler) {
488+        snmp_log(LOG_ERR,
489+                 "error creating cache handler for lmFanSensorsTable\n");
490+        goto bail;
491+    }
492+
493+    if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
494+        snmp_log(LOG_ERR,
495+                 "error injecting cache handler for lmFanSensorsTable\n");
496+        goto bail;
497+    }
498+    handler = NULL;             /* reg has it */
499+
500+    /*
501+     * register the table
502+     */
503+    if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
504+        snmp_log(LOG_ERR,
505+                 "error registering table handler for lmFanSensorsTable\n");
506+        goto bail;
507+    }
508+
509+    return;                     /* ok */
510+
511+    /*
512+     * Some error occurred during registration. Clean up and bail.
513+     */
514+  bail:                        /* not ok */
515+
516+    if (handler)
517+        netsnmp_handler_free(handler);
518+
519+    if (cache)
520+        netsnmp_cache_free(cache);
521+
522+    if (table_info)
523+        netsnmp_table_registration_info_free(table_info);
524+
525+    if (container)
526+        CONTAINER_FREE(container);
527+
528+    if (reg)
529+        netsnmp_handler_registration_free(reg);
530+}
531+
532+/**
533+ * @internal
534+ */
535+static int
536+_cache_load(netsnmp_cache * cache, void *vmagic)
537+{
538+    netsnmp_container *container;
539+
540+    DEBUGMSGTL(("internal:lmFanSensorsTable:_cache_load", "called\n"));
541+
542+    if ((NULL == cache) || (NULL == cache->magic)) {
543+        snmp_log(LOG_ERR,
544+                 "invalid cache for lmFanSensorsTable_cache_load\n");
545+        return -1;
546+    }
547+    container = (netsnmp_container *) cache->magic;
548+
549+    /** should only be called for an invalid or expired cache */
550+    netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
551+
552+    /*
553+     * load cache here (or call function to do it)
554+     */
555+    netsnmp_sensors_container_load(container, NETSNMP_SENSORS_GET_FANS);
556+
557+    return 0;
558+}                               /* _cache_load */
559+
560+/**
561+ * @internal
562+ */
563+static void
564+_cache_free(netsnmp_cache * cache, void *magic)
565+{
566+    netsnmp_container *container;
567+
568+    DEBUGMSGTL(("internal:lmFanSensorsTable:_cache_free", "called\n"));
569+
570+    if ((NULL == cache) || (NULL == cache->magic)) {
571+        snmp_log(LOG_ERR,
572+                 "invalid cache in lmFanSensorsTable_cache_free\n");
573+        return;
574+    }
575+    container = (netsnmp_container *) cache->magic;
576+
577+    /*
578+     * empty (but don't free) cache here
579+     */
580+    netsnmp_sensors_container_free_items(container);
581+
582+}                               /* _cache_free */
583diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmFanSensorsTable.h APPLE/agent/mibgroup/ucd-snmp/lmFanSensorsTable.h
584--- SVN/agent/mibgroup/ucd-snmp/lmFanSensorsTable.h
585+++ APPLE/agent/mibgroup/ucd-snmp/lmFanSensorsTable.h
586@@ -0,0 +1,16 @@
587+/*
588+ * Note: this file originally auto-generated by mib2c using
589+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
590+ */
591+#ifndef LMFANSENSORSTABLE_H
592+#define LMFANSENSORSTABLE_H
593+
594+config_require(ucd-snmp/lmTempSensorsTable)
595+
596+/*
597+ * function declarations 
598+ */
599+void            init_lmFanSensorsTable(void);
600+void            initialize_table_lmFanSensorsTable(void);
601+
602+#endif                          /* LMFANSENSORSTABLE_H */
603diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmTempSensorsTable.c APPLE/agent/mibgroup/ucd-snmp/lmTempSensorsTable.c
604--- SVN/agent/mibgroup/ucd-snmp/lmTempSensorsTable.c
605+++ APPLE/agent/mibgroup/ucd-snmp/lmTempSensorsTable.c
606@@ -0,0 +1,280 @@
607+/*
608+ * Note: this file originally auto-generated by mib2c using
609+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
610+ */
611+
612+#include <net-snmp/net-snmp-config.h>
613+#include <net-snmp/net-snmp-includes.h>
614+#include <net-snmp/agent/net-snmp-agent-includes.h>
615+#include <net-snmp/agent/net-snmp-agent-includes.h>
616+#include <net-snmp/agent/table_container.h>
617+#include <net-snmp/data_access/sensors.h>
618+#include "lmTempSensorsTable.h"
619+
620+/** Initializes the lmTempSensorsTable module */
621+void
622+init_lmTempSensorsTable(void)
623+{
624+    /*
625+     * here we initialize all the tables we're planning on supporting 
626+     */
627+    initialize_table_lmTempSensorsTable();
628+}
629+
630+static void     _cache_free(netsnmp_cache * cache, void *magic);
631+static int      _cache_load(netsnmp_cache * cache, void *vmagic);
632+
633+
634+/** Initialize the lmTempSensorsTable table by defining its contents and how it's structured */
635+void
636+initialize_table_lmTempSensorsTable(void)
637+{
638+    static oid      lmTempSensorsTable_oid[] =
639+        { 1, 3, 6, 1, 4, 1, 2021, 13, 16, 2 };
640+    size_t          lmTempSensorsTable_oid_len =
641+        OID_LENGTH(lmTempSensorsTable_oid);
642+    netsnmp_handler_registration *reg = NULL;
643+    netsnmp_mib_handler *handler = NULL;
644+    netsnmp_container *container = NULL;
645+    netsnmp_table_registration_info *table_info = NULL;
646+    netsnmp_cache  *cache = NULL;
647+
648+    reg =
649+        netsnmp_create_handler_registration("lmTempSensorsTable",
650+                                            lmTempSensorsTable_handler,
651+                                            lmTempSensorsTable_oid,
652+                                            lmTempSensorsTable_oid_len,
653+                                            HANDLER_CAN_RONLY);
654+    if (NULL == reg) {
655+        snmp_log(LOG_ERR,
656+                 "error creating handler registration for lmTempSensorsTable\n");
657+        goto bail;
658+    }
659+
660+    container =
661+        netsnmp_container_find("lmTempSensorsTable:table_container");
662+    if (NULL == container) {
663+        snmp_log(LOG_ERR,
664+                 "error creating container for lmTempSensorsTable\n");
665+        goto bail;
666+    }
667+
668+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
669+    if (NULL == table_info) {
670+        snmp_log(LOG_ERR,
671+                 "error allocating table registration for lmTempSensorsTable\n");
672+        goto bail;
673+    }
674+    netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,   /* index: lmTempSensorsIndex */
675+                                     0);
676+    table_info->min_column = COLUMN_LMTEMPSENSORSINDEX;
677+    table_info->max_column = COLUMN_LMTEMPSENSORSVALUE;
678+
679+    /*************************************************
680+     *
681+     * inject container_table helper
682+     */
683+    handler = netsnmp_container_table_handler_get(table_info, container,
684+                                                  TABLE_CONTAINER_KEY_NETSNMP_INDEX);
685+    if (NULL == handler) {
686+        snmp_log(LOG_ERR,
687+                 "error allocating table registration for lmTempSensorsTable\n");
688+        goto bail;
689+    }
690+    if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
691+        snmp_log(LOG_ERR,
692+                 "error injecting container_table handler for lmTempSensorsTable\n");
693+        goto bail;
694+    }
695+    handler = NULL;             /* reg has it, will reuse below */
696+
697+    /*************************************************
698+     *
699+     * inject cache helper
700+     */
701+    cache = netsnmp_cache_create(30,    /* timeout in seconds */
702+                                 _cache_load, _cache_free,
703+                                 lmTempSensorsTable_oid,
704+                                 lmTempSensorsTable_oid_len);
705+
706+    if (NULL == cache) {
707+        snmp_log(LOG_ERR, "error creating cache for lmTempSensorsTable\n");
708+        goto bail;
709+    }
710+    cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
711+    cache->magic = container;
712+
713+    handler = netsnmp_cache_handler_get(cache);
714+    if (NULL == handler) {
715+        snmp_log(LOG_ERR,
716+                 "error creating cache handler for lmTempSensorsTable\n");
717+        goto bail;
718+    }
719+
720+    if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
721+        snmp_log(LOG_ERR,
722+                 "error injecting cache handler for lmTempSensorsTable\n");
723+        goto bail;
724+    }
725+    handler = NULL;             /* reg has it */
726+
727+    /*
728+     * register the table
729+     */
730+    if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
731+        snmp_log(LOG_ERR,
732+                 "error registering table handler for lmTempSensorsTable\n");
733+        goto bail;
734+    }
735+
736+    /*
737+     * Initialise the contents of the table here
738+     */
739+
740+
741+    return;                     /* ok */
742+
743+    /*
744+     * Some error occurred during registration. Clean up and bail.
745+     */
746+  bail:                        /* not ok */
747+
748+    if (handler)
749+        netsnmp_handler_free(handler);
750+
751+    if (cache)
752+        netsnmp_cache_free(cache);
753+
754+    if (table_info)
755+        netsnmp_table_registration_info_free(table_info);
756+
757+    if (container)
758+        CONTAINER_FREE(container);
759+
760+    if (reg)
761+        netsnmp_handler_registration_free(reg);
762+}
763+
764+/** handles requests for the lmTempSensorsTable table */
765+int
766+lmTempSensorsTable_handler(netsnmp_mib_handler *handler,
767+                           netsnmp_handler_registration *reginfo,
768+                           netsnmp_agent_request_info *reqinfo,
769+                           netsnmp_request_info *requests)
770+{
771+
772+    netsnmp_request_info *request;
773+    netsnmp_table_request_info *table_info;
774+    netsnmp_sensor_entry *table_entry;
775+
776+    switch (reqinfo->mode) {
777+        /*
778+         * Read-support (also covers GetNext requests)
779+         */
780+    case MODE_GET:
781+        for (request = requests; request; request = request->next) {
782+            if (request->processed)
783+                continue;
784+            table_entry = (netsnmp_sensor_entry *)
785+                netsnmp_container_table_extract_context(request);
786+            table_info = netsnmp_extract_table_info(request);
787+            if ((NULL == table_entry) || (NULL == table_info)) {
788+                snmp_log(LOG_ERR,
789+                         "could not extract table entry or info for lmTempSensorsTable\n");
790+                snmp_set_var_typed_value(request->requestvb,
791+                                         SNMP_ERR_GENERR, NULL, 0);
792+                continue;
793+            }
794+
795+            switch (table_info->colnum) {
796+            case COLUMN_LMTEMPSENSORSINDEX:
797+                if (!table_entry) {
798+                    netsnmp_set_request_error(reqinfo, request,
799+                                              SNMP_NOSUCHINSTANCE);
800+                    continue;
801+                }
802+                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
803+                                           table_entry->index);
804+                break;
805+            case COLUMN_LMTEMPSENSORSDEVICE:
806+                if (!table_entry) {
807+                    netsnmp_set_request_error(reqinfo, request,
808+                                              SNMP_NOSUCHINSTANCE);
809+                    continue;
810+                }
811+                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
812+                                         (u_char *) table_entry->device,
813+                                         table_entry->device_len);
814+                break;
815+            case COLUMN_LMTEMPSENSORSVALUE:
816+                if (!table_entry) {
817+                    netsnmp_set_request_error(reqinfo, request,
818+                                              SNMP_NOSUCHINSTANCE);
819+                    continue;
820+                }
821+                snmp_set_var_typed_integer(request->requestvb, ASN_GAUGE,
822+                                           table_entry->value);
823+                break;
824+            default:
825+                netsnmp_set_request_error(reqinfo, request,
826+                                          SNMP_NOSUCHOBJECT);
827+                break;
828+            }
829+        }
830+        break;
831+
832+    }
833+    return SNMP_ERR_NOERROR;
834+}
835+
836+/**
837+ * @internal
838+ */
839+static int
840+_cache_load(netsnmp_cache * cache, void *vmagic)
841+{
842+    netsnmp_container *container;
843+
844+    DEBUGMSGTL(("internal:lmTempSensorsTable:_cache_load", "called\n"));
845+
846+    if ((NULL == cache) || (NULL == cache->magic)) {
847+        snmp_log(LOG_ERR,
848+                 "invalid cache for lmTempSensorsTable_cache_load\n");
849+        return -1;
850+    }
851+    container = (netsnmp_container *) cache->magic;
852+
853+    /** should only be called for an invalid or expired cache */
854+    netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
855+
856+    /*
857+     * load cache here (or call function to do it)
858+     */
859+    netsnmp_sensors_container_load(container, NETSNMP_SENSORS_GET_TEMPS);
860+
861+    return 0;
862+}                               /* _cache_load */
863+
864+/**
865+ * @internal
866+ */
867+static void
868+_cache_free(netsnmp_cache * cache, void *magic)
869+{
870+    netsnmp_container *container;
871+
872+    DEBUGMSGTL(("internal:lmTempSensorsTable:_cache_free", "called\n"));
873+
874+    if ((NULL == cache) || (NULL == cache->magic)) {
875+        snmp_log(LOG_ERR,
876+                 "invalid cache in lmTempSensorsTable_cache_free\n");
877+        return;
878+    }
879+    container = (netsnmp_container *) cache->magic;
880+
881+    /*
882+     * empty (but don't free) cache here
883+     */
884+    netsnmp_sensors_container_free_items(container);
885+
886+}                               /* _cache_free */
887diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmTempSensorsTable.h APPLE/agent/mibgroup/ucd-snmp/lmTempSensorsTable.h
888--- SVN/agent/mibgroup/ucd-snmp/lmTempSensorsTable.h
889+++ APPLE/agent/mibgroup/ucd-snmp/lmTempSensorsTable.h
890@@ -0,0 +1,25 @@
891+/*
892+ * Note: this file originally auto-generated by mib2c using
893+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
894+ */
895+#ifndef LMTEMPSENSORSTABLE_H
896+#define LMTEMPSENSORSTABLE_H
897+
898+config_exclude(ucd-snmp/lmSensors);
899+config_require(ucd-snmp/data_access/sensors);
900+config_add_mib(LM-SENSORS-MIB)
901+
902+/*
903+ * function declarations 
904+ */
905+void            init_lmTempSensorsTable(void);
906+void            initialize_table_lmTempSensorsTable(void);
907+Netsnmp_Node_Handler lmTempSensorsTable_handler;
908+
909+/*
910+ * column number definitions for table lmTempSensorsTable 
911+ */
912+#define COLUMN_LMTEMPSENSORSINDEX		1
913+#define COLUMN_LMTEMPSENSORSDEVICE		2
914+#define COLUMN_LMTEMPSENSORSVALUE		3
915+#endif                          /* LMTEMPSENSORSTABLE_H */
916diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmVoltSensorsTable.c APPLE/agent/mibgroup/ucd-snmp/lmVoltSensorsTable.c
917--- SVN/agent/mibgroup/ucd-snmp/lmVoltSensorsTable.c
918+++ APPLE/agent/mibgroup/ucd-snmp/lmVoltSensorsTable.c
919@@ -0,0 +1,209 @@
920+/*
921+ * Note: this file originally auto-generated by mib2c using
922+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
923+ */
924+
925+#include <net-snmp/net-snmp-config.h>
926+#include <net-snmp/net-snmp-includes.h>
927+#include <net-snmp/agent/net-snmp-agent-includes.h>
928+#include <net-snmp/agent/net-snmp-agent-includes.h>
929+#include <net-snmp/agent/table_container.h>
930+#include <net-snmp/data_access/sensors.h>
931+#include "lmTempSensorsTable.h"
932+#include "lmVoltSensorsTable.h"
933+
934+/** Initializes the lmVoltSensorsTable module */
935+void
936+init_lmVoltSensorsTable(void)
937+{
938+    /*
939+     * here we initialize all the tables we're planning on supporting 
940+     */
941+    initialize_table_lmVoltSensorsTable();
942+}
943+
944+static void     _cache_free(netsnmp_cache * cache, void *magic);
945+static int      _cache_load(netsnmp_cache * cache, void *vmagic);
946+
947+
948+/** Initialize the lmVoltSensorsTable table by defining its contents and how it's structured */
949+void
950+initialize_table_lmVoltSensorsTable(void)
951+{
952+    static oid      lmVoltSensorsTable_oid[] =
953+        { 1, 3, 6, 1, 4, 1, 2021, 13, 16, 4 };
954+    size_t          lmVoltSensorsTable_oid_len =
955+        OID_LENGTH(lmVoltSensorsTable_oid);
956+    netsnmp_handler_registration *reg = NULL;
957+    netsnmp_mib_handler *handler = NULL;
958+    netsnmp_container *container = NULL;
959+    netsnmp_table_registration_info *table_info = NULL;
960+    netsnmp_cache  *cache = NULL;
961+
962+    /*
963+     * NOTE: since all the sensor tables have exactly the same
964+     *       structure, we use the lmTempSensorsTable_handler
965+     *       for all the tables. We just have our own container
966+     *       and cache routines.
967+     */
968+    reg =
969+        netsnmp_create_handler_registration("lmVoltSensorsTable",
970+                                            lmTempSensorsTable_handler,
971+                                            lmVoltSensorsTable_oid,
972+                                            lmVoltSensorsTable_oid_len,
973+                                            HANDLER_CAN_RONLY);
974+    if (NULL == reg) {
975+        snmp_log(LOG_ERR,
976+                 "error creating handler registration for lmVoltSensorsTable\n");
977+        goto bail;
978+    }
979+
980+    container =
981+        netsnmp_container_find("lmVoltSensorsTable:table_container");
982+    if (NULL == container) {
983+        snmp_log(LOG_ERR,
984+                 "error creating container for lmVoltSensorsTable\n");
985+        goto bail;
986+    }
987+
988+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
989+    if (NULL == table_info) {
990+        snmp_log(LOG_ERR,
991+                 "error allocating table registration for lmVoltSensorsTable\n");
992+        goto bail;
993+    }
994+    netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,   /* index: lmVoltSensorsIndex */
995+                                     0);
996+    table_info->min_column = COLUMN_LMTEMPSENSORSINDEX;
997+    table_info->max_column = COLUMN_LMTEMPSENSORSVALUE;
998+
999+    /*************************************************
1000+     *
1001+     * inject container_table helper
1002+     */
1003+    handler = netsnmp_container_table_handler_get(table_info, container,
1004+                                                  TABLE_CONTAINER_KEY_NETSNMP_INDEX);
1005+    if (NULL == handler) {
1006+        snmp_log(LOG_ERR,
1007+                 "error allocating table registration for lmVoltSensorsTable\n");
1008+        goto bail;
1009+    }
1010+    if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
1011+        snmp_log(LOG_ERR,
1012+                 "error injecting container_table handler for lmVoltSensorsTable\n");
1013+        goto bail;
1014+    }
1015+    handler = NULL;             /* reg has it, will reuse below */
1016+
1017+    /*************************************************
1018+     *
1019+     * inject cache helper
1020+     */
1021+    cache = netsnmp_cache_create(30,    /* timeout in seconds */
1022+                                 _cache_load, _cache_free,
1023+                                 lmVoltSensorsTable_oid,
1024+                                 lmVoltSensorsTable_oid_len);
1025+
1026+    if (NULL == cache) {
1027+        snmp_log(LOG_ERR, "error creating cache for lmVoltSensorsTable\n");
1028+        goto bail;
1029+    }
1030+    cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
1031+    cache->magic = container;
1032+
1033+    handler = netsnmp_cache_handler_get(cache);
1034+    if (NULL == handler) {
1035+        snmp_log(LOG_ERR,
1036+                 "error creating cache handler for lmVoltSensorsTable\n");
1037+        goto bail;
1038+    }
1039+
1040+    if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
1041+        snmp_log(LOG_ERR,
1042+                 "error injecting cache handler for lmVoltSensorsTable\n");
1043+        goto bail;
1044+    }
1045+    handler = NULL;             /* reg has it */
1046+
1047+    /*
1048+     * register the table
1049+     */
1050+    if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
1051+        snmp_log(LOG_ERR,
1052+                 "error registering table handler for lmVoltSensorsTable\n");
1053+        goto bail;
1054+    }
1055+
1056+    return;                     /* ok */
1057+
1058+    /*
1059+     * Some error occurred during registration. Clean up and bail.
1060+     */
1061+  bail:                        /* not ok */
1062+
1063+    if (handler)
1064+        netsnmp_handler_free(handler);
1065+
1066+    if (cache)
1067+        netsnmp_cache_free(cache);
1068+
1069+    if (table_info)
1070+        netsnmp_table_registration_info_free(table_info);
1071+
1072+    if (container)
1073+        CONTAINER_FREE(container);
1074+
1075+    if (reg)
1076+        netsnmp_handler_registration_free(reg);
1077+}
1078+
1079+/**
1080+ * @internal
1081+ */
1082+static int
1083+_cache_load(netsnmp_cache * cache, void *vmagic)
1084+{
1085+    netsnmp_container *container;
1086+
1087+    DEBUGMSGTL(("internal:lmVoltSensorsTable:_cache_load", "called\n"));
1088+
1089+    if ((NULL == cache) || (NULL == cache->magic)) {
1090+        snmp_log(LOG_ERR,
1091+                 "invalid cache for lmVoltSensorsTable_cache_load\n");
1092+        return -1;
1093+    }
1094+    container = (netsnmp_container *) cache->magic;
1095+
1096+    /** should only be called for an invalid or expired cache */
1097+    netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
1098+
1099+    /*
1100+     * load cache here (or call function to do it)
1101+     */
1102+    netsnmp_sensors_container_load(container, NETSNMP_SENSORS_GET_VOLTS);
1103+
1104+    return 0;
1105+}                               /* _cache_load */
1106+
1107+/**
1108+ * @internal
1109+ */
1110+static void
1111+_cache_free(netsnmp_cache * cache, void *magic)
1112+{
1113+    netsnmp_container *container;
1114+
1115+    DEBUGMSGTL(("internal:lmVoltSensorsTable:_cache_free", "called\n"));
1116+
1117+    if ((NULL == cache) || (NULL == cache->magic)) {
1118+        snmp_log(LOG_ERR,
1119+                 "invalid cache in lmVoltSensorsTable_cache_free\n");
1120+        return;
1121+    }
1122+    container = (netsnmp_container *) cache->magic;
1123+
1124+    /*
1125+     * empty (but don't free) cache here
1126+     */
1127+    netsnmp_sensors_container_free_items(container);
1128+}
1129diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmVoltSensorsTable.h APPLE/agent/mibgroup/ucd-snmp/lmVoltSensorsTable.h
1130--- SVN/agent/mibgroup/ucd-snmp/lmVoltSensorsTable.h
1131+++ APPLE/agent/mibgroup/ucd-snmp/lmVoltSensorsTable.h
1132@@ -0,0 +1,16 @@
1133+/*
1134+ * Note: this file originally auto-generated by mib2c using
1135+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
1136+ */
1137+#ifndef LMVOLTSENSORSTABLE_H
1138+#define LMVOLTSENSORSTABLE_H
1139+
1140+config_require(ucd-snmp/lmTempSensorsTable)
1141+
1142+/*
1143+ * function declarations 
1144+ */
1145+void            init_lmVoltSensorsTable(void);
1146+void            initialize_table_lmVoltSensorsTable(void);
1147+
1148+#endif                          /* LMVOLTSENSORSTABLE_H */
1149diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmMiscSensorsTable.c APPLE/agent/mibgroup/ucd-snmp/lmMiscSensorsTable.c
1150--- SVN/agent/mibgroup/ucd-snmp/lmMiscSensorsTable.c
1151+++ APPLE/agent/mibgroup/ucd-snmp/lmMiscSensorsTable.c
1152@@ -0,0 +1,202 @@
1153+/*
1154+ * Note: this file originally auto-generated by mib2c using
1155+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
1156+ */
1157+
1158+#include <net-snmp/net-snmp-config.h>
1159+#include <net-snmp/net-snmp-includes.h>
1160+#include <net-snmp/agent/net-snmp-agent-includes.h>
1161+#include <net-snmp/agent/net-snmp-agent-includes.h>
1162+#include <net-snmp/agent/table_container.h>
1163+#include <net-snmp/data_access/sensors.h>
1164+#include "lmTempSensorsTable.h"
1165+#include "lmMiscSensorsTable.h"
1166+
1167+static void     _cache_free(netsnmp_cache * cache, void *magic);
1168+static int      _cache_load(netsnmp_cache * cache, void *vmagic);
1169+
1170+/** Initializes the lmMiscSensorsTable module */
1171+void
1172+init_lmMiscSensorsTable(void)
1173+{
1174+    /*
1175+     * Initialize the lmMiscSensorsTable table by defining its contents
1176+     *  and how it's structured
1177+     */
1178+    static oid      lmMiscSensorsTable_oid[] =
1179+        { 1, 3, 6, 1, 4, 1, 2021, 13, 16, 5 };
1180+    size_t          lmMiscSensorsTable_oid_len =
1181+        OID_LENGTH(lmMiscSensorsTable_oid);
1182+    netsnmp_handler_registration *reg = NULL;
1183+    netsnmp_mib_handler *handler = NULL;
1184+    netsnmp_container *container = NULL;
1185+    netsnmp_table_registration_info *table_info = NULL;
1186+    netsnmp_cache  *cache = NULL;
1187+
1188+    /*
1189+     * NOTE: since all the sensor tables have exactly the same
1190+     *       structure, we use the lmTempSensorsTable_handler
1191+     *       for all the tables. We just have our own container
1192+     *       and cache routines.
1193+     */
1194+    reg =
1195+        netsnmp_create_handler_registration("lmMiscSensorsTable",
1196+                                            lmTempSensorsTable_handler,
1197+                                            lmMiscSensorsTable_oid,
1198+                                            lmMiscSensorsTable_oid_len,
1199+                                            HANDLER_CAN_RONLY);
1200+    if (NULL == reg) {
1201+        snmp_log(LOG_ERR,
1202+                 "error creating handler registration for lmMiscSensorsTable\n");
1203+        goto bail;
1204+    }
1205+
1206+    container =
1207+        netsnmp_container_find("lmMiscSensorsTable:table_container");
1208+    if (NULL == container) {
1209+        snmp_log(LOG_ERR,
1210+                 "error creating container for lmMiscSensorsTable\n");
1211+        goto bail;
1212+    }
1213+
1214+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
1215+    if (NULL == table_info) {
1216+        snmp_log(LOG_ERR,
1217+                 "error allocating table registration for lmMiscSensorsTable\n");
1218+        goto bail;
1219+    }
1220+    netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,   /* index: lmMiscSensorsIndex */
1221+                                     0);
1222+    table_info->min_column = COLUMN_LMTEMPSENSORSINDEX;
1223+    table_info->max_column = COLUMN_LMTEMPSENSORSVALUE;
1224+
1225+    /*************************************************
1226+     *
1227+     * inject container_table helper
1228+     */
1229+    handler = netsnmp_container_table_handler_get(table_info, container,
1230+                                                  TABLE_CONTAINER_KEY_NETSNMP_INDEX);
1231+    if (NULL == handler) {
1232+        snmp_log(LOG_ERR,
1233+                 "error allocating table registration for lmMiscSensorsTable\n");
1234+        goto bail;
1235+    }
1236+    if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
1237+        snmp_log(LOG_ERR,
1238+                 "error injecting container_table handler for lmMiscSensorsTable\n");
1239+        goto bail;
1240+    }
1241+    handler = NULL;             /* reg has it, will reuse below */
1242+
1243+    /*************************************************
1244+     *
1245+     * inject cache helper
1246+     */
1247+    cache = netsnmp_cache_create(30,    /* timeout in seconds */
1248+                                 _cache_load, _cache_free,
1249+                                 lmMiscSensorsTable_oid,
1250+                                 lmMiscSensorsTable_oid_len);
1251+
1252+    if (NULL == cache) {
1253+        snmp_log(LOG_ERR, "error creating cache for lmMiscSensorsTable\n");
1254+        goto bail;
1255+    }
1256+    cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
1257+    cache->magic = container;
1258+
1259+    handler = netsnmp_cache_handler_get(cache);
1260+    if (NULL == handler) {
1261+        snmp_log(LOG_ERR,
1262+                 "error creating cache handler for lmMiscSensorsTable\n");
1263+        goto bail;
1264+    }
1265+
1266+    if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
1267+        snmp_log(LOG_ERR,
1268+                 "error injecting cache handler for lmMiscSensorsTable\n");
1269+        goto bail;
1270+    }
1271+    handler = NULL;             /* reg has it */
1272+
1273+    /*
1274+     * register the table
1275+     */
1276+    if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
1277+        snmp_log(LOG_ERR,
1278+                 "error registering table handler for lmMiscSensorsTable\n");
1279+        goto bail;
1280+    }
1281+
1282+    return;                     /* ok */
1283+
1284+    /*
1285+     * Some error occurred during registration. Clean up and bail.
1286+     */
1287+  bail:                        /* not ok */
1288+
1289+    if (handler)
1290+        netsnmp_handler_free(handler);
1291+
1292+    if (cache)
1293+        netsnmp_cache_free(cache);
1294+
1295+    if (table_info)
1296+        netsnmp_table_registration_info_free(table_info);
1297+
1298+    if (container)
1299+        CONTAINER_FREE(container);
1300+
1301+    if (reg)
1302+        netsnmp_handler_registration_free(reg);
1303+}
1304+
1305+/**
1306+ * @internal
1307+ */
1308+static int
1309+_cache_load(netsnmp_cache * cache, void *vmagic)
1310+{
1311+    netsnmp_container *container;
1312+
1313+    DEBUGMSGTL(("internal:lmMiscSensorsTable:_cache_load", "called\n"));
1314+
1315+    if ((NULL == cache) || (NULL == cache->magic)) {
1316+        snmp_log(LOG_ERR,
1317+                 "invalid cache for lmMiscSensorsTable_cache_load\n");
1318+        return -1;
1319+    }
1320+    container = (netsnmp_container *) cache->magic;
1321+
1322+    /** should only be called for an invalid or expired cache */
1323+    netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
1324+
1325+    /*
1326+     * load cache here (or call function to do it)
1327+     */
1328+    netsnmp_sensors_container_load(container, NETSNMP_SENSORS_GET_MISCS);
1329+
1330+    return 0;
1331+}                               /* _cache_load */
1332+
1333+/**
1334+ * @internal
1335+ */
1336+static void
1337+_cache_free(netsnmp_cache * cache, void *magic)
1338+{
1339+    netsnmp_container *container;
1340+
1341+    DEBUGMSGTL(("internal:lmMiscSensorsTable:_cache_free", "called\n"));
1342+
1343+    if ((NULL == cache) || (NULL == cache->magic)) {
1344+        snmp_log(LOG_ERR,
1345+                 "invalid cache in lmMiscSensorsTable_cache_free\n");
1346+        return;
1347+    }
1348+    container = (netsnmp_container *) cache->magic;
1349+
1350+    /*
1351+     * empty (but don't free) cache here
1352+     */
1353+    netsnmp_sensors_container_free_items(container);
1354+}                               /* _cache_free */
1355diff -I '\$Id: ' -u -r -b -w -p -d --new-file --exclude-from=/Users/rstory/.rcfiles/diff-ignore SVN/agent/mibgroup/ucd-snmp/lmMiscSensorsTable.h APPLE/agent/mibgroup/ucd-snmp/lmMiscSensorsTable.h
1356--- SVN/agent/mibgroup/ucd-snmp/lmMiscSensorsTable.h
1357+++ APPLE/agent/mibgroup/ucd-snmp/lmMiscSensorsTable.h
1358@@ -0,0 +1,16 @@
1359+/*
1360+ * Note: this file originally auto-generated by mib2c using
1361+ *  : /mirrors/net-snmp/trunk/net-snmp/local/mib2c.container.conf 16055 2007-03-25T22:31:31.110329Z dts12  $
1362+ */
1363+#ifndef LMMISCSENSORSTABLE_H
1364+#define LMMISCSENSORSTABLE_H
1365+
1366+config_require(ucd-snmp/lmTempSensorsTable)
1367+
1368+/*
1369+ * function declarations 
1370+ */
1371+void            init_lmMiscSensorsTable(void);
1372+void            initialize_table_lmMiscSensorsTable(void);
1373+
1374+#endif                          /* LMMISCSENSORSTABLE_H */
1375