#############################################################  -*- c -*-
## generic include for XXX. Do not use directly.
##
## $Id: generic-table-indexes.m2i,v 1.10 2004/10/15 00:49:24 rstory Exp $
########################################################################
@if $m2c_mark_boundary == 1@
/** START code generated by $RCSfile: generic-table-indexes.m2i,v $ $Revision: 1.10 $ */
@end@
########################################################################
##
/*
 * TODO:120:r: |-> Review $context mib index.
 * This structure is used to represent the index for $context.
 */
@eval $m2c_gi_others = (count_indexes($context) - 1)@
@eval $m2c_gi_len = 0@
@eval $m2c_gi_warn = 0@
typedef struct ${context}_mib_index_s {

@foreach $node index@
@    include m2c_setup_node.m2i@
##@    include details-node.m2i@
        /*
         * $m2c_node_summary
         */
@    if $m2c_node_needlength == 1@
@        eval $m2c_gi_warn = 1@
@        eval $m2c_gi_maxlen = (128 - $node.oidlength - $m2c_gi_others - 1)@
@        if $m2c_node_maxlen > $m2c_gi_maxlen@
@            eval $m2c_node_maxlen = $m2c_gi_maxlen@
        /** 128 - $m2c_gi_others(other indexes) - oid length($node.oidlength) = $m2c_node_maxlen */
@        end@
@        eval $m2c_gi_len = $m2c_gi_len + $m2c_node_maxlen + 1@
@    elsif "$node.type" eq "ASN_IPADDRESS"@
@        eval $m2c_gi_len = $m2c_gi_len + 4@
@    else@
@        eval $m2c_gi_len = $m2c_gi_len + 1@
@    end@ # needlength
@    include node-storage.m2i@

@end@ # foreach

} ${context}_mib_index;

    /*
     * TODO:121:r: |   |-> Review $context max index length.
     * If you KNOW that your indexes will never exceed a certain
     * length, update this macro to that length.
@    if $m2c_gi_warn == 1@
     *
     * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
     * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
     * Guessing 128 - col/entry(2)  - oid len($context.oidlength)
@        if $m2c_gi_len > 126@
@            eval $m2c_gi_len = 126 - $context.oidlength@
@        end@
##@    else@
##@        eval $m2c_gi_len = count_indexes($context)@
@    end@
*/
#define MAX_${context}_IDX_LEN     $m2c_gi_len

##
########################################################################
@if $m2c_mark_boundary == 1@
/** END code generated by $RCSfile: generic-table-indexes.m2i,v $ $Revision: 1.10 $ */
@end@
