Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / net-snmp / man / default_store.3.top
1 .TH DEFAULT_STORE 3 "25 Jun 2002" VVERSIONINFO "Net-SNMP"
2 .UC 5
3 .SH NAME
4 default_store \- generic storage of global data.
5 .SH SYNOPSIS
6 .B #include <net-snmp/net-snmp-config.h>
7 .br
8 .B #include <net-snmp/config_api.h>
9
10 .BI "int netsnmp_ds_set_boolean(int " store ", int " which ", int " val ");"
11 .br
12 .BI "int netsnmp_ds_get_boolean(int " store ", int " which ");"
13 .br
14 .BI "int netsnmp_ds_set_int(int " store ", int " which ", int " val ");"
15 .br
16 .BI "int netsnmp_ds_get_int(int " store ", int " which ");"
17 .br
18 .BI "int netsnmp_ds_set_string(int " store ", int " which ", "
19 .br
20 .BI "                          const char *" val ");"
21 .br
22 .BI "char *netsnmp_ds_get_string(int " store ", int " which ");"
23 .br
24 .BI "int netsnmp_ds_register_config(u_char " type ", "
25 .br
26 .BI "                               const char *" ftype ","
27 .br
28 .BI "                               const char *" token ","
29 .br
30 .BI "                               int " store ", int " which ");"
31 .br
32 .BI "int netsnmp_ds_register_premib(u_char " type ", "
33 .br
34 .BI "                               const char *" ftype ","
35 .br
36 .BI "                               const char *" token ","
37 .br
38 .BI "                               int " store ", int " which ");"
39 .br
40 .BI "void netsnmp_ds_shutdown(void);"
41 .fi
42 .SH DESCRIPTION
43 The purpose of the default storage is three-fold:
44 .IP 1)
45 To create a global storage space without creating a whole bunch of
46 globally accessible variables or a whole bunch of access functions to
47 work with more privately restricted variables.
48 .IP 2)
49 To provide a single location where the thread locking needs to be
50 implemented. At the time of this writing, however, thread locking is not
51 yet in place.
52 .IP 3)
53 To reduce the number of cross dependencies between code pieces that
54 may or may not be linked together in the long run. This provides for a
55 single location in which configuration data, for example, can be
56 stored for a separate section of code that may not be linked in to
57 the application in question.
58 .PP
59 The functions defined here implement these goals.
60 .PP
61 Currently, three data types are supported: booleans, integers, and
62 strings. Each of these data types have separate storage
63 spaces. In addition, the storage space for each data type is divided
64 further by the application level.   Currently, there are two storage
65 spaces. The first is reserved for the SNMP library itself. The second 
66 is intended for use in applications and is not modified or checked by
67 the library, and, therefore, this is the space usable by you.
68 .PP
69 You can think of these storage spaces as being 3 arrays, something
70 like bool_storage[storeid][which], int_storage[storeid][which], and
71 string_storage[storeid][which].  The data is then accessed through the 
72 functions defined below.  For data you wish to store, you should use a 
73 .I store
74 parameter of
75 .BR NETSNMP_DS_APPLICATION_ID .
76 .PP
77 The storage space used by the library (for which the 
78 .I store
79 parameter is
80 .BR NETSNMP_DS_LIBRARY_ID )
81 is defined in the default_store.h file, which currently contains the 
82 following defines: 
83 .PP
84 .nf