1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
|
/* -*- linux-c -*-
*
* (C) Copyright IBM Corp. 2004
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
* file and program are licensed under a BSD style license. See
* the Copying file included with the OpenHPI distribution for
* full licensing terms.
*
* Author(s):
* Steve Sherman <stevees@us.ibm.com>
*/
/*******************************************************************
* WARNING! This file is auto-magically generated by:
* ./SaHpi2code.pl.
* Do not change this file manually. Update script instead
*******************************************************************/
#include <strings.h>
#include <SaHpi.h>
#include <oh_utils.h>
/**
* oh_lookup_atcahpiledcolor:
* @value: enum value of type AtcaHpiLedColorT.
*
* Converts @value into a string based on @value's HPI enum definition.
*
* Returns:
* string - normal operation.
* NULL - if @value not a valid AtcaHpiLedColorT.
**/
char * oh_lookup_atcahpiledcolor(AtcaHpiLedColorT value)
{
switch (value) {
case ATCAHPI_LED_COLOR_RESERVED:
return "COLOR_RESERVED";
case ATCAHPI_LED_COLOR_BLUE:
return "COLOR_BLUE";
case ATCAHPI_LED_COLOR_RED:
return "COLOR_RED";
case ATCAHPI_LED_COLOR_GREEN:
return "COLOR_GREEN";
case ATCAHPI_LED_COLOR_AMBER:
return "COLOR_AMBER";
case ATCAHPI_LED_COLOR_ORANGE:
return "COLOR_ORANGE";
case ATCAHPI_LED_COLOR_WHITE:
return "COLOR_WHITE";
case ATCAHPI_LED_COLOR_NO_CHANGE:
return "COLOR_NO_CHANGE";
case ATCAHPI_LED_COLOR_USE_DEFAULT:
return "COLOR_USE_DEFAULT";
default:
return NULL;
}
}
struct oh_atcahpiledcolor_map atcahpiledcolor_strings[] = {
{ATCAHPI_LED_COLOR_RESERVED, "COLOR_RESERVED"},
{ATCAHPI_LED_COLOR_BLUE, "COLOR_BLUE"},
{ATCAHPI_LED_COLOR_RED, "COLOR_RED"},
{ATCAHPI_LED_COLOR_GREEN, "COLOR_GREEN"},
{ATCAHPI_LED_COLOR_AMBER, "COLOR_AMBER"},
{ATCAHPI_LED_COLOR_ORANGE, "COLOR_ORANGE"},
{ATCAHPI_LED_COLOR_WHITE, "COLOR_WHITE"},
{ATCAHPI_LED_COLOR_NO_CHANGE, "COLOR_NO_CHANGE"},
{ATCAHPI_LED_COLOR_USE_DEFAULT, "COLOR_USE_DEFAULT"},
};
/**
* oh_encode_atcahpiledcolor:
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation.
* @type: Location (of AtcaHpiLedColorT) to place encoded result.
*
* Converts a @buffer->Data string, generated by oh_lookup_atcahpiledcolor(), back
* into an AtcaHpiLedColorT type.
*
* Returns:
* AtcaHpiLedColorT value - normal operation.
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty.
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid.
**/
SaErrorT oh_encode_atcahpiledcolor(SaHpiTextBufferT *buffer, AtcaHpiLedColorT *type)
{
int i, found;
if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') {
return(SA_ERR_HPI_INVALID_PARAMS);
}
found = 0;
for (i=0; i<OH_MAX_ATCAHPILEDCOLOR; i++) {
if (strcasecmp((char *)buffer->Data, atcahpiledcolor_strings[i].str) == 0) {
found++;
break;
}
}
if (found) {
*type = atcahpiledcolor_strings[i].entity_type;
}
else {
return(SA_ERR_HPI_INVALID_DATA);
}
return(SA_OK);
}
/**
* oh_lookup_atcahpiresourceledmode:
* @value: enum value of type AtcaHpiResourceLedModeT.
*
* Converts @value into a string based on @value's HPI enum definition.
*
* Returns:
* string - normal operation.
* NULL - if @value not a valid AtcaHpiResourceLedModeT.
**/
char * oh_lookup_atcahpiresourceledmode(AtcaHpiResourceLedModeT value)
{
switch (value) {
case ATCAHPI_LED_AUTO:
return "AUTO";
case ATCAHPI_LED_MANUAL:
return "MANUAL";
case ATCAHPI_LED_LAMP_TEST:
return "LAMP_TEST";
default:
return NULL;
}
}
struct oh_atcahpiresourceledmode_map atcahpiresourceledmode_strings[] = {
{ATCAHPI_LED_AUTO, "AUTO"},
{ATCAHPI_LED_MANUAL, "MANUAL"},
{ATCAHPI_LED_LAMP_TEST, "LAMP_TEST"},
};
/**
* oh_encode_atcahpiresourceledmode:
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation.
* @type: Location (of AtcaHpiResourceLedModeT) to place encoded result.
*
* Converts a @buffer->Data string, generated by oh_lookup_atcahpiresourceledmode(), back
* into an AtcaHpiResourceLedModeT type.
*
* Returns:
* AtcaHpiResourceLedModeT value - normal operation.
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty.
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid.
**/
SaErrorT oh_encode_atcahpiresourceledmode(SaHpiTextBufferT *buffer, AtcaHpiResourceLedModeT *type)
{
int i, found;
if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') {
return(SA_ERR_HPI_INVALID_PARAMS);
}
found = 0;
for (i=0; i<OH_MAX_ATCAHPIRESOURCELEDMODE; i++) {
if (strcasecmp((char *)buffer->Data, atcahpiresourceledmode_strings[i].str) == 0) {
found++;
break;
}
}
if (found) {
*type = atcahpiresourceledmode_strings[i].entity_type;
}
else {
return(SA_ERR_HPI_INVALID_DATA);
}
return(SA_OK);
}
/**
* oh_lookup_atcahpiledbrsupport:
* @value: enum value of type AtcaHpiLedBrSupportT.
*
* Converts @value into a string based on @value's HPI enum definition.
*
* Returns:
* string - normal operation.
* NULL - if @value not a valid AtcaHpiLedBrSupportT.
**/
char * oh_lookup_atcahpiledbrsupport(AtcaHpiLedBrSupportT value)
{
switch (value) {
case ATCAHPI_LED_BR_SUPPORTED:
return "BR_SUPPORTED";
case ATCAHPI_LED_BR_NOT_SUPPORTED:
return "BR_NOT_SUPPORTED";
case ATCAHPI_LED_BR_UNKNOWN:
return "BR_UNKNOWN";
default:
return NULL;
}
}
struct oh_atcahpiledbrsupport_map atcahpiledbrsupport_strings[] = {
{ATCAHPI_LED_BR_SUPPORTED, "BR_SUPPORTED"},
{ATCAHPI_LED_BR_NOT_SUPPORTED, "BR_NOT_SUPPORTED"},
{ATCAHPI_LED_BR_UNKNOWN, "BR_UNKNOWN"},
};
/**
* oh_encode_atcahpiledbrsupport:
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation.
* @type: Location (of AtcaHpiLedBrSupportT) to place encoded result.
*
* Converts a @buffer->Data string, generated by oh_lookup_atcahpiledbrsupport(), back
* into an AtcaHpiLedBrSupportT type.
*
* Returns:
* AtcaHpiLedBrSupportT value - normal operation.
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty.
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid.
**/
SaErrorT oh_encode_atcahpiledbrsupport(SaHpiTextBufferT *buffer, AtcaHpiLedBrSupportT *type)
{
int i, found;
if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') {
return(SA_ERR_HPI_INVALID_PARAMS);
}
found = 0;
for (i=0; i<OH_MAX_ATCAHPILEDBRSUPPORT; i++) {
if (strcasecmp((char *)buffer->Data, atcahpiledbrsupport_strings[i].str) == 0) {
found++;
break;
}
}
if (found) {
*type = atcahpiledbrsupport_strings[i].entity_type;
}
else {
return(SA_ERR_HPI_INVALID_DATA);
}
return(SA_OK);
}
/**
* oh_lookup_atcahpientitytype:
* @value: enum value of type AtcaHpiEntityTypeT.
*
* Converts @value into a string based on @value's HPI enum definition.
*
* Returns:
* string - normal operation.
* NULL - if @value not a valid AtcaHpiEntityTypeT.
**/
char * oh_lookup_atcahpientitytype(AtcaHpiEntityTypeT value)
{
switch (value) {
case ATCAHPI_ENT_POWER_ENTRY_MODULE_SLOT:
return "POWER_ENTRY_MODULE_SLOT";
case ATCAHPI_ENT_SHELF_FRU_DEVICE_SLOT:
return "SHELF_FRU_DEVICE_SLOT";
case ATCAHPI_ENT_SHELF_MANAGER_SLOT:
return "SHELF_MANAGER_SLOT";
case ATCAHPI_ENT_FAN_TRAY_SLOT:
return "FAN_TRAY_SLOT";
case ATCAHPI_ENT_FAN_FILTER_TRAY_SLOT:
return "FAN_FILTER_TRAY_SLOT";
case ATCAHPI_ENT_ALARM_SLOT:
return "ALARM_SLOT";
case ATCAHPI_ENT_AMC_SLOT:
return "AMC_SLOT";
case ATCAHPI_ENT_PMC_SLOT:
return "PMC_SLOT";
case ATCAHPI_ENT_RTM_SLOT:
return "RTM_SLOT";
case ATCAHPI_ENT_PICMG_FRONT_BLADE:
return "PICMG_FRONT_BLADE";
case ATCAHPI_ENT_SHELF_FRU_DEVICE:
return "SHELF_FRU_DEVICE";
case ATCAHPI_ENT_FILTRATION_UNIT:
return "FILTRATION_UNIT";
case ATCAHPI_ENT_AMC:
return "AMC";
default:
return NULL;
}
}
struct oh_atcahpientitytype_map atcahpientitytype_strings[] = {
{ATCAHPI_ENT_POWER_ENTRY_MODULE_SLOT, "POWER_ENTRY_MODULE_SLOT"},
{ATCAHPI_ENT_SHELF_FRU_DEVICE_SLOT, "SHELF_FRU_DEVICE_SLOT"},
{ATCAHPI_ENT_SHELF_MANAGER_SLOT, "SHELF_MANAGER_SLOT"},
{ATCAHPI_ENT_FAN_TRAY_SLOT, "FAN_TRAY_SLOT"},
{ATCAHPI_ENT_FAN_FILTER_TRAY_SLOT, "FAN_FILTER_TRAY_SLOT"},
{ATCAHPI_ENT_ALARM_SLOT, "ALARM_SLOT"},
{ATCAHPI_ENT_AMC_SLOT, "AMC_SLOT"},
{ATCAHPI_ENT_PMC_SLOT, "PMC_SLOT"},
{ATCAHPI_ENT_RTM_SLOT, "RTM_SLOT"},
{ATCAHPI_ENT_PICMG_FRONT_BLADE, "PICMG_FRONT_BLADE"},
{ATCAHPI_ENT_SHELF_FRU_DEVICE, "SHELF_FRU_DEVICE"},
{ATCAHPI_ENT_FILTRATION_UNIT, "FILTRATION_UNIT"},
{ATCAHPI_ENT_AMC, "AMC"},
};
/**
* oh_encode_atcahpientitytype:
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation.
* @type: Location (of AtcaHpiEntityTypeT) to place encoded result.
*
* Converts a @buffer->Data string, generated by oh_lookup_atcahpientitytype(), back
* into an AtcaHpiEntityTypeT type.
*
* Returns:
* AtcaHpiEntityTypeT value - normal operation.
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty.
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid.
**/
SaErrorT oh_encode_atcahpientitytype(SaHpiTextBufferT *buffer, AtcaHpiEntityTypeT *type)
{
int i, found;
if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') {
return(SA_ERR_HPI_INVALID_PARAMS);
}
found = 0;
for (i=0; i<OH_MAX_ATCAHPIENTITYTYPE; i++) {
if (strcasecmp((char *)buffer->Data, atcahpientitytype_strings[i].str) == 0) {
found++;
break;
}
}
if (found) {
*type = atcahpientitytype_strings[i].entity_type;
}
else {
return(SA_ERR_HPI_INVALID_DATA);
}
return(SA_OK);
}
|