4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
35 * The /physical-platform node
37 #define PICL_NODE_PHYSPLAT "physical-platform"
40 * List of volatile property OIDs to lookup and update when needed
50 * Types of volatile properties (proptype values)
52 #define VPT_PLATOPSTATE 1
53 #define VPT_NUMSENSOR 2
54 #define VPT_BINSENSOR 3
55 #define VPT_ALARMSTATE 4
56 #define VPT_BATTERYSTATUS 5
59 * Storage related and miscellaneous definitions
61 #define N_ELEMS_IN_VOLPROP_BLOCK 512
62 #define N_ELEMS_IN_NODE_BLOCK 256
63 #define NODE_BLOCK_SHIFT 8
64 #define DEFAULT_SLOT_TYPE "slot"
67 * Local macros and property ids
69 #define ADD_NODE(cl) \
71 if (ptree_create_and_add_node(parenth, node_name, cl, \
72 &nodeh) != PICL_SUCCESS) { \
73 log_msg(LOG_ERR, SNMPP_ADD_NODE_FAIL, node_name, cl); \
78 #define CHECK_LINKRESET(errp, retval) \
79 if ((errp) && (*errp == ECANCELED)) { \
83 #define CHECK_LINKRESET_VOID(errp) \
84 if ((errp) && (*errp == ECANCELED)) { \
88 #define min(x, y) ((x) < (y) ? (x) : (y))
118 * Plugin global routines
120 void snmpplugin_init(void);
121 void snmpplugin_fini(void);
126 #define SNMPP_NO_ROOT \
127 gettext("PICL snmpplugin: cannot get picl tree root (ret=%d)\n")
129 #define SNMPP_CANT_INIT \
130 gettext("PICL snmpplugin: cannot initialize snmp service\n")
132 #define SNMPP_CANT_CREATE_PHYSPLAT \
133 gettext("PICL snmpplugin: cannot create physical-platform root (ret=%d)\n")
135 #define SNMPP_CANT_CREATE_TREE_BUILDER \
136 gettext("PICL snmpplugin: cannot create thr to handle hotplugs (ret=%d)\n")
138 #define SNMPP_NO_ENTPHYSNAME \
139 gettext("PICL snmpplugin: cannot get entPhysicalName (row=%d)\n")
141 #define SNMPP_ADD_NODE_FAIL \
142 gettext("PICL snmpplugin: couldn't add node %s (class=%d)\n")
144 #define SNMPP_UNSUPP_SENSOR_CLASS \
145 gettext("PICL snmpplugin: sunPlatSensorClass %d unsupported (row=%d)\n")
147 #define SNMPP_UNKNOWN_ENTPHYSCLASS \
148 gettext("PICL snmpplugin: entPhysicalClass %d unknown (row=%d)\n")
150 #define SNMPP_NO_MEM \
151 gettext("PICL snmpplugin: failed to allocate %d bytes\n")
153 #define SNMPP_CANT_FIND_VOLPROP \
154 gettext("PICL snmpplugin: cannot find volatile property (proph=%lx)\n")
156 #define SNMPP_INV_PLAT_EQUIP_OPSTATE \
157 gettext("PICL snmpplugin: invalid sunPlatEquipmentOpState %d (row=%d)\n")
159 #define SNMPP_INV_PLAT_BINSNSR_CURRENT \
160 gettext("PICL snmpplugin: invalid sunPlatBinarySensorCurrent %d (row=%d)\n")
162 #define SNMPP_NO_SLOT_TYPE \
163 gettext("PICL snmpplugin: no acceptable slot types (row=%d)\n")
165 #define SNMPP_CANT_INIT_PROPINFO \
166 gettext("PICL snmpplugin: cannot init picl propinfo (err=%d)\n")
168 #define SNMPP_CANT_ADD_PROP \
169 gettext("PICL snmpplugin: cannot add property, err=%d (node=%lx)\n")
171 #define SNMPP_CANT_INIT_STR_PROPINFO \
172 gettext("PICL snmpplugin: cannot init picl str propinfo (err=%d)\n")
174 #define SNMPP_CANT_ADD_STR_PROP \
175 gettext("PICL snmpplugin: cannot add string property (err=%d, node=%lx)\n")
177 #define SNMPP_CANT_INIT_VOID_PROPINFO \
178 gettext("PICL snmpplugin: cannot init picl void propinfo (err=%d)\n")
180 #define SNMPP_CANT_ADD_VOID_PROP \
181 gettext("PICL snmpplugin: cannot add void property (err=%d, node=%lx)\n")
183 #define SNMPP_CANT_INIT_INT_PROPINFO \
184 gettext("PICL snmpplugin: cannot init picl int propinfo (err=%d)\n")
186 #define SNMPP_CANT_ADD_INT_PROP \
187 gettext("PICL snmpplugin: cannot add int property (err=%d, node=%lx)\n")
189 #define SNMPP_CANT_FETCH_OBJECT_VAL \
190 gettext("PICL snmpplugin: cannot fetch object value " \
191 "(err=%d, OID=<%s>, row=%d)\n")
193 #define SNMPP_LINK_RESET \
194 gettext("PICL snmpplugin: snmp ds reset happened, rebuilding tree\n")
196 #define SIGACT_FAILED \
197 gettext("PICL snmpplugin: Failed to install signal handler for %s: %s\n")
199 #ifdef SNMPPLUGIN_DEBUG
200 #define SNMPPLUGIN_DBLOCK_SZ 4096
201 #define SNMPPLUGIN_DMAX_LINE 80
202 #define LOGINIT() snmpplugin_log_init()
203 #define LOGPRINTF(s) snmpplugin_log(s)
204 #define LOGPRINTF1(s, a1) snmpplugin_log(s, a1)
205 #define LOGPRINTF2(s, a1, a2) snmpplugin_log(s, a1, a2)
209 #define LOGPRINTF1(s, a1)
210 #define LOGPRINTF2(s, a1, a2)
217 #endif /* _SNMPPLUGIN_H */