Hi All,
 I am new to net-snmp mib2c complier. I need to compile the SIP MIB using mib2c 
complier. I am following bellow steps to generate .c and .h files from the SIP 
MIB file.
1. I installed net-snmp on redhat 5 system and copied SIP MIB file to 
/usr/local/share/snmp/mibs folder.
(MIB file from http://www.icir.org/fenner/mibs/extracted/SIP-TC-MIB-sip-12.txt)
2. Exported MIBS=ALL
3. Then I used mib2c -c mib2c.scalar.conf sipCommonMIB, it generated 
sipCommonMIB.h and sipCommonMIB.c files. But I feel it didn't generate the 
skeleton code properly. I also tried with different mib2c conf files like 
mib2c.iterate.conf and mib2c.old-api.conf, but no use. Please help me on this. 
 Bellow is the sample of mib2c output for SIP MIB.

/*
 * variable4 sipCommonMIB_variables:
 *   this variable defines function callbacks and type return information
 *   for the sipCommonMIB mib section
 */
struct variable7 sipCommonMIB_variables[] = {
    /*
     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix
     */
};
/*
 * (L = length of the oidsuffix)
 */

/** Initializes the sipCommonMIB module */
void
init_sipCommonMIB(void)
{


    DEBUGMSGTL(("sipCommonMIB", "Initializing\n"));
    /*
     * register ourselves with the agent to handle our mib tree
     */
    REGISTER_MIB("sipCommonMIB", sipCommonMIB_variables, variable4,
                 sipCommonMIB_variables_oid);
    /*
     * place any other initialization junk you need here
     */
}
/*
 * var_sipCommonMIB():
 *   This function is called every time the agent gets a request for
 *   a scalar variable that might be found within your mib section
 *   registered above.  It is up to you to do the right thing and
 *   return the correct value.
unsigned char  *
var_sipCommonMIB(struct variable *vp,
                 oid * name,
                 size_t *length,
                 int exact, size_t *var_len, WriteMethod ** write_method)
{
    /*
     * variables we may use later
     */
    static long     long_ret;
    static u_long   ulong_ret;
    static unsigned char string[SPRINT_MAX_LEN];
    static oid      objid[MAX_OID_LEN];
    static struct counter64 c64;
    if (header_generic(vp, name, length, exact, var_len, write_method)
        == MATCH_FAILED)
        return NULL;
    /*
     * this is where we do the value assignments for the mib results.
     */
    switch (vp->magic) {
    default:
        ERROR_MSG("");
    }
    return NULL;
}

 I also tested same on the ifMIB. Result is the same.
 
Thanks in advance
Jayakar


      
------------------------------------------------------------------------------
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 as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/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