diff options
Diffstat (limited to 'local/mib2c-conf.d/node-get.m2i')
-rw-r--r-- | local/mib2c-conf.d/node-get.m2i | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/local/mib2c-conf.d/node-get.m2i b/local/mib2c-conf.d/node-get.m2i new file mode 100644 index 0000000..1d7255c --- /dev/null +++ b/local/mib2c-conf.d/node-get.m2i @@ -0,0 +1,107 @@ +############################################################# -*- c -*- +## generic include for XXX. Do not use directly. +## +## $Id$ +######################################################################## +@if $m2c_mark_boundary == 1@ +/** START code generated by $RCSfile$ $Revision$ */ +@end@ +######################################################################## +## +@include m2c_setup_node.m2i@ +@eval $m2c_node_realloc = 2@ // malloc +/** + * Extract the current value of the $node data. + * + * Set a value using the data context for the row. + * +@if $m2c_node_get_comments ne ""@ +$m2c_node_get_comments +* +@end@ + * @param rowreq_ctx + * Pointer to the row request context. + * @param $m2c_node_param_ref_name + * Pointer to storage for a $node.decl variable +@if $m2c_node_needlength == 1@ + * @param $m2c_node_param_ref_lname + * Pointer to a size_t. On entry, it will contain the size (in bytes) + * pointed to by $node. + * On exit, this value should contain the data size (in bytes). +@end@ + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error +@if $m2c_node_needlength == 1@ +* + * @note If you need more than (*$m2c_node_param_ref_lname) bytes of memory, + * allocate it using malloc() and update $m2c_node_param_ref_name. + * <b>DO NOT</b> free the previous pointer. + * The MFD helper will release the memory you allocate. + * + * @remark If you call this function yourself, you are responsible + * for checking if the pointer changed, and freeing any + * previously allocated memory. (Not necessary if you pass + * in a pointer to static memory, obviously.) +@end@ + */ +int +${node}_get( ${context}_rowreq_ctx *rowreq_ctx, $m2c_node_param_ref ) +{ +@ifconf syntax-$node.syntax-get.m2i@ +@ include syntax-$node.syntax-get.m2i@ +@else@ +@ include generic-get-decl.m2i@ + + DEBUGMSGTL(("verbose:${context}:${node}_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the $node data. +@if $m2c_node_needlength == 0@ + * copy $m2c_node_lh from $m2c_data_item_base +@else@ + * copy $m2c_node_lh data and $m2c_node_lhs from $m2c_data_item_base +@end@ + */ +@ if ("$m2c_data_context" eq "generated") && ($m2c_node_skip_get != 1)@ +@ include generic-ctx-get.m2i@ +@ else@ +@ if ($m2c_node_skip_get != 1)@ + /* + * TODO:235:M: |-> Remove log message/SKIP once you've set $node data + */ + snmp_log(LOG_ERR,"${context} node $node not implemented: skipping\n"); +@ end@ + return MFD_SKIP; +@ end@ +## ------------------------------------------------------------------ +@ if $node.decl =~ /long/i@ # ASN_INTEGER ASN_COUNTER ASN_GAUGE +@ include generic-get-long.m2i@ +@ elsif $node.decl =~ /char/i@ # ASN_OCTET_STR ASN_OPAQUE +@ include generic-get-char.m2i@ +@ elsif $node.decl =~ /oid/i@ # ASN_OBJECT_ID +@ include generic-get-oid.m2i@ +@ elsif $node.decl =~ /U64/i@ # ASN_COUNTER64 +@ include generic-get-U64.m2i@ +@ else@ +@ print ERROR: unknown node.decl: $node.decl@ +@ exit@ +@ end@ +## ------------------------------------------------------------------ +@ if ($m2c_node_skip_mapping != 1) && ("$m2c_data_context" ne "generated")@ +@ include generic-value-map.m2i@ +@ end@ +@ include generic-get-decl-bot.m2i@ // copy value out +@end@ # no syntax include + + return MFD_SUCCESS; +} /* ${node}_get */ + +## +######################################################################## +@if $m2c_mark_boundary == 1@ +/** END code generated by $RCSfile$ $Revision$ */ +@end@ |