summaryrefslogtreecommitdiff
path: root/local/mib2c-conf.d/mfd-interactive-setup.m2c
blob: e3d3d559d02f1be19538059ce577bbce65e00e47 (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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#######################################################################
## generic include for XXX. Do not use directly.
##
## $Id$
########################################################################
@if $m2c_mark_boundary == 1@
/** START code generated by $RCSfile$ $Revision$ */
@end@
########################################################################
@eval $m2c_temp_writable = table_is_writable($context)@
@eval $m2c_temp_create = table_has_create($context)@
@eval $m2c_temp_dependencies = $m2c_temp_writable@
@eval $m2c_temp_context_reg = "$mfd_default_context_reg"@
@eval $m2c_temp_data_context = "$mfd_default_data_context"@
@eval $m2c_temp_data_allocate = $mfd_default_data_allocate@
@eval $m2c_temp_data_cache = $mfd_default_data_cache@
@eval $m2c_temp_undo_embed = $mfd_default_undo_embed@
@eval $m2c_temp_data_init = $mfd_default_data_init@
@eval $m2c_temp_persistent = $m2c_temp_writable@
@eval $m2c_temp_table_access = "$mfd_default_table_access"@
@eval $m2c_temp_data_transient = $mfd_default_data_transient@
@eval $m2c_temp_include_examples = $mfd_default_include_examples@
@eval $m2c_temp_table_skip_mapping = $mfd_default_table_skip_mapping@
@eval $m2c_temp_table_sparse = $mfd_default_data_sparse@
@eval $m2c_temp_generate_makefile = $mfd_default_generate_makefile@
@eval $m2c_temp_generate_subagent = $mfd_default_generate_subagent@
##
@if $mfd_interactive_setup != 0@
@open -@
@   if $mfd_interactive_setup != -1@
There are no defaults for ${context}. Would you like to

  1) Accept hard-coded defaults
  2) Set defaults now [DEFAULT]

@     eval $ans = 2@
@     prompt $ans Select your choice : @
@   else@
@      eval $ans = 2@
@   end@
@   if $ans == 1@
@   else@


## ---------------------------------------------------
@    if $m2c_temp_writable == 1@
This table has writable columns. Do you want to generate
code for writeable columns, or restrict the table to read-only?

  1) generate code with writeable columns [DEFAULT]
  2) generate code with read-only columns

@      prompt $ans Select your choice : @
@      if $ans == 2@
@        eval $m2c_temp_writable = 0@
@        eval $m2c_temp_create = 0@
@        eval $m2c_temp_dependencies = 0@
@        eval $m2c_temp_persistent = 0@
@      end@


@    end@ # writable
## ---------------------------------------------------
@    if $m2c_temp_persistent == 1@
@        eval $m2c_temp_persistent = 0@
Since your table is writable, do you want to generate code to save and
restore rows in the Net-SNMP persistent store? You should only use this
option if the agent 'owns' the data, and doesn't get the data from an
external source.

  1) do not generate persistent store code [DEFAULT]
  2) generate persistent store code

@      prompt $ans Select your choice : @
@      if $ans == 2@
@        eval $m2c_temp_persistent = 1@
@      end@


@    end@ # persistent
## ---------------------------------------------------
@    if $m2c_temp_dependencies == 1@
@        eval $m2c_temp_dependencies = 0@
Writable tables sometimes have dependencies beteen columns
or with other tables. If there are no dependencies in this table, you
probably do not want the extra code.

  1) do not generate dependency code [DEFAULT]
  2) generate dependency code

@      prompt $ans Select your choice : @
@      if $ans == 2@
@        eval $m2c_temp_dependencies = 1@
@      end@


@    end@ # dependencies
## ---------------------------------------------------
@    if $m2c_temp_create == 1@
This table has read-create columns. Do you want to generate
code for dynamic row creation?

  1) generate code for row creation [DEFAULT]
  2) do not generate code for row creation

