~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to local/mib2c-conf.d/mfd-data-access.m2c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 22:20:23 UTC
  • mto: (1.4.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20070510222023-3fr07xb9i17xvq32
Tags: upstream-5.3.1
ImportĀ upstreamĀ versionĀ 5.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
##//#########################################################  -*- c -*-
2
2
##//generic include for XXX. Do not use directly.
3
3
##
4
 
##//$Id: mfd-data-access.m2c,v 1.12 2004/10/08 23:39:17 rstory Exp $
 
4
##//$Id: mfd-data-access.m2c,v 1.17 2005/09/27 15:54:26 rstory Exp $
5
5
##//####################################################################
6
6
##//####################################################################
7
7
##
13
13
@eval $hack = "Id"@
14
14
/*
15
15
 * Note: this file originally auto-generated by mib2c using
16
 
 *       version $Revision: 1.12 $ of $RCSfile: mfd-data-access.m2c,v $
 
16
 *       version $Revision: 1.17 $ of $RCSfile: mfd-data-access.m2c,v $
17
17
 *
18
18
 * $$hack:$
19
19
 */
20
20
@if $m2c_mark_boundary == 1@
21
 
/** START code generated by $RCSfile: mfd-data-access.m2c,v $ $Revision: 1.12 $ */
 
21
/** START code generated by $RCSfile: mfd-data-access.m2c,v $ $Revision: 1.17 $ */
22
22
@end@
23
23
@eval $m2c_save = "$name"@
24
24
@eval $name = "${name}_DATA_ACCESS"@
36
36
@    include m2c_setup_table.m2i@
37
37
@    include details-table.m2i@
38
38
 
39
 
@    eval $m2c_tmp=""@
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
 
39
##@    eval $m2c_tmp=""@
 
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
44
44
 
45
 
    int ${context}_init_data(${context}_registration_ptr ${context}_reg);
 
45
    int ${context}_init_data(${context}_registration * ${context}_reg);
46
46
 
47
47
@    include mfd-access-${m2c_table_access}-defines.m2i@
48
48
    int ${context}_row_prep( ${context}_rowreq_ctx *rowreq_ctx);
 
49
 
 
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
49
62
@end@
50
63
 
51
64
@eval $m2c_save = "$name"@
59
72
@open ${name}_data_access.c@
60
73
/*
61
74
 * Note: this file originally auto-generated by mib2c using
62
 
 *       version $Revision: 1.12 $ of $RCSfile: mfd-data-access.m2c,v $ 
 
75
 *       version $Revision: 1.17 $ of $RCSfile: mfd-data-access.m2c,v $ 
63
76
 *
64
77
 * $$hack:$
65
78
 */
91
104
 * @retval MFD_ERROR   : unrecoverable error.
92
105
 */
93
106
int
94
 
${context}_init_data(${context}_registration_ptr ${context}_reg)
 
107
${context}_init_data(${context}_registration * ${context}_reg)
95
108
{
96
109
    DEBUGMSGTL(("verbose:${context}:${context}_init_data","called\n"));
97
110
 
147
160
    return MFD_SUCCESS;
148
161
} /* ${context}_row_prep */
149
162
 
 
163
##//####################################################################
 
164
@  if ($m2c_table_row_creation == 1) || ($m2c_table_persistent == 1)@
 
165
/*
 
166
 * TODO:420:r: Implement $context index validation.
 
167
 */
 
168
@    foreach $node externalindex@
 
169
@        include m2c_setup_node.m2i@
 
170
@        if $m2c_report_progress == 1@
 
171
@           print | |   +-> Processing index $node@
 
172
@        end@
 
173
@        include details-node.m2i@
 
174
/**
 
175
 * check validity of ${node} external index portion
 
176
 *
 
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.
 
180
 *
 
181
 * @retval MFD_SUCCESS   : the incoming value is legal
 
182
 * @retval MFD_ERROR     : the incoming value is NOT legal
 
183
 */
 
184
int
 
185
${context}_${node}_check_index( ${context}_rowreq_ctx *rowreq_ctx )
 
186
{
 
187
    DEBUGMSGTL(("verbose:${context}:${context}_${node}_check_index","called\n"));
 
188
 
 
189
    netsnmp_assert(NULL != rowreq_ctx);
 
190
 
 
191
    /*
 
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.
 
195
     */
 
196
 
 
197
    return MFD_SUCCESS; /*  external index $node ok */
 
198
} /* ${context}_${node}_check_index */
 
199
 
 
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@
 
205
@        end@
 
206
@        include details-node.m2i@
 
207
/**
 
208
 * check validity of ${node} index portion
 
209
 *
 
210
 * @retval MFD_SUCCESS   : the incoming value is legal
 
211
 * @retval MFD_ERROR     : the incoming value is NOT legal
 
212
 *
 
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.
 
216
 *
 
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
 
223
 *       available then.
 
224
 *
 
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"@
 
231
@    else@
 
232
@        eval $m2c_tmp_ns = "length"@
 
233
@    end@
 
234
 *    The $m2c_tmp_ns is in (one of) the range set(s): $m2c_evals
 
235
@end@
 
236
 *
 
237
 * If there a no other checks you need to do, simply return MFD_SUCCESS.
 
238
 */
 
239
int
 
240
${node}_check_index( ${context}_rowreq_ctx *rowreq_ctx )
 
241
{
 
242
    DEBUGMSGTL(("verbose:${context}:${node}_check_index","called\n"));
 
243
 
 
244
    netsnmp_assert(NULL != rowreq_ctx);
 
245
 
 
246
    /*
 
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)
 
250
     */
 
251
 
 
252
    return MFD_SUCCESS; /* $node index ok */
 
253
} /* ${node}_check_index */
 
254
 
 
255
@    end@ # foreach internalindex
 
256
/**
 
257
 * verify specified index is valid.
 
258
 *
 
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
 
262
 * checked.
 
263
 *
 
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
 
267
 * here.
 
268
 * 
 
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
 
275
 *       available then.
 
276
 *
 
277
 *
 
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
 
285
 */
 
286
int
 
287
${context}_validate_index( ${context}_registration * ${context}_reg,
 
288
                           ${context}_rowreq_ctx *rowreq_ctx)
 
289
{
 
290
    int rc = MFD_SUCCESS;
 
291
 
 
292
    DEBUGMSGTL(("verbose:${context}:${context}_validate_index","called\n"));
 
293
 
 
294
    /** we should have a non-NULL pointer */
 
295
    netsnmp_assert( NULL != rowreq_ctx );
 
296
 
 
297
    /*
 
298
     * TODO:430:M: |-> Validate potential $context index.
 
299
     */
 
300
    if(1) {
 
301
        snmp_log(LOG_WARNING,"invalid index for a new row in the "
 
302
                 "${context} table.\n");
 
303
        /*
 
304
         * determine failure type.
 
305
         *
 
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.
 
310
         */
 
311
        if(0) {
 
312
            return MFD_CANNOT_CREATE_EVER;
 
313
        }
 
314
        else {
 
315
            return MFD_CANNOT_CREATE_NOW;
 
316
        }
 
317
    }
 
318
 
 
319
    return rc;
 
320
} /* ${context}_validate_index */
 
321
 
 
322
@  end@ # persistent/row creation
150
323
@end@
151
324
##
152
325
/** @} */
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 $ */
156
329
@end@
157
330
@eval $m2c_processing_type = "$mfd_data_access_processing_type"@