/usr/share/snmp/mib2c-data/generic-table-indexes-from-oid.m2i is in libsnmp-base 5.4.3~dfsg-2.8+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ############################################################# -*- c -*-
## generic include for XXX. Do not use directly.
##
## $Id: generic-table-indexes-from-oid.m2i 11300 2004-10-08 23:39:17Z rstory $
########################################################################
@if $m2c_mark_boundary == 1@
/** START code generated by $RCSfile$ $Revision: 11300 $ */
@end@
########################################################################
##
/**
* extract ${context} indexes from a netsnmp_index
*
* @retval SNMP_ERR_NOERROR : no error
* @retval SNMP_ERR_GENERR : error
*/
int
${context}_index_from_oid(netsnmp_index *oid_idx,
${context}_mib_index *mib_idx)
{
@include generic-table-indexes-varbind-setup.m2i@
DEBUGMSGTL(("verbose:${context}:${context}_index_from_oid","called\n"));
/*
* parse the oid into the individual index components
*/
err = parse_oid_indexes( oid_idx->oids, oid_idx->len,
&var_$m2c_dii_first );
if (err == SNMP_ERR_NOERROR) {
/*
* copy out values
*/
@ eval $m2c_node_name = ""@ # purge node name to re-eval $m2c_node_var_name
@ foreach $node index@
@ eval $m2c_node_var_name = "var_${node}."@
@ include m2c_setup_node.m2i@
@ if $m2c_node_needlength == 1@
/*
* NOTE: val_len is in bytes, ${node}_len might not be
*/
if(var_${node}.val_len > sizeof(mib_idx->$node))
err = SNMP_ERR_GENERR;
else {
memcpy(mib_idx->${node}, var_${node}.val.string, var_${node}.val_len);
mib_idx->${node}_len = var_${node}.val_len / sizeof(mib_idx->${node}[0]);
}
@ else@
mib_idx->$node = $m2c_node_var_val;
@ end@
@ end@ # foreach
@ eval $m2c_node_var_name = ""@ #reset custom name
@ eval $m2c_node_name = ""@ # purge node name to re-eval $m2c_node_var_name
}
/*
* parsing may have allocated memory. free it.
*/
snmp_reset_var_buffers( &var_$m2c_dii_first );
return err;
} /* ${context}_index_from_oid */
##
########################################################################
@if $m2c_mark_boundary == 1@
/** END code generated by $RCSfile$ $Revision: 11300 $ */
@end@
|