GCOV Execution Analysis for sahpi_enum_utils.c
The left column is the number of times the code was executed
during the unit test suites.
Exec | Code | Line # | |
---|---|---|---|
Source:sahpi_enum_utils.c | 1 | ||
Graph:.libs/sahpi_enum_utils.gcno | 2 | ||
Data:.libs/sahpi_enum_utils.gcda | 3 | ||
Runs:378 | 4 | ||
Programs:378 | 5 | ||
/* -*- linux-c -*- | 6 | ||
* | 7 | ||
* (C) Copyright IBM Corp. 2004 | 8 | ||
* | 9 | ||
* This program is distributed in the hope that it will be useful, | 10 | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This | 12 | ||
* file and program are licensed under a BSD style license. See | 13 | ||
* the Copying file included with the OpenHPI distribution for | 14 | ||
* full licensing terms. | 15 | ||
* | 16 | ||
* Author(s): | 17 | ||
* Steve Sherman < address removed > | 18 | ||
*/ | 19 | ||
20 | |||
/******************************************************************* | 21 | ||
* WARNING! This file is auto-magically generated by: | 22 | ||
* ../scripts/SaHpi2code.pl. | 23 | ||
* Do not change this file manually. Update script instead | 24 | ||
*******************************************************************/ | 25 | ||
26 | |||
#include <stdlib.h> | 27 | ||
28 | |||
#include <SaHpi.h> | 29 | ||
#include <oh_utils.h> | 30 | ||
31 | |||
/** | 32 | ||
* oh_lookup_language: | 33 | ||
* @value: enum value of type SaHpiLanguageT. | 34 | ||
* | 35 | ||
* Converts @value into a string based on @value's HPI enum definition. | 36 | ||
* | 37 | ||
* Returns: | 38 | ||
* string - normal operation. | 39 | ||
* NULL - if @value not a valid SaHpiLanguageT. | 40 | ||
**/ | 41 | ||
const char * oh_lookup_language(SaHpiLanguageT value) | 42 | ||
13 | { | 43 | |
13 | switch (value) { | 44 | |
case SAHPI_LANG_UNDEF: | 45 | ||
0 | return "UNDEF"; | 46 | |
case SAHPI_LANG_AFAR: | 47 | ||
0 | return "AFAR"; | 48 | |
case SAHPI_LANG_ABKHAZIAN: | 49 | ||
0 | return "ABKHAZIAN"; | 50 | |
case SAHPI_LANG_AFRIKAANS: | 51 | ||
0 | return "AFRIKAANS"; | 52 | |
case SAHPI_LANG_AMHARIC: | 53 | ||
0 | return "AMHARIC"; | 54 | |
case SAHPI_LANG_ARABIC: | 55 | ||
0 | return "ARABIC"; | 56 | |
case SAHPI_LANG_ASSAMESE: | 57 | ||
0 | return "ASSAMESE"; | 58 | |
case SAHPI_LANG_AYMARA: | 59 | ||
0 | return "AYMARA"; | 60 | |
case SAHPI_LANG_AZERBAIJANI: | 61 | ||
0 | return "AZERBAIJANI"; | 62 | |
case SAHPI_LANG_BASHKIR: | 63 | ||
0 | return "BASHKIR"; | 64 | |
case SAHPI_LANG_BYELORUSSIAN: | 65 | ||
0 | return "BYELORUSSIAN"; | 66 | |
case SAHPI_LANG_BULGARIAN: | 67 | ||
0 | return "BULGARIAN"; | 68 | |
case SAHPI_LANG_BIHARI: | 69 | ||
0 | return "BIHARI"; | 70 | |
case SAHPI_LANG_BISLAMA: | 71 | ||
0 | return "BISLAMA"; | 72 | |
case SAHPI_LANG_BENGALI: | 73 | ||
0 | return "BENGALI"; | 74 | |
case SAHPI_LANG_TIBETAN: | 75 | ||
0 | return "TIBETAN"; | 76 | |
case SAHPI_LANG_BRETON: | 77 | ||
0 | return "BRETON"; | 78 | |
case SAHPI_LANG_CATALAN: | 79 | ||
0 | return "CATALAN"; | 80 | |
case SAHPI_LANG_CORSICAN: | 81 | ||
0 | return "CORSICAN"; | 82 | |
case SAHPI_LANG_CZECH: | 83 | ||
0 | return "CZECH"; | 84 | |
case SAHPI_LANG_WELSH: | 85 | ||
0 | return "WELSH"; | 86 | |
case SAHPI_LANG_DANISH: | 87 | ||
0 | return "DANISH"; | 88 | |
case SAHPI_LANG_GERMAN: | 89 | ||
0 | return "GERMAN"; | 90 | |
case SAHPI_LANG_BHUTANI: | 91 | ||
0 | return "BHUTANI"; | 92 | |
case SAHPI_LANG_GREEK: | 93 | ||
0 | return "GREEK"; | 94 | |
case SAHPI_LANG_ENGLISH: | 95 | ||
10 | return "ENGLISH"; | 96 | |
case SAHPI_LANG_ESPERANTO: | 97 | ||
0 | return "ESPERANTO"; | 98 | |
case SAHPI_LANG_SPANISH: | 99 | ||
0 | return "SPANISH"; | 100 | |
case SAHPI_LANG_ESTONIAN: | 101 | ||
0 | return "ESTONIAN"; | 102 | |
case SAHPI_LANG_BASQUE: | 103 | ||
0 | return "BASQUE"; | 104 | |
case SAHPI_LANG_PERSIAN: | 105 | ||
0 | return "PERSIAN"; | 106 | |
case SAHPI_LANG_FINNISH: | 107 | ||
0 | return "FINNISH"; | 108 | |
case SAHPI_LANG_FIJI: | 109 | ||
0 | return "FIJI"; | 110 | |
case SAHPI_LANG_FAEROESE: | 111 | ||
0 | return "FAEROESE"; | 112 | |
case SAHPI_LANG_FRENCH: | 113 | ||
0 | return "FRENCH"; | 114 | |
case SAHPI_LANG_FRISIAN: | 115 | ||
0 | return "FRISIAN"; | 116 | |
case SAHPI_LANG_IRISH: | 117 | ||
0 | return "IRISH"; | 118 | |
case SAHPI_LANG_SCOTSGAELIC: | 119 | ||
0 | return "SCOTSGAELIC"; | 120 | |
case SAHPI_LANG_GALICIAN: | 121 | ||
0 | return "GALICIAN"; | 122 | |
case SAHPI_LANG_GUARANI: | 123 | ||
0 | return "GUARANI"; | 124 | |
case SAHPI_LANG_GUJARATI: | 125 | ||
0 | return "GUJARATI"; | 126 | |
case SAHPI_LANG_HAUSA: | 127 | ||
0 | return "HAUSA"; | 128 | |
case SAHPI_LANG_HINDI: | 129 | ||
0 | return "HINDI"; | 130 | |
case SAHPI_LANG_CROATIAN: | 131 | ||
0 | return "CROATIAN"; | 132 | |
case SAHPI_LANG_HUNGARIAN: | 133 | ||
0 | return "HUNGARIAN"; | 134 | |
case SAHPI_LANG_ARMENIAN: | 135 | ||
0 | return "ARMENIAN"; | 136 | |
case SAHPI_LANG_INTERLINGUA: | 137 | ||
0 | return "INTERLINGUA"; | 138 | |
case SAHPI_LANG_INTERLINGUE: | 139 | ||
0 | return "INTERLINGUE"; | 140 | |
case SAHPI_LANG_INUPIAK: | 141 | ||
0 | return "INUPIAK"; | 142 | |
case SAHPI_LANG_INDONESIAN: | 143 | ||
0 | return "INDONESIAN"; | 144 | |
case SAHPI_LANG_ICELANDIC: | 145 | ||
0 | return "ICELANDIC"; | 146 | |
case SAHPI_LANG_ITALIAN: | 147 | ||
0 | return "ITALIAN"; | 148 | |
case SAHPI_LANG_HEBREW: | 149 | ||
0 | return "HEBREW"; | 150 | |
case SAHPI_LANG_JAPANESE: | 151 | ||
0 | return "JAPANESE"; | 152 | |
case SAHPI_LANG_YIDDISH: | 153 | ||
0 | return "YIDDISH"; | 154 | |
case SAHPI_LANG_JAVANESE: | 155 | ||
0 | return "JAVANESE"; | 156 | |
case SAHPI_LANG_GEORGIAN: | 157 | ||
0 | return "GEORGIAN"; | 158 | |
case SAHPI_LANG_KAZAKH: | 159 | ||
0 | return "KAZAKH"; | 160 | |
case SAHPI_LANG_GREENLANDIC: | 161 | ||
0 | return "GREENLANDIC"; | 162 | |
case SAHPI_LANG_CAMBODIAN: | 163 | ||
0 | return "CAMBODIAN"; | 164 | |
case SAHPI_LANG_KANNADA: | 165 | ||
0 | return "KANNADA"; | 166 | |
case SAHPI_LANG_KOREAN: | 167 | ||
0 | return "KOREAN"; | 168 | |
case SAHPI_LANG_KASHMIRI: | 169 | ||
0 | return "KASHMIRI"; | 170 | |
case SAHPI_LANG_KURDISH: | 171 | ||
0 | return "KURDISH"; | 172 | |
case SAHPI_LANG_KIRGHIZ: | 173 | ||
0 | return "KIRGHIZ"; | 174 | |
case SAHPI_LANG_LATIN: | 175 | ||
0 | return "LATIN"; | 176 | |
case SAHPI_LANG_LINGALA: | 177 | ||
0 | return "LINGALA"; | 178 | |
case SAHPI_LANG_LAOTHIAN: | 179 | ||
0 | return "LAOTHIAN"; | 180 | |
case SAHPI_LANG_LITHUANIAN: | 181 | ||
0 | return "LITHUANIAN"; | 182 | |
case SAHPI_LANG_LATVIANLETTISH: | 183 | ||
0 | return "LATVIANLETTISH"; | 184 | |
case SAHPI_LANG_MALAGASY: | 185 | ||
0 | return "MALAGASY"; | 186 | |
case SAHPI_LANG_MAORI: | 187 | ||
0 | return "MAORI"; | 188 | |
case SAHPI_LANG_MACEDONIAN: | 189 | ||
0 | return "MACEDONIAN"; | 190 | |
case SAHPI_LANG_MALAYALAM: | 191 | ||
0 | return "MALAYALAM"; | 192 | |
case SAHPI_LANG_MONGOLIAN: | 193 | ||
0 | return "MONGOLIAN"; | 194 | |
case SAHPI_LANG_MOLDAVIAN: | 195 | ||
0 | return "MOLDAVIAN"; | 196 | |
case SAHPI_LANG_MARATHI: | 197 | ||
0 | return "MARATHI"; | 198 | |
case SAHPI_LANG_MALAY: | 199 | ||
0 | return "MALAY"; | 200 | |
case SAHPI_LANG_MALTESE: | 201 | ||
0 | return "MALTESE"; | 202 | |
case SAHPI_LANG_BURMESE: | 203 | ||
0 | return "BURMESE"; | 204 | |
case SAHPI_LANG_NAURU: | 205 | ||
0 | return "NAURU"; | 206 | |
case SAHPI_LANG_NEPALI: | 207 | ||
0 | return "NEPALI"; | 208 | |
case SAHPI_LANG_DUTCH: | 209 | ||
0 | return "DUTCH"; | 210 | |
case SAHPI_LANG_NORWEGIAN: | 211 | ||
0 | return "NORWEGIAN"; | 212 | |
case SAHPI_LANG_OCCITAN: | 213 | ||
0 | return "OCCITAN"; | 214 | |
case SAHPI_LANG_AFANOROMO: | 215 | ||
0 | return "AFANOROMO"; | 216 | |
case SAHPI_LANG_ORIYA: | 217 | ||
0 | return "ORIYA"; | 218 | |
case SAHPI_LANG_PUNJABI: | 219 | ||
0 | return "PUNJABI"; | 220 | |
case SAHPI_LANG_POLISH: | 221 | ||
0 | return "POLISH"; | 222 | |
case SAHPI_LANG_PASHTOPUSHTO: | 223 | ||
0 | return "PASHTOPUSHTO"; | 224 | |
case SAHPI_LANG_PORTUGUESE: | 225 | ||
0 | return "PORTUGUESE"; | 226 | |
case SAHPI_LANG_QUECHUA: | 227 | ||
0 | return "QUECHUA"; | 228 | |
case SAHPI_LANG_RHAETOROMANCE: | 229 | ||
0 | return "RHAETOROMANCE"; | 230 | |
case SAHPI_LANG_KIRUNDI: | 231 | ||
0 | return "KIRUNDI"; | 232 | |
case SAHPI_LANG_ROMANIAN: | 233 | ||
0 | return "ROMANIAN"; | 234 | |
case SAHPI_LANG_RUSSIAN: | 235 | ||
0 | return "RUSSIAN"; | 236 | |
case SAHPI_LANG_KINYARWANDA: | 237 | ||
0 | return "KINYARWANDA"; | 238 | |
case SAHPI_LANG_SANSKRIT: | 239 | ||
0 | return "SANSKRIT"; | 240 | |
case SAHPI_LANG_SINDHI: | 241 | ||
0 | return "SINDHI"; | 242 | |
case SAHPI_LANG_SANGRO: | 243 | ||
0 | return "SANGRO"; | 244 | |
case SAHPI_LANG_SERBOCROATIAN: | 245 | ||
0 | return "SERBOCROATIAN"; | 246 | |
case SAHPI_LANG_SINGHALESE: | 247 | ||
0 | return "SINGHALESE"; | 248 | |
case SAHPI_LANG_SLOVAK: | 249 | ||
0 | return "SLOVAK"; | 250 | |
case SAHPI_LANG_SLOVENIAN: | 251 | ||
0 | return "SLOVENIAN"; | 252 | |
case SAHPI_LANG_SAMOAN: | 253 | ||
0 | return "SAMOAN"; | 254 | |
case SAHPI_LANG_SHONA: | 255 | ||
0 | return "SHONA"; | 256 | |
case SAHPI_LANG_SOMALI: | 257 | ||
0 | return "SOMALI"; | 258 | |
case SAHPI_LANG_ALBANIAN: | 259 | ||
0 | return "ALBANIAN"; | 260 | |
case SAHPI_LANG_SERBIAN: | 261 | ||
0 | return "SERBIAN"; | 262 | |
case SAHPI_LANG_SISWATI: | 263 | ||
0 | return "SISWATI"; | 264 | |
case SAHPI_LANG_SESOTHO: | 265 | ||
0 | return "SESOTHO"; | 266 | |
case SAHPI_LANG_SUDANESE: | 267 | ||
0 | return "SUDANESE"; | 268 | |
case SAHPI_LANG_SWEDISH: | 269 | ||
0 | return "SWEDISH"; | 270 | |
case SAHPI_LANG_SWAHILI: | 271 | ||
0 | return "SWAHILI"; | 272 | |
case SAHPI_LANG_TAMIL: | 273 | ||
0 | return "TAMIL"; | 274 | |
case SAHPI_LANG_TELUGU: | 275 | ||
0 | return "TELUGU"; | 276 | |
case SAHPI_LANG_TAJIK: | 277 | ||
0 | return "TAJIK"; | 278 | |
case SAHPI_LANG_THAI: | 279 | ||
0 | return "THAI"; | 280 | |
case SAHPI_LANG_TIGRINYA: | 281 | ||
0 | return "TIGRINYA"; | 282 | |
case SAHPI_LANG_TURKMEN: | 283 | ||
0 | return "TURKMEN"; | 284 | |
case SAHPI_LANG_TAGALOG: | 285 | ||
0 | return "TAGALOG"; | 286 | |
case SAHPI_LANG_SETSWANA: | 287 | ||
0 | return "SETSWANA"; | 288 | |
case SAHPI_LANG_TONGA: | 289 | ||
0 | return "TONGA"; | 290 | |
case SAHPI_LANG_TURKISH: | 291 | ||
0 | return "TURKISH"; | 292 | |
case SAHPI_LANG_TSONGA: | 293 | ||
0 | return "TSONGA"; | 294 | |
case SAHPI_LANG_TATAR: | 295 | ||
0 | return "TATAR"; | 296 | |
case SAHPI_LANG_TWI: | 297 | ||
0 | return "TWI"; | 298 | |
case SAHPI_LANG_UKRAINIAN: | 299 | ||
0 | return "UKRAINIAN"; | 300 | |
case SAHPI_LANG_URDU: | 301 | ||
0 | return "URDU"; | 302 | |
case SAHPI_LANG_UZBEK: | 303 | ||
0 | return "UZBEK"; | 304 | |
case SAHPI_LANG_VIETNAMESE: | 305 | ||
0 | return "VIETNAMESE"; | 306 | |
case SAHPI_LANG_VOLAPUK: | 307 | ||
0 | return "VOLAPUK"; | 308 | |
case SAHPI_LANG_WOLOF: | 309 | ||
0 | return "WOLOF"; | 310 | |
case SAHPI_LANG_XHOSA: | 311 | ||
0 | return "XHOSA"; | 312 | |
case SAHPI_LANG_YORUBA: | 313 | ||
0 | return "YORUBA"; | 314 | |
case SAHPI_LANG_CHINESE: | 315 | ||
0 | return "CHINESE"; | 316 | |
case SAHPI_LANG_ZULU: | 317 | ||
0 | return "ZULU"; | 318 | |
default: | 319 | ||
3 | return NULL; | 320 | |
} | 321 | ||
} | 322 | ||
323 | |||
struct oh_language_map language_strings[] = { | 324 | ||
{SAHPI_LANG_UNDEF, "UNDEF"}, | 325 | ||
{SAHPI_LANG_AFAR, "AFAR"}, | 326 | ||
{SAHPI_LANG_ABKHAZIAN, "ABKHAZIAN"}, | 327 | ||
{SAHPI_LANG_AFRIKAANS, "AFRIKAANS"}, | 328 | ||
{SAHPI_LANG_AMHARIC, "AMHARIC"}, | 329 | ||
{SAHPI_LANG_ARABIC, "ARABIC"}, | 330 | ||
{SAHPI_LANG_ASSAMESE, "ASSAMESE"}, | 331 | ||
{SAHPI_LANG_AYMARA, "AYMARA"}, | 332 | ||
{SAHPI_LANG_AZERBAIJANI, "AZERBAIJANI"}, | 333 | ||
{SAHPI_LANG_BASHKIR, "BASHKIR"}, | 334 | ||
{SAHPI_LANG_BYELORUSSIAN, "BYELORUSSIAN"}, | 335 | ||
{SAHPI_LANG_BULGARIAN, "BULGARIAN"}, | 336 | ||
{SAHPI_LANG_BIHARI, "BIHARI"}, | 337 | ||
{SAHPI_LANG_BISLAMA, "BISLAMA"}, | 338 | ||
{SAHPI_LANG_BENGALI, "BENGALI"}, | 339 | ||
{SAHPI_LANG_TIBETAN, "TIBETAN"}, | 340 | ||
{SAHPI_LANG_BRETON, "BRETON"}, | 341 | ||
{SAHPI_LANG_CATALAN, "CATALAN"}, | 342 | ||
{SAHPI_LANG_CORSICAN, "CORSICAN"}, | 343 | ||
{SAHPI_LANG_CZECH, "CZECH"}, | 344 | ||
{SAHPI_LANG_WELSH, "WELSH"}, | 345 | ||
{SAHPI_LANG_DANISH, "DANISH"}, | 346 | ||
{SAHPI_LANG_GERMAN, "GERMAN"}, | 347 | ||
{SAHPI_LANG_BHUTANI, "BHUTANI"}, | 348 | ||
{SAHPI_LANG_GREEK, "GREEK"}, | 349 | ||
{SAHPI_LANG_ENGLISH, "ENGLISH"}, | 350 | ||
{SAHPI_LANG_ESPERANTO, "ESPERANTO"}, | 351 | ||
{SAHPI_LANG_SPANISH, "SPANISH"}, | 352 | ||
{SAHPI_LANG_ESTONIAN, "ESTONIAN"}, | 353 | ||
{SAHPI_LANG_BASQUE, "BASQUE"}, | 354 | ||
{SAHPI_LANG_PERSIAN, "PERSIAN"}, | 355 | ||
{SAHPI_LANG_FINNISH, "FINNISH"}, | 356 | ||
{SAHPI_LANG_FIJI, "FIJI"}, | 357 | ||
{SAHPI_LANG_FAEROESE, "FAEROESE"}, | 358 | ||
{SAHPI_LANG_FRENCH, "FRENCH"}, | 359 | ||
{SAHPI_LANG_FRISIAN, "FRISIAN"}, | 360 | ||
{SAHPI_LANG_IRISH, "IRISH"}, | 361 | ||
{SAHPI_LANG_SCOTSGAELIC, "SCOTSGAELIC"}, | 362 | ||
{SAHPI_LANG_GALICIAN, "GALICIAN"}, | 363 | ||
{SAHPI_LANG_GUARANI, "GUARANI"}, | 364 | ||
{SAHPI_LANG_GUJARATI, "GUJARATI"}, | 365 | ||
{SAHPI_LANG_HAUSA, "HAUSA"}, | 366 | ||
{SAHPI_LANG_HINDI, "HINDI"}, | 367 | ||
{SAHPI_LANG_CROATIAN, "CROATIAN"}, | 368 | ||
{SAHPI_LANG_HUNGARIAN, "HUNGARIAN"}, | 369 | ||
{SAHPI_LANG_ARMENIAN, "ARMENIAN"}, | 370 | ||
{SAHPI_LANG_INTERLINGUA, "INTERLINGUA"}, | 371 | ||
{SAHPI_LANG_INTERLINGUE, "INTERLINGUE"}, | 372 | ||
{SAHPI_LANG_INUPIAK, "INUPIAK"}, | 373 | ||
{SAHPI_LANG_INDONESIAN, "INDONESIAN"}, | 374 | ||
{SAHPI_LANG_ICELANDIC, "ICELANDIC"}, | 375 | ||
{SAHPI_LANG_ITALIAN, "ITALIAN"}, | 376 | ||
{SAHPI_LANG_HEBREW, "HEBREW"}, | 377 | ||
{SAHPI_LANG_JAPANESE, "JAPANESE"}, | 378 | ||
{SAHPI_LANG_YIDDISH, "YIDDISH"}, | 379 | ||
{SAHPI_LANG_JAVANESE, "JAVANESE"}, | 380 | ||
{SAHPI_LANG_GEORGIAN, "GEORGIAN"}, | 381 | ||
{SAHPI_LANG_KAZAKH, "KAZAKH"}, | 382 | ||
{SAHPI_LANG_GREENLANDIC, "GREENLANDIC"}, | 383 | ||
{SAHPI_LANG_CAMBODIAN, "CAMBODIAN"}, | 384 | ||
{SAHPI_LANG_KANNADA, "KANNADA"}, | 385 | ||
{SAHPI_LANG_KOREAN, "KOREAN"}, | 386 | ||
{SAHPI_LANG_KASHMIRI, "KASHMIRI"}, | 387 | ||
{SAHPI_LANG_KURDISH, "KURDISH"}, | 388 | ||
{SAHPI_LANG_KIRGHIZ, "KIRGHIZ"}, | 389 | ||
{SAHPI_LANG_LATIN, "LATIN"}, | 390 | ||
{SAHPI_LANG_LINGALA, "LINGALA"}, | 391 | ||
{SAHPI_LANG_LAOTHIAN, "LAOTHIAN"}, | 392 | ||
{SAHPI_LANG_LITHUANIAN, "LITHUANIAN"}, | 393 | ||
{SAHPI_LANG_LATVIANLETTISH, "LATVIANLETTISH"}, | 394 | ||
{SAHPI_LANG_MALAGASY, "MALAGASY"}, | 395 | ||
{SAHPI_LANG_MAORI, "MAORI"}, | 396 | ||
{SAHPI_LANG_MACEDONIAN, "MACEDONIAN"}, | 397 | ||
{SAHPI_LANG_MALAYALAM, "MALAYALAM"}, | 398 | ||
{SAHPI_LANG_MONGOLIAN, "MONGOLIAN"}, | 399 | ||
{SAHPI_LANG_MOLDAVIAN, "MOLDAVIAN"}, | 400 | ||
{SAHPI_LANG_MARATHI, "MARATHI"}, | 401 | ||
{SAHPI_LANG_MALAY, "MALAY"}, | 402 | ||
{SAHPI_LANG_MALTESE, "MALTESE"}, | 403 | ||
{SAHPI_LANG_BURMESE, "BURMESE"}, | 404 | ||
{SAHPI_LANG_NAURU, "NAURU"}, | 405 | ||
{SAHPI_LANG_NEPALI, "NEPALI"}, | 406 | ||
{SAHPI_LANG_DUTCH, "DUTCH"}, | 407 | ||
{SAHPI_LANG_NORWEGIAN, "NORWEGIAN"}, | 408 | ||
{SAHPI_LANG_OCCITAN, "OCCITAN"}, | 409 | ||
{SAHPI_LANG_AFANOROMO, "AFANOROMO"}, | 410 | ||
{SAHPI_LANG_ORIYA, "ORIYA"}, | 411 | ||
{SAHPI_LANG_PUNJABI, "PUNJABI"}, | 412 | ||
{SAHPI_LANG_POLISH, "POLISH"}, | 413 | ||
{SAHPI_LANG_PASHTOPUSHTO, "PASHTOPUSHTO"}, | 414 | ||
{SAHPI_LANG_PORTUGUESE, "PORTUGUESE"}, | 415 | ||
{SAHPI_LANG_QUECHUA, "QUECHUA"}, | 416 | ||
{SAHPI_LANG_RHAETOROMANCE, "RHAETOROMANCE"}, | 417 | ||
{SAHPI_LANG_KIRUNDI, "KIRUNDI"}, | 418 | ||
{SAHPI_LANG_ROMANIAN, "ROMANIAN"}, | 419 | ||
{SAHPI_LANG_RUSSIAN, "RUSSIAN"}, | 420 | ||
{SAHPI_LANG_KINYARWANDA, "KINYARWANDA"}, | 421 | ||
{SAHPI_LANG_SANSKRIT, "SANSKRIT"}, | 422 | ||
{SAHPI_LANG_SINDHI, "SINDHI"}, | 423 | ||
{SAHPI_LANG_SANGRO, "SANGRO"}, | 424 | ||
{SAHPI_LANG_SERBOCROATIAN, "SERBOCROATIAN"}, | 425 | ||
{SAHPI_LANG_SINGHALESE, "SINGHALESE"}, | 426 | ||
{SAHPI_LANG_SLOVAK, "SLOVAK"}, | 427 | ||
{SAHPI_LANG_SLOVENIAN, "SLOVENIAN"}, | 428 | ||
{SAHPI_LANG_SAMOAN, "SAMOAN"}, | 429 | ||
{SAHPI_LANG_SHONA, "SHONA"}, | 430 | ||
{SAHPI_LANG_SOMALI, "SOMALI"}, | 431 | ||
{SAHPI_LANG_ALBANIAN, "ALBANIAN"}, | 432 | ||
{SAHPI_LANG_SERBIAN, "SERBIAN"}, | 433 | ||
{SAHPI_LANG_SISWATI, "SISWATI"}, | 434 | ||
{SAHPI_LANG_SESOTHO, "SESOTHO"}, | 435 | ||
{SAHPI_LANG_SUDANESE, "SUDANESE"}, | 436 | ||
{SAHPI_LANG_SWEDISH, "SWEDISH"}, | 437 | ||
{SAHPI_LANG_SWAHILI, "SWAHILI"}, | 438 | ||
{SAHPI_LANG_TAMIL, "TAMIL"}, | 439 | ||
{SAHPI_LANG_TELUGU, "TELUGU"}, | 440 | ||
{SAHPI_LANG_TAJIK, "TAJIK"}, | 441 | ||
{SAHPI_LANG_THAI, "THAI"}, | 442 | ||
{SAHPI_LANG_TIGRINYA, "TIGRINYA"}, | 443 | ||
{SAHPI_LANG_TURKMEN, "TURKMEN"}, | 444 | ||
{SAHPI_LANG_TAGALOG, "TAGALOG"}, | 445 | ||
{SAHPI_LANG_SETSWANA, "SETSWANA"}, | 446 | ||
{SAHPI_LANG_TONGA, "TONGA"}, | 447 | ||
{SAHPI_LANG_TURKISH, "TURKISH"}, | 448 | ||
{SAHPI_LANG_TSONGA, "TSONGA"}, | 449 | ||
{SAHPI_LANG_TATAR, "TATAR"}, | 450 | ||
{SAHPI_LANG_TWI, "TWI"}, | 451 | ||
{SAHPI_LANG_UKRAINIAN, "UKRAINIAN"}, | 452 | ||
{SAHPI_LANG_URDU, "URDU"}, | 453 | ||
{SAHPI_LANG_UZBEK, "UZBEK"}, | 454 | ||
{SAHPI_LANG_VIETNAMESE, "VIETNAMESE"}, | 455 | ||
{SAHPI_LANG_VOLAPUK, "VOLAPUK"}, | 456 | ||
{SAHPI_LANG_WOLOF, "WOLOF"}, | 457 | ||
{SAHPI_LANG_XHOSA, "XHOSA"}, | 458 | ||
{SAHPI_LANG_YORUBA, "YORUBA"}, | 459 | ||
{SAHPI_LANG_CHINESE, "CHINESE"}, | 460 | ||
{SAHPI_LANG_ZULU, "ZULU"}, | 461 | ||
}; | 462 | ||
463 | |||
/** | 464 | ||
* oh_encode_language: | 465 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 466 | ||
* @type: Location (of SaHpiLanguageT) to place encoded result. | 467 | ||
* | 468 | ||
* Converts a @buffer->Data string, generated by oh_lookup_language(), back | 469 | ||
* into an SaHpiLanguageT type. | 470 | ||
* | 471 | ||
* Returns: | 472 | ||
* SaHpiLanguageT value - normal operation. | 473 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 474 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 475 | ||
**/ | 476 | ||
SaErrorT oh_encode_language(SaHpiTextBufferT *buffer, SaHpiLanguageT *type) | 477 | ||
0 | { | 478 | |
0 | int i, found; | 479 | |
480 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 481 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 482 | |
} | 483 | ||
484 | |||
0 | found = 0; | 485 | |
0 | for (i=0; i<OH_MAX_LANGUAGE; i++) { | 486 | |
0 | if (strcasecmp(buffer->Data, language_strings[i].str) == 0) { | 487 | |
0 | found++; | 488 | |
0 | break; | 489 | |
} | 490 | ||
} | 491 | ||
492 | |||
0 | if (found) { | 493 | |
0 | *type = language_strings[i].entity_type; | 494 | |
} | 495 | ||
else { | 496 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 497 | |
} | 498 | ||
499 | |||
0 | return(SA_OK); | 500 | |
} | 501 | ||
502 | |||
/** | 503 | ||
* oh_lookup_texttype: | 504 | ||
* @value: enum value of type SaHpiTextTypeT. | 505 | ||
* | 506 | ||
* Converts @value into a string based on @value's HPI enum definition. | 507 | ||
* | 508 | ||
* Returns: | 509 | ||
* string - normal operation. | 510 | ||
* NULL - if @value not a valid SaHpiTextTypeT. | 511 | ||
**/ | 512 | ||
const char * oh_lookup_texttype(SaHpiTextTypeT value) | 513 | ||
18 | { | 514 | |
18 | switch (value) { | 515 | |
case SAHPI_TL_TYPE_UNICODE: | 516 | ||
0 | return "UNICODE"; | 517 | |
case SAHPI_TL_TYPE_BCDPLUS: | 518 | ||
0 | return "BCDPLUS"; | 519 | |
case SAHPI_TL_TYPE_ASCII6: | 520 | ||
2 | return "ASCII6"; | 521 | |
case SAHPI_TL_TYPE_TEXT: | 522 | ||
13 | return "TEXT"; | 523 | |
case SAHPI_TL_TYPE_BINARY: | 524 | ||
0 | return "BINARY"; | 525 | |
default: | 526 | ||
3 | return NULL; | 527 | |
} | 528 | ||
} | 529 | ||
530 | |||
struct oh_texttype_map texttype_strings[] = { | 531 | ||
{SAHPI_TL_TYPE_UNICODE, "UNICODE"}, | 532 | ||
{SAHPI_TL_TYPE_BCDPLUS, "BCDPLUS"}, | 533 | ||
{SAHPI_TL_TYPE_ASCII6, "ASCII6"}, | 534 | ||
{SAHPI_TL_TYPE_TEXT, "TEXT"}, | 535 | ||
{SAHPI_TL_TYPE_BINARY, "BINARY"}, | 536 | ||
}; | 537 | ||
538 | |||
/** | 539 | ||
* oh_encode_texttype: | 540 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 541 | ||
* @type: Location (of SaHpiTextTypeT) to place encoded result. | 542 | ||
* | 543 | ||
* Converts a @buffer->Data string, generated by oh_lookup_texttype(), back | 544 | ||
* into an SaHpiTextTypeT type. | 545 | ||
* | 546 | ||
* Returns: | 547 | ||
* SaHpiTextTypeT value - normal operation. | 548 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 549 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 550 | ||
**/ | 551 | ||
SaErrorT oh_encode_texttype(SaHpiTextBufferT *buffer, SaHpiTextTypeT *type) | 552 | ||
0 | { | 553 | |
0 | int i, found; | 554 | |
555 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 556 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 557 | |
} | 558 | ||
559 | |||
0 | found = 0; | 560 | |
0 | for (i=0; i<OH_MAX_TEXTTYPE; i++) { | 561 | |
0 | if (strcasecmp(buffer->Data, texttype_strings[i].str) == 0) { | 562 | |
0 | found++; | 563 | |
0 | break; | 564 | |
} | 565 | ||
} | 566 | ||
567 | |||
0 | if (found) { | 568 | |
0 | *type = texttype_strings[i].entity_type; | 569 | |
} | 570 | ||
else { | 571 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 572 | |
} | 573 | ||
574 | |||
0 | return(SA_OK); | 575 | |
} | 576 | ||
577 | |||
/** | 578 | ||
* oh_lookup_entitytype: | 579 | ||
* @value: enum value of type SaHpiEntityTypeT. | 580 | ||
* | 581 | ||
* Converts @value into a string based on @value's HPI enum definition. | 582 | ||
* | 583 | ||
* Returns: | 584 | ||
* string - normal operation. | 585 | ||
* NULL - if @value not a valid SaHpiEntityTypeT. | 586 | ||
**/ | 587 | ||
const char * oh_lookup_entitytype(SaHpiEntityTypeT value) | 588 | ||
0 | { | 589 | |
0 | switch (value) { | 590 | |
case SAHPI_ENT_UNSPECIFIED: | 591 | ||
0 | return "UNSPECIFIED"; | 592 | |
case SAHPI_ENT_OTHER: | 593 | ||
0 | return "OTHER"; | 594 | |
case SAHPI_ENT_UNKNOWN: | 595 | ||
0 | return "UNKNOWN"; | 596 | |
case SAHPI_ENT_PROCESSOR: | 597 | ||
0 | return "PROCESSOR"; | 598 | |
case SAHPI_ENT_DISK_BAY: | 599 | ||
0 | return "DISK_BAY"; | 600 | |
case SAHPI_ENT_PERIPHERAL_BAY: | 601 | ||
0 | return "PERIPHERAL_BAY"; | 602 | |
case SAHPI_ENT_SYS_MGMNT_MODULE: | 603 | ||
0 | return "SYS_MGMNT_MODULE"; | 604 | |
case SAHPI_ENT_SYSTEM_BOARD: | 605 | ||
0 | return "SYSTEM_BOARD"; | 606 | |
case SAHPI_ENT_MEMORY_MODULE: | 607 | ||
0 | return "MEMORY_MODULE"; | 608 | |
case SAHPI_ENT_PROCESSOR_MODULE: | 609 | ||
0 | return "PROCESSOR_MODULE"; | 610 | |
case SAHPI_ENT_POWER_SUPPLY: | 611 | ||
0 | return "POWER_SUPPLY"; | 612 | |
case SAHPI_ENT_ADD_IN_CARD: | 613 | ||
0 | return "ADD_IN_CARD"; | 614 | |
case SAHPI_ENT_FRONT_PANEL_BOARD: | 615 | ||
0 | return "FRONT_PANEL_BOARD"; | 616 | |
case SAHPI_ENT_BACK_PANEL_BOARD: | 617 | ||
0 | return "BACK_PANEL_BOARD"; | 618 | |
case SAHPI_ENT_POWER_SYSTEM_BOARD: | 619 | ||
0 | return "POWER_SYSTEM_BOARD"; | 620 | |
case SAHPI_ENT_DRIVE_BACKPLANE: | 621 | ||
0 | return "DRIVE_BACKPLANE"; | 622 | |
case SAHPI_ENT_SYS_EXPANSION_BOARD: | 623 | ||
0 | return "SYS_EXPANSION_BOARD"; | 624 | |
case SAHPI_ENT_OTHER_SYSTEM_BOARD: | 625 | ||
0 | return "OTHER_SYSTEM_BOARD"; | 626 | |
case SAHPI_ENT_PROCESSOR_BOARD: | 627 | ||
0 | return "PROCESSOR_BOARD"; | 628 | |
case SAHPI_ENT_POWER_UNIT: | 629 | ||
0 | return "POWER_UNIT"; | 630 | |
case SAHPI_ENT_POWER_MODULE: | 631 | ||
0 | return "POWER_MODULE"; | 632 | |
case SAHPI_ENT_POWER_MGMNT: | 633 | ||
0 | return "POWER_MGMNT"; | 634 | |
case SAHPI_ENT_CHASSIS_BACK_PANEL_BOARD: | 635 | ||
0 | return "CHASSIS_BACK_PANEL_BOARD"; | 636 | |
case SAHPI_ENT_SYSTEM_CHASSIS: | 637 | ||
0 | return "SYSTEM_CHASSIS"; | 638 | |
case SAHPI_ENT_SUB_CHASSIS: | 639 | ||
0 | return "SUB_CHASSIS"; | 640 | |
case SAHPI_ENT_OTHER_CHASSIS_BOARD: | 641 | ||
0 | return "OTHER_CHASSIS_BOARD"; | 642 | |
case SAHPI_ENT_DISK_DRIVE_BAY: | 643 | ||
0 | return "DISK_DRIVE_BAY"; | 644 | |
case SAHPI_ENT_PERIPHERAL_BAY_2: | 645 | ||
0 | return "PERIPHERAL_BAY_2"; | 646 | |
case SAHPI_ENT_DEVICE_BAY: | 647 | ||
0 | return "DEVICE_BAY"; | 648 | |
case SAHPI_ENT_COOLING_DEVICE: | 649 | ||
0 | return "COOLING_DEVICE"; | 650 | |
case SAHPI_ENT_COOLING_UNIT: | 651 | ||
0 | return "COOLING_UNIT"; | 652 | |
case SAHPI_ENT_INTERCONNECT: | 653 | ||
0 | return "INTERCONNECT"; | 654 | |
case SAHPI_ENT_MEMORY_DEVICE: | 655 | ||
0 | return "MEMORY_DEVICE"; | 656 | |
case SAHPI_ENT_SYS_MGMNT_SOFTWARE: | 657 | ||
0 | return "SYS_MGMNT_SOFTWARE"; | 658 | |
case SAHPI_ENT_BIOS: | 659 | ||
0 | return "BIOS"; | 660 | |
case SAHPI_ENT_OPERATING_SYSTEM: | 661 | ||
0 | return "OPERATING_SYSTEM"; | 662 | |
case SAHPI_ENT_SYSTEM_BUS: | 663 | ||
0 | return "SYSTEM_BUS"; | 664 | |
case SAHPI_ENT_GROUP: | 665 | ||
0 | return "GROUP"; | 666 | |
case SAHPI_ENT_REMOTE: | 667 | ||
0 | return "REMOTE"; | 668 | |
case SAHPI_ENT_EXTERNAL_ENVIRONMENT: | 669 | ||
0 | return "EXTERNAL_ENVIRONMENT"; | 670 | |
case SAHPI_ENT_BATTERY: | 671 | ||
0 | return "BATTERY"; | 672 | |
case SAHPI_ENT_CHASSIS_SPECIFIC: | 673 | ||
0 | return "CHASSIS_SPECIFIC"; | 674 | |
case SAHPI_ENT_BOARD_SET_SPECIFIC: | 675 | ||
0 | return "BOARD_SET_SPECIFIC"; | 676 | |
case SAHPI_ENT_OEM_SYSINT_SPECIFIC: | 677 | ||
0 | return "OEM_SYSINT_SPECIFIC"; | 678 | |
case SAHPI_ENT_ROOT: | 679 | ||
0 | return "ROOT"; | 680 | |
case SAHPI_ENT_RACK: | 681 | ||
0 | return "RACK"; | 682 | |
case SAHPI_ENT_SUBRACK: | 683 | ||
0 | return "SUBRACK"; | 684 | |
case SAHPI_ENT_COMPACTPCI_CHASSIS: | 685 | ||
0 | return "COMPACTPCI_CHASSIS"; | 686 | |
case SAHPI_ENT_ADVANCEDTCA_CHASSIS: | 687 | ||
0 | return "ADVANCEDTCA_CHASSIS"; | 688 | |
case SAHPI_ENT_RACK_MOUNTED_SERVER: | 689 | ||
0 | return "RACK_MOUNTED_SERVER"; | 690 | |
case SAHPI_ENT_SYSTEM_BLADE: | 691 | ||
0 | return "SYSTEM_BLADE"; | 692 | |
case SAHPI_ENT_SWITCH: | 693 | ||
0 | return "SWITCH"; | 694 | |
case SAHPI_ENT_SWITCH_BLADE: | 695 | ||
0 | return "SWITCH_BLADE"; | 696 | |
case SAHPI_ENT_SBC_BLADE: | 697 | ||
0 | return "SBC_BLADE"; | 698 | |
case SAHPI_ENT_IO_BLADE: | 699 | ||
0 | return "IO_BLADE"; | 700 | |
case SAHPI_ENT_DISK_BLADE: | 701 | ||
0 | return "DISK_BLADE"; | 702 | |
case SAHPI_ENT_DISK_DRIVE: | 703 | ||
0 | return "DISK_DRIVE"; | 704 | |
case SAHPI_ENT_FAN: | 705 | ||
0 | return "FAN"; | 706 | |
case SAHPI_ENT_POWER_DISTRIBUTION_UNIT: | 707 | ||
0 | return "POWER_DISTRIBUTION_UNIT"; | 708 | |
case SAHPI_ENT_SPEC_PROC_BLADE: | 709 | ||
0 | return "SPEC_PROC_BLADE"; | 710 | |
case SAHPI_ENT_IO_SUBBOARD: | 711 | ||
0 | return "IO_SUBBOARD"; | 712 | |
case SAHPI_ENT_SBC_SUBBOARD: | 713 | ||
0 | return "SBC_SUBBOARD"; | 714 | |
case SAHPI_ENT_ALARM_MANAGER: | 715 | ||
0 | return "ALARM_MANAGER"; | 716 | |
case SAHPI_ENT_SHELF_MANAGER: | 717 | ||
0 | return "SHELF_MANAGER"; | 718 | |
case SAHPI_ENT_DISPLAY_PANEL: | 719 | ||
0 | return "DISPLAY_PANEL"; | 720 | |
case SAHPI_ENT_SUBBOARD_CARRIER_BLADE: | 721 | ||
0 | return "SUBBOARD_CARRIER_BLADE"; | 722 | |
case SAHPI_ENT_PHYSICAL_SLOT: | 723 | ||
0 | return "PHYSICAL_SLOT"; | 724 | |
default: | 725 | ||
0 | return NULL; | 726 | |
} | 727 | ||
} | 728 | ||
729 | |||
struct oh_entitytype_map entitytype_strings[] = { | 730 | ||
{SAHPI_ENT_UNSPECIFIED, "UNSPECIFIED"}, | 731 | ||
{SAHPI_ENT_OTHER, "OTHER"}, | 732 | ||
{SAHPI_ENT_UNKNOWN, "UNKNOWN"}, | 733 | ||
{SAHPI_ENT_PROCESSOR, "PROCESSOR"}, | 734 | ||
{SAHPI_ENT_DISK_BAY, "DISK_BAY"}, | 735 | ||
{SAHPI_ENT_PERIPHERAL_BAY, "PERIPHERAL_BAY"}, | 736 | ||
{SAHPI_ENT_SYS_MGMNT_MODULE, "SYS_MGMNT_MODULE"}, | 737 | ||
{SAHPI_ENT_SYSTEM_BOARD, "SYSTEM_BOARD"}, | 738 | ||
{SAHPI_ENT_MEMORY_MODULE, "MEMORY_MODULE"}, | 739 | ||
{SAHPI_ENT_PROCESSOR_MODULE, "PROCESSOR_MODULE"}, | 740 | ||
{SAHPI_ENT_POWER_SUPPLY, "POWER_SUPPLY"}, | 741 | ||
{SAHPI_ENT_ADD_IN_CARD, "ADD_IN_CARD"}, | 742 | ||
{SAHPI_ENT_FRONT_PANEL_BOARD, "FRONT_PANEL_BOARD"}, | 743 | ||
{SAHPI_ENT_BACK_PANEL_BOARD, "BACK_PANEL_BOARD"}, | 744 | ||
{SAHPI_ENT_POWER_SYSTEM_BOARD, "POWER_SYSTEM_BOARD"}, | 745 | ||
{SAHPI_ENT_DRIVE_BACKPLANE, "DRIVE_BACKPLANE"}, | 746 | ||
{SAHPI_ENT_SYS_EXPANSION_BOARD, "SYS_EXPANSION_BOARD"}, | 747 | ||
{SAHPI_ENT_OTHER_SYSTEM_BOARD, "OTHER_SYSTEM_BOARD"}, | 748 | ||
{SAHPI_ENT_PROCESSOR_BOARD, "PROCESSOR_BOARD"}, | 749 | ||
{SAHPI_ENT_POWER_UNIT, "POWER_UNIT"}, | 750 | ||
{SAHPI_ENT_POWER_MODULE, "POWER_MODULE"}, | 751 | ||
{SAHPI_ENT_POWER_MGMNT, "POWER_MGMNT"}, | 752 | ||
{SAHPI_ENT_CHASSIS_BACK_PANEL_BOARD, "CHASSIS_BACK_PANEL_BOARD"}, | 753 | ||
{SAHPI_ENT_SYSTEM_CHASSIS, "SYSTEM_CHASSIS"}, | 754 | ||
{SAHPI_ENT_SUB_CHASSIS, "SUB_CHASSIS"}, | 755 | ||
{SAHPI_ENT_OTHER_CHASSIS_BOARD, "OTHER_CHASSIS_BOARD"}, | 756 | ||
{SAHPI_ENT_DISK_DRIVE_BAY, "DISK_DRIVE_BAY"}, | 757 | ||
{SAHPI_ENT_PERIPHERAL_BAY_2, "PERIPHERAL_BAY_2"}, | 758 | ||
{SAHPI_ENT_DEVICE_BAY, "DEVICE_BAY"}, | 759 | ||
{SAHPI_ENT_COOLING_DEVICE, "COOLING_DEVICE"}, | 760 | ||
{SAHPI_ENT_COOLING_UNIT, "COOLING_UNIT"}, | 761 | ||
{SAHPI_ENT_INTERCONNECT, "INTERCONNECT"}, | 762 | ||
{SAHPI_ENT_MEMORY_DEVICE, "MEMORY_DEVICE"}, | 763 | ||
{SAHPI_ENT_SYS_MGMNT_SOFTWARE, "SYS_MGMNT_SOFTWARE"}, | 764 | ||
{SAHPI_ENT_BIOS, "BIOS"}, | 765 | ||
{SAHPI_ENT_OPERATING_SYSTEM, "OPERATING_SYSTEM"}, | 766 | ||
{SAHPI_ENT_SYSTEM_BUS, "SYSTEM_BUS"}, | 767 | ||
{SAHPI_ENT_GROUP, "GROUP"}, | 768 | ||
{SAHPI_ENT_REMOTE, "REMOTE"}, | 769 | ||
{SAHPI_ENT_EXTERNAL_ENVIRONMENT, "EXTERNAL_ENVIRONMENT"}, | 770 | ||
{SAHPI_ENT_BATTERY, "BATTERY"}, | 771 | ||
{SAHPI_ENT_CHASSIS_SPECIFIC, "CHASSIS_SPECIFIC"}, | 772 | ||
{SAHPI_ENT_BOARD_SET_SPECIFIC, "BOARD_SET_SPECIFIC"}, | 773 | ||
{SAHPI_ENT_OEM_SYSINT_SPECIFIC, "OEM_SYSINT_SPECIFIC"}, | 774 | ||
{SAHPI_ENT_ROOT, "ROOT"}, | 775 | ||
{SAHPI_ENT_RACK, "RACK"}, | 776 | ||
{SAHPI_ENT_SUBRACK, "SUBRACK"}, | 777 | ||
{SAHPI_ENT_COMPACTPCI_CHASSIS, "COMPACTPCI_CHASSIS"}, | 778 | ||
{SAHPI_ENT_ADVANCEDTCA_CHASSIS, "ADVANCEDTCA_CHASSIS"}, | 779 | ||
{SAHPI_ENT_RACK_MOUNTED_SERVER, "RACK_MOUNTED_SERVER"}, | 780 | ||
{SAHPI_ENT_SYSTEM_BLADE, "SYSTEM_BLADE"}, | 781 | ||
{SAHPI_ENT_SWITCH, "SWITCH"}, | 782 | ||
{SAHPI_ENT_SWITCH_BLADE, "SWITCH_BLADE"}, | 783 | ||
{SAHPI_ENT_SBC_BLADE, "SBC_BLADE"}, | 784 | ||
{SAHPI_ENT_IO_BLADE, "IO_BLADE"}, | 785 | ||
{SAHPI_ENT_DISK_BLADE, "DISK_BLADE"}, | 786 | ||
{SAHPI_ENT_DISK_DRIVE, "DISK_DRIVE"}, | 787 | ||
{SAHPI_ENT_FAN, "FAN"}, | 788 | ||
{SAHPI_ENT_POWER_DISTRIBUTION_UNIT, "POWER_DISTRIBUTION_UNIT"}, | 789 | ||
{SAHPI_ENT_SPEC_PROC_BLADE, "SPEC_PROC_BLADE"}, | 790 | ||
{SAHPI_ENT_IO_SUBBOARD, "IO_SUBBOARD"}, | 791 | ||
{SAHPI_ENT_SBC_SUBBOARD, "SBC_SUBBOARD"}, | 792 | ||
{SAHPI_ENT_ALARM_MANAGER, "ALARM_MANAGER"}, | 793 | ||
{SAHPI_ENT_SHELF_MANAGER, "SHELF_MANAGER"}, | 794 | ||
{SAHPI_ENT_DISPLAY_PANEL, "DISPLAY_PANEL"}, | 795 | ||
{SAHPI_ENT_SUBBOARD_CARRIER_BLADE, "SUBBOARD_CARRIER_BLADE"}, | 796 | ||
{SAHPI_ENT_PHYSICAL_SLOT, "PHYSICAL_SLOT"}, | 797 | ||
}; | 798 | ||
799 | |||
/** | 800 | ||
* oh_encode_entitytype: | 801 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 802 | ||
* @type: Location (of SaHpiEntityTypeT) to place encoded result. | 803 | ||
* | 804 | ||
* Converts a @buffer->Data string, generated by oh_lookup_entitytype(), back | 805 | ||
* into an SaHpiEntityTypeT type. | 806 | ||
* | 807 | ||
* Returns: | 808 | ||
* SaHpiEntityTypeT value - normal operation. | 809 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 810 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 811 | ||
**/ | 812 | ||
SaErrorT oh_encode_entitytype(SaHpiTextBufferT *buffer, SaHpiEntityTypeT *type) | 813 | ||
0 | { | 814 | |
0 | int i, found; | 815 | |
816 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 817 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 818 | |
} | 819 | ||
820 | |||
0 | found = 0; | 821 | |
0 | for (i=0; i<OH_MAX_ENTITYTYPE; i++) { | 822 | |
0 | if (strcasecmp(buffer->Data, entitytype_strings[i].str) == 0) { | 823 | |
0 | found++; | 824 | |
0 | break; | 825 | |
} | 826 | ||
} | 827 | ||
828 | |||
0 | if (found) { | 829 | |
0 | *type = entitytype_strings[i].entity_type; | 830 | |
} | 831 | ||
else { | 832 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 833 | |
} | 834 | ||
835 | |||
0 | return(SA_OK); | 836 | |
} | 837 | ||
838 | |||
/** | 839 | ||
* oh_lookup_sensortype: | 840 | ||
* @value: enum value of type SaHpiSensorTypeT. | 841 | ||
* | 842 | ||
* Converts @value into a string based on @value's HPI enum definition. | 843 | ||
* | 844 | ||
* Returns: | 845 | ||
* string - normal operation. | 846 | ||
* NULL - if @value not a valid SaHpiSensorTypeT. | 847 | ||
**/ | 848 | ||
const char * oh_lookup_sensortype(SaHpiSensorTypeT value) | 849 | ||
0 | { | 850 | |
0 | switch (value) { | 851 | |
case SAHPI_TEMPERATURE: | 852 | ||
0 | return "TEMPERATURE"; | 853 | |
case SAHPI_VOLTAGE: | 854 | ||
0 | return "VOLTAGE"; | 855 | |
case SAHPI_CURRENT: | 856 | ||
0 | return "CURRENT"; | 857 | |
case SAHPI_FAN: | 858 | ||
0 | return "FAN"; | 859 | |
case SAHPI_PHYSICAL_SECURITY: | 860 | ||
0 | return "PHYSICAL_SECURITY"; | 861 | |
case SAHPI_PLATFORM_VIOLATION: | 862 | ||
0 | return "PLATFORM_VIOLATION"; | 863 | |
case SAHPI_PROCESSOR: | 864 | ||
0 | return "PROCESSOR"; | 865 | |
case SAHPI_POWER_SUPPLY: | 866 | ||
0 | return "POWER_SUPPLY"; | 867 | |
case SAHPI_POWER_UNIT: | 868 | ||
0 | return "POWER_UNIT"; | 869 | |
case SAHPI_COOLING_DEVICE: | 870 | ||
0 | return "COOLING_DEVICE"; | 871 | |
case SAHPI_OTHER_UNITS_BASED_SENSOR: | 872 | ||
0 | return "OTHER_UNITS_BASED_SENSOR"; | 873 | |
case SAHPI_MEMORY: | 874 | ||
0 | return "MEMORY"; | 875 | |
case SAHPI_DRIVE_SLOT: | 876 | ||
0 | return "DRIVE_SLOT"; | 877 | |
case SAHPI_POST_MEMORY_RESIZE: | 878 | ||
0 | return "POST_MEMORY_RESIZE"; | 879 | |
case SAHPI_SYSTEM_FW_PROGRESS: | 880 | ||
0 | return "SYSTEM_FW_PROGRESS"; | 881 | |
case SAHPI_EVENT_LOGGING_DISABLED: | 882 | ||
0 | return "EVENT_LOGGING_DISABLED"; | 883 | |
case SAHPI_RESERVED1: | 884 | ||
0 | return "RESERVED1"; | 885 | |
case SAHPI_SYSTEM_EVENT: | 886 | ||
0 | return "SYSTEM_EVENT"; | 887 | |
case SAHPI_CRITICAL_INTERRUPT: | 888 | ||
0 | return "CRITICAL_INTERRUPT"; | 889 | |
case SAHPI_BUTTON: | 890 | ||
0 | return "BUTTON"; | 891 | |
case SAHPI_MODULE_BOARD: | 892 | ||
0 | return "MODULE_BOARD"; | 893 | |
case SAHPI_MICROCONTROLLER_COPROCESSOR: | 894 | ||
0 | return "MICROCONTROLLER_COPROCESSOR"; | 895 | |
case SAHPI_ADDIN_CARD: | 896 | ||
0 | return "ADDIN_CARD"; | 897 | |
case SAHPI_CHASSIS: | 898 | ||
0 | return "CHASSIS"; | 899 | |
case SAHPI_CHIP_SET: | 900 | ||
0 | return "CHIP_SET"; | 901 | |
case SAHPI_OTHER_FRU: | 902 | ||
0 | return "OTHER_FRU"; | 903 | |
case SAHPI_CABLE_INTERCONNECT: | 904 | ||
0 | return "CABLE_INTERCONNECT"; | 905 | |
case SAHPI_TERMINATOR: | 906 | ||
0 | return "TERMINATOR"; | 907 | |
case SAHPI_SYSTEM_BOOT_INITIATED: | 908 | ||
0 | return "SYSTEM_BOOT_INITIATED"; | 909 | |
case SAHPI_BOOT_ERROR: | 910 | ||
0 | return "BOOT_ERROR"; | 911 | |
case SAHPI_OS_BOOT: | 912 | ||
0 | return "OS_BOOT"; | 913 | |
case SAHPI_OS_CRITICAL_STOP: | 914 | ||
0 | return "OS_CRITICAL_STOP"; | 915 | |
case SAHPI_SLOT_CONNECTOR: | 916 | ||
0 | return "SLOT_CONNECTOR"; | 917 | |
case SAHPI_SYSTEM_ACPI_POWER_STATE: | 918 | ||
0 | return "SYSTEM_ACPI_POWER_STATE"; | 919 | |
case SAHPI_RESERVED2: | 920 | ||
0 | return "RESERVED2"; | 921 | |
case SAHPI_PLATFORM_ALERT: | 922 | ||
0 | return "PLATFORM_ALERT"; | 923 | |
case SAHPI_ENTITY_PRESENCE: | 924 | ||
0 | return "ENTITY_PRESENCE"; | 925 | |
case SAHPI_MONITOR_ASIC_IC: | 926 | ||
0 | return "MONITOR_ASIC_IC"; | 927 | |
case SAHPI_LAN: | 928 | ||
0 | return "LAN"; | 929 | |
case SAHPI_MANAGEMENT_SUBSYSTEM_HEALTH: | 930 | ||
0 | return "MANAGEMENT_SUBSYSTEM_HEALTH"; | 931 | |
case SAHPI_BATTERY: | 932 | ||
0 | return "BATTERY"; | 933 | |
case SAHPI_OPERATIONAL: | 934 | ||
0 | return "OPERATIONAL"; | 935 | |
case SAHPI_OEM_SENSOR: | 936 | ||
0 | return "OEM_SENSOR"; | 937 | |
default: | 938 | ||
0 | return NULL; | 939 | |
} | 940 | ||
} | 941 | ||
942 | |||
struct oh_sensortype_map sensortype_strings[] = { | 943 | ||
{SAHPI_TEMPERATURE, "TEMPERATURE"}, | 944 | ||
{SAHPI_VOLTAGE, "VOLTAGE"}, | 945 | ||
{SAHPI_CURRENT, "CURRENT"}, | 946 | ||
{SAHPI_FAN, "FAN"}, | 947 | ||
{SAHPI_PHYSICAL_SECURITY, "PHYSICAL_SECURITY"}, | 948 | ||
{SAHPI_PLATFORM_VIOLATION, "PLATFORM_VIOLATION"}, | 949 | ||
{SAHPI_PROCESSOR, "PROCESSOR"}, | 950 | ||
{SAHPI_POWER_SUPPLY, "POWER_SUPPLY"}, | 951 | ||
{SAHPI_POWER_UNIT, "POWER_UNIT"}, | 952 | ||
{SAHPI_COOLING_DEVICE, "COOLING_DEVICE"}, | 953 | ||
{SAHPI_OTHER_UNITS_BASED_SENSOR, "OTHER_UNITS_BASED_SENSOR"}, | 954 | ||
{SAHPI_MEMORY, "MEMORY"}, | 955 | ||
{SAHPI_DRIVE_SLOT, "DRIVE_SLOT"}, | 956 | ||
{SAHPI_POST_MEMORY_RESIZE, "POST_MEMORY_RESIZE"}, | 957 | ||
{SAHPI_SYSTEM_FW_PROGRESS, "SYSTEM_FW_PROGRESS"}, | 958 | ||
{SAHPI_EVENT_LOGGING_DISABLED, "EVENT_LOGGING_DISABLED"}, | 959 | ||
{SAHPI_RESERVED1, "RESERVED1"}, | 960 | ||
{SAHPI_SYSTEM_EVENT, "SYSTEM_EVENT"}, | 961 | ||
{SAHPI_CRITICAL_INTERRUPT, "CRITICAL_INTERRUPT"}, | 962 | ||
{SAHPI_BUTTON, "BUTTON"}, | 963 | ||
{SAHPI_MODULE_BOARD, "MODULE_BOARD"}, | 964 | ||
{SAHPI_MICROCONTROLLER_COPROCESSOR, "MICROCONTROLLER_COPROCESSOR"}, | 965 | ||
{SAHPI_ADDIN_CARD, "ADDIN_CARD"}, | 966 | ||
{SAHPI_CHASSIS, "CHASSIS"}, | 967 | ||
{SAHPI_CHIP_SET, "CHIP_SET"}, | 968 | ||
{SAHPI_OTHER_FRU, "OTHER_FRU"}, | 969 | ||
{SAHPI_CABLE_INTERCONNECT, "CABLE_INTERCONNECT"}, | 970 | ||
{SAHPI_TERMINATOR, "TERMINATOR"}, | 971 | ||
{SAHPI_SYSTEM_BOOT_INITIATED, "SYSTEM_BOOT_INITIATED"}, | 972 | ||
{SAHPI_BOOT_ERROR, "BOOT_ERROR"}, | 973 | ||
{SAHPI_OS_BOOT, "OS_BOOT"}, | 974 | ||
{SAHPI_OS_CRITICAL_STOP, "OS_CRITICAL_STOP"}, | 975 | ||
{SAHPI_SLOT_CONNECTOR, "SLOT_CONNECTOR"}, | 976 | ||
{SAHPI_SYSTEM_ACPI_POWER_STATE, "SYSTEM_ACPI_POWER_STATE"}, | 977 | ||
{SAHPI_RESERVED2, "RESERVED2"}, | 978 | ||
{SAHPI_PLATFORM_ALERT, "PLATFORM_ALERT"}, | 979 | ||
{SAHPI_ENTITY_PRESENCE, "ENTITY_PRESENCE"}, | 980 | ||
{SAHPI_MONITOR_ASIC_IC, "MONITOR_ASIC_IC"}, | 981 | ||
{SAHPI_LAN, "LAN"}, | 982 | ||
{SAHPI_MANAGEMENT_SUBSYSTEM_HEALTH, "MANAGEMENT_SUBSYSTEM_HEALTH"}, | 983 | ||
{SAHPI_BATTERY, "BATTERY"}, | 984 | ||
{SAHPI_OPERATIONAL, "OPERATIONAL"}, | 985 | ||
{SAHPI_OEM_SENSOR, "OEM_SENSOR"}, | 986 | ||
}; | 987 | ||
988 | |||
/** | 989 | ||
* oh_encode_sensortype: | 990 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 991 | ||
* @type: Location (of SaHpiSensorTypeT) to place encoded result. | 992 | ||
* | 993 | ||
* Converts a @buffer->Data string, generated by oh_lookup_sensortype(), back | 994 | ||
* into an SaHpiSensorTypeT type. | 995 | ||
* | 996 | ||
* Returns: | 997 | ||
* SaHpiSensorTypeT value - normal operation. | 998 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 999 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1000 | ||
**/ | 1001 | ||
SaErrorT oh_encode_sensortype(SaHpiTextBufferT *buffer, SaHpiSensorTypeT *type) | 1002 | ||
0 | { | 1003 | |
0 | int i, found; | 1004 | |
1005 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1006 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1007 | |
} | 1008 | ||
1009 | |||
0 | found = 0; | 1010 | |
0 | for (i=0; i<OH_MAX_SENSORTYPE; i++) { | 1011 | |
0 | if (strcasecmp(buffer->Data, sensortype_strings[i].str) == 0) { | 1012 | |
0 | found++; | 1013 | |
0 | break; | 1014 | |
} | 1015 | ||
} | 1016 | ||
1017 | |||
0 | if (found) { | 1018 | |
0 | *type = sensortype_strings[i].entity_type; | 1019 | |
} | 1020 | ||
else { | 1021 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1022 | |
} | 1023 | ||
1024 | |||
0 | return(SA_OK); | 1025 | |
} | 1026 | ||
1027 | |||
/** | 1028 | ||
* oh_lookup_sensorreadingtype: | 1029 | ||
* @value: enum value of type SaHpiSensorReadingTypeT. | 1030 | ||
* | 1031 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1032 | ||
* | 1033 | ||
* Returns: | 1034 | ||
* string - normal operation. | 1035 | ||
* NULL - if @value not a valid SaHpiSensorReadingTypeT. | 1036 | ||
**/ | 1037 | ||
const char * oh_lookup_sensorreadingtype(SaHpiSensorReadingTypeT value) | 1038 | ||
0 | { | 1039 | |
0 | switch (value) { | 1040 | |
case SAHPI_SENSOR_READING_TYPE_INT64: | 1041 | ||
0 | return "INT64"; | 1042 | |
case SAHPI_SENSOR_READING_TYPE_UINT64: | 1043 | ||
0 | return "UINT64"; | 1044 | |
case SAHPI_SENSOR_READING_TYPE_FLOAT64: | 1045 | ||
0 | return "FLOAT64"; | 1046 | |
case SAHPI_SENSOR_READING_TYPE_BUFFER: | 1047 | ||
0 | return "BUFFER"; | 1048 | |
default: | 1049 | ||
0 | return NULL; | 1050 | |
} | 1051 | ||
} | 1052 | ||
1053 | |||
struct oh_sensorreadingtype_map sensorreadingtype_strings[] = { | 1054 | ||
{SAHPI_SENSOR_READING_TYPE_INT64, "INT64"}, | 1055 | ||
{SAHPI_SENSOR_READING_TYPE_UINT64, "UINT64"}, | 1056 | ||
{SAHPI_SENSOR_READING_TYPE_FLOAT64, "FLOAT64"}, | 1057 | ||
{SAHPI_SENSOR_READING_TYPE_BUFFER, "BUFFER"}, | 1058 | ||
}; | 1059 | ||
1060 | |||
/** | 1061 | ||
* oh_encode_sensorreadingtype: | 1062 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1063 | ||
* @type: Location (of SaHpiSensorReadingTypeT) to place encoded result. | 1064 | ||
* | 1065 | ||
* Converts a @buffer->Data string, generated by oh_lookup_sensorreadingtype(), back | 1066 | ||
* into an SaHpiSensorReadingTypeT type. | 1067 | ||
* | 1068 | ||
* Returns: | 1069 | ||
* SaHpiSensorReadingTypeT value - normal operation. | 1070 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1071 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1072 | ||
**/ | 1073 | ||
SaErrorT oh_encode_sensorreadingtype(SaHpiTextBufferT *buffer, SaHpiSensorReadingTypeT *type) | 1074 | ||
0 | { | 1075 | |
0 | int i, found; | 1076 | |
1077 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1078 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1079 | |
} | 1080 | ||
1081 | |||
0 | found = 0; | 1082 | |
0 | for (i=0; i<OH_MAX_SENSORREADINGTYPE; i++) { | 1083 | |
0 | if (strcasecmp(buffer->Data, sensorreadingtype_strings[i].str) == 0) { | 1084 | |
0 | found++; | 1085 | |
0 | break; | 1086 | |
} | 1087 | ||
} | 1088 | ||
1089 | |||
0 | if (found) { | 1090 | |
0 | *type = sensorreadingtype_strings[i].entity_type; | 1091 | |
} | 1092 | ||
else { | 1093 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1094 | |
} | 1095 | ||
1096 | |||
0 | return(SA_OK); | 1097 | |
} | 1098 | ||
1099 | |||
/** | 1100 | ||
* oh_lookup_sensoreventmaskaction: | 1101 | ||
* @value: enum value of type SaHpiSensorEventMaskActionT. | 1102 | ||
* | 1103 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1104 | ||
* | 1105 | ||
* Returns: | 1106 | ||
* string - normal operation. | 1107 | ||
* NULL - if @value not a valid SaHpiSensorEventMaskActionT. | 1108 | ||
**/ | 1109 | ||
const char * oh_lookup_sensoreventmaskaction(SaHpiSensorEventMaskActionT value) | 1110 | ||
0 | { | 1111 | |
0 | switch (value) { | 1112 | |
case SAHPI_SENS_ADD_EVENTS_TO_MASKS: | 1113 | ||
0 | return "ADD_EVENTS_TO_MASKS"; | 1114 | |
case SAHPI_SENS_REMOVE_EVENTS_FROM_MASKS: | 1115 | ||
0 | return "REMOVE_EVENTS_FROM_MASKS"; | 1116 | |
default: | 1117 | ||
0 | return NULL; | 1118 | |
} | 1119 | ||
} | 1120 | ||
1121 | |||
struct oh_sensoreventmaskaction_map sensoreventmaskaction_strings[] = { | 1122 | ||
{SAHPI_SENS_ADD_EVENTS_TO_MASKS, "ADD_EVENTS_TO_MASKS"}, | 1123 | ||
{SAHPI_SENS_REMOVE_EVENTS_FROM_MASKS, "REMOVE_EVENTS_FROM_MASKS"}, | 1124 | ||
}; | 1125 | ||
1126 | |||
/** | 1127 | ||
* oh_encode_sensoreventmaskaction: | 1128 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1129 | ||
* @type: Location (of SaHpiSensorEventMaskActionT) to place encoded result. | 1130 | ||
* | 1131 | ||
* Converts a @buffer->Data string, generated by oh_lookup_sensoreventmaskaction(), back | 1132 | ||
* into an SaHpiSensorEventMaskActionT type. | 1133 | ||
* | 1134 | ||
* Returns: | 1135 | ||
* SaHpiSensorEventMaskActionT value - normal operation. | 1136 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1137 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1138 | ||
**/ | 1139 | ||
SaErrorT oh_encode_sensoreventmaskaction(SaHpiTextBufferT *buffer, SaHpiSensorEventMaskActionT *type) | 1140 | ||
0 | { | 1141 | |
0 | int i, found; | 1142 | |
1143 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1144 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1145 | |
} | 1146 | ||
1147 | |||
0 | found = 0; | 1148 | |
0 | for (i=0; i<OH_MAX_SENSOREVENTMASKACTION; i++) { | 1149 | |
0 | if (strcasecmp(buffer->Data, sensoreventmaskaction_strings[i].str) == 0) { | 1150 | |
0 | found++; | 1151 | |
0 | break; | 1152 | |
} | 1153 | ||
} | 1154 | ||
1155 | |||
0 | if (found) { | 1156 | |
0 | *type = sensoreventmaskaction_strings[i].entity_type; | 1157 | |
} | 1158 | ||
else { | 1159 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1160 | |
} | 1161 | ||
1162 | |||
0 | return(SA_OK); | 1163 | |
} | 1164 | ||
1165 | |||
/** | 1166 | ||
* oh_lookup_sensorunits: | 1167 | ||
* @value: enum value of type SaHpiSensorUnitsT. | 1168 | ||
* | 1169 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1170 | ||
* | 1171 | ||
* Returns: | 1172 | ||
* string - normal operation. | 1173 | ||
* NULL - if @value not a valid SaHpiSensorUnitsT. | 1174 | ||
**/ | 1175 | ||
const char * oh_lookup_sensorunits(SaHpiSensorUnitsT value) | 1176 | ||
0 | { | 1177 | |
0 | switch (value) { | 1178 | |
case SAHPI_SU_UNSPECIFIED: | 1179 | ||
0 | return "Unspecified"; | 1180 | |
case SAHPI_SU_DEGREES_C: | 1181 | ||
0 | return "Degrees C"; | 1182 | |
case SAHPI_SU_DEGREES_F: | 1183 | ||
0 | return "Degrees F"; | 1184 | |
case SAHPI_SU_DEGREES_K: | 1185 | ||
0 | return "Degrees K"; | 1186 | |
case SAHPI_SU_VOLTS: | 1187 | ||
0 | return "Volts"; | 1188 | |
case SAHPI_SU_AMPS: | 1189 | ||
0 | return "Amps"; | 1190 | |
case SAHPI_SU_WATTS: | 1191 | ||
0 | return "Watts"; | 1192 | |
case SAHPI_SU_JOULES: | 1193 | ||
0 | return "Joules"; | 1194 | |
case SAHPI_SU_COULOMBS: | 1195 | ||
0 | return "Coulombs"; | 1196 | |
case SAHPI_SU_VA: | 1197 | ||
0 | return "Va"; | 1198 | |
case SAHPI_SU_NITS: | 1199 | ||
0 | return "Nits"; | 1200 | |
case SAHPI_SU_LUMEN: | 1201 | ||
0 | return "Lumen"; | 1202 | |
case SAHPI_SU_LUX: | 1203 | ||
0 | return "Lux"; | 1204 | |
case SAHPI_SU_CANDELA: | 1205 | ||
0 | return "Candela"; | 1206 | |
case SAHPI_SU_KPA: | 1207 | ||
0 | return "Kpa"; | 1208 | |
case SAHPI_SU_PSI: | 1209 | ||
0 | return "Psi"; | 1210 | |
case SAHPI_SU_NEWTON: | 1211 | ||
0 | return "Newton"; | 1212 | |
case SAHPI_SU_CFM: | 1213 | ||
0 | return "Cfm"; | 1214 | |
case SAHPI_SU_RPM: | 1215 | ||
0 | return "Rpm"; | 1216 | |
case SAHPI_SU_HZ: | 1217 | ||
0 | return "Hz"; | 1218 | |
case SAHPI_SU_MICROSECOND: | 1219 | ||
0 | return "Microsecond"; | 1220 | |
case SAHPI_SU_MILLISECOND: | 1221 | ||
0 | return "Millisecond"; | 1222 | |
case SAHPI_SU_SECOND: | 1223 | ||
0 | return "Second"; | 1224 | |
case SAHPI_SU_MINUTE: | 1225 | ||
0 | return "Minute"; | 1226 | |
case SAHPI_SU_HOUR: | 1227 | ||
0 | return "Hour"; | 1228 | |
case SAHPI_SU_DAY: | 1229 | ||
0 | return "Day"; | 1230 | |
case SAHPI_SU_WEEK: | 1231 | ||
0 | return "Week"; | 1232 | |
case SAHPI_SU_MIL: | 1233 | ||
0 | return "Mil"; | 1234 | |
case SAHPI_SU_INCHES: | 1235 | ||
0 | return "Inches"; | 1236 | |
case SAHPI_SU_FEET: | 1237 | ||
0 | return "Feet"; | 1238 | |
case SAHPI_SU_CU_IN: | 1239 | ||
0 | return "Cu In"; | 1240 | |
case SAHPI_SU_CU_FEET: | 1241 | ||
0 | return "Cu Feet"; | 1242 | |
case SAHPI_SU_MM: | 1243 | ||
0 | return "Mm"; | 1244 | |
case SAHPI_SU_CM: | 1245 | ||
0 | return "Cm"; | 1246 | |
case SAHPI_SU_M: | 1247 | ||
0 | return "M"; | 1248 | |
case SAHPI_SU_CU_CM: | 1249 | ||
0 | return "Cu Cm"; | 1250 | |
case SAHPI_SU_CU_M: | 1251 | ||
0 | return "Cu M"; | 1252 | |
case SAHPI_SU_LITERS: | 1253 | ||
0 | return "Liters"; | 1254 | |
case SAHPI_SU_FLUID_OUNCE: | 1255 | ||
0 | return "Fluid Ounce"; | 1256 | |
case SAHPI_SU_RADIANS: | 1257 | ||
0 | return "Radians"; | 1258 | |
case SAHPI_SU_STERADIANS: | 1259 | ||
0 | return "Steradians"; | 1260 | |
case SAHPI_SU_REVOLUTIONS: | 1261 | ||
0 | return "Revolutions"; | 1262 | |
case SAHPI_SU_CYCLES: | 1263 | ||
0 | return "Cycles"; | 1264 | |
case SAHPI_SU_GRAVITIES: | 1265 | ||
0 | return "Gravities"; | 1266 | |
case SAHPI_SU_OUNCE: | 1267 | ||
0 | return "Ounce"; | 1268 | |
case SAHPI_SU_POUND: | 1269 | ||
0 | return "Pound"; | 1270 | |
case SAHPI_SU_FT_LB: | 1271 | ||
0 | return "Ft Lb"; | 1272 | |
case SAHPI_SU_OZ_IN: | 1273 | ||
0 | return "Oz In"; | 1274 | |
case SAHPI_SU_GAUSS: | 1275 | ||
0 | return "Gauss"; | 1276 | |
case SAHPI_SU_GILBERTS: | 1277 | ||
0 | return "Gilberts"; | 1278 | |
case SAHPI_SU_HENRY: | 1279 | ||
0 | return "Henry"; | 1280 | |
case SAHPI_SU_MILLIHENRY: | 1281 | ||
0 | return "Millihenry"; | 1282 | |
case SAHPI_SU_FARAD: | 1283 | ||
0 | return "Farad"; | 1284 | |
case SAHPI_SU_MICROFARAD: | 1285 | ||
0 | return "Microfarad"; | 1286 | |
case SAHPI_SU_OHMS: | 1287 | ||
0 | return "Ohms"; | 1288 | |
case SAHPI_SU_SIEMENS: | 1289 | ||
0 | return "Siemens"; | 1290 | |
case SAHPI_SU_MOLE: | 1291 | ||
0 | return "Mole"; | 1292 | |
case SAHPI_SU_BECQUEREL: | 1293 | ||
0 | return "Becquerel"; | 1294 | |
case SAHPI_SU_PPM: | 1295 | ||
0 | return "Ppm"; | 1296 | |
case SAHPI_SU_RESERVED: | 1297 | ||
0 | return "Reserved"; | 1298 | |
case SAHPI_SU_DECIBELS: | 1299 | ||
0 | return "Decibels"; | 1300 | |
case SAHPI_SU_DBA: | 1301 | ||
0 | return "Dba"; | 1302 | |
case SAHPI_SU_DBC: | 1303 | ||
0 | return "Dbc"; | 1304 | |
case SAHPI_SU_GRAY: | 1305 | ||
0 | return "Gray"; | 1306 | |
case SAHPI_SU_SIEVERT: | 1307 | ||
0 | return "Sievert"; | 1308 | |
case SAHPI_SU_COLOR_TEMP_DEG_K: | 1309 | ||
0 | return "Color Temp Deg K"; | 1310 | |
case SAHPI_SU_BIT: | 1311 | ||
0 | return "Bit"; | 1312 | |
case SAHPI_SU_KILOBIT: | 1313 | ||
0 | return "Kilobit"; | 1314 | |
case SAHPI_SU_MEGABIT: | 1315 | ||
0 | return "Megabit"; | 1316 | |
case SAHPI_SU_GIGABIT: | 1317 | ||
0 | return "Gigabit"; | 1318 | |
case SAHPI_SU_BYTE: | 1319 | ||
0 | return "Byte"; | 1320 | |
case SAHPI_SU_KILOBYTE: | 1321 | ||
0 | return "Kilobyte"; | 1322 | |
case SAHPI_SU_MEGABYTE: | 1323 | ||
0 | return "Megabyte"; | 1324 | |
case SAHPI_SU_GIGABYTE: | 1325 | ||
0 | return "Gigabyte"; | 1326 | |
case SAHPI_SU_WORD: | 1327 | ||
0 | return "Word"; | 1328 | |
case SAHPI_SU_DWORD: | 1329 | ||
0 | return "Dword"; | 1330 | |
case SAHPI_SU_QWORD: | 1331 | ||
0 | return "Qword"; | 1332 | |
case SAHPI_SU_LINE: | 1333 | ||
0 | return "Line"; | 1334 | |
case SAHPI_SU_HIT: | 1335 | ||
0 | return "Hit"; | 1336 | |
case SAHPI_SU_MISS: | 1337 | ||
0 | return "Miss"; | 1338 | |
case SAHPI_SU_RETRY: | 1339 | ||
0 | return "Retry"; | 1340 | |
case SAHPI_SU_RESET: | 1341 | ||
0 | return "Reset"; | 1342 | |
case SAHPI_SU_OVERRUN: | 1343 | ||
0 | return "Overrun"; | 1344 | |
case SAHPI_SU_UNDERRUN: | 1345 | ||
0 | return "Underrun"; | 1346 | |
case SAHPI_SU_COLLISION: | 1347 | ||
0 | return "Collision"; | 1348 | |
case SAHPI_SU_PACKETS: | 1349 | ||
0 | return "Packets"; | 1350 | |
case SAHPI_SU_MESSAGES: | 1351 | ||
0 | return "Messages"; | 1352 | |
case SAHPI_SU_CHARACTERS: | 1353 | ||
0 | return "Characters"; | 1354 | |
case SAHPI_SU_ERRORS: | 1355 | ||
0 | return "Errors"; | 1356 | |
case SAHPI_SU_CORRECTABLE_ERRORS: | 1357 | ||
0 | return "Correctable Errors"; | 1358 | |
case SAHPI_SU_UNCORRECTABLE_ERRORS: | 1359 | ||
0 | return "Uncorrectable Errors"; | 1360 | |
default: | 1361 | ||
0 | return NULL; | 1362 | |
} | 1363 | ||
} | 1364 | ||
1365 | |||
struct oh_sensorunits_map sensorunits_strings[] = { | 1366 | ||
{SAHPI_SU_UNSPECIFIED, "Unspecified"}, | 1367 | ||
{SAHPI_SU_DEGREES_C, "Degrees C"}, | 1368 | ||
{SAHPI_SU_DEGREES_F, "Degrees F"}, | 1369 | ||
{SAHPI_SU_DEGREES_K, "Degrees K"}, | 1370 | ||
{SAHPI_SU_VOLTS, "Volts"}, | 1371 | ||
{SAHPI_SU_AMPS, "Amps"}, | 1372 | ||
{SAHPI_SU_WATTS, "Watts"}, | 1373 | ||
{SAHPI_SU_JOULES, "Joules"}, | 1374 | ||
{SAHPI_SU_COULOMBS, "Coulombs"}, | 1375 | ||
{SAHPI_SU_VA, "Va"}, | 1376 | ||
{SAHPI_SU_NITS, "Nits"}, | 1377 | ||
{SAHPI_SU_LUMEN, "Lumen"}, | 1378 | ||
{SAHPI_SU_LUX, "Lux"}, | 1379 | ||
{SAHPI_SU_CANDELA, "Candela"}, | 1380 | ||
{SAHPI_SU_KPA, "Kpa"}, | 1381 | ||
{SAHPI_SU_PSI, "Psi"}, | 1382 | ||
{SAHPI_SU_NEWTON, "Newton"}, | 1383 | ||
{SAHPI_SU_CFM, "Cfm"}, | 1384 | ||
{SAHPI_SU_RPM, "Rpm"}, | 1385 | ||
{SAHPI_SU_HZ, "Hz"}, | 1386 | ||
{SAHPI_SU_MICROSECOND, "Microsecond"}, | 1387 | ||
{SAHPI_SU_MILLISECOND, "Millisecond"}, | 1388 | ||
{SAHPI_SU_SECOND, "Second"}, | 1389 | ||
{SAHPI_SU_MINUTE, "Minute"}, | 1390 | ||
{SAHPI_SU_HOUR, "Hour"}, | 1391 | ||
{SAHPI_SU_DAY, "Day"}, | 1392 | ||
{SAHPI_SU_WEEK, "Week"}, | 1393 | ||
{SAHPI_SU_MIL, "Mil"}, | 1394 | ||
{SAHPI_SU_INCHES, "Inches"}, | 1395 | ||
{SAHPI_SU_FEET, "Feet"}, | 1396 | ||
{SAHPI_SU_CU_IN, "Cu In"}, | 1397 | ||
{SAHPI_SU_CU_FEET, "Cu Feet"}, | 1398 | ||
{SAHPI_SU_MM, "Mm"}, | 1399 | ||
{SAHPI_SU_CM, "Cm"}, | 1400 | ||
{SAHPI_SU_M, "M"}, | 1401 | ||
{SAHPI_SU_CU_CM, "Cu Cm"}, | 1402 | ||
{SAHPI_SU_CU_M, "Cu M"}, | 1403 | ||
{SAHPI_SU_LITERS, "Liters"}, | 1404 | ||
{SAHPI_SU_FLUID_OUNCE, "Fluid Ounce"}, | 1405 | ||
{SAHPI_SU_RADIANS, "Radians"}, | 1406 | ||
{SAHPI_SU_STERADIANS, "Steradians"}, | 1407 | ||
{SAHPI_SU_REVOLUTIONS, "Revolutions"}, | 1408 | ||
{SAHPI_SU_CYCLES, "Cycles"}, | 1409 | ||
{SAHPI_SU_GRAVITIES, "Gravities"}, | 1410 | ||
{SAHPI_SU_OUNCE, "Ounce"}, | 1411 | ||
{SAHPI_SU_POUND, "Pound"}, | 1412 | ||
{SAHPI_SU_FT_LB, "Ft Lb"}, | 1413 | ||
{SAHPI_SU_OZ_IN, "Oz In"}, | 1414 | ||
{SAHPI_SU_GAUSS, "Gauss"}, | 1415 | ||
{SAHPI_SU_GILBERTS, "Gilberts"}, | 1416 | ||
{SAHPI_SU_HENRY, "Henry"}, | 1417 | ||
{SAHPI_SU_MILLIHENRY, "Millihenry"}, | 1418 | ||
{SAHPI_SU_FARAD, "Farad"}, | 1419 | ||
{SAHPI_SU_MICROFARAD, "Microfarad"}, | 1420 | ||
{SAHPI_SU_OHMS, "Ohms"}, | 1421 | ||
{SAHPI_SU_SIEMENS, "Siemens"}, | 1422 | ||
{SAHPI_SU_MOLE, "Mole"}, | 1423 | ||
{SAHPI_SU_BECQUEREL, "Becquerel"}, | 1424 | ||
{SAHPI_SU_PPM, "Ppm"}, | 1425 | ||
{SAHPI_SU_RESERVED, "Reserved"}, | 1426 | ||
{SAHPI_SU_DECIBELS, "Decibels"}, | 1427 | ||
{SAHPI_SU_DBA, "Dba"}, | 1428 | ||
{SAHPI_SU_DBC, "Dbc"}, | 1429 | ||
{SAHPI_SU_GRAY, "Gray"}, | 1430 | ||
{SAHPI_SU_SIEVERT, "Sievert"}, | 1431 | ||
{SAHPI_SU_COLOR_TEMP_DEG_K, "Color Temp Deg K"}, | 1432 | ||
{SAHPI_SU_BIT, "Bit"}, | 1433 | ||
{SAHPI_SU_KILOBIT, "Kilobit"}, | 1434 | ||
{SAHPI_SU_MEGABIT, "Megabit"}, | 1435 | ||
{SAHPI_SU_GIGABIT, "Gigabit"}, | 1436 | ||
{SAHPI_SU_BYTE, "Byte"}, | 1437 | ||
{SAHPI_SU_KILOBYTE, "Kilobyte"}, | 1438 | ||
{SAHPI_SU_MEGABYTE, "Megabyte"}, | 1439 | ||
{SAHPI_SU_GIGABYTE, "Gigabyte"}, | 1440 | ||
{SAHPI_SU_WORD, "Word"}, | 1441 | ||
{SAHPI_SU_DWORD, "Dword"}, | 1442 | ||
{SAHPI_SU_QWORD, "Qword"}, | 1443 | ||
{SAHPI_SU_LINE, "Line"}, | 1444 | ||
{SAHPI_SU_HIT, "Hit"}, | 1445 | ||
{SAHPI_SU_MISS, "Miss"}, | 1446 | ||
{SAHPI_SU_RETRY, "Retry"}, | 1447 | ||
{SAHPI_SU_RESET, "Reset"}, | 1448 | ||
{SAHPI_SU_OVERRUN, "Overrun"}, | 1449 | ||
{SAHPI_SU_UNDERRUN, "Underrun"}, | 1450 | ||
{SAHPI_SU_COLLISION, "Collision"}, | 1451 | ||
{SAHPI_SU_PACKETS, "Packets"}, | 1452 | ||
{SAHPI_SU_MESSAGES, "Messages"}, | 1453 | ||
{SAHPI_SU_CHARACTERS, "Characters"}, | 1454 | ||
{SAHPI_SU_ERRORS, "Errors"}, | 1455 | ||
{SAHPI_SU_CORRECTABLE_ERRORS, "Correctable Errors"}, | 1456 | ||
{SAHPI_SU_UNCORRECTABLE_ERRORS, "Uncorrectable Errors"}, | 1457 | ||
}; | 1458 | ||
1459 | |||
/** | 1460 | ||
* oh_encode_sensorunits: | 1461 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1462 | ||
* @type: Location (of SaHpiSensorUnitsT) to place encoded result. | 1463 | ||
* | 1464 | ||
* Converts a @buffer->Data string, generated by oh_lookup_sensorunits(), back | 1465 | ||
* into an SaHpiSensorUnitsT type. | 1466 | ||
* | 1467 | ||
* Returns: | 1468 | ||
* SaHpiSensorUnitsT value - normal operation. | 1469 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1470 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1471 | ||
**/ | 1472 | ||
SaErrorT oh_encode_sensorunits(SaHpiTextBufferT *buffer, SaHpiSensorUnitsT *type) | 1473 | ||
0 | { | 1474 | |
0 | int i, found; | 1475 | |
1476 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1477 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1478 | |
} | 1479 | ||
1480 | |||
0 | found = 0; | 1481 | |
0 | for (i=0; i<OH_MAX_SENSORUNITS; i++) { | 1482 | |
0 | if (strcasecmp(buffer->Data, sensorunits_strings[i].str) == 0) { | 1483 | |
0 | found++; | 1484 | |
0 | break; | 1485 | |
} | 1486 | ||
} | 1487 | ||
1488 | |||
0 | if (found) { | 1489 | |
0 | *type = sensorunits_strings[i].entity_type; | 1490 | |
} | 1491 | ||
else { | 1492 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1493 | |
} | 1494 | ||
1495 | |||
0 | return(SA_OK); | 1496 | |
} | 1497 | ||
1498 | |||
/** | 1499 | ||
* oh_lookup_sensormodunituse: | 1500 | ||
* @value: enum value of type SaHpiSensorModUnitUseT. | 1501 | ||
* | 1502 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1503 | ||
* | 1504 | ||
* Returns: | 1505 | ||
* string - normal operation. | 1506 | ||
* NULL - if @value not a valid SaHpiSensorModUnitUseT. | 1507 | ||
**/ | 1508 | ||
const char * oh_lookup_sensormodunituse(SaHpiSensorModUnitUseT value) | 1509 | ||
0 | { | 1510 | |
0 | switch (value) { | 1511 | |
case SAHPI_SMUU_NONE: | 1512 | ||
0 | return "NONE"; | 1513 | |
case SAHPI_SMUU_BASIC_OVER_MODIFIER: | 1514 | ||
0 | return "BASIC_OVER_MODIFIER"; | 1515 | |
case SAHPI_SMUU_BASIC_TIMES_MODIFIER: | 1516 | ||
0 | return "BASIC_TIMES_MODIFIER"; | 1517 | |
default: | 1518 | ||
0 | return NULL; | 1519 | |
} | 1520 | ||
} | 1521 | ||
1522 | |||
struct oh_sensormodunituse_map sensormodunituse_strings[] = { | 1523 | ||
{SAHPI_SMUU_NONE, "NONE"}, | 1524 | ||
{SAHPI_SMUU_BASIC_OVER_MODIFIER, "BASIC_OVER_MODIFIER"}, | 1525 | ||
{SAHPI_SMUU_BASIC_TIMES_MODIFIER, "BASIC_TIMES_MODIFIER"}, | 1526 | ||
}; | 1527 | ||
1528 | |||
/** | 1529 | ||
* oh_encode_sensormodunituse: | 1530 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1531 | ||
* @type: Location (of SaHpiSensorModUnitUseT) to place encoded result. | 1532 | ||
* | 1533 | ||
* Converts a @buffer->Data string, generated by oh_lookup_sensormodunituse(), back | 1534 | ||
* into an SaHpiSensorModUnitUseT type. | 1535 | ||
* | 1536 | ||
* Returns: | 1537 | ||
* SaHpiSensorModUnitUseT value - normal operation. | 1538 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1539 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1540 | ||
**/ | 1541 | ||
SaErrorT oh_encode_sensormodunituse(SaHpiTextBufferT *buffer, SaHpiSensorModUnitUseT *type) | 1542 | ||
0 | { | 1543 | |
0 | int i, found; | 1544 | |
1545 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1546 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1547 | |
} | 1548 | ||
1549 | |||
0 | found = 0; | 1550 | |
0 | for (i=0; i<OH_MAX_SENSORMODUNITUSE; i++) { | 1551 | |
0 | if (strcasecmp(buffer->Data, sensormodunituse_strings[i].str) == 0) { | 1552 | |
0 | found++; | 1553 | |
0 | break; | 1554 | |
} | 1555 | ||
} | 1556 | ||
1557 | |||
0 | if (found) { | 1558 | |
0 | *type = sensormodunituse_strings[i].entity_type; | 1559 | |
} | 1560 | ||
else { | 1561 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1562 | |
} | 1563 | ||
1564 | |||
0 | return(SA_OK); | 1565 | |
} | 1566 | ||
1567 | |||
/** | 1568 | ||
* oh_lookup_sensoreventctrl: | 1569 | ||
* @value: enum value of type SaHpiSensorEventCtrlT. | 1570 | ||
* | 1571 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1572 | ||
* | 1573 | ||
* Returns: | 1574 | ||
* string - normal operation. | 1575 | ||
* NULL - if @value not a valid SaHpiSensorEventCtrlT. | 1576 | ||
**/ | 1577 | ||
const char * oh_lookup_sensoreventctrl(SaHpiSensorEventCtrlT value) | 1578 | ||
0 | { | 1579 | |
0 | switch (value) { | 1580 | |
case SAHPI_SEC_PER_EVENT: | 1581 | ||
0 | return "PER_EVENT"; | 1582 | |
case SAHPI_SEC_READ_ONLY_MASKS: | 1583 | ||
0 | return "READ_ONLY_MASKS"; | 1584 | |
case SAHPI_SEC_READ_ONLY: | 1585 | ||
0 | return "READ_ONLY"; | 1586 | |
default: | 1587 | ||
0 | return NULL; | 1588 | |
} | 1589 | ||
} | 1590 | ||
1591 | |||
struct oh_sensoreventctrl_map sensoreventctrl_strings[] = { | 1592 | ||
{SAHPI_SEC_PER_EVENT, "PER_EVENT"}, | 1593 | ||
{SAHPI_SEC_READ_ONLY_MASKS, "READ_ONLY_MASKS"}, | 1594 | ||
{SAHPI_SEC_READ_ONLY, "READ_ONLY"}, | 1595 | ||
}; | 1596 | ||
1597 | |||
/** | 1598 | ||
* oh_encode_sensoreventctrl: | 1599 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1600 | ||
* @type: Location (of SaHpiSensorEventCtrlT) to place encoded result. | 1601 | ||
* | 1602 | ||
* Converts a @buffer->Data string, generated by oh_lookup_sensoreventctrl(), back | 1603 | ||
* into an SaHpiSensorEventCtrlT type. | 1604 | ||
* | 1605 | ||
* Returns: | 1606 | ||
* SaHpiSensorEventCtrlT value - normal operation. | 1607 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1608 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1609 | ||
**/ | 1610 | ||
SaErrorT oh_encode_sensoreventctrl(SaHpiTextBufferT *buffer, SaHpiSensorEventCtrlT *type) | 1611 | ||
0 | { | 1612 | |
0 | int i, found; | 1613 | |
1614 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1615 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1616 | |
} | 1617 | ||
1618 | |||
0 | found = 0; | 1619 | |
0 | for (i=0; i<OH_MAX_SENSOREVENTCTRL; i++) { | 1620 | |
0 | if (strcasecmp(buffer->Data, sensoreventctrl_strings[i].str) == 0) { | 1621 | |
0 | found++; | 1622 | |
0 | break; | 1623 | |
} | 1624 | ||
} | 1625 | ||
1626 | |||
0 | if (found) { | 1627 | |
0 | *type = sensoreventctrl_strings[i].entity_type; | 1628 | |
} | 1629 | ||
else { | 1630 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1631 | |
} | 1632 | ||
1633 | |||
0 | return(SA_OK); | 1634 | |
} | 1635 | ||
1636 | |||
/** | 1637 | ||
* oh_lookup_ctrltype: | 1638 | ||
* @value: enum value of type SaHpiCtrlTypeT. | 1639 | ||
* | 1640 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1641 | ||
* | 1642 | ||
* Returns: | 1643 | ||
* string - normal operation. | 1644 | ||
* NULL - if @value not a valid SaHpiCtrlTypeT. | 1645 | ||
**/ | 1646 | ||
const char * oh_lookup_ctrltype(SaHpiCtrlTypeT value) | 1647 | ||
0 | { | 1648 | |
0 | switch (value) { | 1649 | |
case SAHPI_CTRL_TYPE_DIGITAL: | 1650 | ||
0 | return "DIGITAL"; | 1651 | |
case SAHPI_CTRL_TYPE_DISCRETE: | 1652 | ||
0 | return "DISCRETE"; | 1653 | |
case SAHPI_CTRL_TYPE_ANALOG: | 1654 | ||
0 | return "ANALOG"; | 1655 | |
case SAHPI_CTRL_TYPE_STREAM: | 1656 | ||
0 | return "STREAM"; | 1657 | |
case SAHPI_CTRL_TYPE_TEXT: | 1658 | ||
0 | return "TEXT"; | 1659 | |
case SAHPI_CTRL_TYPE_OEM: | 1660 | ||
0 | return "OEM"; | 1661 | |
default: | 1662 | ||
0 | return NULL; | 1663 | |
} | 1664 | ||
} | 1665 | ||
1666 | |||
struct oh_ctrltype_map ctrltype_strings[] = { | 1667 | ||
{SAHPI_CTRL_TYPE_DIGITAL, "DIGITAL"}, | 1668 | ||
{SAHPI_CTRL_TYPE_DISCRETE, "DISCRETE"}, | 1669 | ||
{SAHPI_CTRL_TYPE_ANALOG, "ANALOG"}, | 1670 | ||
{SAHPI_CTRL_TYPE_STREAM, "STREAM"}, | 1671 | ||
{SAHPI_CTRL_TYPE_TEXT, "TEXT"}, | 1672 | ||
{SAHPI_CTRL_TYPE_OEM, "OEM"}, | 1673 | ||
}; | 1674 | ||
1675 | |||
/** | 1676 | ||
* oh_encode_ctrltype: | 1677 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1678 | ||
* @type: Location (of SaHpiCtrlTypeT) to place encoded result. | 1679 | ||
* | 1680 | ||
* Converts a @buffer->Data string, generated by oh_lookup_ctrltype(), back | 1681 | ||
* into an SaHpiCtrlTypeT type. | 1682 | ||
* | 1683 | ||
* Returns: | 1684 | ||
* SaHpiCtrlTypeT value - normal operation. | 1685 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1686 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1687 | ||
**/ | 1688 | ||
SaErrorT oh_encode_ctrltype(SaHpiTextBufferT *buffer, SaHpiCtrlTypeT *type) | 1689 | ||
0 | { | 1690 | |
0 | int i, found; | 1691 | |
1692 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1693 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1694 | |
} | 1695 | ||
1696 | |||
0 | found = 0; | 1697 | |
0 | for (i=0; i<OH_MAX_CTRLTYPE; i++) { | 1698 | |
0 | if (strcasecmp(buffer->Data, ctrltype_strings[i].str) == 0) { | 1699 | |
0 | found++; | 1700 | |
0 | break; | 1701 | |
} | 1702 | ||
} | 1703 | ||
1704 | |||
0 | if (found) { | 1705 | |
0 | *type = ctrltype_strings[i].entity_type; | 1706 | |
} | 1707 | ||
else { | 1708 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1709 | |
} | 1710 | ||
1711 | |||
0 | return(SA_OK); | 1712 | |
} | 1713 | ||
1714 | |||
/** | 1715 | ||
* oh_lookup_ctrlstatedigital: | 1716 | ||
* @value: enum value of type SaHpiCtrlStateDigitalT. | 1717 | ||
* | 1718 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1719 | ||
* | 1720 | ||
* Returns: | 1721 | ||
* string - normal operation. | 1722 | ||
* NULL - if @value not a valid SaHpiCtrlStateDigitalT. | 1723 | ||
**/ | 1724 | ||
const char * oh_lookup_ctrlstatedigital(SaHpiCtrlStateDigitalT value) | 1725 | ||
1 | { | 1726 | |
1 | switch (value) { | 1727 | |
case SAHPI_CTRL_STATE_OFF: | 1728 | ||
1 | return "OFF"; | 1729 | |
case SAHPI_CTRL_STATE_ON: | 1730 | ||
0 | return "ON"; | 1731 | |
case SAHPI_CTRL_STATE_PULSE_OFF: | 1732 | ||
0 | return "PULSE_OFF"; | 1733 | |
case SAHPI_CTRL_STATE_PULSE_ON: | 1734 | ||
0 | return "PULSE_ON"; | 1735 | |
default: | 1736 | ||
0 | return NULL; | 1737 | |
} | 1738 | ||
} | 1739 | ||
1740 | |||
struct oh_ctrlstatedigital_map ctrlstatedigital_strings[] = { | 1741 | ||
{SAHPI_CTRL_STATE_OFF, "OFF"}, | 1742 | ||
{SAHPI_CTRL_STATE_ON, "ON"}, | 1743 | ||
{SAHPI_CTRL_STATE_PULSE_OFF, "PULSE_OFF"}, | 1744 | ||
{SAHPI_CTRL_STATE_PULSE_ON, "PULSE_ON"}, | 1745 | ||
}; | 1746 | ||
1747 | |||
/** | 1748 | ||
* oh_encode_ctrlstatedigital: | 1749 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1750 | ||
* @type: Location (of SaHpiCtrlStateDigitalT) to place encoded result. | 1751 | ||
* | 1752 | ||
* Converts a @buffer->Data string, generated by oh_lookup_ctrlstatedigital(), back | 1753 | ||
* into an SaHpiCtrlStateDigitalT type. | 1754 | ||
* | 1755 | ||
* Returns: | 1756 | ||
* SaHpiCtrlStateDigitalT value - normal operation. | 1757 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1758 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1759 | ||
**/ | 1760 | ||
SaErrorT oh_encode_ctrlstatedigital(SaHpiTextBufferT *buffer, SaHpiCtrlStateDigitalT *type) | 1761 | ||
0 | { | 1762 | |
0 | int i, found; | 1763 | |
1764 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1765 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1766 | |
} | 1767 | ||
1768 | |||
0 | found = 0; | 1769 | |
0 | for (i=0; i<OH_MAX_CTRLSTATEDIGITAL; i++) { | 1770 | |
0 | if (strcasecmp(buffer->Data, ctrlstatedigital_strings[i].str) == 0) { | 1771 | |
0 | found++; | 1772 | |
0 | break; | 1773 | |
} | 1774 | ||
} | 1775 | ||
1776 | |||
0 | if (found) { | 1777 | |
0 | *type = ctrlstatedigital_strings[i].entity_type; | 1778 | |
} | 1779 | ||
else { | 1780 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1781 | |
} | 1782 | ||
1783 | |||
0 | return(SA_OK); | 1784 | |
} | 1785 | ||
1786 | |||
/** | 1787 | ||
* oh_lookup_ctrlmode: | 1788 | ||
* @value: enum value of type SaHpiCtrlModeT. | 1789 | ||
* | 1790 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1791 | ||
* | 1792 | ||
* Returns: | 1793 | ||
* string - normal operation. | 1794 | ||
* NULL - if @value not a valid SaHpiCtrlModeT. | 1795 | ||
**/ | 1796 | ||
const char * oh_lookup_ctrlmode(SaHpiCtrlModeT value) | 1797 | ||
7 | { | 1798 | |
7 | switch (value) { | 1799 | |
case SAHPI_CTRL_MODE_AUTO: | 1800 | ||
6 | return "AUTO"; | 1801 | |
case SAHPI_CTRL_MODE_MANUAL: | 1802 | ||
0 | return "MANUAL"; | 1803 | |
default: | 1804 | ||
1 | return NULL; | 1805 | |
} | 1806 | ||
} | 1807 | ||
1808 | |||
struct oh_ctrlmode_map ctrlmode_strings[] = { | 1809 | ||
{SAHPI_CTRL_MODE_AUTO, "AUTO"}, | 1810 | ||
{SAHPI_CTRL_MODE_MANUAL, "MANUAL"}, | 1811 | ||
}; | 1812 | ||
1813 | |||
/** | 1814 | ||
* oh_encode_ctrlmode: | 1815 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1816 | ||
* @type: Location (of SaHpiCtrlModeT) to place encoded result. | 1817 | ||
* | 1818 | ||
* Converts a @buffer->Data string, generated by oh_lookup_ctrlmode(), back | 1819 | ||
* into an SaHpiCtrlModeT type. | 1820 | ||
* | 1821 | ||
* Returns: | 1822 | ||
* SaHpiCtrlModeT value - normal operation. | 1823 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1824 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1825 | ||
**/ | 1826 | ||
SaErrorT oh_encode_ctrlmode(SaHpiTextBufferT *buffer, SaHpiCtrlModeT *type) | 1827 | ||
0 | { | 1828 | |
0 | int i, found; | 1829 | |
1830 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1831 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1832 | |
} | 1833 | ||
1834 | |||
0 | found = 0; | 1835 | |
0 | for (i=0; i<OH_MAX_CTRLMODE; i++) { | 1836 | |
0 | if (strcasecmp(buffer->Data, ctrlmode_strings[i].str) == 0) { | 1837 | |
0 | found++; | 1838 | |
0 | break; | 1839 | |
} | 1840 | ||
} | 1841 | ||
1842 | |||
0 | if (found) { | 1843 | |
0 | *type = ctrlmode_strings[i].entity_type; | 1844 | |
} | 1845 | ||
else { | 1846 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1847 | |
} | 1848 | ||
1849 | |||
0 | return(SA_OK); | 1850 | |
} | 1851 | ||
1852 | |||
/** | 1853 | ||
* oh_lookup_ctrloutputtype: | 1854 | ||
* @value: enum value of type SaHpiCtrlOutputTypeT. | 1855 | ||
* | 1856 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1857 | ||
* | 1858 | ||
* Returns: | 1859 | ||
* string - normal operation. | 1860 | ||
* NULL - if @value not a valid SaHpiCtrlOutputTypeT. | 1861 | ||
**/ | 1862 | ||
const char * oh_lookup_ctrloutputtype(SaHpiCtrlOutputTypeT value) | 1863 | ||
0 | { | 1864 | |
0 | switch (value) { | 1865 | |
case SAHPI_CTRL_GENERIC: | 1866 | ||
0 | return "GENERIC"; | 1867 | |
case SAHPI_CTRL_LED: | 1868 | ||
0 | return "LED"; | 1869 | |
case SAHPI_CTRL_FAN_SPEED: | 1870 | ||
0 | return "FAN_SPEED"; | 1871 | |
case SAHPI_CTRL_DRY_CONTACT_CLOSURE: | 1872 | ||
0 | return "DRY_CONTACT_CLOSURE"; | 1873 | |
case SAHPI_CTRL_POWER_SUPPLY_INHIBIT: | 1874 | ||
0 | return "POWER_SUPPLY_INHIBIT"; | 1875 | |
case SAHPI_CTRL_AUDIBLE: | 1876 | ||
0 | return "AUDIBLE"; | 1877 | |
case SAHPI_CTRL_FRONT_PANEL_LOCKOUT: | 1878 | ||
0 | return "FRONT_PANEL_LOCKOUT"; | 1879 | |
case SAHPI_CTRL_POWER_INTERLOCK: | 1880 | ||
0 | return "POWER_INTERLOCK"; | 1881 | |
case SAHPI_CTRL_POWER_STATE: | 1882 | ||
0 | return "POWER_STATE"; | 1883 | |
case SAHPI_CTRL_LCD_DISPLAY: | 1884 | ||
0 | return "LCD_DISPLAY"; | 1885 | |
case SAHPI_CTRL_OEM: | 1886 | ||
0 | return "OEM"; | 1887 | |
default: | 1888 | ||
0 | return NULL; | 1889 | |
} | 1890 | ||
} | 1891 | ||
1892 | |||
struct oh_ctrloutputtype_map ctrloutputtype_strings[] = { | 1893 | ||
{SAHPI_CTRL_GENERIC, "GENERIC"}, | 1894 | ||
{SAHPI_CTRL_LED, "LED"}, | 1895 | ||
{SAHPI_CTRL_FAN_SPEED, "FAN_SPEED"}, | 1896 | ||
{SAHPI_CTRL_DRY_CONTACT_CLOSURE, "DRY_CONTACT_CLOSURE"}, | 1897 | ||
{SAHPI_CTRL_POWER_SUPPLY_INHIBIT, "POWER_SUPPLY_INHIBIT"}, | 1898 | ||
{SAHPI_CTRL_AUDIBLE, "AUDIBLE"}, | 1899 | ||
{SAHPI_CTRL_FRONT_PANEL_LOCKOUT, "FRONT_PANEL_LOCKOUT"}, | 1900 | ||
{SAHPI_CTRL_POWER_INTERLOCK, "POWER_INTERLOCK"}, | 1901 | ||
{SAHPI_CTRL_POWER_STATE, "POWER_STATE"}, | 1902 | ||
{SAHPI_CTRL_LCD_DISPLAY, "LCD_DISPLAY"}, | 1903 | ||
{SAHPI_CTRL_OEM, "OEM"}, | 1904 | ||
}; | 1905 | ||
1906 | |||
/** | 1907 | ||
* oh_encode_ctrloutputtype: | 1908 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1909 | ||
* @type: Location (of SaHpiCtrlOutputTypeT) to place encoded result. | 1910 | ||
* | 1911 | ||
* Converts a @buffer->Data string, generated by oh_lookup_ctrloutputtype(), back | 1912 | ||
* into an SaHpiCtrlOutputTypeT type. | 1913 | ||
* | 1914 | ||
* Returns: | 1915 | ||
* SaHpiCtrlOutputTypeT value - normal operation. | 1916 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1917 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1918 | ||
**/ | 1919 | ||
SaErrorT oh_encode_ctrloutputtype(SaHpiTextBufferT *buffer, SaHpiCtrlOutputTypeT *type) | 1920 | ||
0 | { | 1921 | |
0 | int i, found; | 1922 | |
1923 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 1924 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 1925 | |
} | 1926 | ||
1927 | |||
0 | found = 0; | 1928 | |
0 | for (i=0; i<OH_MAX_CTRLOUTPUTTYPE; i++) { | 1929 | |
0 | if (strcasecmp(buffer->Data, ctrloutputtype_strings[i].str) == 0) { | 1930 | |
0 | found++; | 1931 | |
0 | break; | 1932 | |
} | 1933 | ||
} | 1934 | ||
1935 | |||
0 | if (found) { | 1936 | |
0 | *type = ctrloutputtype_strings[i].entity_type; | 1937 | |
} | 1938 | ||
else { | 1939 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 1940 | |
} | 1941 | ||
1942 | |||
0 | return(SA_OK); | 1943 | |
} | 1944 | ||
1945 | |||
/** | 1946 | ||
* oh_lookup_idrareatype: | 1947 | ||
* @value: enum value of type SaHpiIdrAreaTypeT. | 1948 | ||
* | 1949 | ||
* Converts @value into a string based on @value's HPI enum definition. | 1950 | ||
* | 1951 | ||
* Returns: | 1952 | ||
* string - normal operation. | 1953 | ||
* NULL - if @value not a valid SaHpiIdrAreaTypeT. | 1954 | ||
**/ | 1955 | ||
const char * oh_lookup_idrareatype(SaHpiIdrAreaTypeT value) | 1956 | ||
0 | { | 1957 | |
0 | switch (value) { | 1958 | |
case SAHPI_IDR_AREATYPE_INTERNAL_USE: | 1959 | ||
0 | return "INTERNAL_USE"; | 1960 | |
case SAHPI_IDR_AREATYPE_CHASSIS_INFO: | 1961 | ||
0 | return "CHASSIS_INFO"; | 1962 | |
case SAHPI_IDR_AREATYPE_BOARD_INFO: | 1963 | ||
0 | return "BOARD_INFO"; | 1964 | |
case SAHPI_IDR_AREATYPE_PRODUCT_INFO: | 1965 | ||
0 | return "PRODUCT_INFO"; | 1966 | |
case SAHPI_IDR_AREATYPE_OEM: | 1967 | ||
0 | return "OEM"; | 1968 | |
case SAHPI_IDR_AREATYPE_UNSPECIFIED: | 1969 | ||
0 | return "UNSPECIFIED"; | 1970 | |
default: | 1971 | ||
0 | return NULL; | 1972 | |
} | 1973 | ||
} | 1974 | ||
1975 | |||
struct oh_idrareatype_map idrareatype_strings[] = { | 1976 | ||
{SAHPI_IDR_AREATYPE_INTERNAL_USE, "INTERNAL_USE"}, | 1977 | ||
{SAHPI_IDR_AREATYPE_CHASSIS_INFO, "CHASSIS_INFO"}, | 1978 | ||
{SAHPI_IDR_AREATYPE_BOARD_INFO, "BOARD_INFO"}, | 1979 | ||
{SAHPI_IDR_AREATYPE_PRODUCT_INFO, "PRODUCT_INFO"}, | 1980 | ||
{SAHPI_IDR_AREATYPE_OEM, "OEM"}, | 1981 | ||
{SAHPI_IDR_AREATYPE_UNSPECIFIED, "UNSPECIFIED"}, | 1982 | ||
}; | 1983 | ||
1984 | |||
/** | 1985 | ||
* oh_encode_idrareatype: | 1986 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 1987 | ||
* @type: Location (of SaHpiIdrAreaTypeT) to place encoded result. | 1988 | ||
* | 1989 | ||
* Converts a @buffer->Data string, generated by oh_lookup_idrareatype(), back | 1990 | ||
* into an SaHpiIdrAreaTypeT type. | 1991 | ||
* | 1992 | ||
* Returns: | 1993 | ||
* SaHpiIdrAreaTypeT value - normal operation. | 1994 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 1995 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 1996 | ||
**/ | 1997 | ||
SaErrorT oh_encode_idrareatype(SaHpiTextBufferT *buffer, SaHpiIdrAreaTypeT *type) | 1998 | ||
0 | { | 1999 | |
0 | int i, found; | 2000 | |
2001 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2002 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2003 | |
} | 2004 | ||
2005 | |||
0 | found = 0; | 2006 | |
0 | for (i=0; i<OH_MAX_IDRAREATYPE; i++) { | 2007 | |
0 | if (strcasecmp(buffer->Data, idrareatype_strings[i].str) == 0) { | 2008 | |
0 | found++; | 2009 | |
0 | break; | 2010 | |
} | 2011 | ||
} | 2012 | ||
2013 | |||
0 | if (found) { | 2014 | |
0 | *type = idrareatype_strings[i].entity_type; | 2015 | |
} | 2016 | ||
else { | 2017 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2018 | |
} | 2019 | ||
2020 | |||
0 | return(SA_OK); | 2021 | |
} | 2022 | ||
2023 | |||
/** | 2024 | ||
* oh_lookup_idrfieldtype: | 2025 | ||
* @value: enum value of type SaHpiIdrFieldTypeT. | 2026 | ||
* | 2027 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2028 | ||
* | 2029 | ||
* Returns: | 2030 | ||
* string - normal operation. | 2031 | ||
* NULL - if @value not a valid SaHpiIdrFieldTypeT. | 2032 | ||
**/ | 2033 | ||
const char * oh_lookup_idrfieldtype(SaHpiIdrFieldTypeT value) | 2034 | ||
0 | { | 2035 | |
0 | switch (value) { | 2036 | |
case SAHPI_IDR_FIELDTYPE_CHASSIS_TYPE: | 2037 | ||
0 | return "CHASSIS_TYPE"; | 2038 | |
case SAHPI_IDR_FIELDTYPE_MFG_DATETIME: | 2039 | ||
0 | return "MFG_DATETIME"; | 2040 | |
case SAHPI_IDR_FIELDTYPE_MANUFACTURER: | 2041 | ||
0 | return "MANUFACTURER"; | 2042 | |
case SAHPI_IDR_FIELDTYPE_PRODUCT_NAME: | 2043 | ||
0 | return "PRODUCT_NAME"; | 2044 | |
case SAHPI_IDR_FIELDTYPE_PRODUCT_VERSION: | 2045 | ||
0 | return "PRODUCT_VERSION"; | 2046 | |
case SAHPI_IDR_FIELDTYPE_SERIAL_NUMBER: | 2047 | ||
0 | return "SERIAL_NUMBER"; | 2048 | |
case SAHPI_IDR_FIELDTYPE_PART_NUMBER: | 2049 | ||
0 | return "PART_NUMBER"; | 2050 | |
case SAHPI_IDR_FIELDTYPE_FILE_ID: | 2051 | ||
0 | return "FILE_ID"; | 2052 | |
case SAHPI_IDR_FIELDTYPE_ASSET_TAG: | 2053 | ||
0 | return "ASSET_TAG"; | 2054 | |
case SAHPI_IDR_FIELDTYPE_CUSTOM: | 2055 | ||
0 | return "CUSTOM"; | 2056 | |
case SAHPI_IDR_FIELDTYPE_UNSPECIFIED: | 2057 | ||
0 | return "UNSPECIFIED"; | 2058 | |
default: | 2059 | ||
0 | return NULL; | 2060 | |
} | 2061 | ||
} | 2062 | ||
2063 | |||
struct oh_idrfieldtype_map idrfieldtype_strings[] = { | 2064 | ||
{SAHPI_IDR_FIELDTYPE_CHASSIS_TYPE, "CHASSIS_TYPE"}, | 2065 | ||
{SAHPI_IDR_FIELDTYPE_MFG_DATETIME, "MFG_DATETIME"}, | 2066 | ||
{SAHPI_IDR_FIELDTYPE_MANUFACTURER, "MANUFACTURER"}, | 2067 | ||
{SAHPI_IDR_FIELDTYPE_PRODUCT_NAME, "PRODUCT_NAME"}, | 2068 | ||
{SAHPI_IDR_FIELDTYPE_PRODUCT_VERSION, "PRODUCT_VERSION"}, | 2069 | ||
{SAHPI_IDR_FIELDTYPE_SERIAL_NUMBER, "SERIAL_NUMBER"}, | 2070 | ||
{SAHPI_IDR_FIELDTYPE_PART_NUMBER, "PART_NUMBER"}, | 2071 | ||
{SAHPI_IDR_FIELDTYPE_FILE_ID, "FILE_ID"}, | 2072 | ||
{SAHPI_IDR_FIELDTYPE_ASSET_TAG, "ASSET_TAG"}, | 2073 | ||
{SAHPI_IDR_FIELDTYPE_CUSTOM, "CUSTOM"}, | 2074 | ||
{SAHPI_IDR_FIELDTYPE_UNSPECIFIED, "UNSPECIFIED"}, | 2075 | ||
}; | 2076 | ||
2077 | |||
/** | 2078 | ||
* oh_encode_idrfieldtype: | 2079 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2080 | ||
* @type: Location (of SaHpiIdrFieldTypeT) to place encoded result. | 2081 | ||
* | 2082 | ||
* Converts a @buffer->Data string, generated by oh_lookup_idrfieldtype(), back | 2083 | ||
* into an SaHpiIdrFieldTypeT type. | 2084 | ||
* | 2085 | ||
* Returns: | 2086 | ||
* SaHpiIdrFieldTypeT value - normal operation. | 2087 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2088 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2089 | ||
**/ | 2090 | ||
SaErrorT oh_encode_idrfieldtype(SaHpiTextBufferT *buffer, SaHpiIdrFieldTypeT *type) | 2091 | ||
0 | { | 2092 | |
0 | int i, found; | 2093 | |
2094 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2095 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2096 | |
} | 2097 | ||
2098 | |||
0 | found = 0; | 2099 | |
0 | for (i=0; i<OH_MAX_IDRFIELDTYPE; i++) { | 2100 | |
0 | if (strcasecmp(buffer->Data, idrfieldtype_strings[i].str) == 0) { | 2101 | |
0 | found++; | 2102 | |
0 | break; | 2103 | |
} | 2104 | ||
} | 2105 | ||
2106 | |||
0 | if (found) { | 2107 | |
0 | *type = idrfieldtype_strings[i].entity_type; | 2108 | |
} | 2109 | ||
else { | 2110 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2111 | |
} | 2112 | ||
2113 | |||
0 | return(SA_OK); | 2114 | |
} | 2115 | ||
2116 | |||
/** | 2117 | ||
* oh_lookup_watchdogaction: | 2118 | ||
* @value: enum value of type SaHpiWatchdogActionT. | 2119 | ||
* | 2120 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2121 | ||
* | 2122 | ||
* Returns: | 2123 | ||
* string - normal operation. | 2124 | ||
* NULL - if @value not a valid SaHpiWatchdogActionT. | 2125 | ||
**/ | 2126 | ||
const char * oh_lookup_watchdogaction(SaHpiWatchdogActionT value) | 2127 | ||
0 | { | 2128 | |
0 | switch (value) { | 2129 | |
case SAHPI_WA_NO_ACTION: | 2130 | ||
0 | return "NO_ACTION"; | 2131 | |
case SAHPI_WA_RESET: | 2132 | ||
0 | return "RESET"; | 2133 | |
case SAHPI_WA_POWER_DOWN: | 2134 | ||
0 | return "POWER_DOWN"; | 2135 | |
case SAHPI_WA_POWER_CYCLE: | 2136 | ||
0 | return "POWER_CYCLE"; | 2137 | |
default: | 2138 | ||
0 | return NULL; | 2139 | |
} | 2140 | ||
} | 2141 | ||
2142 | |||
struct oh_watchdogaction_map watchdogaction_strings[] = { | 2143 | ||
{SAHPI_WA_NO_ACTION, "NO_ACTION"}, | 2144 | ||
{SAHPI_WA_RESET, "RESET"}, | 2145 | ||
{SAHPI_WA_POWER_DOWN, "POWER_DOWN"}, | 2146 | ||
{SAHPI_WA_POWER_CYCLE, "POWER_CYCLE"}, | 2147 | ||
}; | 2148 | ||
2149 | |||
/** | 2150 | ||
* oh_encode_watchdogaction: | 2151 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2152 | ||
* @type: Location (of SaHpiWatchdogActionT) to place encoded result. | 2153 | ||
* | 2154 | ||
* Converts a @buffer->Data string, generated by oh_lookup_watchdogaction(), back | 2155 | ||
* into an SaHpiWatchdogActionT type. | 2156 | ||
* | 2157 | ||
* Returns: | 2158 | ||
* SaHpiWatchdogActionT value - normal operation. | 2159 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2160 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2161 | ||
**/ | 2162 | ||
SaErrorT oh_encode_watchdogaction(SaHpiTextBufferT *buffer, SaHpiWatchdogActionT *type) | 2163 | ||
0 | { | 2164 | |
0 | int i, found; | 2165 | |
2166 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2167 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2168 | |
} | 2169 | ||
2170 | |||
0 | found = 0; | 2171 | |
0 | for (i=0; i<OH_MAX_WATCHDOGACTION; i++) { | 2172 | |
0 | if (strcasecmp(buffer->Data, watchdogaction_strings[i].str) == 0) { | 2173 | |
0 | found++; | 2174 | |
0 | break; | 2175 | |
} | 2176 | ||
} | 2177 | ||
2178 | |||
0 | if (found) { | 2179 | |
0 | *type = watchdogaction_strings[i].entity_type; | 2180 | |
} | 2181 | ||
else { | 2182 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2183 | |
} | 2184 | ||
2185 | |||
0 | return(SA_OK); | 2186 | |
} | 2187 | ||
2188 | |||
/** | 2189 | ||
* oh_lookup_watchdogactionevent: | 2190 | ||
* @value: enum value of type SaHpiWatchdogActionEventT. | 2191 | ||
* | 2192 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2193 | ||
* | 2194 | ||
* Returns: | 2195 | ||
* string - normal operation. | 2196 | ||
* NULL - if @value not a valid SaHpiWatchdogActionEventT. | 2197 | ||
**/ | 2198 | ||
const char * oh_lookup_watchdogactionevent(SaHpiWatchdogActionEventT value) | 2199 | ||
0 | { | 2200 | |
0 | switch (value) { | 2201 | |
case SAHPI_WAE_NO_ACTION: | 2202 | ||
0 | return "NO_ACTION"; | 2203 | |
case SAHPI_WAE_RESET: | 2204 | ||
0 | return "RESET"; | 2205 | |
case SAHPI_WAE_POWER_DOWN: | 2206 | ||
0 | return "POWER_DOWN"; | 2207 | |
case SAHPI_WAE_POWER_CYCLE: | 2208 | ||
0 | return "POWER_CYCLE"; | 2209 | |
case SAHPI_WAE_TIMER_INT: | 2210 | ||
0 | return "TIMER_INT"; | 2211 | |
default: | 2212 | ||
0 | return NULL; | 2213 | |
} | 2214 | ||
} | 2215 | ||
2216 | |||
struct oh_watchdogactionevent_map watchdogactionevent_strings[] = { | 2217 | ||
{SAHPI_WAE_NO_ACTION, "NO_ACTION"}, | 2218 | ||
{SAHPI_WAE_RESET, "RESET"}, | 2219 | ||
{SAHPI_WAE_POWER_DOWN, "POWER_DOWN"}, | 2220 | ||
{SAHPI_WAE_POWER_CYCLE, "POWER_CYCLE"}, | 2221 | ||
{SAHPI_WAE_TIMER_INT, "TIMER_INT"}, | 2222 | ||
}; | 2223 | ||
2224 | |||
/** | 2225 | ||
* oh_encode_watchdogactionevent: | 2226 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2227 | ||
* @type: Location (of SaHpiWatchdogActionEventT) to place encoded result. | 2228 | ||
* | 2229 | ||
* Converts a @buffer->Data string, generated by oh_lookup_watchdogactionevent(), back | 2230 | ||
* into an SaHpiWatchdogActionEventT type. | 2231 | ||
* | 2232 | ||
* Returns: | 2233 | ||
* SaHpiWatchdogActionEventT value - normal operation. | 2234 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2235 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2236 | ||
**/ | 2237 | ||
SaErrorT oh_encode_watchdogactionevent(SaHpiTextBufferT *buffer, SaHpiWatchdogActionEventT *type) | 2238 | ||
0 | { | 2239 | |
0 | int i, found; | 2240 | |
2241 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2242 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2243 | |
} | 2244 | ||
2245 | |||
0 | found = 0; | 2246 | |
0 | for (i=0; i<OH_MAX_WATCHDOGACTIONEVENT; i++) { | 2247 | |
0 | if (strcasecmp(buffer->Data, watchdogactionevent_strings[i].str) == 0) { | 2248 | |
0 | found++; | 2249 | |
0 | break; | 2250 | |
} | 2251 | ||
} | 2252 | ||
2253 | |||
0 | if (found) { | 2254 | |
0 | *type = watchdogactionevent_strings[i].entity_type; | 2255 | |
} | 2256 | ||
else { | 2257 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2258 | |
} | 2259 | ||
2260 | |||
0 | return(SA_OK); | 2261 | |
} | 2262 | ||
2263 | |||
/** | 2264 | ||
* oh_lookup_watchdogpretimerinterrupt: | 2265 | ||
* @value: enum value of type SaHpiWatchdogPretimerInterruptT. | 2266 | ||
* | 2267 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2268 | ||
* | 2269 | ||
* Returns: | 2270 | ||
* string - normal operation. | 2271 | ||
* NULL - if @value not a valid SaHpiWatchdogPretimerInterruptT. | 2272 | ||
**/ | 2273 | ||
const char * oh_lookup_watchdogpretimerinterrupt(SaHpiWatchdogPretimerInterruptT value) | 2274 | ||
0 | { | 2275 | |
0 | switch (value) { | 2276 | |
case SAHPI_WPI_NONE: | 2277 | ||
0 | return "NONE"; | 2278 | |
case SAHPI_WPI_SMI: | 2279 | ||
0 | return "SMI"; | 2280 | |
case SAHPI_WPI_NMI: | 2281 | ||
0 | return "NMI"; | 2282 | |
case SAHPI_WPI_MESSAGE_INTERRUPT: | 2283 | ||
0 | return "MESSAGE_INTERRUPT"; | 2284 | |
case SAHPI_WPI_OEM: | 2285 | ||
0 | return "OEM"; | 2286 | |
default: | 2287 | ||
0 | return NULL; | 2288 | |
} | 2289 | ||
} | 2290 | ||
2291 | |||
struct oh_watchdogpretimerinterrupt_map watchdogpretimerinterrupt_strings[] = { | 2292 | ||
{SAHPI_WPI_NONE, "NONE"}, | 2293 | ||
{SAHPI_WPI_SMI, "SMI"}, | 2294 | ||
{SAHPI_WPI_NMI, "NMI"}, | 2295 | ||
{SAHPI_WPI_MESSAGE_INTERRUPT, "MESSAGE_INTERRUPT"}, | 2296 | ||
{SAHPI_WPI_OEM, "OEM"}, | 2297 | ||
}; | 2298 | ||
2299 | |||
/** | 2300 | ||
* oh_encode_watchdogpretimerinterrupt: | 2301 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2302 | ||
* @type: Location (of SaHpiWatchdogPretimerInterruptT) to place encoded result. | 2303 | ||
* | 2304 | ||
* Converts a @buffer->Data string, generated by oh_lookup_watchdogpretimerinterrupt(), back | 2305 | ||
* into an SaHpiWatchdogPretimerInterruptT type. | 2306 | ||
* | 2307 | ||
* Returns: | 2308 | ||
* SaHpiWatchdogPretimerInterruptT value - normal operation. | 2309 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2310 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2311 | ||
**/ | 2312 | ||
SaErrorT oh_encode_watchdogpretimerinterrupt(SaHpiTextBufferT *buffer, SaHpiWatchdogPretimerInterruptT *type) | 2313 | ||
0 | { | 2314 | |
0 | int i, found; | 2315 | |
2316 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2317 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2318 | |
} | 2319 | ||
2320 | |||
0 | found = 0; | 2321 | |
0 | for (i=0; i<OH_MAX_WATCHDOGPRETIMERINTERRUPT; i++) { | 2322 | |
0 | if (strcasecmp(buffer->Data, watchdogpretimerinterrupt_strings[i].str) == 0) { | 2323 | |
0 | found++; | 2324 | |
0 | break; | 2325 | |
} | 2326 | ||
} | 2327 | ||
2328 | |||
0 | if (found) { | 2329 | |
0 | *type = watchdogpretimerinterrupt_strings[i].entity_type; | 2330 | |
} | 2331 | ||
else { | 2332 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2333 | |
} | 2334 | ||
2335 | |||
0 | return(SA_OK); | 2336 | |
} | 2337 | ||
2338 | |||
/** | 2339 | ||
* oh_lookup_watchdogtimeruse: | 2340 | ||
* @value: enum value of type SaHpiWatchdogTimerUseT. | 2341 | ||
* | 2342 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2343 | ||
* | 2344 | ||
* Returns: | 2345 | ||
* string - normal operation. | 2346 | ||
* NULL - if @value not a valid SaHpiWatchdogTimerUseT. | 2347 | ||
**/ | 2348 | ||
const char * oh_lookup_watchdogtimeruse(SaHpiWatchdogTimerUseT value) | 2349 | ||
0 | { | 2350 | |
0 | switch (value) { | 2351 | |
case SAHPI_WTU_NONE: | 2352 | ||
0 | return "NONE"; | 2353 | |
case SAHPI_WTU_BIOS_FRB2: | 2354 | ||
0 | return "BIOS_FRB2"; | 2355 | |
case SAHPI_WTU_BIOS_POST: | 2356 | ||
0 | return "BIOS_POST"; | 2357 | |
case SAHPI_WTU_OS_LOAD: | 2358 | ||
0 | return "OS_LOAD"; | 2359 | |
case SAHPI_WTU_SMS_OS: | 2360 | ||
0 | return "SMS_OS"; | 2361 | |
case SAHPI_WTU_OEM: | 2362 | ||
0 | return "OEM"; | 2363 | |
case SAHPI_WTU_UNSPECIFIED: | 2364 | ||
0 | return "UNSPECIFIED"; | 2365 | |
default: | 2366 | ||
0 | return NULL; | 2367 | |
} | 2368 | ||
} | 2369 | ||
2370 | |||
struct oh_watchdogtimeruse_map watchdogtimeruse_strings[] = { | 2371 | ||
{SAHPI_WTU_NONE, "NONE"}, | 2372 | ||
{SAHPI_WTU_BIOS_FRB2, "BIOS_FRB2"}, | 2373 | ||
{SAHPI_WTU_BIOS_POST, "BIOS_POST"}, | 2374 | ||
{SAHPI_WTU_OS_LOAD, "OS_LOAD"}, | 2375 | ||
{SAHPI_WTU_SMS_OS, "SMS_OS"}, | 2376 | ||
{SAHPI_WTU_OEM, "OEM"}, | 2377 | ||
{SAHPI_WTU_UNSPECIFIED, "UNSPECIFIED"}, | 2378 | ||
}; | 2379 | ||
2380 | |||
/** | 2381 | ||
* oh_encode_watchdogtimeruse: | 2382 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2383 | ||
* @type: Location (of SaHpiWatchdogTimerUseT) to place encoded result. | 2384 | ||
* | 2385 | ||
* Converts a @buffer->Data string, generated by oh_lookup_watchdogtimeruse(), back | 2386 | ||
* into an SaHpiWatchdogTimerUseT type. | 2387 | ||
* | 2388 | ||
* Returns: | 2389 | ||
* SaHpiWatchdogTimerUseT value - normal operation. | 2390 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2391 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2392 | ||
**/ | 2393 | ||
SaErrorT oh_encode_watchdogtimeruse(SaHpiTextBufferT *buffer, SaHpiWatchdogTimerUseT *type) | 2394 | ||
0 | { | 2395 | |
0 | int i, found; | 2396 | |
2397 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2398 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2399 | |
} | 2400 | ||
2401 | |||
0 | found = 0; | 2402 | |
0 | for (i=0; i<OH_MAX_WATCHDOGTIMERUSE; i++) { | 2403 | |
0 | if (strcasecmp(buffer->Data, watchdogtimeruse_strings[i].str) == 0) { | 2404 | |
0 | found++; | 2405 | |
0 | break; | 2406 | |
} | 2407 | ||
} | 2408 | ||
2409 | |||
0 | if (found) { | 2410 | |
0 | *type = watchdogtimeruse_strings[i].entity_type; | 2411 | |
} | 2412 | ||
else { | 2413 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2414 | |
} | 2415 | ||
2416 | |||
0 | return(SA_OK); | 2417 | |
} | 2418 | ||
2419 | |||
/** | 2420 | ||
* oh_lookup_hsindicatorstate: | 2421 | ||
* @value: enum value of type SaHpiHsIndicatorStateT. | 2422 | ||
* | 2423 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2424 | ||
* | 2425 | ||
* Returns: | 2426 | ||
* string - normal operation. | 2427 | ||
* NULL - if @value not a valid SaHpiHsIndicatorStateT. | 2428 | ||
**/ | 2429 | ||
const char * oh_lookup_hsindicatorstate(SaHpiHsIndicatorStateT value) | 2430 | ||
7 | { | 2431 | |
7 | switch (value) { | 2432 | |
case SAHPI_HS_INDICATOR_OFF: | 2433 | ||
1 | return "OFF"; | 2434 | |
case SAHPI_HS_INDICATOR_ON: | 2435 | ||
5 | return "ON"; | 2436 | |
default: | 2437 | ||
1 | return NULL; | 2438 | |
} | 2439 | ||
} | 2440 | ||
2441 | |||
struct oh_hsindicatorstate_map hsindicatorstate_strings[] = { | 2442 | ||
{SAHPI_HS_INDICATOR_OFF, "OFF"}, | 2443 | ||
{SAHPI_HS_INDICATOR_ON, "ON"}, | 2444 | ||
}; | 2445 | ||
2446 | |||
/** | 2447 | ||
* oh_encode_hsindicatorstate: | 2448 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2449 | ||
* @type: Location (of SaHpiHsIndicatorStateT) to place encoded result. | 2450 | ||
* | 2451 | ||
* Converts a @buffer->Data string, generated by oh_lookup_hsindicatorstate(), back | 2452 | ||
* into an SaHpiHsIndicatorStateT type. | 2453 | ||
* | 2454 | ||
* Returns: | 2455 | ||
* SaHpiHsIndicatorStateT value - normal operation. | 2456 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2457 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2458 | ||
**/ | 2459 | ||
SaErrorT oh_encode_hsindicatorstate(SaHpiTextBufferT *buffer, SaHpiHsIndicatorStateT *type) | 2460 | ||
0 | { | 2461 | |
0 | int i, found; | 2462 | |
2463 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2464 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2465 | |
} | 2466 | ||
2467 | |||
0 | found = 0; | 2468 | |
0 | for (i=0; i<OH_MAX_HSINDICATORSTATE; i++) { | 2469 | |
0 | if (strcasecmp(buffer->Data, hsindicatorstate_strings[i].str) == 0) { | 2470 | |
0 | found++; | 2471 | |
0 | break; | 2472 | |
} | 2473 | ||
} | 2474 | ||
2475 | |||
0 | if (found) { | 2476 | |
0 | *type = hsindicatorstate_strings[i].entity_type; | 2477 | |
} | 2478 | ||
else { | 2479 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2480 | |
} | 2481 | ||
2482 | |||
0 | return(SA_OK); | 2483 | |
} | 2484 | ||
2485 | |||
/** | 2486 | ||
* oh_lookup_hsaction: | 2487 | ||
* @value: enum value of type SaHpiHsActionT. | 2488 | ||
* | 2489 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2490 | ||
* | 2491 | ||
* Returns: | 2492 | ||
* string - normal operation. | 2493 | ||
* NULL - if @value not a valid SaHpiHsActionT. | 2494 | ||
**/ | 2495 | ||
const char * oh_lookup_hsaction(SaHpiHsActionT value) | 2496 | ||
13 | { | 2497 | |
13 | switch (value) { | 2498 | |
case SAHPI_HS_ACTION_INSERTION: | 2499 | ||
7 | return "INSERTION"; | 2500 | |
case SAHPI_HS_ACTION_EXTRACTION: | 2501 | ||
5 | return "EXTRACTION"; | 2502 | |
default: | 2503 | ||
1 | return NULL; | 2504 | |
} | 2505 | ||
} | 2506 | ||
2507 | |||
struct oh_hsaction_map hsaction_strings[] = { | 2508 | ||
{SAHPI_HS_ACTION_INSERTION, "INSERTION"}, | 2509 | ||
{SAHPI_HS_ACTION_EXTRACTION, "EXTRACTION"}, | 2510 | ||
}; | 2511 | ||
2512 | |||
/** | 2513 | ||
* oh_encode_hsaction: | 2514 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2515 | ||
* @type: Location (of SaHpiHsActionT) to place encoded result. | 2516 | ||
* | 2517 | ||
* Converts a @buffer->Data string, generated by oh_lookup_hsaction(), back | 2518 | ||
* into an SaHpiHsActionT type. | 2519 | ||
* | 2520 | ||
* Returns: | 2521 | ||
* SaHpiHsActionT value - normal operation. | 2522 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2523 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2524 | ||
**/ | 2525 | ||
SaErrorT oh_encode_hsaction(SaHpiTextBufferT *buffer, SaHpiHsActionT *type) | 2526 | ||
0 | { | 2527 | |
0 | int i, found; | 2528 | |
2529 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2530 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2531 | |
} | 2532 | ||
2533 | |||
0 | found = 0; | 2534 | |
0 | for (i=0; i<OH_MAX_HSACTION; i++) { | 2535 | |
0 | if (strcasecmp(buffer->Data, hsaction_strings[i].str) == 0) { | 2536 | |
0 | found++; | 2537 | |
0 | break; | 2538 | |
} | 2539 | ||
} | 2540 | ||
2541 | |||
0 | if (found) { | 2542 | |
0 | *type = hsaction_strings[i].entity_type; | 2543 | |
} | 2544 | ||
else { | 2545 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2546 | |
} | 2547 | ||
2548 | |||
0 | return(SA_OK); | 2549 | |
} | 2550 | ||
2551 | |||
/** | 2552 | ||
* oh_lookup_hsstate: | 2553 | ||
* @value: enum value of type SaHpiHsStateT. | 2554 | ||
* | 2555 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2556 | ||
* | 2557 | ||
* Returns: | 2558 | ||
* string - normal operation. | 2559 | ||
* NULL - if @value not a valid SaHpiHsStateT. | 2560 | ||
**/ | 2561 | ||
const char * oh_lookup_hsstate(SaHpiHsStateT value) | 2562 | ||
0 | { | 2563 | |
0 | switch (value) { | 2564 | |
case SAHPI_HS_STATE_INACTIVE: | 2565 | ||
0 | return "INACTIVE"; | 2566 | |
case SAHPI_HS_STATE_INSERTION_PENDING: | 2567 | ||
0 | return "INSERTION_PENDING"; | 2568 | |
case SAHPI_HS_STATE_ACTIVE: | 2569 | ||
0 | return "ACTIVE"; | 2570 | |
case SAHPI_HS_STATE_EXTRACTION_PENDING: | 2571 | ||
0 | return "EXTRACTION_PENDING"; | 2572 | |
case SAHPI_HS_STATE_NOT_PRESENT: | 2573 | ||
0 | return "NOT_PRESENT"; | 2574 | |
default: | 2575 | ||
0 | return NULL; | 2576 | |
} | 2577 | ||
} | 2578 | ||
2579 | |||
struct oh_hsstate_map hsstate_strings[] = { | 2580 | ||
{SAHPI_HS_STATE_INACTIVE, "INACTIVE"}, | 2581 | ||
{SAHPI_HS_STATE_INSERTION_PENDING, "INSERTION_PENDING"}, | 2582 | ||
{SAHPI_HS_STATE_ACTIVE, "ACTIVE"}, | 2583 | ||
{SAHPI_HS_STATE_EXTRACTION_PENDING, "EXTRACTION_PENDING"}, | 2584 | ||
{SAHPI_HS_STATE_NOT_PRESENT, "NOT_PRESENT"}, | 2585 | ||
}; | 2586 | ||
2587 | |||
/** | 2588 | ||
* oh_encode_hsstate: | 2589 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2590 | ||
* @type: Location (of SaHpiHsStateT) to place encoded result. | 2591 | ||
* | 2592 | ||
* Converts a @buffer->Data string, generated by oh_lookup_hsstate(), back | 2593 | ||
* into an SaHpiHsStateT type. | 2594 | ||
* | 2595 | ||
* Returns: | 2596 | ||
* SaHpiHsStateT value - normal operation. | 2597 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2598 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2599 | ||
**/ | 2600 | ||
SaErrorT oh_encode_hsstate(SaHpiTextBufferT *buffer, SaHpiHsStateT *type) | 2601 | ||
0 | { | 2602 | |
0 | int i, found; | 2603 | |
2604 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2605 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2606 | |
} | 2607 | ||
2608 | |||
0 | found = 0; | 2609 | |
0 | for (i=0; i<OH_MAX_HSSTATE; i++) { | 2610 | |
0 | if (strcasecmp(buffer->Data, hsstate_strings[i].str) == 0) { | 2611 | |
0 | found++; | 2612 | |
0 | break; | 2613 | |
} | 2614 | ||
} | 2615 | ||
2616 | |||
0 | if (found) { | 2617 | |
0 | *type = hsstate_strings[i].entity_type; | 2618 | |
} | 2619 | ||
else { | 2620 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2621 | |
} | 2622 | ||
2623 | |||
0 | return(SA_OK); | 2624 | |
} | 2625 | ||
2626 | |||
/** | 2627 | ||
* oh_lookup_severity: | 2628 | ||
* @value: enum value of type SaHpiSeverityT. | 2629 | ||
* | 2630 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2631 | ||
* | 2632 | ||
* Returns: | 2633 | ||
* string - normal operation. | 2634 | ||
* NULL - if @value not a valid SaHpiSeverityT. | 2635 | ||
**/ | 2636 | ||
const char * oh_lookup_severity(SaHpiSeverityT value) | 2637 | ||
14 | { | 2638 | |
14 | switch (value) { | 2639 | |
case SAHPI_CRITICAL: | 2640 | ||
1 | return "CRITICAL"; | 2641 | |
case SAHPI_MAJOR: | 2642 | ||
1 | return "MAJOR"; | 2643 | |
case SAHPI_MINOR: | 2644 | ||
0 | return "MINOR"; | 2645 | |
case SAHPI_INFORMATIONAL: | 2646 | ||
4 | return "INFORMATIONAL"; | 2647 | |
case SAHPI_OK: | 2648 | ||
5 | return "OK"; | 2649 | |
case SAHPI_DEBUG: | 2650 | ||
0 | return "DEBUG"; | 2651 | |
case SAHPI_ALL_SEVERITIES: | 2652 | ||
0 | return "ALL_SEVERITIES"; | 2653 | |
default: | 2654 | ||
3 | return NULL; | 2655 | |
} | 2656 | ||
} | 2657 | ||
2658 | |||
struct oh_severity_map severity_strings[] = { | 2659 | ||
{SAHPI_CRITICAL, "CRITICAL"}, | 2660 | ||
{SAHPI_MAJOR, "MAJOR"}, | 2661 | ||
{SAHPI_MINOR, "MINOR"}, | 2662 | ||
{SAHPI_INFORMATIONAL, "INFORMATIONAL"}, | 2663 | ||
{SAHPI_OK, "OK"}, | 2664 | ||
{SAHPI_DEBUG, "DEBUG"}, | 2665 | ||
{SAHPI_ALL_SEVERITIES, "ALL_SEVERITIES"}, | 2666 | ||
}; | 2667 | ||
2668 | |||
/** | 2669 | ||
* oh_encode_severity: | 2670 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2671 | ||
* @type: Location (of SaHpiSeverityT) to place encoded result. | 2672 | ||
* | 2673 | ||
* Converts a @buffer->Data string, generated by oh_lookup_severity(), back | 2674 | ||
* into an SaHpiSeverityT type. | 2675 | ||
* | 2676 | ||
* Returns: | 2677 | ||
* SaHpiSeverityT value - normal operation. | 2678 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2679 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2680 | ||
**/ | 2681 | ||
SaErrorT oh_encode_severity(SaHpiTextBufferT *buffer, SaHpiSeverityT *type) | 2682 | ||
0 | { | 2683 | |
0 | int i, found; | 2684 | |
2685 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2686 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2687 | |
} | 2688 | ||
2689 | |||
0 | found = 0; | 2690 | |
0 | for (i=0; i<OH_MAX_SEVERITY; i++) { | 2691 | |
0 | if (strcasecmp(buffer->Data, severity_strings[i].str) == 0) { | 2692 | |
0 | found++; | 2693 | |
0 | break; | 2694 | |
} | 2695 | ||
} | 2696 | ||
2697 | |||
0 | if (found) { | 2698 | |
0 | *type = severity_strings[i].entity_type; | 2699 | |
} | 2700 | ||
else { | 2701 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2702 | |
} | 2703 | ||
2704 | |||
0 | return(SA_OK); | 2705 | |
} | 2706 | ||
2707 | |||
/** | 2708 | ||
* oh_lookup_resourceeventtype: | 2709 | ||
* @value: enum value of type SaHpiResourceEventTypeT. | 2710 | ||
* | 2711 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2712 | ||
* | 2713 | ||
* Returns: | 2714 | ||
* string - normal operation. | 2715 | ||
* NULL - if @value not a valid SaHpiResourceEventTypeT. | 2716 | ||
**/ | 2717 | ||
const char * oh_lookup_resourceeventtype(SaHpiResourceEventTypeT value) | 2718 | ||
0 | { | 2719 | |
0 | switch (value) { | 2720 | |
case SAHPI_RESE_RESOURCE_FAILURE: | 2721 | ||
0 | return "FAILURE"; | 2722 | |
case SAHPI_RESE_RESOURCE_RESTORED: | 2723 | ||
0 | return "RESTORED"; | 2724 | |
case SAHPI_RESE_RESOURCE_ADDED: | 2725 | ||
0 | return "ADDED"; | 2726 | |
default: | 2727 | ||
0 | return NULL; | 2728 | |
} | 2729 | ||
} | 2730 | ||
2731 | |||
struct oh_resourceeventtype_map resourceeventtype_strings[] = { | 2732 | ||
{SAHPI_RESE_RESOURCE_FAILURE, "FAILURE"}, | 2733 | ||
{SAHPI_RESE_RESOURCE_RESTORED, "RESTORED"}, | 2734 | ||
{SAHPI_RESE_RESOURCE_ADDED, "ADDED"}, | 2735 | ||
}; | 2736 | ||
2737 | |||
/** | 2738 | ||
* oh_encode_resourceeventtype: | 2739 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2740 | ||
* @type: Location (of SaHpiResourceEventTypeT) to place encoded result. | 2741 | ||
* | 2742 | ||
* Converts a @buffer->Data string, generated by oh_lookup_resourceeventtype(), back | 2743 | ||
* into an SaHpiResourceEventTypeT type. | 2744 | ||
* | 2745 | ||
* Returns: | 2746 | ||
* SaHpiResourceEventTypeT value - normal operation. | 2747 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2748 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2749 | ||
**/ | 2750 | ||
SaErrorT oh_encode_resourceeventtype(SaHpiTextBufferT *buffer, SaHpiResourceEventTypeT *type) | 2751 | ||
0 | { | 2752 | |
0 | int i, found; | 2753 | |
2754 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2755 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2756 | |
} | 2757 | ||
2758 | |||
0 | found = 0; | 2759 | |
0 | for (i=0; i<OH_MAX_RESOURCEEVENTTYPE; i++) { | 2760 | |
0 | if (strcasecmp(buffer->Data, resourceeventtype_strings[i].str) == 0) { | 2761 | |
0 | found++; | 2762 | |
0 | break; | 2763 | |
} | 2764 | ||
} | 2765 | ||
2766 | |||
0 | if (found) { | 2767 | |
0 | *type = resourceeventtype_strings[i].entity_type; | 2768 | |
} | 2769 | ||
else { | 2770 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2771 | |
} | 2772 | ||
2773 | |||
0 | return(SA_OK); | 2774 | |
} | 2775 | ||
2776 | |||
/** | 2777 | ||
* oh_lookup_domaineventtype: | 2778 | ||
* @value: enum value of type SaHpiDomainEventTypeT. | 2779 | ||
* | 2780 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2781 | ||
* | 2782 | ||
* Returns: | 2783 | ||
* string - normal operation. | 2784 | ||
* NULL - if @value not a valid SaHpiDomainEventTypeT. | 2785 | ||
**/ | 2786 | ||
const char * oh_lookup_domaineventtype(SaHpiDomainEventTypeT value) | 2787 | ||
0 | { | 2788 | |
0 | switch (value) { | 2789 | |
case SAHPI_DOMAIN_REF_ADDED: | 2790 | ||
0 | return "ADDED"; | 2791 | |
case SAHPI_DOMAIN_REF_REMOVED: | 2792 | ||
0 | return "REMOVED"; | 2793 | |
default: | 2794 | ||
0 | return NULL; | 2795 | |
} | 2796 | ||
} | 2797 | ||
2798 | |||
struct oh_domaineventtype_map domaineventtype_strings[] = { | 2799 | ||
{SAHPI_DOMAIN_REF_ADDED, "ADDED"}, | 2800 | ||
{SAHPI_DOMAIN_REF_REMOVED, "REMOVED"}, | 2801 | ||
}; | 2802 | ||
2803 | |||
/** | 2804 | ||
* oh_encode_domaineventtype: | 2805 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2806 | ||
* @type: Location (of SaHpiDomainEventTypeT) to place encoded result. | 2807 | ||
* | 2808 | ||
* Converts a @buffer->Data string, generated by oh_lookup_domaineventtype(), back | 2809 | ||
* into an SaHpiDomainEventTypeT type. | 2810 | ||
* | 2811 | ||
* Returns: | 2812 | ||
* SaHpiDomainEventTypeT value - normal operation. | 2813 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2814 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2815 | ||
**/ | 2816 | ||
SaErrorT oh_encode_domaineventtype(SaHpiTextBufferT *buffer, SaHpiDomainEventTypeT *type) | 2817 | ||
0 | { | 2818 | |
0 | int i, found; | 2819 | |
2820 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2821 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2822 | |
} | 2823 | ||
2824 | |||
0 | found = 0; | 2825 | |
0 | for (i=0; i<OH_MAX_DOMAINEVENTTYPE; i++) { | 2826 | |
0 | if (strcasecmp(buffer->Data, domaineventtype_strings[i].str) == 0) { | 2827 | |
0 | found++; | 2828 | |
0 | break; | 2829 | |
} | 2830 | ||
} | 2831 | ||
2832 | |||
0 | if (found) { | 2833 | |
0 | *type = domaineventtype_strings[i].entity_type; | 2834 | |
} | 2835 | ||
else { | 2836 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2837 | |
} | 2838 | ||
2839 | |||
0 | return(SA_OK); | 2840 | |
} | 2841 | ||
2842 | |||
/** | 2843 | ||
* oh_lookup_sweventtype: | 2844 | ||
* @value: enum value of type SaHpiSwEventTypeT. | 2845 | ||
* | 2846 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2847 | ||
* | 2848 | ||
* Returns: | 2849 | ||
* string - normal operation. | 2850 | ||
* NULL - if @value not a valid SaHpiSwEventTypeT. | 2851 | ||
**/ | 2852 | ||
const char * oh_lookup_sweventtype(SaHpiSwEventTypeT value) | 2853 | ||
0 | { | 2854 | |
0 | switch (value) { | 2855 | |
case SAHPI_HPIE_AUDIT: | 2856 | ||
0 | return "AUDIT"; | 2857 | |
case SAHPI_HPIE_STARTUP: | 2858 | ||
0 | return "STARTUP"; | 2859 | |
case SAHPI_HPIE_OTHER: | 2860 | ||
0 | return "OTHER"; | 2861 | |
default: | 2862 | ||
0 | return NULL; | 2863 | |
} | 2864 | ||
} | 2865 | ||
2866 | |||
struct oh_sweventtype_map sweventtype_strings[] = { | 2867 | ||
{SAHPI_HPIE_AUDIT, "AUDIT"}, | 2868 | ||
{SAHPI_HPIE_STARTUP, "STARTUP"}, | 2869 | ||
{SAHPI_HPIE_OTHER, "OTHER"}, | 2870 | ||
}; | 2871 | ||
2872 | |||
/** | 2873 | ||
* oh_encode_sweventtype: | 2874 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2875 | ||
* @type: Location (of SaHpiSwEventTypeT) to place encoded result. | 2876 | ||
* | 2877 | ||
* Converts a @buffer->Data string, generated by oh_lookup_sweventtype(), back | 2878 | ||
* into an SaHpiSwEventTypeT type. | 2879 | ||
* | 2880 | ||
* Returns: | 2881 | ||
* SaHpiSwEventTypeT value - normal operation. | 2882 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2883 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2884 | ||
**/ | 2885 | ||
SaErrorT oh_encode_sweventtype(SaHpiTextBufferT *buffer, SaHpiSwEventTypeT *type) | 2886 | ||
0 | { | 2887 | |
0 | int i, found; | 2888 | |
2889 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2890 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2891 | |
} | 2892 | ||
2893 | |||
0 | found = 0; | 2894 | |
0 | for (i=0; i<OH_MAX_SWEVENTTYPE; i++) { | 2895 | |
0 | if (strcasecmp(buffer->Data, sweventtype_strings[i].str) == 0) { | 2896 | |
0 | found++; | 2897 | |
0 | break; | 2898 | |
} | 2899 | ||
} | 2900 | ||
2901 | |||
0 | if (found) { | 2902 | |
0 | *type = sweventtype_strings[i].entity_type; | 2903 | |
} | 2904 | ||
else { | 2905 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2906 | |
} | 2907 | ||
2908 | |||
0 | return(SA_OK); | 2909 | |
} | 2910 | ||
2911 | |||
/** | 2912 | ||
* oh_lookup_eventtype: | 2913 | ||
* @value: enum value of type SaHpiEventTypeT. | 2914 | ||
* | 2915 | ||
* Converts @value into a string based on @value's HPI enum definition. | 2916 | ||
* | 2917 | ||
* Returns: | 2918 | ||
* string - normal operation. | 2919 | ||
* NULL - if @value not a valid SaHpiEventTypeT. | 2920 | ||
**/ | 2921 | ||
const char * oh_lookup_eventtype(SaHpiEventTypeT value) | 2922 | ||
0 | { | 2923 | |
0 | switch (value) { | 2924 | |
case SAHPI_ET_RESOURCE: | 2925 | ||
0 | return "RESOURCE"; | 2926 | |
case SAHPI_ET_DOMAIN: | 2927 | ||
0 | return "DOMAIN"; | 2928 | |
case SAHPI_ET_SENSOR: | 2929 | ||
0 | return "SENSOR"; | 2930 | |
case SAHPI_ET_SENSOR_ENABLE_CHANGE: | 2931 | ||
0 | return "SENSOR_ENABLE_CHANGE"; | 2932 | |
case SAHPI_ET_HOTSWAP: | 2933 | ||
0 | return "HOTSWAP"; | 2934 | |
case SAHPI_ET_WATCHDOG: | 2935 | ||
0 | return "WATCHDOG"; | 2936 | |
case SAHPI_ET_HPI_SW: | 2937 | ||
0 | return "HPI_SW"; | 2938 | |
case SAHPI_ET_OEM: | 2939 | ||
0 | return "OEM"; | 2940 | |
case SAHPI_ET_USER: | 2941 | ||
0 | return "USER"; | 2942 | |
default: | 2943 | ||
0 | return NULL; | 2944 | |
} | 2945 | ||
} | 2946 | ||
2947 | |||
struct oh_eventtype_map eventtype_strings[] = { | 2948 | ||
{SAHPI_ET_RESOURCE, "RESOURCE"}, | 2949 | ||
{SAHPI_ET_DOMAIN, "DOMAIN"}, | 2950 | ||
{SAHPI_ET_SENSOR, "SENSOR"}, | 2951 | ||
{SAHPI_ET_SENSOR_ENABLE_CHANGE, "SENSOR_ENABLE_CHANGE"}, | 2952 | ||
{SAHPI_ET_HOTSWAP, "HOTSWAP"}, | 2953 | ||
{SAHPI_ET_WATCHDOG, "WATCHDOG"}, | 2954 | ||
{SAHPI_ET_HPI_SW, "HPI_SW"}, | 2955 | ||
{SAHPI_ET_OEM, "OEM"}, | 2956 | ||
{SAHPI_ET_USER, "USER"}, | 2957 | ||
}; | 2958 | ||
2959 | |||
/** | 2960 | ||
* oh_encode_eventtype: | 2961 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 2962 | ||
* @type: Location (of SaHpiEventTypeT) to place encoded result. | 2963 | ||
* | 2964 | ||
* Converts a @buffer->Data string, generated by oh_lookup_eventtype(), back | 2965 | ||
* into an SaHpiEventTypeT type. | 2966 | ||
* | 2967 | ||
* Returns: | 2968 | ||
* SaHpiEventTypeT value - normal operation. | 2969 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 2970 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 2971 | ||
**/ | 2972 | ||
SaErrorT oh_encode_eventtype(SaHpiTextBufferT *buffer, SaHpiEventTypeT *type) | 2973 | ||
0 | { | 2974 | |
0 | int i, found; | 2975 | |
2976 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 2977 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 2978 | |
} | 2979 | ||
2980 | |||
0 | found = 0; | 2981 | |
0 | for (i=0; i<OH_MAX_EVENTTYPE; i++) { | 2982 | |
0 | if (strcasecmp(buffer->Data, eventtype_strings[i].str) == 0) { | 2983 | |
0 | found++; | 2984 | |
0 | break; | 2985 | |
} | 2986 | ||
} | 2987 | ||
2988 | |||
0 | if (found) { | 2989 | |
0 | *type = eventtype_strings[i].entity_type; | 2990 | |
} | 2991 | ||
else { | 2992 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 2993 | |
} | 2994 | ||
2995 | |||
0 | return(SA_OK); | 2996 | |
} | 2997 | ||
2998 | |||
/** | 2999 | ||
* oh_lookup_statuscondtype: | 3000 | ||
* @value: enum value of type SaHpiStatusCondTypeT. | 3001 | ||
* | 3002 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3003 | ||
* | 3004 | ||
* Returns: | 3005 | ||
* string - normal operation. | 3006 | ||
* NULL - if @value not a valid SaHpiStatusCondTypeT. | 3007 | ||
**/ | 3008 | ||
const char * oh_lookup_statuscondtype(SaHpiStatusCondTypeT value) | 3009 | ||
0 | { | 3010 | |
0 | switch (value) { | 3011 | |
case SAHPI_STATUS_COND_TYPE_SENSOR: | 3012 | ||
0 | return "SENSOR"; | 3013 | |
case SAHPI_STATUS_COND_TYPE_RESOURCE: | 3014 | ||
0 | return "RESOURCE"; | 3015 | |
case SAHPI_STATUS_COND_TYPE_OEM: | 3016 | ||
0 | return "OEM"; | 3017 | |
case SAHPI_STATUS_COND_TYPE_USER: | 3018 | ||
0 | return "USER"; | 3019 | |
default: | 3020 | ||
0 | return NULL; | 3021 | |
} | 3022 | ||
} | 3023 | ||
3024 | |||
struct oh_statuscondtype_map statuscondtype_strings[] = { | 3025 | ||
{SAHPI_STATUS_COND_TYPE_SENSOR, "SENSOR"}, | 3026 | ||
{SAHPI_STATUS_COND_TYPE_RESOURCE, "RESOURCE"}, | 3027 | ||
{SAHPI_STATUS_COND_TYPE_OEM, "OEM"}, | 3028 | ||
{SAHPI_STATUS_COND_TYPE_USER, "USER"}, | 3029 | ||
}; | 3030 | ||
3031 | |||
/** | 3032 | ||
* oh_encode_statuscondtype: | 3033 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3034 | ||
* @type: Location (of SaHpiStatusCondTypeT) to place encoded result. | 3035 | ||
* | 3036 | ||
* Converts a @buffer->Data string, generated by oh_lookup_statuscondtype(), back | 3037 | ||
* into an SaHpiStatusCondTypeT type. | 3038 | ||
* | 3039 | ||
* Returns: | 3040 | ||
* SaHpiStatusCondTypeT value - normal operation. | 3041 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3042 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3043 | ||
**/ | 3044 | ||
SaErrorT oh_encode_statuscondtype(SaHpiTextBufferT *buffer, SaHpiStatusCondTypeT *type) | 3045 | ||
0 | { | 3046 | |
0 | int i, found; | 3047 | |
3048 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3049 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3050 | |
} | 3051 | ||
3052 | |||
0 | found = 0; | 3053 | |
0 | for (i=0; i<OH_MAX_STATUSCONDTYPE; i++) { | 3054 | |
0 | if (strcasecmp(buffer->Data, statuscondtype_strings[i].str) == 0) { | 3055 | |
0 | found++; | 3056 | |
0 | break; | 3057 | |
} | 3058 | ||
} | 3059 | ||
3060 | |||
0 | if (found) { | 3061 | |
0 | *type = statuscondtype_strings[i].entity_type; | 3062 | |
} | 3063 | ||
else { | 3064 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3065 | |
} | 3066 | ||
3067 | |||
0 | return(SA_OK); | 3068 | |
} | 3069 | ||
3070 | |||
/** | 3071 | ||
* oh_lookup_annunciatormode: | 3072 | ||
* @value: enum value of type SaHpiAnnunciatorModeT. | 3073 | ||
* | 3074 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3075 | ||
* | 3076 | ||
* Returns: | 3077 | ||
* string - normal operation. | 3078 | ||
* NULL - if @value not a valid SaHpiAnnunciatorModeT. | 3079 | ||
**/ | 3080 | ||
const char * oh_lookup_annunciatormode(SaHpiAnnunciatorModeT value) | 3081 | ||
0 | { | 3082 | |
0 | switch (value) { | 3083 | |
case SAHPI_ANNUNCIATOR_MODE_AUTO: | 3084 | ||
0 | return "AUTO"; | 3085 | |
case SAHPI_ANNUNCIATOR_MODE_USER: | 3086 | ||
0 | return "USER"; | 3087 | |
case SAHPI_ANNUNCIATOR_MODE_SHARED: | 3088 | ||
0 | return "SHARED"; | 3089 | |
default: | 3090 | ||
0 | return NULL; | 3091 | |
} | 3092 | ||
} | 3093 | ||
3094 | |||
struct oh_annunciatormode_map annunciatormode_strings[] = { | 3095 | ||
{SAHPI_ANNUNCIATOR_MODE_AUTO, "AUTO"}, | 3096 | ||
{SAHPI_ANNUNCIATOR_MODE_USER, "USER"}, | 3097 | ||
{SAHPI_ANNUNCIATOR_MODE_SHARED, "SHARED"}, | 3098 | ||
}; | 3099 | ||
3100 | |||
/** | 3101 | ||
* oh_encode_annunciatormode: | 3102 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3103 | ||
* @type: Location (of SaHpiAnnunciatorModeT) to place encoded result. | 3104 | ||
* | 3105 | ||
* Converts a @buffer->Data string, generated by oh_lookup_annunciatormode(), back | 3106 | ||
* into an SaHpiAnnunciatorModeT type. | 3107 | ||
* | 3108 | ||
* Returns: | 3109 | ||
* SaHpiAnnunciatorModeT value - normal operation. | 3110 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3111 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3112 | ||
**/ | 3113 | ||
SaErrorT oh_encode_annunciatormode(SaHpiTextBufferT *buffer, SaHpiAnnunciatorModeT *type) | 3114 | ||
0 | { | 3115 | |
0 | int i, found; | 3116 | |
3117 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3118 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3119 | |
} | 3120 | ||
3121 | |||
0 | found = 0; | 3122 | |
0 | for (i=0; i<OH_MAX_ANNUNCIATORMODE; i++) { | 3123 | |
0 | if (strcasecmp(buffer->Data, annunciatormode_strings[i].str) == 0) { | 3124 | |
0 | found++; | 3125 | |
0 | break; | 3126 | |
} | 3127 | ||
} | 3128 | ||
3129 | |||
0 | if (found) { | 3130 | |
0 | *type = annunciatormode_strings[i].entity_type; | 3131 | |
} | 3132 | ||
else { | 3133 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3134 | |
} | 3135 | ||
3136 | |||
0 | return(SA_OK); | 3137 | |
} | 3138 | ||
3139 | |||
/** | 3140 | ||
* oh_lookup_annunciatortype: | 3141 | ||
* @value: enum value of type SaHpiAnnunciatorTypeT. | 3142 | ||
* | 3143 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3144 | ||
* | 3145 | ||
* Returns: | 3146 | ||
* string - normal operation. | 3147 | ||
* NULL - if @value not a valid SaHpiAnnunciatorTypeT. | 3148 | ||
**/ | 3149 | ||
const char * oh_lookup_annunciatortype(SaHpiAnnunciatorTypeT value) | 3150 | ||
0 | { | 3151 | |
0 | switch (value) { | 3152 | |
case SAHPI_ANNUNCIATOR_TYPE_LED: | 3153 | ||
0 | return "LED"; | 3154 | |
case SAHPI_ANNUNCIATOR_TYPE_DRY_CONTACT_CLOSURE: | 3155 | ||
0 | return "DRY_CONTACT_CLOSURE"; | 3156 | |
case SAHPI_ANNUNCIATOR_TYPE_AUDIBLE: | 3157 | ||
0 | return "AUDIBLE"; | 3158 | |
case SAHPI_ANNUNCIATOR_TYPE_LCD_DISPLAY: | 3159 | ||
0 | return "LCD_DISPLAY"; | 3160 | |
case SAHPI_ANNUNCIATOR_TYPE_MESSAGE: | 3161 | ||
0 | return "MESSAGE"; | 3162 | |
case SAHPI_ANNUNCIATOR_TYPE_COMPOSITE: | 3163 | ||
0 | return "COMPOSITE"; | 3164 | |
case SAHPI_ANNUNCIATOR_TYPE_OEM: | 3165 | ||
0 | return "OEM"; | 3166 | |
default: | 3167 | ||
0 | return NULL; | 3168 | |
} | 3169 | ||
} | 3170 | ||
3171 | |||
struct oh_annunciatortype_map annunciatortype_strings[] = { | 3172 | ||
{SAHPI_ANNUNCIATOR_TYPE_LED, "LED"}, | 3173 | ||
{SAHPI_ANNUNCIATOR_TYPE_DRY_CONTACT_CLOSURE, "DRY_CONTACT_CLOSURE"}, | 3174 | ||
{SAHPI_ANNUNCIATOR_TYPE_AUDIBLE, "AUDIBLE"}, | 3175 | ||
{SAHPI_ANNUNCIATOR_TYPE_LCD_DISPLAY, "LCD_DISPLAY"}, | 3176 | ||
{SAHPI_ANNUNCIATOR_TYPE_MESSAGE, "MESSAGE"}, | 3177 | ||
{SAHPI_ANNUNCIATOR_TYPE_COMPOSITE, "COMPOSITE"}, | 3178 | ||
{SAHPI_ANNUNCIATOR_TYPE_OEM, "OEM"}, | 3179 | ||
}; | 3180 | ||
3181 | |||
/** | 3182 | ||
* oh_encode_annunciatortype: | 3183 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3184 | ||
* @type: Location (of SaHpiAnnunciatorTypeT) to place encoded result. | 3185 | ||
* | 3186 | ||
* Converts a @buffer->Data string, generated by oh_lookup_annunciatortype(), back | 3187 | ||
* into an SaHpiAnnunciatorTypeT type. | 3188 | ||
* | 3189 | ||
* Returns: | 3190 | ||
* SaHpiAnnunciatorTypeT value - normal operation. | 3191 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3192 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3193 | ||
**/ | 3194 | ||
SaErrorT oh_encode_annunciatortype(SaHpiTextBufferT *buffer, SaHpiAnnunciatorTypeT *type) | 3195 | ||
0 | { | 3196 | |
0 | int i, found; | 3197 | |
3198 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3199 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3200 | |
} | 3201 | ||
3202 | |||
0 | found = 0; | 3203 | |
0 | for (i=0; i<OH_MAX_ANNUNCIATORTYPE; i++) { | 3204 | |
0 | if (strcasecmp(buffer->Data, annunciatortype_strings[i].str) == 0) { | 3205 | |
0 | found++; | 3206 | |
0 | break; | 3207 | |
} | 3208 | ||
} | 3209 | ||
3210 | |||
0 | if (found) { | 3211 | |
0 | *type = annunciatortype_strings[i].entity_type; | 3212 | |
} | 3213 | ||
else { | 3214 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3215 | |
} | 3216 | ||
3217 | |||
0 | return(SA_OK); | 3218 | |
} | 3219 | ||
3220 | |||
/** | 3221 | ||
* oh_lookup_rdrtype: | 3222 | ||
* @value: enum value of type SaHpiRdrTypeT. | 3223 | ||
* | 3224 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3225 | ||
* | 3226 | ||
* Returns: | 3227 | ||
* string - normal operation. | 3228 | ||
* NULL - if @value not a valid SaHpiRdrTypeT. | 3229 | ||
**/ | 3230 | ||
const char * oh_lookup_rdrtype(SaHpiRdrTypeT value) | 3231 | ||
0 | { | 3232 | |
0 | switch (value) { | 3233 | |
case SAHPI_NO_RECORD: | 3234 | ||
0 | return "NO_RECORD"; | 3235 | |
case SAHPI_CTRL_RDR: | 3236 | ||
0 | return "CTRL_RDR"; | 3237 | |
case SAHPI_SENSOR_RDR: | 3238 | ||
0 | return "SENSOR_RDR"; | 3239 | |
case SAHPI_INVENTORY_RDR: | 3240 | ||
0 | return "INVENTORY_RDR"; | 3241 | |
case SAHPI_WATCHDOG_RDR: | 3242 | ||
0 | return "WATCHDOG_RDR"; | 3243 | |
case SAHPI_ANNUNCIATOR_RDR: | 3244 | ||
0 | return "ANNUNCIATOR_RDR"; | 3245 | |
default: | 3246 | ||
0 | return NULL; | 3247 | |
} | 3248 | ||
} | 3249 | ||
3250 | |||
struct oh_rdrtype_map rdrtype_strings[] = { | 3251 | ||
{SAHPI_NO_RECORD, "NO_RECORD"}, | 3252 | ||
{SAHPI_CTRL_RDR, "CTRL_RDR"}, | 3253 | ||
{SAHPI_SENSOR_RDR, "SENSOR_RDR"}, | 3254 | ||
{SAHPI_INVENTORY_RDR, "INVENTORY_RDR"}, | 3255 | ||
{SAHPI_WATCHDOG_RDR, "WATCHDOG_RDR"}, | 3256 | ||
{SAHPI_ANNUNCIATOR_RDR, "ANNUNCIATOR_RDR"}, | 3257 | ||
}; | 3258 | ||
3259 | |||
/** | 3260 | ||
* oh_encode_rdrtype: | 3261 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3262 | ||
* @type: Location (of SaHpiRdrTypeT) to place encoded result. | 3263 | ||
* | 3264 | ||
* Converts a @buffer->Data string, generated by oh_lookup_rdrtype(), back | 3265 | ||
* into an SaHpiRdrTypeT type. | 3266 | ||
* | 3267 | ||
* Returns: | 3268 | ||
* SaHpiRdrTypeT value - normal operation. | 3269 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3270 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3271 | ||
**/ | 3272 | ||
SaErrorT oh_encode_rdrtype(SaHpiTextBufferT *buffer, SaHpiRdrTypeT *type) | 3273 | ||
0 | { | 3274 | |
0 | int i, found; | 3275 | |
3276 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3277 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3278 | |
} | 3279 | ||
3280 | |||
0 | found = 0; | 3281 | |
0 | for (i=0; i<OH_MAX_RDRTYPE; i++) { | 3282 | |
0 | if (strcasecmp(buffer->Data, rdrtype_strings[i].str) == 0) { | 3283 | |
0 | found++; | 3284 | |
0 | break; | 3285 | |
} | 3286 | ||
} | 3287 | ||
3288 | |||
0 | if (found) { | 3289 | |
0 | *type = rdrtype_strings[i].entity_type; | 3290 | |
} | 3291 | ||
else { | 3292 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3293 | |
} | 3294 | ||
3295 | |||
0 | return(SA_OK); | 3296 | |
} | 3297 | ||
3298 | |||
/** | 3299 | ||
* oh_lookup_parmaction: | 3300 | ||
* @value: enum value of type SaHpiParmActionT. | 3301 | ||
* | 3302 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3303 | ||
* | 3304 | ||
* Returns: | 3305 | ||
* string - normal operation. | 3306 | ||
* NULL - if @value not a valid SaHpiParmActionT. | 3307 | ||
**/ | 3308 | ||
const char * oh_lookup_parmaction(SaHpiParmActionT value) | 3309 | ||
6 | { | 3310 | |
6 | switch (value) { | 3311 | |
case SAHPI_DEFAULT_PARM: | 3312 | ||
3 | return "DEFAULT_PARM"; | 3313 | |
case SAHPI_SAVE_PARM: | 3314 | ||
1 | return "SAVE_PARM"; | 3315 | |
case SAHPI_RESTORE_PARM: | 3316 | ||
1 | return "RESTORE_PARM"; | 3317 | |
default: | 3318 | ||
1 | return NULL; | 3319 | |
} | 3320 | ||
} | 3321 | ||
3322 | |||
struct oh_parmaction_map parmaction_strings[] = { | 3323 | ||
{SAHPI_DEFAULT_PARM, "DEFAULT_PARM"}, | 3324 | ||
{SAHPI_SAVE_PARM, "SAVE_PARM"}, | 3325 | ||
{SAHPI_RESTORE_PARM, "RESTORE_PARM"}, | 3326 | ||
}; | 3327 | ||
3328 | |||
/** | 3329 | ||
* oh_encode_parmaction: | 3330 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3331 | ||
* @type: Location (of SaHpiParmActionT) to place encoded result. | 3332 | ||
* | 3333 | ||
* Converts a @buffer->Data string, generated by oh_lookup_parmaction(), back | 3334 | ||
* into an SaHpiParmActionT type. | 3335 | ||
* | 3336 | ||
* Returns: | 3337 | ||
* SaHpiParmActionT value - normal operation. | 3338 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3339 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3340 | ||
**/ | 3341 | ||
SaErrorT oh_encode_parmaction(SaHpiTextBufferT *buffer, SaHpiParmActionT *type) | 3342 | ||
0 | { | 3343 | |
0 | int i, found; | 3344 | |
3345 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3346 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3347 | |
} | 3348 | ||
3349 | |||
0 | found = 0; | 3350 | |
0 | for (i=0; i<OH_MAX_PARMACTION; i++) { | 3351 | |
0 | if (strcasecmp(buffer->Data, parmaction_strings[i].str) == 0) { | 3352 | |
0 | found++; | 3353 | |
0 | break; | 3354 | |
} | 3355 | ||
} | 3356 | ||
3357 | |||
0 | if (found) { | 3358 | |
0 | *type = parmaction_strings[i].entity_type; | 3359 | |
} | 3360 | ||
else { | 3361 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3362 | |
} | 3363 | ||
3364 | |||
0 | return(SA_OK); | 3365 | |
} | 3366 | ||
3367 | |||
/** | 3368 | ||
* oh_lookup_resetaction: | 3369 | ||
* @value: enum value of type SaHpiResetActionT. | 3370 | ||
* | 3371 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3372 | ||
* | 3373 | ||
* Returns: | 3374 | ||
* string - normal operation. | 3375 | ||
* NULL - if @value not a valid SaHpiResetActionT. | 3376 | ||
**/ | 3377 | ||
const char * oh_lookup_resetaction(SaHpiResetActionT value) | 3378 | ||
4 | { | 3379 | |
4 | switch (value) { | 3380 | |
case SAHPI_COLD_RESET: | 3381 | ||
0 | return "COLD_RESET"; | 3382 | |
case SAHPI_WARM_RESET: | 3383 | ||
0 | return "WARM_RESET"; | 3384 | |
case SAHPI_RESET_ASSERT: | 3385 | ||
1 | return "RESET_ASSERT"; | 3386 | |
case SAHPI_RESET_DEASSERT: | 3387 | ||
2 | return "RESET_DEASSERT"; | 3388 | |
default: | 3389 | ||
1 | return NULL; | 3390 | |
} | 3391 | ||
} | 3392 | ||
3393 | |||
struct oh_resetaction_map resetaction_strings[] = { | 3394 | ||
{SAHPI_COLD_RESET, "COLD_RESET"}, | 3395 | ||
{SAHPI_WARM_RESET, "WARM_RESET"}, | 3396 | ||
{SAHPI_RESET_ASSERT, "RESET_ASSERT"}, | 3397 | ||
{SAHPI_RESET_DEASSERT, "RESET_DEASSERT"}, | 3398 | ||
}; | 3399 | ||
3400 | |||
/** | 3401 | ||
* oh_encode_resetaction: | 3402 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3403 | ||
* @type: Location (of SaHpiResetActionT) to place encoded result. | 3404 | ||
* | 3405 | ||
* Converts a @buffer->Data string, generated by oh_lookup_resetaction(), back | 3406 | ||
* into an SaHpiResetActionT type. | 3407 | ||
* | 3408 | ||
* Returns: | 3409 | ||
* SaHpiResetActionT value - normal operation. | 3410 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3411 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3412 | ||
**/ | 3413 | ||
SaErrorT oh_encode_resetaction(SaHpiTextBufferT *buffer, SaHpiResetActionT *type) | 3414 | ||
0 | { | 3415 | |
0 | int i, found; | 3416 | |
3417 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3418 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3419 | |
} | 3420 | ||
3421 | |||
0 | found = 0; | 3422 | |
0 | for (i=0; i<OH_MAX_RESETACTION; i++) { | 3423 | |
0 | if (strcasecmp(buffer->Data, resetaction_strings[i].str) == 0) { | 3424 | |
0 | found++; | 3425 | |
0 | break; | 3426 | |
} | 3427 | ||
} | 3428 | ||
3429 | |||
0 | if (found) { | 3430 | |
0 | *type = resetaction_strings[i].entity_type; | 3431 | |
} | 3432 | ||
else { | 3433 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3434 | |
} | 3435 | ||
3436 | |||
0 | return(SA_OK); | 3437 | |
} | 3438 | ||
3439 | |||
/** | 3440 | ||
* oh_lookup_powerstate: | 3441 | ||
* @value: enum value of type SaHpiPowerStateT. | 3442 | ||
* | 3443 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3444 | ||
* | 3445 | ||
* Returns: | 3446 | ||
* string - normal operation. | 3447 | ||
* NULL - if @value not a valid SaHpiPowerStateT. | 3448 | ||
**/ | 3449 | ||
const char * oh_lookup_powerstate(SaHpiPowerStateT value) | 3450 | ||
9 | { | 3451 | |
9 | switch (value) { | 3452 | |
case SAHPI_POWER_OFF: | 3453 | ||
1 | return "OFF"; | 3454 | |
case SAHPI_POWER_ON: | 3455 | ||
6 | return "ON"; | 3456 | |
case SAHPI_POWER_CYCLE: | 3457 | ||
1 | return "CYCLE"; | 3458 | |
default: | 3459 | ||
1 | return NULL; | 3460 | |
} | 3461 | ||
} | 3462 | ||
3463 | |||
struct oh_powerstate_map powerstate_strings[] = { | 3464 | ||
{SAHPI_POWER_OFF, "OFF"}, | 3465 | ||
{SAHPI_POWER_ON, "ON"}, | 3466 | ||
{SAHPI_POWER_CYCLE, "CYCLE"}, | 3467 | ||
}; | 3468 | ||
3469 | |||
/** | 3470 | ||
* oh_encode_powerstate: | 3471 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3472 | ||
* @type: Location (of SaHpiPowerStateT) to place encoded result. | 3473 | ||
* | 3474 | ||
* Converts a @buffer->Data string, generated by oh_lookup_powerstate(), back | 3475 | ||
* into an SaHpiPowerStateT type. | 3476 | ||
* | 3477 | ||
* Returns: | 3478 | ||
* SaHpiPowerStateT value - normal operation. | 3479 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3480 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3481 | ||
**/ | 3482 | ||
SaErrorT oh_encode_powerstate(SaHpiTextBufferT *buffer, SaHpiPowerStateT *type) | 3483 | ||
0 | { | 3484 | |
0 | int i, found; | 3485 | |
3486 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3487 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3488 | |
} | 3489 | ||
3490 | |||
0 | found = 0; | 3491 | |
0 | for (i=0; i<OH_MAX_POWERSTATE; i++) { | 3492 | |
0 | if (strcasecmp(buffer->Data, powerstate_strings[i].str) == 0) { | 3493 | |
0 | found++; | 3494 | |
0 | break; | 3495 | |
} | 3496 | ||
} | 3497 | ||
3498 | |||
0 | if (found) { | 3499 | |
0 | *type = powerstate_strings[i].entity_type; | 3500 | |
} | 3501 | ||
else { | 3502 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3503 | |
} | 3504 | ||
3505 | |||
0 | return(SA_OK); | 3506 | |
} | 3507 | ||
3508 | |||
/** | 3509 | ||
* oh_lookup_eventlogoverflowaction: | 3510 | ||
* @value: enum value of type SaHpiEventLogOverflowActionT. | 3511 | ||
* | 3512 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3513 | ||
* | 3514 | ||
* Returns: | 3515 | ||
* string - normal operation. | 3516 | ||
* NULL - if @value not a valid SaHpiEventLogOverflowActionT. | 3517 | ||
**/ | 3518 | ||
const char * oh_lookup_eventlogoverflowaction(SaHpiEventLogOverflowActionT value) | 3519 | ||
0 | { | 3520 | |
0 | switch (value) { | 3521 | |
case SAHPI_EL_OVERFLOW_DROP: | 3522 | ||
0 | return "OVERFLOW_DROP"; | 3523 | |
case SAHPI_EL_OVERFLOW_OVERWRITE: | 3524 | ||
0 | return "OVERFLOW_OVERWRITE"; | 3525 | |
default: | 3526 | ||
0 | return NULL; | 3527 | |
} | 3528 | ||
} | 3529 | ||
3530 | |||
struct oh_eventlogoverflowaction_map eventlogoverflowaction_strings[] = { | 3531 | ||
{SAHPI_EL_OVERFLOW_DROP, "OVERFLOW_DROP"}, | 3532 | ||
{SAHPI_EL_OVERFLOW_OVERWRITE, "OVERFLOW_OVERWRITE"}, | 3533 | ||
}; | 3534 | ||
3535 | |||
/** | 3536 | ||
* oh_encode_eventlogoverflowaction: | 3537 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3538 | ||
* @type: Location (of SaHpiEventLogOverflowActionT) to place encoded result. | 3539 | ||
* | 3540 | ||
* Converts a @buffer->Data string, generated by oh_lookup_eventlogoverflowaction(), back | 3541 | ||
* into an SaHpiEventLogOverflowActionT type. | 3542 | ||
* | 3543 | ||
* Returns: | 3544 | ||
* SaHpiEventLogOverflowActionT value - normal operation. | 3545 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3546 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3547 | ||
**/ | 3548 | ||
SaErrorT oh_encode_eventlogoverflowaction(SaHpiTextBufferT *buffer, SaHpiEventLogOverflowActionT *type) | 3549 | ||
0 | { | 3550 | |
0 | int i, found; | 3551 | |
3552 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3553 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3554 | |
} | 3555 | ||
3556 | |||
0 | found = 0; | 3557 | |
0 | for (i=0; i<OH_MAX_EVENTLOGOVERFLOWACTION; i++) { | 3558 | |
0 | if (strcasecmp(buffer->Data, eventlogoverflowaction_strings[i].str) == 0) { | 3559 | |
0 | found++; | 3560 | |
0 | break; | 3561 | |
} | 3562 | ||
} | 3563 | ||
3564 | |||
0 | if (found) { | 3565 | |
0 | *type = eventlogoverflowaction_strings[i].entity_type; | 3566 | |
} | 3567 | ||
else { | 3568 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3569 | |
} | 3570 | ||
3571 | |||
0 | return(SA_OK); | 3572 | |
} | 3573 | ||
3574 | |||
/** | 3575 | ||
* oh_lookup_error: | 3576 | ||
* @value: enum value of type SaErrorT. | 3577 | ||
* | 3578 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3579 | ||
* | 3580 | ||
* Returns: | 3581 | ||
* string - normal operation. | 3582 | ||
* NULL - if @value not a valid SaErrorT. | 3583 | ||
**/ | 3584 | ||
const char * oh_lookup_error(SaErrorT value) | 3585 | ||
0 | { | 3586 | |
0 | switch (value) { | 3587 | |
case SA_OK: | 3588 | ||
0 | return "SA_OK"; | 3589 | |
case SA_ERR_HPI_ERROR: | 3590 | ||
0 | return "ERROR"; | 3591 | |
case SA_ERR_HPI_UNSUPPORTED_API: | 3592 | ||
0 | return "UNSUPPORTED_API"; | 3593 | |
case SA_ERR_HPI_BUSY: | 3594 | ||
0 | return "BUSY"; | 3595 | |
case SA_ERR_HPI_INTERNAL_ERROR: | 3596 | ||
0 | return "INTERNAL_ERROR"; | 3597 | |
case SA_ERR_HPI_INVALID_CMD: | 3598 | ||
0 | return "INVALID_CMD"; | 3599 | |
case SA_ERR_HPI_TIMEOUT: | 3600 | ||
0 | return "TIMEOUT"; | 3601 | |
case SA_ERR_HPI_OUT_OF_SPACE: | 3602 | ||
0 | return "OUT_OF_SPACE"; | 3603 | |
case SA_ERR_HPI_OUT_OF_MEMORY: | 3604 | ||
0 | return "OUT_OF_MEMORY"; | 3605 | |
case SA_ERR_HPI_INVALID_PARAMS: | 3606 | ||
0 | return "INVALID_PARAMS"; | 3607 | |
case SA_ERR_HPI_INVALID_DATA: | 3608 | ||
0 | return "INVALID_DATA"; | 3609 | |
case SA_ERR_HPI_NOT_PRESENT: | 3610 | ||
0 | return "NOT_PRESENT"; | 3611 | |
case SA_ERR_HPI_NO_RESPONSE: | 3612 | ||
0 | return "NO_RESPONSE"; | 3613 | |
case SA_ERR_HPI_DUPLICATE: | 3614 | ||
0 | return "DUPLICATE"; | 3615 | |
case SA_ERR_HPI_INVALID_SESSION: | 3616 | ||
0 | return "INVALID_SESSION"; | 3617 | |
case SA_ERR_HPI_INVALID_DOMAIN: | 3618 | ||
0 | return "INVALID_DOMAIN"; | 3619 | |
case SA_ERR_HPI_INVALID_RESOURCE: | 3620 | ||
0 | return "INVALID_RESOURCE"; | 3621 | |
case SA_ERR_HPI_INVALID_REQUEST: | 3622 | ||
0 | return "INVALID_REQUEST"; | 3623 | |
case SA_ERR_HPI_ENTITY_NOT_PRESENT: | 3624 | ||
0 | return "ENTITY_NOT_PRESENT"; | 3625 | |
case SA_ERR_HPI_READ_ONLY: | 3626 | ||
0 | return "READ_ONLY"; | 3627 | |
case SA_ERR_HPI_CAPABILITY: | 3628 | ||
0 | return "CAPABILITY"; | 3629 | |
case SA_ERR_HPI_UNKNOWN: | 3630 | ||
0 | return "UNKNOWN"; | 3631 | |
default: | 3632 | ||
0 | return NULL; | 3633 | |
} | 3634 | ||
} | 3635 | ||
3636 | |||
struct oh_error_map error_strings[] = { | 3637 | ||
{SA_OK, "SA_OK"}, | 3638 | ||
{SA_ERR_HPI_ERROR, "ERROR"}, | 3639 | ||
{SA_ERR_HPI_UNSUPPORTED_API, "UNSUPPORTED_API"}, | 3640 | ||
{SA_ERR_HPI_BUSY, "BUSY"}, | 3641 | ||
{SA_ERR_HPI_INTERNAL_ERROR, "INTERNAL_ERROR"}, | 3642 | ||
{SA_ERR_HPI_INVALID_CMD, "INVALID_CMD"}, | 3643 | ||
{SA_ERR_HPI_TIMEOUT, "TIMEOUT"}, | 3644 | ||
{SA_ERR_HPI_OUT_OF_SPACE, "OUT_OF_SPACE"}, | 3645 | ||
{SA_ERR_HPI_OUT_OF_MEMORY, "OUT_OF_MEMORY"}, | 3646 | ||
{SA_ERR_HPI_INVALID_PARAMS, "INVALID_PARAMS"}, | 3647 | ||
{SA_ERR_HPI_INVALID_DATA, "INVALID_DATA"}, | 3648 | ||
{SA_ERR_HPI_NOT_PRESENT, "NOT_PRESENT"}, | 3649 | ||
{SA_ERR_HPI_NO_RESPONSE, "NO_RESPONSE"}, | 3650 | ||
{SA_ERR_HPI_DUPLICATE, "DUPLICATE"}, | 3651 | ||
{SA_ERR_HPI_INVALID_SESSION, "INVALID_SESSION"}, | 3652 | ||
{SA_ERR_HPI_INVALID_DOMAIN, "INVALID_DOMAIN"}, | 3653 | ||
{SA_ERR_HPI_INVALID_RESOURCE, "INVALID_RESOURCE"}, | 3654 | ||
{SA_ERR_HPI_INVALID_REQUEST, "INVALID_REQUEST"}, | 3655 | ||
{SA_ERR_HPI_ENTITY_NOT_PRESENT, "ENTITY_NOT_PRESENT"}, | 3656 | ||
{SA_ERR_HPI_READ_ONLY, "READ_ONLY"}, | 3657 | ||
{SA_ERR_HPI_CAPABILITY, "CAPABILITY"}, | 3658 | ||
{SA_ERR_HPI_UNKNOWN, "UNKNOWN"}, | 3659 | ||
}; | 3660 | ||
3661 | |||
/** | 3662 | ||
* oh_encode_error: | 3663 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3664 | ||
* @type: Location (of SaErrorT) to place encoded result. | 3665 | ||
* | 3666 | ||
* Converts a @buffer->Data string, generated by oh_lookup_error(), back | 3667 | ||
* into an SaErrorT type. | 3668 | ||
* | 3669 | ||
* Returns: | 3670 | ||
* SaErrorT value - normal operation. | 3671 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3672 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3673 | ||
**/ | 3674 | ||
SaErrorT oh_encode_error(SaHpiTextBufferT *buffer, SaErrorT *type) | 3675 | ||
0 | { | 3676 | |
0 | int i, found; | 3677 | |
3678 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3679 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3680 | |
} | 3681 | ||
3682 | |||
0 | found = 0; | 3683 | |
0 | for (i=0; i<OH_MAX_ERROR; i++) { | 3684 | |
0 | if (strcasecmp(buffer->Data, error_strings[i].str) == 0) { | 3685 | |
0 | found++; | 3686 | |
0 | break; | 3687 | |
} | 3688 | ||
} | 3689 | ||
3690 | |||
0 | if (found) { | 3691 | |
0 | *type = error_strings[i].entity_type; | 3692 | |
} | 3693 | ||
else { | 3694 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3695 | |
} | 3696 | ||
3697 | |||
0 | return(SA_OK); | 3698 | |
} | 3699 | ||
3700 | |||
/** | 3701 | ||
* oh_lookup_eventcategory: | 3702 | ||
* @value: enum value of type SaHpiEventCategoryT. | 3703 | ||
* | 3704 | ||
* Converts @value into a string based on @value's HPI enum definition. | 3705 | ||
* | 3706 | ||
* Returns: | 3707 | ||
* string - normal operation. | 3708 | ||
* NULL - if @value not a valid SaHpiEventCategoryT. | 3709 | ||
**/ | 3710 | ||
const char * oh_lookup_eventcategory(SaHpiEventCategoryT value) | 3711 | ||
0 | { | 3712 | |
0 | switch (value) { | 3713 | |
case SAHPI_EC_UNSPECIFIED: | 3714 | ||
0 | return "UNSPECIFIED"; | 3715 | |
case SAHPI_EC_THRESHOLD: | 3716 | ||
0 | return "THRESHOLD"; | 3717 | |
case SAHPI_EC_USAGE: | 3718 | ||
0 | return "USAGE"; | 3719 | |
case SAHPI_EC_STATE: | 3720 | ||
0 | return "STATE"; | 3721 | |
case SAHPI_EC_PRED_FAIL: | 3722 | ||
0 | return "PRED_FAIL"; | 3723 | |
case SAHPI_EC_LIMIT: | 3724 | ||
0 | return "LIMIT"; | 3725 | |
case SAHPI_EC_PERFORMANCE: | 3726 | ||
0 | return "PERFORMANCE"; | 3727 | |
case SAHPI_EC_SEVERITY: | 3728 | ||
0 | return "SEVERITY"; | 3729 | |
case SAHPI_EC_PRESENCE: | 3730 | ||
0 | return "PRESENCE"; | 3731 | |
case SAHPI_EC_ENABLE: | 3732 | ||
0 | return "ENABLE"; | 3733 | |
case SAHPI_EC_AVAILABILITY: | 3734 | ||
0 | return "AVAILABILITY"; | 3735 | |
case SAHPI_EC_REDUNDANCY: | 3736 | ||
0 | return "REDUNDANCY"; | 3737 | |
case SAHPI_EC_SENSOR_SPECIFIC: | 3738 | ||
0 | return "SENSOR_SPECIFIC"; | 3739 | |
case SAHPI_EC_GENERIC: | 3740 | ||
0 | return "GENERIC"; | 3741 | |
default: | 3742 | ||
0 | return NULL; | 3743 | |
} | 3744 | ||
} | 3745 | ||
3746 | |||
struct oh_eventcategory_map eventcategory_strings[] = { | 3747 | ||
{SAHPI_EC_UNSPECIFIED, "UNSPECIFIED"}, | 3748 | ||
{SAHPI_EC_THRESHOLD, "THRESHOLD"}, | 3749 | ||
{SAHPI_EC_USAGE, "USAGE"}, | 3750 | ||
{SAHPI_EC_STATE, "STATE"}, | 3751 | ||
{SAHPI_EC_PRED_FAIL, "PRED_FAIL"}, | 3752 | ||
{SAHPI_EC_LIMIT, "LIMIT"}, | 3753 | ||
{SAHPI_EC_PERFORMANCE, "PERFORMANCE"}, | 3754 | ||
{SAHPI_EC_SEVERITY, "SEVERITY"}, | 3755 | ||
{SAHPI_EC_PRESENCE, "PRESENCE"}, | 3756 | ||
{SAHPI_EC_ENABLE, "ENABLE"}, | 3757 | ||
{SAHPI_EC_AVAILABILITY, "AVAILABILITY"}, | 3758 | ||
{SAHPI_EC_REDUNDANCY, "REDUNDANCY"}, | 3759 | ||
{SAHPI_EC_SENSOR_SPECIFIC, "SENSOR_SPECIFIC"}, | 3760 | ||
{SAHPI_EC_GENERIC, "GENERIC"}, | 3761 | ||
}; | 3762 | ||
3763 | |||
/** | 3764 | ||
* oh_encode_eventcategory: | 3765 | ||
* @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. | 3766 | ||
* @type: Location (of SaHpiEventCategoryT) to place encoded result. | 3767 | ||
* | 3768 | ||
* Converts a @buffer->Data string, generated by oh_lookup_eventcategory(), back | 3769 | ||
* into an SaHpiEventCategoryT type. | 3770 | ||
* | 3771 | ||
* Returns: | 3772 | ||
* SaHpiEventCategoryT value - normal operation. | 3773 | ||
* SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. | 3774 | ||
* SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. | 3775 | ||
**/ | 3776 | ||
SaErrorT oh_encode_eventcategory(SaHpiTextBufferT *buffer, SaHpiEventCategoryT *type) | 3777 | ||
0 | { | 3778 | |
0 | int i, found; | 3779 | |
3780 | |||
0 | if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { | 3781 | |
0 | return(SA_ERR_HPI_INVALID_PARAMS); | 3782 | |
} | 3783 | ||
3784 | |||
0 | found = 0; | 3785 | |
0 | for (i=0; i<OH_MAX_EVENTCATEGORY; i++) { | 3786 | |
0 | if (strcasecmp(buffer->Data, eventcategory_strings[i].str) == 0) { | 3787 | |
0 | found++; | 3788 | |
0 | break; | 3789 | |
} | 3790 | ||
} | 3791 | ||
3792 | |||
0 | if (found) { | 3793 | |
0 | *type = eventcategory_strings[i].entity_type; | 3794 | |
} | 3795 | ||
else { | 3796 | ||
0 | return(SA_ERR_HPI_INVALID_DATA); | 3797 | |
} | 3798 | ||
3799 | |||
0 | return(SA_OK); | 3800 | |
} | 3801 | ||
3802 |