summaryrefslogtreecommitdiff
path: root/snmplib/ucd_compat.c
blob: 64c1e13b1153516bfa5d6677b6a17672d95ba8e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/*
 * For compatibility with applications built using
 * previous versions of the UCD library only.
 */

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-features.h>

#include <net-snmp/types.h>
#include <net-snmp/session_api.h>
#include <net-snmp/config_api.h>
#include <net-snmp/library/mib.h>	/* for OID O/P format enums */
#include <net-snmp/library/ucd_compat.h>

netsnmp_feature_child_of(ucd_compatibility, libnetsnmp)

#ifndef NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY
/*
 * use <netsnmp_session *)->s_snmp_errno instead 
 */
int
snmp_get_errno(void)
{
    return SNMPERR_SUCCESS;
}

/*
 * synch_reset and synch_setup are no longer used. 
 */
NETSNMP_IMPORT void snmp_synch_reset(netsnmp_session * notused);
void
snmp_synch_reset(netsnmp_session * notused)
{
}
NETSNMP_IMPORT void snmp_synch_setup(netsnmp_session * notused);
void
snmp_synch_setup(netsnmp_session * notused)
{
}


void
snmp_set_dump_packet(int x)
{
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_DUMP_PACKET, x);
}

int
snmp_get_dump_packet(void)
{
    return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
				  NETSNMP_DS_LIB_DUMP_PACKET);
}

void
snmp_set_quick_print(int x)
{
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_QUICK_PRINT, x);
}

int
snmp_get_quick_print(void)
{
    return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
				  NETSNMP_DS_LIB_QUICK_PRINT);
}


void
snmp_set_suffix_only(int x)
{
    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
		       NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, x);
}

int
snmp_get_suffix_only(void)
{
    return netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
			      NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
}

void
snmp_set_full_objid(int x)
{
    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
                                              NETSNMP_OID_OUTPUT_FULL);
}

int
snmp_get_full_objid(void)
{
    return (NETSNMP_OID_OUTPUT_FULL ==
        netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT));
}

void
snmp_set_random_access(int x)
{
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_RANDOM_ACCESS, x);
}

int
snmp_get_random_access(void)
{
    return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
				  NETSNMP_DS_LIB_RANDOM_ACCESS);
}

void
snmp_set_mib_errors(int err)
{
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_MIB_ERRORS, err);
}

void
snmp_set_mib_warnings(int warn)
{
    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
		       NETSNMP_DS_LIB_MIB_WARNINGS, warn);
}

void
snmp_set_save_descriptions(int save)
{
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_SAVE_MIB_DESCRS, save);
}

void
snmp_set_mib_comment_term(int save)
{
    /*
     * 0=strict, 1=EOL terminated 
     */
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_MIB_COMMENT_TERM, save);
}

void
snmp_set_mib_parse_label(int save)
{
    /*
     * 0=strict, 1=underscore OK in label 
     */
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_MIB_PARSE_LABEL, save);
}

int
ds_set_boolean		(int storeid, int which, int value)
{
  return netsnmp_ds_set_boolean(storeid, which, value);
}

int
ds_get_boolean		(int storeid, int which)
{
  return netsnmp_ds_get_boolean(storeid, which);
}

int
ds_toggle_boolean	(int storeid, int which)
{
  return netsnmp_ds_toggle_boolean(storeid, which);
}

int
ds_set_int		(int storeid, int which, int value)
{
  return netsnmp_ds_set_int(storeid, which, value);
}

int
ds_get_int		(int storeid, int which)
{
  return netsnmp_ds_get_int(storeid, which);
}


int
ds_set_string		(int storeid, int which, const char *value)
{
  return netsnmp_ds_set_string(storeid, which, value);
}

char *
ds_get_string		(int storeid, int which)
{
  return netsnmp_ds_get_string(storeid, which);
}

int
ds_set_void		(int storeid, int which, void *value)
{
  return netsnmp_ds_set_void(storeid, which, value);
}

void *
ds_get_void		(int storeid, int which)
{
  return netsnmp_ds_get_void(storeid, which);
}

int
ds_register_config	(u_char type, const char *ftype,
			 const char *token, int storeid, int which)
{
  return netsnmp_ds_register_config(type, ftype, token, storeid, which);
}

int
ds_register_premib	(u_char type, const char *ftype,
			 const char *token, int storeid, int which)
{
  return netsnmp_ds_register_premib(type, ftype, token, storeid, which);
}

void
ds_shutdown		(void)
{
  netsnmp_ds_shutdown();
}
#else /* !NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY */
netsnmp_feature_unused(ucd_compatibility);
#endif /* !NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY */