added files
[bcm963xx.git] / userapps / opensource / net-snmp / perl / default_store / default_store.xs
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4
5 #include <net-snmp/library/default_store.h>
6
7 static int
8 not_here(char *s)
9 {
10     croak("%s not implemented on this architecture", s);
11     return -1;
12 }
13
14 static double
15 constant_NETSNMP_DS_S(char *name, int len, int arg)
16 {
17     if (12 + 12 >= len ) {
18         errno = EINVAL;
19         return 0;
20     }
21     switch (name[12 + 12]) {
22     case '1':
23         if (strEQ(name + 12, "NMP_VERSION_1")) {        /* NETSNMP_DS_S removed */
24 #ifdef NETSNMP_DS_SNMP_VERSION_1
25             return NETSNMP_DS_SNMP_VERSION_1;
26 #else
27             goto not_there;
28 #endif
29         }
30     case '2':
31         if (strEQ(name + 12, "NMP_VERSION_2c")) {       /* NETSNMP_DS_S removed */
32 #ifdef NETSNMP_DS_SNMP_VERSION_2c
33             return NETSNMP_DS_SNMP_VERSION_2c;
34 #else
35             goto not_there;
36 #endif
37         }
38     case '3':
39         if (strEQ(name + 12, "NMP_VERSION_3")) {        /* NETSNMP_DS_S removed */
40 #ifdef NETSNMP_DS_SNMP_VERSION_3
41             return NETSNMP_DS_SNMP_VERSION_3;
42 #else
43             goto not_there;
44 #endif
45         }
46     }
47     errno = EINVAL;
48     return 0;
49
50 not_there:
51     errno = ENOENT;
52     return 0;
53 }
54
55 static double
56 constant_NETSNMP_DS_LIB_N(char *name, int len, int arg)
57 {
58     switch (name[16 + 0]) {
59     case 'O':
60         if (strEQ(name + 16, "O_TOKEN_WARNINGS")) {     /* NETSNMP_DS_LIB_N removed */
61 #ifdef NETSNMP_DS_LIB_NO_TOKEN_WARNINGS
62             return NETSNMP_DS_LIB_NO_TOKEN_WARNINGS;
63 #else
64             goto not_there;
65 #endif
66         }
67     case 'U':
68         if (strEQ(name + 16, "UMERIC_TIMETICKS")) {     /* NETSNMP_DS_LIB_N removed */
69 #ifdef NETSNMP_DS_LIB_NUMERIC_TIMETICKS
70             return NETSNMP_DS_LIB_NUMERIC_TIMETICKS;
71 #else
72             goto not_there;
73 #endif
74         }
75     }
76     errno = EINVAL;
77     return 0;
78
79 not_there:
80     errno = ENOENT;
81     return 0;
82 }
83
84 static double
85 constant_NETSNMP_DS_LIB_O(char *name, int len, int arg)
86 {
87     switch (name[16 + 0]) {
88     case 'I':
89         if (strEQ(name + 16, "ID_OUTPUT_FORMAT")) {     /* NETSNMP_DS_LIB_O removed */
90 #ifdef NETSNMP_DS_LIB_OID_OUTPUT_FORMAT
91             return NETSNMP_DS_LIB_OID_OUTPUT_FORMAT;
92 #else
93             goto not_there;
94 #endif
95         }
96     case 'P':
97         if (strEQ(name + 16, "PTIONALCONFIG")) {        /* NETSNMP_DS_LIB_O removed */
98 #ifdef NETSNMP_DS_LIB_OPTIONALCONFIG
99             return NETSNMP_DS_LIB_OPTIONALCONFIG;
100 #else
101             goto not_there;
102 #endif
103         }
104     }
105     errno = EINVAL;
106     return 0;
107
108 not_there:
109     errno = ENOENT;
110     return 0;
111 }
112
113 static double
114 constant_NETSNMP_DS_LIB_PRINT_N(char *name, int len, int arg)
115 {
116     if (22 + 7 >= len ) {
117         errno = EINVAL;
118         return 0;
119     }
120     switch (name[22 + 7]) {
121     case 'E':
122         if (strEQ(name + 22, "UMERIC_ENUM")) {  /* NETSNMP_DS_LIB_PRINT_N removed */
123 #ifdef NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM
124             return NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM;
125 #else
126             goto not_there;
127 #endif
128         }
129     case 'O':
130         if (strEQ(name + 22, "UMERIC_OIDS")) {  /* NETSNMP_DS_LIB_PRINT_N removed */
131 #ifdef NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS
132             return NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS;
133 #else
134             goto not_there;
135 #endif
136         }
137     }
138     errno = EINVAL;
139     return 0;
140
141 not_there:
142     errno = ENOENT;
143     return 0;
144 }
145
146 static double
147 constant_NETSNMP_DS_LIB_PRIN(char *name, int len, int arg)
148 {
149     if (19 + 2 >= len ) {
150         errno = EINVAL;
151         return 0;
152     }
153     switch (name[19 + 2]) {
154     case 'B':
155         if (strEQ(name + 19, "T_BARE_VALUE")) { /* NETSNMP_DS_LIB_PRIN removed */
156 #ifdef NETSNMP_DS_LIB_PRINT_BARE_VALUE
157             return NETSNMP_DS_LIB_PRINT_BARE_VALUE;
158 #else
159             goto not_there;
160 #endif
161         }
162     case 'F':
163         if (strEQ(name + 19, "T_FULL_OID")) {   /* NETSNMP_DS_LIB_PRIN removed */
164 #ifdef NETSNMP_DS_LIB_PRINT_FULL_OID
165             return NETSNMP_DS_LIB_PRINT_FULL_OID;
166 #else
167             goto not_there;
168 #endif
169         }
170     case 'H':
171         if (strEQ(name + 19, "T_HEX_TEXT")) {   /* NETSNMP_DS_LIB_PRIN removed */
172 #ifdef NETSNMP_DS_LIB_PRINT_HEX_TEXT
173             return NETSNMP_DS_LIB_PRINT_HEX_TEXT;
174 #else
175             goto not_there;
176 #endif
177         }
178     case 'N':
179         if (!strnEQ(name + 19,"T_", 2))
180             break;
181         return constant_NETSNMP_DS_LIB_PRINT_N(name, len, arg);
182     case 'S':
183         if (strEQ(name + 19, "T_SUFFIX_ONLY")) {        /* NETSNMP_DS_LIB_PRIN removed */
184 #ifdef NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY
185             return NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY;
186 #else
187             goto not_there;
188 #endif
189         }
190     case 'U':
191         if (strEQ(name + 19, "T_UCD_STYLE_OID")) {      /* NETSNMP_DS_LIB_PRIN removed */
192 #ifdef NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID
193             return NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID;
194 #else
195             goto not_there;
196 #endif
197         }
198     }
199     errno = EINVAL;
200     return 0;
201
202 not_there:
203     errno = ENOENT;
204     return 0;
205 }
206
207 static double
208 constant_NETSNMP_DS_LIB_PR(char *name, int len, int arg)
209 {
210     if (17 + 1 >= len ) {
211         errno = EINVAL;
212         return 0;
213     }
214     switch (name[17 + 1]) {
215     case 'N':
216         if (!strnEQ(name + 17,"I", 1))
217             break;
218         return constant_NETSNMP_DS_LIB_PRIN(name, len, arg);
219     case 'V':
220         if (strEQ(name + 17, "IVPASSPHRASE")) { /* NETSNMP_DS_LIB_PR removed */
221 #ifdef NETSNMP_DS_LIB_PRIVPASSPHRASE
222             return NETSNMP_DS_LIB_PRIVPASSPHRASE;
223 #else
224             goto not_there;
225 #endif
226         }
227     }
228     errno = EINVAL;
229     return 0;
230
231 not_there:
232     errno = ENOENT;
233     return 0;
234 }
235
236 static double
237 constant_NETSNMP_DS_LIB_P(char *name, int len, int arg)
238 {
239     switch (name[16 + 0]) {
240     case 'A':
241         if (strEQ(name + 16, "ASSPHRASE")) {    /* NETSNMP_DS_LIB_P removed */
242 #ifdef NETSNMP_DS_LIB_PASSPHRASE
243             return NETSNMP_DS_LIB_PASSPHRASE;
244 #else
245             goto not_there;
246 #endif
247         }
248     case 'E':
249         if (strEQ(name + 16, "ERSISTENT_DIR")) {        /* NETSNMP_DS_LIB_P removed */
250 #ifdef NETSNMP_DS_LIB_PERSISTENT_DIR
251             return NETSNMP_DS_LIB_PERSISTENT_DIR;
252 #else
253             goto not_there;
254 #endif
255         }
256     case 'R':
257         return constant_NETSNMP_DS_LIB_PR(name, len, arg);
258     }
259     errno = EINVAL;
260     return 0;
261
262 not_there:
263     errno = ENOENT;
264     return 0;
265 }
266
267 static double
268 constant_NETSNMP_DS_LIB_Q(char *name, int len, int arg)
269 {
270     if (16 + 4 >= len ) {
271         errno = EINVAL;
272         return 0;
273     }
274     switch (name[16 + 4]) {
275     case 'E':
276         if (strEQ(name + 16, "UICKE_PRINT")) {  /* NETSNMP_DS_LIB_Q removed */
277 #ifdef NETSNMP_DS_LIB_QUICKE_PRINT
278             return NETSNMP_DS_LIB_QUICKE_PRINT;
279 #else
280             goto not_there;
281 #endif
282         }
283     case '_':
284         if (strEQ(name + 16, "UICK_PRINT")) {   /* NETSNMP_DS_LIB_Q removed */
285 #ifdef NETSNMP_DS_LIB_QUICK_PRINT
286             return NETSNMP_DS_LIB_QUICK_PRINT;
287 #else
288             goto not_there;
289 #endif
290         }
291     }
292     errno = EINVAL;
293     return 0;
294
295 not_there:
296     errno = ENOENT;
297     return 0;
298 }
299
300 static double
301 constant_NETSNMP_DS_LIB_A(char *name, int len, int arg)
302 {
303     switch (name[16 + 0]) {
304     case 'L':
305         if (strEQ(name + 16, "LARM_DONT_USE_SIG")) {    /* NETSNMP_DS_LIB_A removed */
306 #ifdef NETSNMP_DS_LIB_ALARM_DONT_USE_SIG
307             return NETSNMP_DS_LIB_ALARM_DONT_USE_SIG;
308 #else
309             goto not_there;
310 #endif
311         }
312     case 'P':
313         if (strEQ(name + 16, "PPTYPE")) {       /* NETSNMP_DS_LIB_A removed */
314 #ifdef NETSNMP_DS_LIB_APPTYPE
315             return NETSNMP_DS_LIB_APPTYPE;
316 #else
317             goto not_there;
318 #endif
319         }
320     case 'U':
321         if (strEQ(name + 16, "UTHPASSPHRASE")) {        /* NETSNMP_DS_LIB_A removed */
322 #ifdef NETSNMP_DS_LIB_AUTHPASSPHRASE
323             return NETSNMP_DS_LIB_AUTHPASSPHRASE;
324 #else
325             goto not_there;
326 #endif
327         }
328     }
329     errno = EINVAL;
330     return 0;
331
332 not_there:
333     errno = ENOENT;
334     return 0;
335 }
336
337 static double
338 constant_NETSNMP_DS_LIB_RE(char *name, int len, int arg)
339 {
340     switch (name[17 + 0]) {
341     case 'A':
342         if (strEQ(name + 17, "AD_UCD_STYLE_OID")) {     /* NETSNMP_DS_LIB_RE removed */
343 #ifdef NETSNMP_DS_LIB_READ_UCD_STYLE_OID
344             return NETSNMP_DS_LIB_READ_UCD_STYLE_OID;
345 #else
346             goto not_there;
347 #endif
348         }
349     case 'G':
350         if (strEQ(name + 17, "GEX_ACCESS")) {   /* NETSNMP_DS_LIB_RE removed */
351 #ifdef NETSNMP_DS_LIB_REGEX_ACCESS
352             return NETSNMP_DS_LIB_REGEX_ACCESS;
353 #else
354             goto not_there;
355 #endif
356         }
357     case 'V':
358         if (strEQ(name + 17, "VERSE_ENCODE")) { /* NETSNMP_DS_LIB_RE removed */
359 #ifdef NETSNMP_DS_LIB_REVERSE_ENCODE
360             return NETSNMP_DS_LIB_REVERSE_ENCODE;
361 #else
362             goto not_there;
363 #endif
364         }
365     }
366     errno = EINVAL;
367     return 0;
368
369 not_there:
370     errno = ENOENT;
371     return 0;
372 }
373
374 static double
375 constant_NETSNMP_DS_LIB_R(char *name, int len, int arg)
376 {
377     switch (name[16 + 0]) {
378     case 'A':
379         if (strEQ(name + 16, "ANDOM_ACCESS")) { /* NETSNMP_DS_LIB_R removed */
380 #ifdef NETSNMP_DS_LIB_RANDOM_ACCESS
381             return NETSNMP_DS_LIB_RANDOM_ACCESS;
382 #else
383             goto not_there;
384 #endif
385         }
386     case 'E':
387         return constant_NETSNMP_DS_LIB_RE(name, len, arg);
388     }
389     errno = EINVAL;
390     return 0;
391
392 not_there:
393     errno = ENOENT;
394     return 0;
395 }
396
397 static double
398 constant_NETSNMP_DS_LIB_SE(char *name, int len, int arg)
399 {
400     if (17 + 1 >= len ) {
401         errno = EINVAL;
402         return 0;
403     }
404     switch (name[17 + 1]) {
405     case 'L':
406         if (strEQ(name + 17, "CLEVEL")) {       /* NETSNMP_DS_LIB_SE removed */
407 #ifdef NETSNMP_DS_LIB_SECLEVEL
408             return NETSNMP_DS_LIB_SECLEVEL;
409 #else
410             goto not_there;
411 #endif
412         }
413     case 'M':
414         if (strEQ(name + 17, "CMODEL")) {       /* NETSNMP_DS_LIB_SE removed */
415 #ifdef NETSNMP_DS_LIB_SECMODEL
416             return NETSNMP_DS_LIB_SECMODEL;
417 #else
418             goto not_there;
419 #endif
420         }
421     case 'N':
422         if (strEQ(name + 17, "CNAME")) {        /* NETSNMP_DS_LIB_SE removed */
423 #ifdef NETSNMP_DS_LIB_SECNAME
424             return NETSNMP_DS_LIB_SECNAME;
425 #else
426             goto not_there;
427 #endif
428         }
429     }
430     errno = EINVAL;
431     return 0;
432
433 not_there:
434     errno = ENOENT;
435     return 0;
436 }
437
438 static double
439 constant_NETSNMP_DS_LIB_S(char *name, int len, int arg)
440 {
441     switch (name[16 + 0]) {
442     case 'A':
443         if (strEQ(name + 16, "AVE_MIB_DESCRS")) {       /* NETSNMP_DS_LIB_S removed */
444 #ifdef NETSNMP_DS_LIB_SAVE_MIB_DESCRS
445             return NETSNMP_DS_LIB_SAVE_MIB_DESCRS;
446 #else
447             goto not_there;
448 #endif
449         }
450     case 'E':
451         return constant_NETSNMP_DS_LIB_SE(name, len, arg);
452     case 'N':
453         if (strEQ(name + 16, "NMPVERSION")) {   /* NETSNMP_DS_LIB_S removed */
454 #ifdef NETSNMP_DS_LIB_SNMPVERSION
455             return NETSNMP_DS_LIB_SNMPVERSION;
456 #else
457             goto not_there;
458 #endif
459         }
460     }
461     errno = EINVAL;
462     return 0;
463
464 not_there:
465     errno = ENOENT;
466     return 0;
467 }
468
469 static double
470 constant_NETSNMP_DS_LIB_CON(char *name, int len, int arg)
471 {
472     switch (name[18 + 0]) {
473     case 'F':
474         if (strEQ(name + 18, "FIGURATION_DIR")) {       /* NETSNMP_DS_LIB_CON removed */
475 #ifdef NETSNMP_DS_LIB_CONFIGURATION_DIR
476             return NETSNMP_DS_LIB_CONFIGURATION_DIR;
477 #else
478             goto not_there;
479 #endif
480         }
481     case 'T':
482         if (strEQ(name + 18, "TEXT")) { /* NETSNMP_DS_LIB_CON removed */
483 #ifdef NETSNMP_DS_LIB_CONTEXT
484             return NETSNMP_DS_LIB_CONTEXT;
485 #else
486             goto not_there;
487 #endif
488         }
489     }
490     errno = EINVAL;
491     return 0;
492
493 not_there:
494     errno = ENOENT;
495     return 0;
496 }
497
498 static double
499 constant_NETSNMP_DS_LIB_C(char *name, int len, int arg)
500 {
501     if (16 + 1 >= len ) {
502         errno = EINVAL;
503         return 0;
504     }
505     switch (name[16 + 1]) {
506     case 'M':
507         if (strEQ(name + 16, "OMMUNITY")) {     /* NETSNMP_DS_LIB_C removed */
508 #ifdef NETSNMP_DS_LIB_COMMUNITY
509             return NETSNMP_DS_LIB_COMMUNITY;
510 #else
511             goto not_there;
512 #endif
513         }
514     case 'N':
515         if (!strnEQ(name + 16,"O", 1))
516             break;
517         return constant_NETSNMP_DS_LIB_CON(name, len, arg);
518     }
519     errno = EINVAL;
520     return 0;
521
522 not_there:
523     errno = ENOENT;
524     return 0;
525 }
526
527 static double
528 constant_NETSNMP_DS_LIB_DO(char *name, int len, int arg)
529 {
530     if (17 + 3 >= len ) {
531         errno = EINVAL;
532         return 0;
533     }
534     switch (name[17 + 3]) {
535     case 'B':
536         if (strEQ(name + 17, "NT_BREAKDOWN_OIDS")) {    /* NETSNMP_DS_LIB_DO removed */
537 #ifdef NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS
538             return NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS;
539 #else
540             goto not_there;
541 #endif
542         }
543     case 'C':
544         if (strEQ(name + 17, "NT_CHECK_RANGE")) {       /* NETSNMP_DS_LIB_DO removed */
545 #ifdef NETSNMP_DS_LIB_DONT_CHECK_RANGE
546             return NETSNMP_DS_LIB_DONT_CHECK_RANGE;
547 #else
548             goto not_there;
549 #endif
550         }
551     case 'R':
552         if (strEQ(name + 17, "NT_READ_CONFIGS")) {      /* NETSNMP_DS_LIB_DO removed */
553 #ifdef NETSNMP_DS_LIB_DONT_READ_CONFIGS
554             return NETSNMP_DS_LIB_DONT_READ_CONFIGS;
555 #else
556             goto not_there;
557 #endif
558         }
559     }
560     errno = EINVAL;
561     return 0;
562
563 not_there:
564     errno = ENOENT;
565     return 0;
566 }
567
568 static double
569 constant_NETSNMP_DS_LIB_D(char *name, int len, int arg)
570 {
571     switch (name[16 + 0]) {
572     case 'E':
573         if (strEQ(name + 16, "EFAULT_PORT")) {  /* NETSNMP_DS_LIB_D removed */
574 #ifdef NETSNMP_DS_LIB_DEFAULT_PORT
575             return NETSNMP_DS_LIB_DEFAULT_PORT;
576 #else
577             goto not_there;
578 #endif
579         }
580     case 'O':
581         return constant_NETSNMP_DS_LIB_DO(name, len, arg);
582     case 'U':
583         if (strEQ(name + 16, "UMP_PACKET")) {   /* NETSNMP_DS_LIB_D removed */
584 #ifdef NETSNMP_DS_LIB_DUMP_PACKET
585             return NETSNMP_DS_LIB_DUMP_PACKET;
586 #else
587             goto not_there;
588 #endif
589         }
590     }
591     errno = EINVAL;
592     return 0;
593
594 not_there:
595     errno = ENOENT;
596     return 0;
597 }
598
599 static double
600 constant_NETSNMP_DS_LIB_E(char *name, int len, int arg)
601 {
602     switch (name[16 + 0]) {
603     case 'S':
604         if (strEQ(name + 16, "SCAPE_QUOTES")) { /* NETSNMP_DS_LIB_E removed */
605 #ifdef NETSNMP_DS_LIB_ESCAPE_QUOTES
606             return NETSNMP_DS_LIB_ESCAPE_QUOTES;
607 #else
608             goto not_there;
609 #endif
610         }
611     case 'X':
612         if (strEQ(name + 16, "XTENDED_INDEX")) {        /* NETSNMP_DS_LIB_E removed */
613 #ifdef NETSNMP_DS_LIB_EXTENDED_INDEX
614             return NETSNMP_DS_LIB_EXTENDED_INDEX;
615 #else
616             goto not_there;
617 #endif
618         }
619     }
620     errno = EINVAL;
621     return 0;
622
623 not_there:
624     errno = ENOENT;
625     return 0;
626 }
627
628 static double
629 constant_NETSNMP_DS_LIB_H(char *name, int len, int arg)
630 {
631     if (16 + 9 >= len ) {
632         errno = EINVAL;
633         return 0;
634     }
635     switch (name[16 + 9]) {
636     case 'C':
637         if (strEQ(name + 16, "AVE_READ_CONFIG")) {      /* NETSNMP_DS_LIB_H removed */
638 #ifdef NETSNMP_DS_LIB_HAVE_READ_CONFIG
639             return NETSNMP_DS_LIB_HAVE_READ_CONFIG;
640 #else
641             goto not_there;
642 #endif
643         }
644     case 'P':
645         if (strEQ(name + 16, "AVE_READ_PREMIB_CONFIG")) {       /* NETSNMP_DS_LIB_H removed */
646 #ifdef NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG
647             return NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG;
648 #else
649             goto not_there;
650 #endif
651         }
652     }
653     errno = EINVAL;
654     return 0;
655
656 not_there:
657     errno = ENOENT;
658     return 0;
659 }
660
661 static double
662 constant_NETSNMP_DS_LIB_MIB_(char *name, int len, int arg)
663 {
664     switch (name[19 + 0]) {
665     case 'C':
666         if (strEQ(name + 19, "COMMENT_TERM")) { /* NETSNMP_DS_LIB_MIB_ removed */
667 #ifdef NETSNMP_DS_LIB_MIB_COMMENT_TERM
668             return NETSNMP_DS_LIB_MIB_COMMENT_TERM;
669 #else
670             goto not_there;
671 #endif
672         }
673     case 'E':
674         if (strEQ(name + 19, "ERRORS")) {       /* NETSNMP_DS_LIB_MIB_ removed */
675 #ifdef NETSNMP_DS_LIB_MIB_ERRORS
676             return NETSNMP_DS_LIB_MIB_ERRORS;
677 #else
678             goto not_there;
679 #endif
680         }
681     case 'P':
682         if (strEQ(name + 19, "PARSE_LABEL")) {  /* NETSNMP_DS_LIB_MIB_ removed */
683 #ifdef NETSNMP_DS_LIB_MIB_PARSE_LABEL
684             return NETSNMP_DS_LIB_MIB_PARSE_LABEL;
685 #else
686             goto not_there;
687 #endif
688         }
689     case 'R':
690         if (strEQ(name + 19, "REPLACE")) {      /* NETSNMP_DS_LIB_MIB_ removed */
691 #ifdef NETSNMP_DS_LIB_MIB_REPLACE
692             return NETSNMP_DS_LIB_MIB_REPLACE;
693 #else
694             goto not_there;
695 #endif
696         }
697     case 'W':
698         if (strEQ(name + 19, "WARNINGS")) {     /* NETSNMP_DS_LIB_MIB_ removed */
699 #ifdef NETSNMP_DS_LIB_MIB_WARNINGS
700             return NETSNMP_DS_LIB_MIB_WARNINGS;
701 #else
702             goto not_there;
703 #endif
704         }
705     }
706     errno = EINVAL;
707     return 0;
708
709 not_there:
710     errno = ENOENT;
711     return 0;
712 }
713
714 static double
715 constant_NETSNMP_DS_LIB_M(char *name, int len, int arg)
716 {
717     if (16 + 2 >= len ) {
718         errno = EINVAL;
719         return 0;
720     }
721     switch (name[16 + 2]) {
722     case 'D':
723         if (strEQ(name + 16, "IBDIRS")) {       /* NETSNMP_DS_LIB_M removed */
724 #ifdef NETSNMP_DS_LIB_MIBDIRS
725             return NETSNMP_DS_LIB_MIBDIRS;
726 #else
727             goto not_there;
728 #endif
729         }
730     case '_':
731         if (!strnEQ(name + 16,"IB", 2))
732             break;
733         return constant_NETSNMP_DS_LIB_MIB_(name, len, arg);
734     }
735     errno = EINVAL;
736     return 0;
737
738 not_there:
739     errno = ENOENT;
740     return 0;
741 }
742
743 static double
744 constant_NETSNMP_DS_LIB_(char *name, int len, int arg)
745 {
746     switch (name[15 + 0]) {
747     case 'A':
748         return constant_NETSNMP_DS_LIB_A(name, len, arg);
749     case 'C':
750         return constant_NETSNMP_DS_LIB_C(name, len, arg);
751     case 'D':
752         return constant_NETSNMP_DS_LIB_D(name, len, arg);
753     case 'E':
754         return constant_NETSNMP_DS_LIB_E(name, len, arg);
755     case 'H':
756         return constant_NETSNMP_DS_LIB_H(name, len, arg);
757     case 'L':
758         if (strEQ(name + 15, "LOG_TIMESTAMP")) {        /* NETSNMP_DS_LIB_ removed */
759 #ifdef NETSNMP_DS_LIB_LOG_TIMESTAMP
760             return NETSNMP_DS_LIB_LOG_TIMESTAMP;
761 #else
762             goto not_there;
763 #endif
764         }
765     case 'M':
766         return constant_NETSNMP_DS_LIB_M(name, len, arg);
767     case 'N':
768         return constant_NETSNMP_DS_LIB_N(name, len, arg);
769     case 'O':
770         return constant_NETSNMP_DS_LIB_O(name, len, arg);
771     case 'P':
772         return constant_NETSNMP_DS_LIB_P(name, len, arg);
773     case 'Q':
774         return constant_NETSNMP_DS_LIB_Q(name, len, arg);
775     case 'R':
776         return constant_NETSNMP_DS_LIB_R(name, len, arg);
777     case 'S':
778         return constant_NETSNMP_DS_LIB_S(name, len, arg);
779     }
780     errno = EINVAL;
781     return 0;
782
783 not_there:
784     errno = ENOENT;
785     return 0;
786 }
787
788 static double
789 constant_NETSNMP_DS_L(char *name, int len, int arg)
790 {
791     if (12 + 2 >= len ) {
792         errno = EINVAL;
793         return 0;
794     }
795     switch (name[12 + 2]) {
796     case 'R':
797         if (strEQ(name + 12, "IBRARY_ID")) {    /* NETSNMP_DS_L removed */
798 #ifdef NETSNMP_DS_LIBRARY_ID
799             return NETSNMP_DS_LIBRARY_ID;
800 #else
801             goto not_there;
802 #endif
803         }
804     case '_':
805         if (!strnEQ(name + 12,"IB", 2))
806             break;
807         return constant_NETSNMP_DS_LIB_(name, len, arg);
808     }
809     errno = EINVAL;
810     return 0;
811
812 not_there:
813     errno = ENOENT;
814     return 0;
815 }
816
817 static double
818 constant_NETSNMP_DS_M(char *name, int len, int arg)
819 {
820     if (12 + 3 >= len ) {
821         errno = EINVAL;
822         return 0;
823     }
824     switch (name[12 + 3]) {
825     case 'I':
826         if (strEQ(name + 12, "AX_IDS")) {       /* NETSNMP_DS_M removed */
827 #ifdef NETSNMP_DS_MAX_IDS
828             return NETSNMP_DS_MAX_IDS;
829 #else
830             goto not_there;
831 #endif
832         }
833     case 'S':
834         if (strEQ(name + 12, "AX_SUBIDS")) {    /* NETSNMP_DS_M removed */
835 #ifdef NETSNMP_DS_MAX_SUBIDS
836             return NETSNMP_DS_MAX_SUBIDS;
837 #else
838             goto not_there;
839 #endif
840         }
841     }
842     errno = EINVAL;
843     return 0;
844
845 not_there:
846     errno = ENOENT;
847     return 0;
848 }
849
850 static double
851 constant(char *name, int len, int arg)
852 {
853     errno = 0;
854     if (0 + 11 >= len ) {
855         errno = EINVAL;
856         return 0;
857     }
858     switch (name[0 + 11]) {
859     case 'A':
860         if (strEQ(name + 0, "NETSNMP_DS_APPLICATION_ID")) {     /*  removed */
861 #ifdef NETSNMP_DS_APPLICATION_ID
862             return NETSNMP_DS_APPLICATION_ID;
863 #else
864             goto not_there;
865 #endif
866         }
867     case 'L':
868         if (!strnEQ(name + 0,"NETSNMP_DS_", 11))
869             break;
870         return constant_NETSNMP_DS_L(name, len, arg);
871     case 'M':
872         if (!strnEQ(name + 0,"NETSNMP_DS_", 11))
873             break;
874         return constant_NETSNMP_DS_M(name, len, arg);
875     case 'S':
876         if (!strnEQ(name + 0,"NETSNMP_DS_", 11))
877             break;
878         return constant_NETSNMP_DS_S(name, len, arg);
879     case 'T':
880         if (strEQ(name + 0, "NETSNMP_DS_TOKEN_ID")) {   /*  removed */
881 #ifdef NETSNMP_DS_TOKEN_ID
882             return NETSNMP_DS_TOKEN_ID;
883 #else
884             goto not_there;
885 #endif
886         }
887     }
888     errno = EINVAL;
889     return 0;
890
891 not_there:
892     errno = ENOENT;
893     return 0;
894 }
895
896
897 MODULE = NetSNMP::default_store         PACKAGE = NetSNMP::default_store                
898
899
900 double
901 constant(sv,arg)
902     PREINIT:
903         STRLEN          len;
904     INPUT:
905         SV *            sv
906         char *          s = SvPV(sv, len);
907         int             arg
908     CODE:
909         RETVAL = constant(s,len,arg);
910     OUTPUT:
911         RETVAL
912
913 int
914 netsnmp_ds_get_boolean(storeid, which)
915         int     storeid
916         int     which
917
918 int
919 netsnmp_ds_get_int(storeid, which)
920         int     storeid
921         int     which
922
923 char *
924 netsnmp_ds_get_string(storeid, which)
925         int     storeid
926         int     which
927
928 void *
929 netsnmp_ds_get_void(storeid, which)
930         int     storeid
931         int     which
932
933 int
934 netsnmp_ds_register_config(type, ftype, token, storeid, which)
935         unsigned char   type
936         const char *    ftype
937         const char *    token
938         int     storeid
939         int     which
940
941 int
942 netsnmp_ds_register_premib(type, ftype, token, storeid, which)
943         unsigned char   type
944         const char *    ftype
945         const char *    token
946         int     storeid
947         int     which
948
949 int
950 netsnmp_ds_set_boolean(storeid, which, value)
951         int     storeid
952         int     which
953         int     value
954
955 int
956 netsnmp_ds_set_int(storeid, which, value)
957         int     storeid
958         int     which
959         int     value
960
961 int
962 netsnmp_ds_set_string(storeid, which, value)
963         int     storeid
964         int     which
965         const char *    value
966
967 int
968 netsnmp_ds_set_void(storeid, which, value)
969         int     storeid
970         int     which
971         void *  value
972
973 void
974 netsnmp_ds_shutdown()
975
976 int
977 netsnmp_ds_toggle_boolean(storeid, which)
978         int     storeid
979         int     which