blob: e3d3d559d02f1be19538059ce577bbce65e00e47 [file] [log] [blame]
#######################################################################
## 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@