1 /*
2 * For compatibility with applications built using
3 * previous versions of the UCD library only.
4 */
5
6 #define UCD_COMPATIBLE
7
8 #include <net-snmp/net-snmp-config.h>
9 #include <net-snmp/net-snmp-features.h>
10
11 #include <net-snmp/types.h>
12 #include <net-snmp/session_api.h>
13 #include <net-snmp/config_api.h>
14 #include <net-snmp/library/mib.h> /* for OID O/P format enums */
15 #include <net-snmp/library/ucd_compat.h>
16
17 #include <ucd-snmp/default_store.h>
18
19 netsnmp_feature_child_of(ucd_compatibility, libnetsnmp);
20
21 #ifndef NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY
22 /*
23 * use <netsnmp_session *)->s_snmp_errno instead
24 */
25 int
snmp_get_errno(void)26 snmp_get_errno(void)
27 {
28 return SNMPERR_SUCCESS;
29 }
30
31 /*
32 * synch_reset and synch_setup are no longer used.
33 */
34 NETSNMP_IMPORT void snmp_synch_reset(netsnmp_session * notused);
35 void
snmp_synch_reset(netsnmp_session * notused)36 snmp_synch_reset(netsnmp_session * notused)
37 {
38 }
39 NETSNMP_IMPORT void snmp_synch_setup(netsnmp_session * notused);
40 void
snmp_synch_setup(netsnmp_session * notused)41 snmp_synch_setup(netsnmp_session * notused)
42 {
43 }
44
45
46 void
snmp_set_dump_packet(int x)47 snmp_set_dump_packet(int x)
48 {
49 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
50 NETSNMP_DS_LIB_DUMP_PACKET, x);
51 }
52
53 int
snmp_get_dump_packet(void)54 snmp_get_dump_packet(void)
55 {
56 return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
57 NETSNMP_DS_LIB_DUMP_PACKET);
58 }
59
60 void
snmp_set_quick_print(int x)61 snmp_set_quick_print(int x)
62 {
63 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
64 NETSNMP_DS_LIB_QUICK_PRINT, x);
65 }
66
67 int
snmp_get_quick_print(void)68 snmp_get_quick_print(void)
69 {
70 return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
71 NETSNMP_DS_LIB_QUICK_PRINT);
72 }
73
74
75 void
snmp_set_suffix_only(int x)76 snmp_set_suffix_only(int x)
77 {
78 netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
79 NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, x);
80 }
81
82 int
snmp_get_suffix_only(void)83 snmp_get_suffix_only(void)
84 {
85 return netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
86 NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
87 }
88
89 void
snmp_set_full_objid(int x)90 snmp_set_full_objid(int x)
91 {
92 netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
93 NETSNMP_OID_OUTPUT_FULL);
94 }
95
96 int
snmp_get_full_objid(void)97 snmp_get_full_objid(void)
98 {
99 return (NETSNMP_OID_OUTPUT_FULL ==
100 netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT));
101 }
102
103 void
snmp_set_random_access(int x)104 snmp_set_random_access(int x)
105 {
106 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
107 NETSNMP_DS_LIB_RANDOM_ACCESS, x);
108 }
109
110 int
snmp_get_random_access(void)111 snmp_get_random_access(void)
112 {
113 return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
114 NETSNMP_DS_LIB_RANDOM_ACCESS);
115 }
116
117 void
snmp_set_mib_errors(int err)118 snmp_set_mib_errors(int err)
119 {
120 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
121 NETSNMP_DS_LIB_MIB_ERRORS, err);
122 }
123
124 void
snmp_set_mib_warnings(int warn)125 snmp_set_mib_warnings(int warn)
126 {
127 netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
128 NETSNMP_DS_LIB_MIB_WARNINGS, warn);
129 }
130
131 void
snmp_set_save_descriptions(int save)132 snmp_set_save_descriptions(int save)
133 {
134 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
135 NETSNMP_DS_LIB_SAVE_MIB_DESCRS, save);
136 }
137
138 void
snmp_set_mib_comment_term(int save)139 snmp_set_mib_comment_term(int save)
140 {
141 /*
142 * 0=strict, 1=EOL terminated
143 */
144 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
145 NETSNMP_DS_LIB_MIB_COMMENT_TERM, save);
146 }
147
148 void
snmp_set_mib_parse_label(int save)149 snmp_set_mib_parse_label(int save)
150 {
151 /*
152 * 0=strict, 1=underscore OK in label
153 */
154 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
155 NETSNMP_DS_LIB_MIB_PARSE_LABEL, save);
156 }
157
158 int
ds_set_boolean(int storeid,int which,int value)159 ds_set_boolean (int storeid, int which, int value)
160 {
161 return netsnmp_ds_set_boolean(storeid, which, value);
162 }
163
164 int
ds_get_boolean(int storeid,int which)165 ds_get_boolean (int storeid, int which)
166 {
167 return netsnmp_ds_get_boolean(storeid, which);
168 }
169
170 int
ds_toggle_boolean(int storeid,int which)171 ds_toggle_boolean (int storeid, int which)
172 {
173 return netsnmp_ds_toggle_boolean(storeid, which);
174 }
175
176 int
ds_set_int(int storeid,int which,int value)177 ds_set_int (int storeid, int which, int value)
178 {
179 return netsnmp_ds_set_int(storeid, which, value);
180 }
181
182 int
ds_get_int(int storeid,int which)183 ds_get_int (int storeid, int which)
184 {
185 return netsnmp_ds_get_int(storeid, which);
186 }
187
188
189 int
ds_set_string(int storeid,int which,const char * value)190 ds_set_string (int storeid, int which, const char *value)
191 {
192 return netsnmp_ds_set_string(storeid, which, value);
193 }
194
195 char *
ds_get_string(int storeid,int which)196 ds_get_string (int storeid, int which)
197 {
198 return netsnmp_ds_get_string(storeid, which);
199 }
200
201 int
ds_set_void(int storeid,int which,void * value)202 ds_set_void (int storeid, int which, void *value)
203 {
204 return netsnmp_ds_set_void(storeid, which, value);
205 }
206
207 void *
ds_get_void(int storeid,int which)208 ds_get_void (int storeid, int which)
209 {
210 return netsnmp_ds_get_void(storeid, which);
211 }
212
213 int
ds_register_config(u_char type,const char * ftype,const char * token,int storeid,int which)214 ds_register_config (u_char type, const char *ftype,
215 const char *token, int storeid, int which)
216 {
217 return netsnmp_ds_register_config(type, ftype, token, storeid, which);
218 }
219
220 int
ds_register_premib(u_char type,const char * ftype,const char * token,int storeid,int which)221 ds_register_premib (u_char type, const char *ftype,
222 const char *token, int storeid, int which)
223 {
224 return netsnmp_ds_register_premib(type, ftype, token, storeid, which);
225 }
226
227 void
ds_shutdown(void)228 ds_shutdown (void)
229 {
230 netsnmp_ds_shutdown();
231 }
232 #else /* !NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY */
233 netsnmp_feature_unused(ucd_compatibility);
234 #endif /* !NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY */
235