@      prompt $ans Select your choice : @
@      if $ans == 2@
@        eval $m2c_temp_create = 0@
@      end@


@    end@ # create
## ---------------------------------------------------
Do you want to use an existing data structure for the USER context?
This would be a structure used to track data for the entire table,
(similar to a global variable) not individual rows.  (Many
implementations won't need this, in which case the default is fine).


  1) No, use $m2c_temp_context_reg [DEFAULT]
  2) Yes, use my own structure

@      prompt $ans Select your choice : @
@      if $ans == 2@
@        prompt $m2c_temp_context_reg   Enter your USER context : @
@      end@


## ---------------------------------------------------
Do you want to use an existing data structure for the DATA context?
The DATA context holds the data for each MIB column in a given row. By
default, a new data structure will be created with an element for each
column.  If you already have a structure that holds your data, select 2.

  1) No, use $m2c_temp_data_context [DEFAULT]
  2) Yes, use my own structure

@      prompt $ans Select your choice : @
@      if $ans == 2@


Note: Do not enter a pointer type. Use the base structure name. For
example, use 'struct widget', not 'struct widget *'. If you will be
using pointer to the structure, select dynamic allocation in the
next question.

@        prompt $m2c_temp_data_context   Enter your DATA context : @
@      end@


## ---------------------------------------------------
@      if "x$m2c_temp_data_context" ne "x$mfd_default_data_context"@
Do you want to allocate your '$m2c_temp_data_context' DATA context, or
embed it directly? If your data is INTERNAL (controlled by the agent), you
probably want embedded. If your data is EXTERNAL (controlled by another
process) and you have pointers to the data, you probably want allocated.

  1) directly embed structure [DEFAULT]
  2) dynamically allocate structure

@        prompt $ans Select your choice : @
@        if $ans == 2@
@          eval $m2c_temp_data_allocate = 1@
@        end@


@      end@ # ! default (generated)
## ---------------------------------------------------
Do you need to initialize elements in the '$m2c_temp_data_context' DATA
context when a new instance is created (eg default values, or other structures
you are going to add that might need initialization to the row request context?
(The most common reasons you might need to do this is are if you want to keep
some non-MIB data for every row, or some columns have default values.)

  1) no, no initialization needed
  2) yes, initilization is needed [DEFAULT]

@        prompt $ans Select your choice : @
@        if $ans == 1@
@          eval $m2c_temp_data_init = 0@
@        end@


## ---------------------------------------------------
Do you plan on keeping all data in the format defined by the MIB? If so,
no functions will be generated to map values. If some data will be
stored in a different format, the mapping functions will be generated.
If your MIB has integers with enumerations, mapping functions are more
likely to be needed. (e.g. A TruthValue object will hold the value
1 or 2, but a C boolean would be 1 or 0.)

  1) All values will be stored as defined by the MIB [DEFAULT]
  2) I need to map values to the format defined by the MIB.

@        prompt $ans Select your choice : @
@        if $ans == 2@
@          eval $m2c_temp_table_skip_mapping = -1@
@        end@


## ---------------------------------------------------
Which method would you like to use to gather data about available rows? 

  1) container : [DEFAULT]  This access method uses a netsnmp_container
     to store all row data in memory. This method is best for:
         - Internal data (maintained by the agent)
         - Access speed is important
         - Sufficient memory exists to contain all rows

  2) container-cached : This access method uses a netsnmp_container
     to keep track of the indexes (and data, usually) for each 
     row. This method is best for:
         - External data (maintained by another process/the kernel)
         - Access speed is important
         - Sufficient memory exists to contain all indexes
     
  3) unsorted-external : This access method iterates over all of your data
     to find the row with the appropriate index. This method is good for
         - External data (maintained by another process/the kernel)
         - Using less memory is much more important than access speed
     
@      prompt $ans Select your choice : @
@      if $ans == 3@
@        eval $m2c_temp_table_access = "unsorted-external"@
@      elsif $ans == 2@
@        eval $m2c_temp_table_access = "container-cached"@
@        eval $m2c_temp_data_cache = 1@
@      else@
@        eval $m2c_temp_table_access = "container-cached"@
@        eval $m2c_temp_data_cache = 0@
@      end@


