net-snmp
5.4.1
|
00001 #ifndef SNMP_ENUM_H 00002 #define SNMP_ENUM_H 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 struct snmp_enum_list { 00009 struct snmp_enum_list *next; 00010 int value; 00011 char *label; 00012 }; 00013 00014 #define SE_MAX_IDS 5 00015 #define SE_MAX_SUBIDS 32 /* needs to be a multiple of 8 */ 00016 00017 /* 00018 * begin storage definitions 00019 */ 00020 /* 00021 * These definitions correspond with the "storid" argument to the API 00022 */ 00023 #define SE_LIBRARY_ID 0 00024 #define SE_MIB_ID 1 00025 #define SE_APPLICATION_ID 2 00026 #define SE_ASSIGNED_ID 3 00027 00028 /* 00029 * library specific enum locations 00030 */ 00031 00032 /* 00033 * error codes 00034 */ 00035 #define SE_OK 0 00036 #define SE_NOMEM 1 00037 #define SE_ALREADY_THERE 2 00038 #define SE_DNE -2 00039 00040 int init_snmp_enum(const char *type); 00041 struct snmp_enum_list *se_find_list(unsigned int major, 00042 unsigned int minor); 00043 struct snmp_enum_list *se_find_slist(const char *listname); 00044 int se_store_in_list(struct snmp_enum_list *, 00045 unsigned int major, unsigned int minor); 00046 int se_find_value(unsigned int major, unsigned int minor, 00047 const char *label); 00048 int se_find_free_value(unsigned int major, unsigned int minor); 00049 char *se_find_label(unsigned int major, unsigned int minor, 00050 int value); 00051 int se_add_pair(unsigned int major, unsigned int minor, 00052 char *label, int value); 00053 00054 /* 00055 * finds a list of enums in a list of enum structs associated by a name. 00056 */ 00057 /* 00058 * find a list, and then operate on that list 00059 * ( direct methods further below if you already have the list pointer) 00060 */ 00061 char *se_find_label_in_slist(const char *listname, 00062 int value); 00063 int se_find_value_in_slist(const char *listname, 00064 const char *label); 00065 int se_find_free_value_in_slist(const char *listname); 00066 int se_add_pair_to_slist(const char *listname, char *label, 00067 int value); 00068 00069 /* 00070 * operates directly on a possibly external list 00071 */ 00072 char *se_find_label_in_list(struct snmp_enum_list *list, 00073 int value); 00074 int se_find_value_in_list(struct snmp_enum_list *list, 00075 const char *label); 00076 int se_find_free_value_in_list(struct snmp_enum_list *list); 00077 int se_add_pair_to_list(struct snmp_enum_list **list, 00078 char *label, int value); 00079 00080 /* 00081 * Persistent enumeration lists 00082 */ 00083 void se_store_enum_list(struct snmp_enum_list *new_list, 00084 const char *token, char *type); 00085 void se_store_list(unsigned int major, unsigned int minor, char *type); 00086 void se_store_slist(const char *listname, char *type); 00087 int se_store_slist_callback(int majorID, int minorID, 00088 void *serverargs, void *clientargs); 00089 void se_read_conf(const char *word, char *cptr); 00090 void clear_snmp_enum(void); 00091 00092 #ifdef __cplusplus 00093 } 00094 #endif 00095 #endif /* SNMP_ENUM_H */