get "segment fault" msg, please help me - SNMP

This is a discussion on get "segment fault" msg, please help me - SNMP ; I create .c & .h files by using "mib2c -c iterate.conf XXX", and I use myTable_createEntry to add a row in the initialize_table_myTable function, this is the only thing I do in the template, of course some other tiny changes ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: get "segment fault" msg, please help me

  1. get "segment fault" msg, please help me

    I create .c & .h files by using "mib2c -c iterate.conf XXX", and I use
    myTable_createEntry to add a row in the initialize_table_myTable
    function, this is the only thing I do in the template, of course some
    other tiny changes to make the code compile successfully,compile the
    subagent by the command "net-snmp-config".

    I start the subagent, and try to get value from the row I added
    before. but I can't see any rows in the table by MG-SOFT MIB Browser.
    the table content is blank.if I add another row and get the value
    again, unfortunatelly I got "segment fault" message, meanwhile the
    subagent terminate.I don't why this happend. I came to the official
    mailist,but find nothing valuable. As a newbie to the net-snmp agent
    progamming, this problem cost me two days checking without any effect.
    I hope some one here can help me, I paste my code and any hint will be
    useful.Thank you all.

    PS:Cos my poor english, I hope I have described the problem clearly

    the code is here:

    ###################jmtest.h#######################
    /*
    * Note: this file originally auto-generated by mib2c using
    * : mib2c.iterate.conf,v 5.17 2005/05/09 08:13:45 dts12 Exp $
    */
    #ifndef JMTEST_H
    #define JMTEST_H

    /*
    * function declarations
    */
    void init_jmtest(void);
    void initialize_table_keyTable(void);
    Netsnmp_Node_Handler keyTable_handler;
    Netsnmp_First_Data_Point keyTable_get_first_data_point;
    Netsnmp_Next_Data_Point keyTable_get_next_data_point;

    /*
    * column number definitions for table keyTable
    */
    #define COLUMN_USERINDEX 1
    #define COLUMN_USERSTATUS 2
    #define COLUMN_CHECKTIME 3
    #define COLUMN_MONSET 4
    #endif /* JMTEST_H */

    ###################jmtest.c#######################
    /*
    * Note: this file originally auto-generated by mib2c using
    * : mib2c.iterate.conf,v 5.17 2005/05/09 08:13:45 dts12 Exp $
    */

    #include
    #include
    #include
    #include "jmtest.h"
    #include

    /* Typical data structure for a row entry */
    struct keyTable_entry {
    /* Index values */
    long userIndex;

    /* Column values */
    char userStatus[30];
    u_long checkTime;
    long monSet;
    long old_monSet;

    /* Illustrate using a simple linked list */
    int valid;
    struct keyTable_entry *next;
    };

    struct keyTable_entry *keyTable_head = NULL;

    /* create a new row in the (unsorted) table */
    struct keyTable_entry *
    keyTable_createEntry(
    long userIndex, char *userStatus, u_long checkTime,
    long monSet
    ) {
    struct keyTable_entry *entry;

    entry = SNMP_MALLOC_TYPEDEF(struct keyTable_entry);
    if (!entry)
    return NULL;

    entry->userIndex = userIndex;
    strcpy(entry->userStatus, userStatus);
    entry->checkTime = checkTime;
    entry->monSet = monSet;
    entry->next = keyTable_head;
    keyTable_head = entry;
    return entry;
    }

    /* remove a row from the table */
    void
    keyTable_removeEntry( struct keyTable_entry *entry ) {
    struct keyTable_entry *ptr, *prev;

    if (!entry)
    return; /* Nothing to remove */

    for ( ptr = keyTable_head, prev = NULL;
    ptr != NULL;
    prev = ptr, ptr = ptr->next ) {
    if ( ptr == entry )
    break;
    }
    if ( !ptr )
    return; /* Can't find it */

    if ( prev == NULL )
    keyTable_head = ptr->next;
    else
    prev->next = ptr->next;

    SNMP_FREE( entry ); /* XXX - release any other internal resources
    */
    }
    /** here is my row_adding code*/
    void initializeTableContext()
    {
    struct keyTable_entry *tmp;
    while(keyTable_head){
    tmp = keyTable_head->next;
    keyTable_removeEntry(keyTable_head);
    keyTable_head = tmp;
    }
    tmp = SNMP_MALLOC_TYPEDEF(struct keyTable_entry);
    tmp->next = NULL;
    memset(tmp, 0, sizeof(struct keyTable_entry));
    tmp->userIndex = 1;
    strcpy(tmp->userStatus, "****");
    tmp->checkTime = 100;
    tmp->monSet = 3;
    keyTable_createEntry(tmp->userIndex, tmp->userStatus,
    tmp->checkTime, tmp->monSet);
    SNMP_FREE(tmp);
    }


    /** Initializes the jmtest module */
    void
    init_jmtest(void)
    {
    /* here we initialize all the tables we're planning on supporting */
    initialize_table_keyTable();
    }

    /** Initialize the keyTable table by defining its contents and how it's
    structured */
    void
    initialize_table_keyTable(void)
    {
    static oid keyTable_oid[] = {1,3,6,1,3,72,3};
    size_t keyTable_oid_len = OID_LENGTH(keyTable_oid);
    netsnmp_handler_registration *reg;
    netsnmp_iterator_info *iinfo;
    netsnmp_table_registration_info *table_info;

    reg = netsnmp_create_handler_registration(
    "keyTable", keyTable_handler,
    keyTable_oid, keyTable_oid_len,
    HANDLER_CAN_RWRITE
    );

    table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info
    );
    netsnmp_table_helper_add_indexes(table_info,
    ASN_INTEGER, /* index: userIndex */
    0);
    table_info->min_column = 1;
    table_info->max_column = 4;

    iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    iinfo->get_first_data_point = keyTable_get_first_data_point;
    iinfo->get_next_data_point = keyTable_get_next_data_point;
    iinfo->table_reginfo = table_info;

    netsnmp_register_table_iterator( reg, iinfo );

    /* Initialise the contents of the table here */
    initializeTableContext();

    }

    /* Example iterator hook routines - using 'get_next' to do most of the
    work */
    netsnmp_variable_list *
    keyTable_get_first_data_point(void **my_loop_context,
    void **my_data_context,
    netsnmp_variable_list *put_index_data,
    netsnmp_iterator_info *mydata)
    {
    *my_loop_context = keyTable_head;
    *my_data_context = keyTable_head;
    return keyTable_get_next_data_point(my_loop_context,
    my_data_context,
    put_index_data, mydata );
    }

    netsnmp_variable_list *
    keyTable_get_next_data_point(void **my_loop_context,
    void **my_data_context,
    netsnmp_variable_list *put_index_data,
    netsnmp_iterator_info *mydata)
    {
    struct keyTable_entry *entry = (struct keyTable_entry
    *)*my_loop_context;
    netsnmp_variable_list *idx = put_index_data;

    if ( entry ) {
    snmp_set_var_value( idx, (u_char *)&entry->userIndex,
    sizeof(entry->userIndex) );
    idx = idx->next_variable;
    *my_data_context = (void *)entry;
    *my_loop_context = (void *)entry->next;
    } else {
    return NULL;
    }
    }


    /** handles requests for the keyTable table */
    int
    keyTable_handler(
    netsnmp_mib_handler *handler,
    netsnmp_handler_registration *reginfo,
    netsnmp_agent_request_info *reqinfo,
    netsnmp_request_info *requests) {

    netsnmp_request_info *request;
    netsnmp_table_request_info *table_info;
    struct keyTable_entry *table_entry;

    switch (reqinfo->mode) {
    /*
    * Read-support (also covers GetNext requests)
    */
    case MODE_GET:
    for (request=requests; request; request=request->next) {
    table_entry = (struct keyTable_entry *)

    netsnmp_extract_iterator_context(request);
    table_info = netsnmp_extract_table_info(
    request);

    switch (table_info->colnum) {
    case COLUMN_USERINDEX:
    snmp_set_var_typed_value( request->requestvb,
    ASN_INTEGER,
    (u_char
    *)&table_entry->userIndex,

    sizeof(table_entry->userIndex));
    break;
    case COLUMN_USERSTATUS:
    snmp_set_var_typed_value( request->requestvb,
    ASN_OCTET_STR,
    table_entry->userStatus,

    sizeof(table_entry->userStatus));
    break;
    case COLUMN_CHECKTIME:
    snmp_set_var_typed_value( request->requestvb,
    ASN_TIMETICKS,
    (u_char
    *)&table_entry->checkTime,

    sizeof(table_entry->checkTime));
    break;
    case COLUMN_MONSET:
    snmp_set_var_typed_value( request->requestvb,
    ASN_INTEGER,
    (u_char
    *)&table_entry->monSet,
    sizeof(table_entry->monSet));
    break;
    }
    }
    break;

    /*
    * Write-support
    */
    case MODE_SET_RESERVE1:
    for (request=requests; request; request=request->next) {
    table_entry = (struct keyTable_entry *)

    netsnmp_extract_iterator_context(request);
    table_info = netsnmp_extract_table_info(
    request);

    switch (table_info->colnum) {
    case COLUMN_MONSET:
    if ( request->requestvb->type != ASN_INTEGER ) {
    netsnmp_set_request_error( reqinfo, request,
    SNMP_ERR_WRONGTYPE );
    return SNMP_ERR_NOERROR;
    }
    /* Also may need to check size/value */
    break;
    default:
    netsnmp_set_request_error( reqinfo, request,
    SNMP_ERR_NOTWRITABLE );
    return SNMP_ERR_NOERROR;
    }
    }
    break;

    case MODE_SET_RESERVE2:
    break;

    case MODE_SET_FREE:
    break;

    case MODE_SET_ACTION:
    for (request=requests; request; request=request->next) {
    table_entry = (struct keyTable_entry *)

    netsnmp_extract_iterator_context(request);
    table_info = netsnmp_extract_table_info(
    request);

    switch (table_info->colnum) {
    case COLUMN_MONSET:
    /* Need to save old 'table_entry->monSet' value.
    May need to use 'memcpy' */
    table_entry->old_monSet = table_entry->monSet;
    table_entry->monSet = *((long
    *)request->requestvb->val.integer);
    break;
    }
    }
    break;

    case MODE_SET_UNDO:
    for (request=requests; request; request=request->next) {
    table_entry = (struct keyTable_entry *)

    netsnmp_extract_iterator_context(request);
    table_info = netsnmp_extract_table_info(
    request);

    switch (table_info->colnum) {
    case COLUMN_MONSET:
    /* Need to restore old 'table_entry->monSet' value.
    May need to use 'memcpy' */
    table_entry->monSet = table_entry->old_monSet;
    break;
    }
    }
    break;

    case MODE_SET_COMMIT:
    break;
    }
    return SNMP_ERR_NOERROR;
    }
    ###################mib#######################
    JM-TEST-1-MIB DEFINITIONS ::= BEGIN

    IMPORTS
    experimental, MODULE-IDENTITY, OBJECT-TYPE FROM SNMPv2-SMI
    DisplayString FROM SNMPv2-TC;

    jmtest MODULE-IDENTITY
    LAST-UPDATED "200203210000Z"
    ORGANIZATION "Temple U"
    CONTACT-INFO
    "None yet."
    DESCRIPTION
    "AgentX testing MIB"
    REVISION "200203210000Z"
    DESCRIPTION
    "None yet."
    ::= { experimental 72}

    firstKey OBJECT-TYPE
    SYNTAX INTEGER (0..100)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "Value initialized to 0 and on each
    access:
    - Return current val.
    - increment"

    ::= { jmtest 1 }

    secondKey OBJECT-TYPE
    SYNTAX DisplayString
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "Value initialize to some string"
    ::= { jmtest 2 }

    keyTable OBJECT-TYPE
    SYNTAX SEQUENCE OF keyEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
    "A list of Sample Entries"
    ::= { jmtest 3 }

    keyEntry OBJECT-TYPE
    SYNTAX keyEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
    "An Entry containing management info"
    INDEX { userIndex }
    ::= { keyTable 1 }

    keyEntry ::= SEQUENCE {
    userIndex INTEGER,
    userStatus DisplayString,
    checkTime TimeTicks,
    monSet INTEGER
    }

    userIndex OBJECT-TYPE
    SYNTAX INTEGER
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
    "A unique Value of the row"
    ::= { keyEntry 1 }

    userStatus OBJECT-TYPE
    SYNTAX DisplayString
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
    "machine status."
    ::= { keyEntry 2 }

    checkTime OBJECT-TYPE
    SYNTAX TimeTicks
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
    "machine status checking time."
    ::= { keyEntry 3 }

    monSet OBJECT-TYPE
    SYNTAX INTEGER
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "An Example to test set Fun."
    ::= { keyEntry 4 }

    END




    casper
    2006-04-30


  2. Re: get "segment fault" msg, please help me

    any one can help me ?

    tlmcasper@etang.com wrote:
    > I create .c & .h files by using "mib2c -c iterate.conf XXX", and I use
    > myTable_createEntry to add a row in the initialize_table_myTable
    > function, this is the only thing I do in the template, of course some
    > other tiny changes to make the code compile successfully,compile the
    > subagent by the command "net-snmp-config".
    >
    > I start the subagent, and try to get value from the row I added
    > before. but I can't see any rows in the table by MG-SOFT MIB Browser.
    > the table content is blank.if I add another row and get the value
    > again, unfortunatelly I got "segment fault" message, meanwhile the
    > subagent terminate.I don't why this happend. I came to the official
    > mailist,but find nothing valuable. As a newbie to the net-snmp agent
    > progamming, this problem cost me two days checking without any effect.
    > I hope some one here can help me, I paste my code and any hint will be
    > useful.Thank you all.
    >
    > PS:Cos my poor english, I hope I have described the problem clearly
    >
    > the code is here:
    >
    > ###################jmtest.h#######################
    > /*
    > * Note: this file originally auto-generated by mib2c using
    > * : mib2c.iterate.conf,v 5.17 2005/05/09 08:13:45 dts12 Exp $
    > */
    > #ifndef JMTEST_H
    > #define JMTEST_H
    >
    > /*
    > * function declarations
    > */
    > void init_jmtest(void);
    > void initialize_table_keyTable(void);
    > Netsnmp_Node_Handler keyTable_handler;
    > Netsnmp_First_Data_Point keyTable_get_first_data_point;
    > Netsnmp_Next_Data_Point keyTable_get_next_data_point;
    >
    > /*
    > * column number definitions for table keyTable
    > */
    > #define COLUMN_USERINDEX 1
    > #define COLUMN_USERSTATUS 2
    > #define COLUMN_CHECKTIME 3
    > #define COLUMN_MONSET 4
    > #endif /* JMTEST_H */
    >
    > ###################jmtest.c#######################
    > /*
    > * Note: this file originally auto-generated by mib2c using
    > * : mib2c.iterate.conf,v 5.17 2005/05/09 08:13:45 dts12 Exp $
    > */
    >
    > #include
    > #include
    > #include
    > #include "jmtest.h"
    > #include
    >
    > /* Typical data structure for a row entry */
    > struct keyTable_entry {
    > /* Index values */
    > long userIndex;
    >
    > /* Column values */
    > char userStatus[30];
    > u_long checkTime;
    > long monSet;
    > long old_monSet;
    >
    > /* Illustrate using a simple linked list */
    > int valid;
    > struct keyTable_entry *next;
    > };
    >
    > struct keyTable_entry *keyTable_head = NULL;
    >
    > /* create a new row in the (unsorted) table */
    > struct keyTable_entry *
    > keyTable_createEntry(
    > long userIndex, char *userStatus, u_long checkTime,
    > long monSet
    > ) {
    > struct keyTable_entry *entry;
    >
    > entry = SNMP_MALLOC_TYPEDEF(struct keyTable_entry);
    > if (!entry)
    > return NULL;
    >
    > entry->userIndex = userIndex;
    > strcpy(entry->userStatus, userStatus);
    > entry->checkTime = checkTime;
    > entry->monSet = monSet;
    > entry->next = keyTable_head;
    > keyTable_head = entry;
    > return entry;
    > }
    >
    > /* remove a row from the table */
    > void
    > keyTable_removeEntry( struct keyTable_entry *entry ) {
    > struct keyTable_entry *ptr, *prev;
    >
    > if (!entry)
    > return; /* Nothing to remove */
    >
    > for ( ptr = keyTable_head, prev = NULL;
    > ptr != NULL;
    > prev = ptr, ptr = ptr->next ) {
    > if ( ptr == entry )
    > break;
    > }
    > if ( !ptr )
    > return; /* Can't find it */
    >
    > if ( prev == NULL )
    > keyTable_head = ptr->next;
    > else
    > prev->next = ptr->next;
    >
    > SNMP_FREE( entry ); /* XXX - release any other internal resources
    > */
    > }
    > /** here is my row_adding code*/
    > void initializeTableContext()
    > {
    > struct keyTable_entry *tmp;
    > while(keyTable_head){
    > tmp = keyTable_head->next;
    > keyTable_removeEntry(keyTable_head);
    > keyTable_head = tmp;
    > }
    > tmp = SNMP_MALLOC_TYPEDEF(struct keyTable_entry);
    > tmp->next = NULL;
    > memset(tmp, 0, sizeof(struct keyTable_entry));
    > tmp->userIndex = 1;
    > strcpy(tmp->userStatus, "****");
    > tmp->checkTime = 100;
    > tmp->monSet = 3;
    > keyTable_createEntry(tmp->userIndex, tmp->userStatus,
    > tmp->checkTime, tmp->monSet);
    > SNMP_FREE(tmp);
    > }
    >
    >
    > /** Initializes the jmtest module */
    > void
    > init_jmtest(void)
    > {
    > /* here we initialize all the tables we're planning on supporting */
    > initialize_table_keyTable();
    > }
    >
    > /** Initialize the keyTable table by defining its contents and how it's
    > structured */
    > void
    > initialize_table_keyTable(void)
    > {
    > static oid keyTable_oid[] = {1,3,6,1,3,72,3};
    > size_t keyTable_oid_len = OID_LENGTH(keyTable_oid);
    > netsnmp_handler_registration *reg;
    > netsnmp_iterator_info *iinfo;
    > netsnmp_table_registration_info *table_info;
    >
    > reg = netsnmp_create_handler_registration(
    > "keyTable", keyTable_handler,
    > keyTable_oid, keyTable_oid_len,
    > HANDLER_CAN_RWRITE
    > );
    >
    > table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info
    > );
    > netsnmp_table_helper_add_indexes(table_info,
    > ASN_INTEGER, /* index: userIndex */
    > 0);
    > table_info->min_column = 1;
    > table_info->max_column = 4;
    >
    > iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
    > iinfo->get_first_data_point = keyTable_get_first_data_point;
    > iinfo->get_next_data_point = keyTable_get_next_data_point;
    > iinfo->table_reginfo = table_info;
    >
    > netsnmp_register_table_iterator( reg, iinfo );
    >
    > /* Initialise the contents of the table here */
    > initializeTableContext();
    >
    > }
    >
    > /* Example iterator hook routines - using 'get_next' to do most of the
    > work */
    > netsnmp_variable_list *
    > keyTable_get_first_data_point(void **my_loop_context,
    > void **my_data_context,
    > netsnmp_variable_list *put_index_data,
    > netsnmp_iterator_info *mydata)
    > {
    > *my_loop_context = keyTable_head;
    > *my_data_context = keyTable_head;
    > return keyTable_get_next_data_point(my_loop_context,
    > my_data_context,
    > put_index_data, mydata );
    > }
    >
    > netsnmp_variable_list *
    > keyTable_get_next_data_point(void **my_loop_context,
    > void **my_data_context,
    > netsnmp_variable_list *put_index_data,
    > netsnmp_iterator_info *mydata)
    > {
    > struct keyTable_entry *entry = (struct keyTable_entry
    > *)*my_loop_context;
    > netsnmp_variable_list *idx = put_index_data;
    >
    > if ( entry ) {
    > snmp_set_var_value( idx, (u_char *)&entry->userIndex,
    > sizeof(entry->userIndex) );
    > idx = idx->next_variable;
    > *my_data_context = (void *)entry;
    > *my_loop_context = (void *)entry->next;
    > } else {
    > return NULL;
    > }
    > }
    >
    >
    > /** handles requests for the keyTable table */
    > int
    > keyTable_handler(
    > netsnmp_mib_handler *handler,
    > netsnmp_handler_registration *reginfo,
    > netsnmp_agent_request_info *reqinfo,
    > netsnmp_request_info *requests) {
    >
    > netsnmp_request_info *request;
    > netsnmp_table_request_info *table_info;
    > struct keyTable_entry *table_entry;
    >
    > switch (reqinfo->mode) {
    > /*
    > * Read-support (also covers GetNext requests)
    > */
    > case MODE_GET:
    > for (request=requests; request; request=request->next) {
    > table_entry = (struct keyTable_entry *)
    >
    > netsnmp_extract_iterator_context(request);
    > table_info = netsnmp_extract_table_info(
    > request);
    >
    > switch (table_info->colnum) {
    > case COLUMN_USERINDEX:
    > snmp_set_var_typed_value( request->requestvb,
    > ASN_INTEGER,
    > (u_char
    > *)&table_entry->userIndex,
    >
    > sizeof(table_entry->userIndex));
    > break;
    > case COLUMN_USERSTATUS:
    > snmp_set_var_typed_value( request->requestvb,
    > ASN_OCTET_STR,
    > table_entry->userStatus,
    >
    > sizeof(table_entry->userStatus));
    > break;
    > case COLUMN_CHECKTIME:
    > snmp_set_var_typed_value( request->requestvb,
    > ASN_TIMETICKS,
    > (u_char
    > *)&table_entry->checkTime,
    >
    > sizeof(table_entry->checkTime));
    > break;
    > case COLUMN_MONSET:
    > snmp_set_var_typed_value( request->requestvb,
    > ASN_INTEGER,
    > (u_char
    > *)&table_entry->monSet,
    > sizeof(table_entry->monSet));
    > break;
    > }
    > }
    > break;
    >
    > /*
    > * Write-support
    > */
    > case MODE_SET_RESERVE1:
    > for (request=requests; request; request=request->next) {
    > table_entry = (struct keyTable_entry *)
    >
    > netsnmp_extract_iterator_context(request);
    > table_info = netsnmp_extract_table_info(
    > request);
    >
    > switch (table_info->colnum) {
    > case COLUMN_MONSET:
    > if ( request->requestvb->type != ASN_INTEGER ) {
    > netsnmp_set_request_error( reqinfo, request,
    > SNMP_ERR_WRONGTYPE );
    > return SNMP_ERR_NOERROR;
    > }
    > /* Also may need to check size/value */
    > break;
    > default:
    > netsnmp_set_request_error( reqinfo, request,
    > SNMP_ERR_NOTWRITABLE );
    > return SNMP_ERR_NOERROR;
    > }
    > }
    > break;
    >
    > case MODE_SET_RESERVE2:
    > break;
    >
    > case MODE_SET_FREE:
    > break;
    >
    > case MODE_SET_ACTION:
    > for (request=requests; request; request=request->next) {
    > table_entry = (struct keyTable_entry *)
    >
    > netsnmp_extract_iterator_context(request);
    > table_info = netsnmp_extract_table_info(
    > request);
    >
    > switch (table_info->colnum) {
    > case COLUMN_MONSET:
    > /* Need to save old 'table_entry->monSet' value.
    > May need to use 'memcpy' */
    > table_entry->old_monSet = table_entry->monSet;
    > table_entry->monSet = *((long
    > *)request->requestvb->val.integer);
    > break;
    > }
    > }
    > break;
    >
    > case MODE_SET_UNDO:
    > for (request=requests; request; request=request->next) {
    > table_entry = (struct keyTable_entry *)
    >
    > netsnmp_extract_iterator_context(request);
    > table_info = netsnmp_extract_table_info(
    > request);
    >
    > switch (table_info->colnum) {
    > case COLUMN_MONSET:
    > /* Need to restore old 'table_entry->monSet' value.
    > May need to use 'memcpy' */
    > table_entry->monSet = table_entry->old_monSet;
    > break;
    > }
    > }
    > break;
    >
    > case MODE_SET_COMMIT:
    > break;
    > }
    > return SNMP_ERR_NOERROR;
    > }
    > ###################mib#######################
    > JM-TEST-1-MIB DEFINITIONS ::= BEGIN
    >
    > IMPORTS
    > experimental, MODULE-IDENTITY, OBJECT-TYPE FROM SNMPv2-SMI
    > DisplayString FROM SNMPv2-TC;
    >
    > jmtest MODULE-IDENTITY
    > LAST-UPDATED "200203210000Z"
    > ORGANIZATION "Temple U"
    > CONTACT-INFO
    > "None yet."
    > DESCRIPTION
    > "AgentX testing MIB"
    > REVISION "200203210000Z"
    > DESCRIPTION
    > "None yet."
    > ::= { experimental 72}
    >
    > firstKey OBJECT-TYPE
    > SYNTAX INTEGER (0..100)
    > MAX-ACCESS read-write
    > STATUS current
    > DESCRIPTION
    > "Value initialized to 0 and on each
    > access:
    > - Return current val.
    > - increment"
    >
    > ::= { jmtest 1 }
    >
    > secondKey OBJECT-TYPE
    > SYNTAX DisplayString
    > MAX-ACCESS read-write
    > STATUS current
    > DESCRIPTION
    > "Value initialize to some string"
    > ::= { jmtest 2 }
    >
    > keyTable OBJECT-TYPE
    > SYNTAX SEQUENCE OF keyEntry
    > MAX-ACCESS not-accessible
    > STATUS current
    > DESCRIPTION
    > "A list of Sample Entries"
    > ::= { jmtest 3 }
    >
    > keyEntry OBJECT-TYPE
    > SYNTAX keyEntry
    > MAX-ACCESS not-accessible
    > STATUS current
    > DESCRIPTION
    > "An Entry containing management info"
    > INDEX { userIndex }
    > ::= { keyTable 1 }
    >
    > keyEntry ::= SEQUENCE {
    > userIndex INTEGER,
    > userStatus DisplayString,
    > checkTime TimeTicks,
    > monSet INTEGER
    > }
    >
    > userIndex OBJECT-TYPE
    > SYNTAX INTEGER
    > MAX-ACCESS read-only
    > STATUS current
    > DESCRIPTION
    > "A unique Value of the row"
    > ::= { keyEntry 1 }
    >
    > userStatus OBJECT-TYPE
    > SYNTAX DisplayString
    > MAX-ACCESS read-only
    > STATUS current
    > DESCRIPTION
    > "machine status."
    > ::= { keyEntry 2 }
    >
    > checkTime OBJECT-TYPE
    > SYNTAX TimeTicks
    > MAX-ACCESS read-only
    > STATUS current
    > DESCRIPTION
    > "machine status checking time."
    > ::= { keyEntry 3 }
    >
    > monSet OBJECT-TYPE
    > SYNTAX INTEGER
    > MAX-ACCESS read-write
    > STATUS current
    > DESCRIPTION
    > "An Example to test set Fun."
    > ::= { keyEntry 4 }
    >
    > END
    >
    >
    >
    >
    > casper
    > 2006-04-30



+ Reply to Thread