How to implement an indexed table in perl subagent?

[email protected]
Newsgroups gmane.network.net-snmp.user
Message-ID <20100314111950.68f7cf5591f807c96a9cfdc2829ac177.293e5ad754.wbe@email03.secureserver.net>
I'm trying to implement an indexed table in a perl subagent that will
use agentx to connect to the master agent. Is there a structure that I
can implement that would support GET/GETNEXT operations on the table?

I'm trying to figure out what the struct needs to have to allow it to be
"walked" by GETNEXT

here is some psuedocode:

sub get_data {
    # do some work and build a struct
    return \%my_snmp_data; # as a hashref
}

sub myhandler {
my ( $handler, $registration_info, $request_info, $requests ) = @_;

    my $request;

    # go get my special data
    my $my_snmp_data = get_data();

    for ( $request = $requests ; $request ; $request = $request->next()
) {

        my $oid = $request->getOID();

        if ( $request_info->getMode() == MODE_GET ) {
            # search struct w/ $oid
        }

        elsif ( $request_info->getMode() == MODE_GETNEXT ) {
            # find your row in the struct with $oid
        }

        else {

        }
    }
}




------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.