11303Swesolows /* 21303Swesolows * CDDL HEADER START 31303Swesolows * 41303Swesolows * The contents of this file are subject to the terms of the 51303Swesolows * Common Development and Distribution License (the "License"). 61303Swesolows * You may not use this file except in compliance with the License. 71303Swesolows * 81303Swesolows * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 91303Swesolows * or http://www.opensolaris.org/os/licensing. 101303Swesolows * See the License for the specific language governing permissions 111303Swesolows * and limitations under the License. 121303Swesolows * 131303Swesolows * When distributing Covered Code, include this CDDL HEADER in each 141303Swesolows * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 151303Swesolows * If applicable, add the following below this CDDL HEADER, with the 161303Swesolows * fields enclosed by brackets "[]" replaced with your own identifying 171303Swesolows * information: Portions Copyright [yyyy] [name of copyright owner] 181303Swesolows * 191303Swesolows * CDDL HEADER END 201303Swesolows */ 211303Swesolows 221303Swesolows /* 23*11050SRobert.Johnston@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 241303Swesolows * Use is subject to license terms. 251303Swesolows */ 261303Swesolows 271303Swesolows #include <fm/fmd_snmp.h> 281303Swesolows #include <net-snmp/net-snmp-config.h> 291303Swesolows #include <net-snmp/net-snmp-includes.h> 301303Swesolows #include <net-snmp/agent/net-snmp-agent-includes.h> 311303Swesolows #include "sunFM_impl.h" 321303Swesolows #include "module.h" 331303Swesolows #include "resource.h" 341303Swesolows #include "problem.h" 351303Swesolows 361303Swesolows static const sunFm_table_t sun_fm_tables[] = { 371303Swesolows TABLE_REG(sunFmModuleTable), 381303Swesolows TABLE_REG(sunFmResourceTable), 391303Swesolows TABLE_REG(sunFmProblemTable), 401303Swesolows TABLE_REG(sunFmFaultEventTable), 411303Swesolows TABLE_NULL 421303Swesolows }; 431303Swesolows 441303Swesolows /* 451303Swesolows * This is our entry point for initialization by the agent, which 461303Swesolows * (for reasons unknown) ignores the return value. The name is fixed 471303Swesolows * by the agent API. 481303Swesolows */ 491303Swesolows int 501303Swesolows init_sunFM(void) 511303Swesolows { 521303Swesolows int max_err = MIB_REGISTERED_OK; 531303Swesolows const sunFm_table_t *table; 541303Swesolows 551303Swesolows for (table = sun_fm_tables; table->t_name != NULL; table++) { 561303Swesolows int err = table->t_init(); 571303Swesolows 581303Swesolows switch (err) { 591303Swesolows case MIB_REGISTERED_OK: 601303Swesolows DEBUGMSGTL((MODNAME_STR, "registered table %s\n", 611303Swesolows table->t_name)); 621303Swesolows break; 631303Swesolows case MIB_DUPLICATE_REGISTRATION: 641303Swesolows (void) snmp_log(LOG_ERR, MODNAME_STR 651303Swesolows ": table %s initialization failed: duplicate " 661303Swesolows "registration\n", table->t_name); 671303Swesolows break; 681303Swesolows case MIB_REGISTRATION_FAILED: 691303Swesolows (void) snmp_log(LOG_ERR, MODNAME_STR 701303Swesolows ": table %s initialization failed: agent " 711303Swesolows "registration failure\n", table->t_name); 721303Swesolows break; 731303Swesolows default: 74*11050SRobert.Johnston@Sun.COM (void) snmp_log(LOG_ERR, MODNAME_STR 751303Swesolows ": table %s initialization failed: " 761303Swesolows "unknown reason\n", table->t_name); 771303Swesolows } 781303Swesolows 791303Swesolows if (err > max_err) 801303Swesolows max_err = err; 811303Swesolows } 821303Swesolows 831303Swesolows return (max_err); 841303Swesolows } 85