net-snmp 5.7
ucd_compat.c
00001 /*
00002  * For compatibility with applications built using
00003  * previous versions of the UCD library only.
00004  */
00005 
00006 #include <net-snmp/net-snmp-config.h>
00007 #include <net-snmp/net-snmp-features.h>
00008 
00009 #include <net-snmp/types.h>
00010 #include <net-snmp/session_api.h>
00011 #include <net-snmp/config_api.h>
00012 #include <net-snmp/library/mib.h>       /* for OID O/P format enums */
00013 #include <net-snmp/library/ucd_compat.h>
00014 
00015 netsnmp_feature_child_of(ucd_compatibility, libnetsnmp)
00016 
00017 #ifndef NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY
00018 /*
00019  * use <netsnmp_session *)->s_snmp_errno instead 
00020  */
00021 int
00022 snmp_get_errno(void)
00023 {
00024     return SNMPERR_SUCCESS;
00025 }
00026 
00027 /*
00028  * synch_reset and synch_setup are no longer used. 
00029  */
00030 NETSNMP_IMPORT void snmp_synch_reset(netsnmp_session * notused);
00031 void
00032 snmp_synch_reset(netsnmp_session * notused)
00033 {
00034 }
00035 NETSNMP_IMPORT void snmp_synch_setup(netsnmp_session * notused);
00036 void
00037 snmp_synch_setup(netsnmp_session * notused)
00038 {
00039 }
00040 
00041 
00042 void
00043 snmp_set_dump_packet(int x)
00044 {
00045     netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
00046                            NETSNMP_DS_LIB_DUMP_PACKET, x);
00047 }
00048 
00049 int
00050 snmp_get_dump_packet(void)
00051 {
00052     return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
00053                                   NETSNMP_DS_LIB_DUMP_PACKET);
00054 }
00055 
00056 void
00057 snmp_set_quick_print(int x)
00058 {
00059     netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
00060                            NETSNMP_DS_LIB_QUICK_PRINT, x);
00061 }
00062 
00063 int
00064 snmp_get_quick_print(void)
00065 {
00066     return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
00067                                   NETSNMP_DS_LIB_QUICK_PRINT);
00068 }
00069 
00070 
00071 void
00072 snmp_set_suffix_only(int x)
00073 {
00074     netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
00075                        NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, x);
00076 }
00077 
00078 int
00079 snmp_get_suffix_only(void)
00080 {
00081     return netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
00082                               NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
00083 }
00084 
00085 void
00086 snmp_set_full_objid(int x)
00087 {
00088     netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
00089                                               NETSNMP_OID_OUTPUT_FULL);
00090 }
00091 
00092 int
00093 snmp_get_full_objid(void)
00094 {
00095     return (NETSNMP_OID_OUTPUT_FULL ==
00096         netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT));
00097 }
00098 
00099 void
00100 snmp_set_random_access(int x)
00101 {
00102     netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
00103                            NETSNMP_DS_LIB_RANDOM_ACCESS, x);
00104 }
00105 
00106 int
00107 snmp_get_random_access(void)
00108 {
00109     return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
00110                                   NETSNMP_DS_LIB_RANDOM_ACCESS);
00111 }
00112 
00113 void
00114 snmp_set_mib_errors(int err)
00115 {
00116     netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
00117                            NETSNMP_DS_LIB_MIB_ERRORS, err);
00118 }
00119 
00120 void
00121 snmp_set_mib_warnings(int warn)
00122 {
00123     netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
00124                        NETSNMP_DS_LIB_MIB_WARNINGS, warn);
00125 }
00126 
00127 void
00128 snmp_set_save_descriptions(int save)
00129 {
00130     netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
00131                            NETSNMP_DS_LIB_SAVE_MIB_DESCRS, save);
00132 }
00133 
00134 void
00135 snmp_set_mib_comment_term(int save)
00136 {
00137     /*
00138      * 0=strict, 1=EOL terminated 
00139      */
00140     netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
00141                            NETSNMP_DS_LIB_MIB_COMMENT_TERM, save);
00142 }
00143 
00144 void
00145 snmp_set_mib_parse_label(int save)
00146 {
00147     /*
00148      * 0=strict, 1=underscore OK in label 
00149      */
00150     netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
00151                            NETSNMP_DS_LIB_MIB_PARSE_LABEL, save);
00152 }
00153 
00154 int
00155 ds_set_boolean          (int storeid, int which, int value)
00156 {
00157   return netsnmp_ds_set_boolean(storeid, which, value);
00158 }
00159 
00160 int
00161 ds_get_boolean          (int storeid, int which)
00162 {
00163   return netsnmp_ds_get_boolean(storeid, which);
00164 }
00165 
00166 int
00167 ds_toggle_boolean       (int storeid, int which)
00168 {
00169   return netsnmp_ds_toggle_boolean(storeid, which);
00170 }
00171 
00172 int
00173 ds_set_int              (int storeid, int which, int value)
00174 {
00175   return netsnmp_ds_set_int(storeid, which, value);
00176 }
00177 
00178 int
00179 ds_get_int              (int storeid, int which)
00180 {
00181   return netsnmp_ds_get_int(storeid, which);
00182 }
00183 
00184 
00185 int
00186 ds_set_string           (int storeid, int which, const char *value)
00187 {
00188   return netsnmp_ds_set_string(storeid, which, value);
00189 }
00190 
00191 char *
00192 ds_get_string           (int storeid, int which)
00193 {
00194   return netsnmp_ds_get_string(storeid, which);
00195 }
00196 
00197 int
00198 ds_set_void             (int storeid, int which, void *value)
00199 {
00200   return netsnmp_ds_set_void(storeid, which, value);
00201 }
00202 
00203 void *
00204 ds_get_void             (int storeid, int which)
00205 {
00206   return netsnmp_ds_get_void(storeid, which);
00207 }
00208 
00209 int
00210 ds_register_config      (u_char type, const char *ftype,
00211                          const char *token, int storeid, int which)
00212 {
00213   return netsnmp_ds_register_config(type, ftype, token, storeid, which);
00214 }
00215 
00216 int
00217 ds_register_premib      (u_char type, const char *ftype,
00218                          const char *token, int storeid, int which)
00219 {
00220   return netsnmp_ds_register_premib(type, ftype, token, storeid, which);
00221 }
00222 
00223 void
00224 ds_shutdown             (void)
00225 {
00226   netsnmp_ds_shutdown();
00227 }
00228 #else /* !NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY */
00229 netsnmp_feature_unused(ucd_compatibility);
00230 #endif /* !NETSNMP_FEATURE_REMOVE_UCD_COMPATIBILITY */