Hello everybody,

I was wondering how to complete mib2c output in order to create some kind of a 
nested table which i have already defined in a mib file. In other words, I want 
to have a table which is included in an instance of another tablerow. 
I used mib2c with create-dataset.conf but it just created template code with 
ASN types missing for the inner table.

The Table should look something like this:
-----------------------------
exampleTable OBJECT-TYPE
        SYNTAX                  SEQUENCE OF ExampleEntry
        MAX-ACCESS              not-accessible  
        STATUS                  current
    DESCRIPTION         "..." 
        ::= { a-mib-node 3 }
    
exampleEntry OBJECT-TYPE
    SYNTAX      ExampleEntry
    ACCESS      not-accessible
    STATUS      mandatory
    DESCRIPTION
        "..."
    INDEX   { exampleIndex }
    ::= {exampleTable 1 }

ExampleEntry ::= SEQUENCE {
        type                            OCTET STRING,
        innerExampleTable               SEQUENCE OF InnerExampleEntry
}

exampleIndex OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-create
    STATUS      mandatory
    DESCRIPTION
        "..."
    ::= { exampleEntry 1 }

...

-----------------------------
The innerExampleTable - which code is structured similarly to exampleTable 
(except inclusion of another inner table) - is held in a seperate mib file.


Here is a snippet of the mib2c output (.h file):
-----------------------------
#ifndef EXAMPLETABLE_H
#define EXAMPLETABLE_H

void init_exampleTable(void);
void initialize_table_exampleTable(void);
Netsnmp_Node_Handler exampleTable_handler;

       #define COLUMN_EXAMPLEINDEX              1
       #define COLUMN_INNEREXAMPLETABLE         2
#endif /* EXAMPLETABLE_H */
-----------------------------

Here is a snippet of the mib2c output (.c file without comments):
-----------------------------
    static oid exampleTable_oid[] = {1,3,6,1,4,1,778,1,1,1,1,3};
    size_t exampleTable_oid_len = OID_LENGTH(exampleTable_oid);
    netsnmp_table_data_set *table_set;

    table_set = netsnmp_create_table_data_set("exampleTable");

    table_set->allow_creation = 1;
    netsnmp_table_set_add_indexes(table_set,
                           ASN_OCTET_STR,  
                           0);
                 
    netsnmp_table_set_multi_add_default_row(table_set,
                                            COLUMN_TYPE, ASN_OCTET_STR, 1,
                                            NULL, 0,
                                            COLUMN_INNEREXAMPLETABLE, , 0,
                                            NULL, 0,
                              0);

    
netsnmp_register_table_data_set(netsnmp_create_handler_registration("exampleTable",
 exampleTable_handler, exampleTable_oid, exampleTable_oid_len, 
HANDLER_CAN_RWRITE), table_set, NULL);
}

void
init_exampleTable(void)
{
    initialize_table_exampleTable();
    initialize_table_innerExampleTable();
}
-----------------------------

Can I extend the generated code for my purpose? When calling 
netsnmp_table_set_multi_add_default_row I don't know which ASN type to chose to 
specify COLUMN_INNEREXAMPLETABLE. Can anyone help me out?
-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss 
für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to