Hi Dave,

Thanks for your reply.

Te handler routine lookslike following:

/** handles requests for the xDSLATMConfProfileTable table, if anything else 
needs to be done */
int
xDSLATMConfProfileTable_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;
    netsnmp_variable_list *var;
    struct commitInfo *ci = NULL;

    void *data_context = NULL;

    oid *suffix;
    size_t suffix_len;

    /** column and row index encoded portion */
    suffix = requests->requestvb->name + reginfo->rootoid_len + 1;
    suffix_len = requests->requestvb->name_length -
        (reginfo->rootoid_len + 1);

    for(request = requests; request; request = request->next) {
        var = request->requestvb;
        if (request->processed != 0)
            continue;

        switch (reqinfo->mode) {
        case MODE_GET:
        case MODE_SET_RESERVE1:
            data_context =  netsnmp_extract_iterator_context(request);
            if (data_context == NULL) {
                if (reqinfo->mode == MODE_GET) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
            }
            break;

        default: /* == the other SET modes */
            ci = netsnmp_oid_stash_get_data(commitStorage,
                                            suffix+1, suffix_len-1);
            break;

        }

        /** extracts the information about the table from the request */
        table_info = netsnmp_extract_table_info(request);
        /** table_info->colnum contains the column number requested */
        /** table_info->indexes contains a linked list of snmp variable
           bindings for the indexes of the table.  Values in the list
           have been set corresponding to the indexes of the
           request */
        if (table_info == NULL) {
            continue;
        }

        switch(reqinfo->mode) {
            case MODE_GET:
                switch(table_info->colnum) {
                    case COLUMN_XDSLATMCHCONFPROFIMAENABLED:
                            {
                                long *retval;
                                size_t retval_len = 0;
                                retval = 
get_xDSLATMChConfProfImaEnabled(data_context, &retval_len);
                                snmp_set_var_typed_value(var, ASN_INTEGER,
                                                         (const u_char *) 
retval,
                                                         retval_len);
                            }
                        break;

[snip]



So in your opinion, there may be a bug in the old version?
Trying to upgrade agent code or the template will be helpful?


Thanks,



永鈦鑫   iTAS Corporation
新竹市水源街75號
NO. 75,Shuiyuan St., Hsinchu City, Taiwan, R.O.C.
Tel:03-5716099 Ext.1208
E-mail:tewen.hs...@itas.com.tw
----- Original Message ----- 
From: "Dave Shield" <d.t.shi...@liverpool.ac.uk>
To: "Tewen Hsieh" <tewen.hs...@itas.com.tw>
Cc: <net-snmp-coders@lists.sourceforge.net>
Sent: Tuesday, August 18, 2009 3:26 PM
Subject: Re: Could anyone give me some suggestions?


> 2009/8/18 Tewen Hsieh <tewen.hs...@itas.com.tw>:
>> I am working with template code which was generated from
>> mib2c.iterate_access.conf.
>> Because of performance issue, I get the external data(PHY register 
>> values)
>> in each column's get_ routine like following:
>
>  [snip]
>
> Yes.  And what does the handler routine look like?
> I.e. the code where these get_xxx calls are actually used?
>
>
>> Is there anything wrong in my get_ routine?
>> Or it's a net-snmp 5.1.1's bug?
>
> That's probably the problem, then.
> The 5.1.x line is very *very* old, and the mib2c templates
> (along with everything else) have been significantly
> improved since then.
>   In particular, there are no checks on the return value
> of the 'get_xxx' routines.
>
> Try using a less obsolete version of the code.
> (Or at the very least, a newer version of the mib2c template)
>
> Dave 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to