## ---------------------------------------------------
When accessing your data, is your data TRANSIENT?

  1) Yes. My data is TRANSIENT (e.g. a pointer to a static buffer that
     my be overwritten during a request) and needs to be copied during
     processing.

  2) Yes. My data is SEMI-TRANSIENT (e.g. an allocated pointer to a
     copy of the data).

  3) No, my data is PERSISTENT (e.g. an allocated pointer to the actual
     data, which is under the agent's control)
## '
  
@      prompt $ans Select your choice [DEFAULT=1] : @
@      if $ans == 3@
@        eval $m2c_temp_data_transient = 0@
@      elsif $ans == 2@
@        eval $m2c_temp_data_transient = 1@
@      else@
@        eval $m2c_temp_data_transient = 2@
@      end@


## ---------------------------------------------------
Do you want example code to be generated? This will generate example code
for reading data from a text file.

  1) generate example code [DEFAULT]
  2) do not generate example code

@      prompt $ans Select your choice : @
@      if $ans == 2@
@        eval $m2c_temp_include_examples = 0@
@      else@
@        eval $m2c_temp_include_examples = 1@
@      end@

## ---------------------------------------------------
Is your table sparse? A sparse table is a table where some
columns might not exist for all rows. Note that if your table
contains a RowStaus column and it supports createAndWait, you
will need sparse table support.

  1) No, all columns always exist for every row [DEFAULT]
  2) Yes, my table is sparse

@      prompt $ans Select your choice : @
@      if $ans == 2@
@        eval $m2c_temp_table_sparse = 1@
@      end@

## ---------------------------------------------------
Do you want a makefile and AgentX subagent source file generated?
This will let you test your table without having to link it into
snmpd. (You can still link it in later.)

  1) do not generate makefile/AgentX code [DEFAULT]
  2) generate makefile/AgentX code

@      prompt $ans Select your choice : @
@      if $ans == 2@
@        eval $m2c_temp_generate_makefile = 1@
@        eval $m2c_temp_generate_subagent = 1@
@      else@
@        eval $m2c_temp_generate_makefile = 0@
@        eval $m2c_temp_generate_subagent = 0@
@      end@

@   end@ # do not use hardcoded
@end@ # $mfd_interactive_setup == 1
##################################
##
## save values
##      Note: if you add a var here, add it in m2c_table_save_defaults.m2i too
##
@eval $m2c_context_reg = "$m2c_temp_context_reg"@
@eval $m2c_data_allocate = $m2c_temp_data_allocate@
@eval $m2c_data_cache = $m2c_temp_data_cache@
@eval $m2c_data_context = "$m2c_temp_data_context"@
@eval $m2c_data_init = $m2c_temp_data_init@
@eval $m2c_data_transient = $m2c_temp_data_transient@
@eval $m2c_include_examples = $m2c_temp_include_examples@
@eval $m2c_irreversible_commit = $m2c_irreversible_commit@
@eval $m2c_table_access = "$m2c_temp_table_access"@
@eval $m2c_table_dependencies = $m2c_temp_dependencies@
@eval $m2c_table_persistent = $m2c_temp_persistent@
@eval $m2c_table_row_creation = $m2c_temp_create@
@eval $m2c_table_settable = $m2c_temp_writable@
@eval $m2c_table_skip_mapping = $m2c_temp_table_skip_mapping@
@eval $m2c_table_sparse = $m2c_temp_table_sparse@
@eval $mfd_generate_makefile = $m2c_temp_generate_makefile@
@eval $mfd_generate_subagent = $m2c_temp_generate_subagent@
##
## write them back
##
@include m2c_table_save_defaults.m2i@
##
########################################################################
@if $m2c_mark_boundary == 1@
/** END code generated by $RCSfile$ $Revision$ */
@end@