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