generic-table-indexes-set.m2i
上传用户:wxp200602
上传日期:2007-10-30
资源大小:4028k
文件大小:4k
源码类别:
SNMP编程
开发平台:
Unix_Linux
- ############################################################# -*- c -*-
- ## generic include for XXX. Do not use directly.
- ##
- ## $Id: generic-table-indexes-set.m2i,v 1.9 2004/10/08 23:39:17 rstory Exp $
- ########################################################################
- @if $m2c_mark_boundary == 1@
- /** START code generated by $RCSfile: generic-table-indexes-set.m2i,v $ $Revision: 1.9 $ */
- @end@
- ########################################################################
- ## memcpy((u_char*)&$node, ${node}_ptr, ${node}_len * sizeof(tbl_idx->${node}[0]));
- ## tbl_idx->${node}_len = ${node}_len;
- ##
- @eval $gtis_tmp=""@
- @foreach $node index@
- @ include m2c_setup_node.m2i@
- @ eval $gtis_tmp="$gtis_tmp, $m2c_node_param_val"@
- @end@ # for each index
- ########################################################################
- ##//####################################################################
- ##//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ##//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- @if $m2c_processing_type eq 'h'@
- int ${context}_indexes_set_tbl_idx(${context}_mib_index *tbl_idx$gtis_tmp);
- int ${context}_indexes_set(${context}_rowreq_ctx *rowreq_ctx$gtis_tmp);
- @end@ // m2c_processing_type eq 'h'
- ########################################################################
- ##//####################################################################
- ##//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ##//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- @if $m2c_processing_type eq 'c'@
- /**
- * set mib index(es)
- *
- * @param tbl_idx mib index structure
- *
- * @retval MFD_SUCCESS : success.
- * @retval MFD_ERROR : other error.
- *
- * @remark
- * This convenience function is useful for setting all the MIB index
- * components with a single function call. It is assume that the C values
- * have already been mapped from their native/rawformat to the MIB format.
- */
- int
- ${context}_indexes_set_tbl_idx(${context}_mib_index *tbl_idx$gtis_tmp)
- {
- DEBUGMSGTL(("verbose:${context}:${context}_indexes_set_tbl_idx","calledn"));
- @foreach $node index@
- @ include m2c_setup_node.m2i@
- ## table indexes are not allocated pointers, so do not allow realloc here
- @eval $m2c_node_realloc = 0@ // fail
- /* $m2c_node_summary */
- @ eval $m2c_ctx_lh = "tbl_idx->$node"@
- @ eval $m2c_ctx_lhs = "tbl_idx->${node}_len"@
- @ eval $m2c_ctx_rh = "$m2c_node_param_val_name"@
- @ eval $m2c_ctx_rhs = "$m2c_node_param_val_lname"@
- @ if $m2c_node_needlength == 1@
- $m2c_ctx_lhs = sizeof($m2c_ctx_lh);
- @ end@
- ## also, assume mapping already done
- @ include generic-ctx-get.m2i@
- ##@ include generic-value-map.m2i@
- @end@ // for each column
- return MFD_SUCCESS;
- } /* ${context}_indexes_set_tbl_idx */
- /**
- * @internal
- * set row context indexes
- *
- * @param reqreq_ctx the row context that needs updated indexes
- *
- * @retval MFD_SUCCESS : success.
- * @retval MFD_ERROR : other error.
- *
- * @remark
- * This function sets the mib indexs, then updates the oid indexs
- * from the mib index.
- */
- int
- ${context}_indexes_set(${context}_rowreq_ctx *rowreq_ctx$gtis_tmp)
- {
- DEBUGMSGTL(("verbose:${context}:${context}_indexes_set","calledn"));
- if(MFD_SUCCESS != ${context}_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx
- @foreach $node index@
- @ include m2c_setup_node.m2i@
- , $m2c_node_param_val_call
- @end@ # for each index
- ))
- return MFD_ERROR;
- /*
- * convert mib index to oid index
- */
- rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
- if(0 != ${context}_index_to_oid(&rowreq_ctx->oid_idx,
- &rowreq_ctx->tbl_idx)) {
- return MFD_ERROR;
- }
- return MFD_SUCCESS;
- } /* ${context}_indexes_set */
- @end@ // m2c_processing_type eq 'c'
- ##
- ########################################################################
- @if $m2c_mark_boundary == 1@
- /** END code generated by $RCSfile: generic-table-indexes-set.m2i,v $ $Revision: 1.9 $ */
- @end@