36
36
@ include m2c_setup_table.m2i@
37
37
@ include details-table.m2i@
40
@ foreach $node index@
41
@ include m2c_setup_node.m2i@
42
@ eval $m2c_tmp="$m2c_tmp, $m2c_node_param_val"@
43
@ end@ // for each index
40
##@ foreach $node index@
41
##@ include m2c_setup_node.m2i@
42
##@ eval $m2c_tmp="$m2c_tmp, $m2c_node_param_val"@
43
##@ end@ // for each index
45
int ${context}_init_data(${context}_registration_ptr ${context}_reg);
45
int ${context}_init_data(${context}_registration * ${context}_reg);
47
47
@ include mfd-access-${m2c_table_access}-defines.m2i@
48
48
int ${context}_row_prep( ${context}_rowreq_ctx *rowreq_ctx);
50
@ if ($m2c_table_row_creation == 1) || ($m2c_table_persistent == 1)@
51
int ${context}_validate_index( ${context}_registration * ${context}_reg,
52
${context}_rowreq_ctx *rowreq_ctx);
53
@ foreach $node externalindex@
54
@ include m2c_setup_node.m2i@
55
int ${context}_${node}_check_index( ${context}_rowreq_ctx *rowreq_ctx ); /* external */
56
@ end@ # foreach externalindex
57
@ foreach $node internalindex@
58
@ include m2c_setup_node.m2i@
59
int ${node}_check_index( ${context}_rowreq_ctx *rowreq_ctx ); /* internal */
60
@ end@ # foreach internalindex
61
@ end@ # row creation/persistent
51
64
@eval $m2c_save = "$name"@
147
160
return MFD_SUCCESS;
148
161
} /* ${context}_row_prep */
163
##//####################################################################
164
@ if ($m2c_table_row_creation == 1) || ($m2c_table_persistent == 1)@
166
* TODO:420:r: Implement $context index validation.
168
@ foreach $node externalindex@
169
@ include m2c_setup_node.m2i@
170
@ if $m2c_report_progress == 1@
171
@ print | | +-> Processing index $node@
173
@ include details-node.m2i@
175
* check validity of ${node} external index portion
177
* NOTE: this is not the place to do any checks for the sanity
178
* of multiple indexes. Those types of checks should be done in the
179
* ${context}_validate_index() function.
181
* @retval MFD_SUCCESS : the incoming value is legal
182
* @retval MFD_ERROR : the incoming value is NOT legal
185
${context}_${node}_check_index( ${context}_rowreq_ctx *rowreq_ctx )
187
DEBUGMSGTL(("verbose:${context}:${context}_${node}_check_index","called\n"));
189
netsnmp_assert(NULL != rowreq_ctx);
192
* TODO:424:M: |-> Check $context external index $node.
193
* check that index value in the table context (rowreq_ctx)
194
* for the external index $node is legal.
197
return MFD_SUCCESS; /* external index $node ok */
198
} /* ${context}_${node}_check_index */
200
@ end@ # foreach externalindex
201
@ foreach $node internalindex@
202
@ include m2c_setup_node.m2i@
203
@ if $m2c_report_progress == 1@
204
@ print | | +-> Processing index $node@
206
@ include details-node.m2i@
208
* check validity of ${node} index portion
210
* @retval MFD_SUCCESS : the incoming value is legal
211
* @retval MFD_ERROR : the incoming value is NOT legal
213
* @note this is not the place to do any checks for the sanity
214
* of multiple indexes. Those types of checks should be done in the
215
* ${context}_validate_index() function.
217
* @note Also keep in mind that if the index refers to a row in this or
218
* some other table, you can't check for that row here to make
219
* decisions, since that row might not be created yet, but may
220
* be created during the processing this request. If you have
221
* such checks, they should be done in the check_dependencies
222
* function, because any new/deleted/changed rows should be
225
* The following checks have already been done for you:
226
@if $node.enums == 1@
227
* The value is one of $m2c_evals
228
@elsif $node.ranges == 1@
229
@ if ("$node.decl" eq "long") || ("$node.decl" eq "u_long")@
230
@ eval $m2c_tmp_ns = "value"@
232
@ eval $m2c_tmp_ns = "length"@
234
* The $m2c_tmp_ns is in (one of) the range set(s): $m2c_evals
237
* If there a no other checks you need to do, simply return MFD_SUCCESS.
240
${node}_check_index( ${context}_rowreq_ctx *rowreq_ctx )
242
DEBUGMSGTL(("verbose:${context}:${node}_check_index","called\n"));
244
netsnmp_assert(NULL != rowreq_ctx);
247
* TODO:426:M: |-> Check $context index $node.
248
* check that index value in the table context is legal.
249
* (rowreq_ctx->tbl_index.$node)
252
return MFD_SUCCESS; /* $node index ok */
253
} /* ${node}_check_index */
255
@ end@ # foreach internalindex
257
* verify specified index is valid.
259
* This check is independent of whether or not the values specified for
260
* the columns of the new row are valid. Column values and row consistency
261
* will be checked later. At this point, only the index values should be
264
* All of the individual index validation functions have been called, so this
265
* is the place to make sure they are valid as a whole when combined. If
266
* you only have one index, then you probably don't need to do anything else
269
* @note Keep in mind that if the indexes refer to a row in this or
270
* some other table, you can't check for that row here to make
271
* decisions, since that row might not be created yet, but may
272
* be created during the processing this request. If you have
273
* such checks, they should be done in the check_dependencies
274
* function, because any new/deleted/changed rows should be
278
* @param ${context}_reg
279
* Pointer to the user registration data
280
* @param ${context}_rowreq_ctx
281
* Pointer to the users context.
282
* @retval MFD_SUCCESS : success
283
* @retval MFD_CANNOT_CREATE_NOW : index not valid right now
284
* @retval MFD_CANNOT_CREATE_EVER : index never valid
287
${context}_validate_index( ${context}_registration * ${context}_reg,
288
${context}_rowreq_ctx *rowreq_ctx)
290
int rc = MFD_SUCCESS;
292
DEBUGMSGTL(("verbose:${context}:${context}_validate_index","called\n"));
294
/** we should have a non-NULL pointer */
295
netsnmp_assert( NULL != rowreq_ctx );
298
* TODO:430:M: |-> Validate potential $context index.
301
snmp_log(LOG_WARNING,"invalid index for a new row in the "
302
"${context} table.\n");
304
* determine failure type.
306
* If the index could not ever be created, return MFD_NOT_EVER
307
* If the index can not be created under the present circumstances
308
* (even though it could be created under other circumstances),
309
* return MFD_NOT_NOW.
312
return MFD_CANNOT_CREATE_EVER;
315
return MFD_CANNOT_CREATE_NOW;
320
} /* ${context}_validate_index */
322
@ end@ # persistent/row creation
153
326
##//####################################################################
154
327
@if $m2c_mark_boundary == 1@
155
/** END code generated by $RCSfile: mfd-data-access.m2c,v $ $Revision: 1.12 $ */
328
/** END code generated by $RCSfile: mfd-data-access.m2c,v $ $Revision: 1.17 $ */
157
330
@eval $m2c_processing_type = "$mfd_data_access_processing_type"@