net-snmp 5.7
Data Structures | Typedefs | Functions
storage space for defaults
The Net-SNMP library

The purpose of the default storage is three-fold: More...

Data Structures

struct  netsnmp_ds_read_config_s

Typedefs

typedef struct
netsnmp_ds_read_config_s 
netsnmp_ds_read_config

Functions

 netsnmp_feature_child_of (default_store_all, libnetsnmp)
void netsnmp_ds_handle_config (const char *token, char *line)
int netsnmp_ds_set_boolean (int storeid, int which, int value)
 Stores "true" or "false" given an int value for value into netsnmp_ds_booleans[store][which] slot.
int netsnmp_ds_toggle_boolean (int storeid, int which)
int netsnmp_ds_get_boolean (int storeid, int which)
int netsnmp_ds_set_int (int storeid, int which, int value)
int netsnmp_ds_get_int (int storeid, int which)
int netsnmp_ds_set_string (int storeid, int which, const char *value)
char * netsnmp_ds_get_string (int storeid, int which)
int netsnmp_ds_set_void (int storeid, int which, void *value)
void * netsnmp_ds_get_void (int storeid, int which)
int netsnmp_ds_parse_boolean (char *line)
int netsnmp_ds_register_config (u_char type, const char *ftype, const char *token, int storeid, int which)
int netsnmp_ds_register_premib (u_char type, const char *ftype, const char *token, int storeid, int which)
void netsnmp_ds_shutdown (void)

Detailed Description

The purpose of the default storage is three-fold:

1) To create a global storage space without creating a whole bunch of globally accessible variables or a whole bunch of access functions to work with more privately restricted variables.

2) To provide a single location where the thread lock- ing needs to be implemented. At the time of this writing, however, thread locking is not yet in place.

3) To reduce the number of cross dependencies between code pieces that may or may not be linked together in the long run. This provides for a single loca- tion in which configuration data, for example, can be stored for a separate section of code that may not be linked in to the application in question.

The functions defined here implement these goals.

Currently, three data types are supported: booleans, inte- gers, and strings. Each of these data types have separate storage spaces. In addition, the storage space for each data type is divided further by the application level. Currently, there are two storage spaces. The first is reserved for the SNMP library itself. The second is intended for use in applications and is not modified or checked by the library, and, therefore, this is the space usable by you.

These definitions correspond with the "storid" argument to the API

These definitions correspond with the "which" argument to the API, when the storeid argument is NETSNMP_DS_LIBRARY_ID

library booleans

library integers

library strings


Function Documentation

int netsnmp_ds_set_boolean ( int  storeid,
int  which,
int  value 
)

Stores "true" or "false" given an int value for value into netsnmp_ds_booleans[store][which] slot.

Parameters:
storeidan index to the boolean storage container's first index(store)
whichan index to the boolean storage container's second index(which)
valueif > 0, "true" is set into the slot otherwise "false"
Returns:
Returns SNMPPERR_GENERR if the storeid and which parameters do not correspond to a valid slot, or SNMPERR_SUCCESS otherwise.

Definition at line 208 of file default_store.c.