and added files
[bcm963xx.git] / userapps / opensource / net-snmp / include / net-snmp / library / snmp_enum.h
1 #ifndef SNMP_ENUM_H
2 #define SNMP_ENUM_H
3
4 #ifdef __cplusplus
5 extern          "C" {
6 #endif
7
8     struct snmp_enum_list {
9         struct snmp_enum_list *next;
10         int             value;
11         char           *label;
12     };
13
14 #define SE_MAX_IDS 5
15 #define SE_MAX_SUBIDS 32        /* needs to be a multiple of 8 */
16
17     /*
18      * begin storage definitions 
19      */
20     /*
21      * These definitions correspond with the "storid" argument to the API 
22      */
23 #define SE_LIBRARY_ID     0
24 #define SE_MIB_ID         1
25 #define SE_APPLICATION_ID 2
26 #define SE_ASSIGNED_ID    3
27
28     /*
29      * library specific enum locations 
30      */
31
32     /*
33      * error codes 
34      */
35 #define SE_OK            0
36 #define SE_NOMEM         1
37 #define SE_ALREADY_THERE 2
38 #define SE_DNE           -2
39
40     int             init_snmp_enum(void);
41     struct snmp_enum_list *se_find_list(unsigned int major,
42                                         unsigned int minor);
43     int             se_store_list(struct snmp_enum_list *,
44                                   unsigned int major, unsigned int minor);
45     struct snmp_enum_list *se_find_list(unsigned int major,
46                                         unsigned int minor);
47     int             se_find_value(unsigned int major, unsigned int minor,
48                                   char *label);
49     char           *se_find_label(unsigned int major, unsigned int minor,
50                                   int value);
51     int             se_add_pair(unsigned int major, unsigned int minor,
52                                 char *label, int value);
53
54     /*
55      * finds a list of enums in a list of enum structs associated by a name. 
56      */
57     /*
58      * not as fast as the above routines, since two lists must be traversed. 
59      */
60     char           *se_find_label_in_slist(const char *listname,
61                                            int value);
62     int             se_find_value_in_slist(const char *listname,
63                                            char *label);
64     int             se_add_pair_to_slist(const char *listname, char *label,
65                                          int value);
66
67     /*
68      * operates directly on a possibly external list 
69      */
70     char           *se_find_label_in_list(struct snmp_enum_list *list,
71                                           int value);
72     int             se_find_value_in_list(struct snmp_enum_list *list,
73                                           char *label);
74     int             se_add_pair_to_list(struct snmp_enum_list **list,
75                                         char *label, int value);
76
77
78 #ifdef __cplusplus
79 }
80 #endif
81 #endif                          /* SNMP_ENUM_H */