net-snmp 5.7
|
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); 00056 int se_add_pair(unsigned int major, unsigned int minor, 00057 char *label, int value); 00058 00059 /* 00060 * finds a list of enums in a list of enum structs associated by a name. 00061 */ 00062 /* 00063 * find a list, and then operate on that list 00064 * ( direct methods further below if you already have the list pointer) 00065 */ 00066 NETSNMP_IMPORT 00067 char *se_find_label_in_slist(const char *listname, 00068 int value); 00069 NETSNMP_IMPORT 00070 int se_find_value_in_slist(const char *listname, 00071 const char *label); 00072 int se_find_free_value_in_slist(const char *listname); 00078 NETSNMP_IMPORT 00079 int se_add_pair_to_slist(const char *listname, char *label, 00080 int value); 00081 00082 /* 00083 * operates directly on a possibly external list 00084 */ 00085 char *se_find_label_in_list(struct snmp_enum_list *list, 00086 int value); 00087 int se_find_value_in_list(struct snmp_enum_list *list, 00088 const char *label); 00089 int se_find_free_value_in_list(struct snmp_enum_list *list); 00090 int se_add_pair_to_list(struct snmp_enum_list **list, 00091 char *label, int value); 00092 00093 /* 00094 * Persistent enumeration lists 00095 */ 00096 void se_store_enum_list(struct snmp_enum_list *new_list, 00097 const char *token, char *type); 00098 void se_store_list(unsigned int major, unsigned int minor, char *type); 00099 void se_clear_slist(const char *listname); 00100 void se_store_slist(const char *listname, char *type); 00101 int se_store_slist_callback(int majorID, int minorID, 00102 void *serverargs, void *clientargs); 00103 void se_read_conf(const char *word, char *cptr); 00108 NETSNMP_IMPORT 00109 void clear_snmp_enum(void); 00110 00111 #ifdef __cplusplus 00112 } 00113 #endif 00114 #endif /* SNMP_ENUM_H */