> Ok, if I've got this right a session is created establishing the > data to connect the local client (RFC says manager) to the target > agent. So step 1 is to initialize a session.
Basically, yes. But note that this "session" doesn't actually imply a proper connection (such as you might get with TCP-based protocols). It's really just a means of gathering together all of the administration information (version, community string, user, passwords, etc). > Then the session sends > one or more PDUs, which need to be setup. Each PDU contains one or > more varbinds (called variable_list's in the API). Yup. > A variable_list is a linked list made up of OID values. An (OID, value) pair, yes - though the value is typically empty for GET* requests. But you'd need to specify this value explicitly when setting up a SET request. The response (following both SET and GET* requests) will also contain the same list of (OID, non-empty value) pairs. > Step 3 then is to attach a variable_list in a linked list fashion for > multiple OIDs in a single PDU. Yup. Note that you'd typically add each varbind to the PDU as it's created (rather than constructing the list first and then adding it to the PDU in one go). See the client application code for an example. > Step 4 is to actually send the PDU (snmp_sync_response?). That's the easiest approach, yes. > Then we do soemthing with the return variables > in the variable_list's. Making the remaining steps a matter of > freeing the PDU and closing the session. > > Is that vaguely right? Yes - that's basically correct. > Am I missing something? I see "varbind" in some > places (like the PERL docs) and "variable_list" in other places > (the C API), which is alittle confusing. We're good at confusion. "A foolish consistency is the hobgoblin of little minds" > 2) Whats the best way to retrieve multiple OIDs at one time? > Can I use snmp_add_null_var() multiple times on the same PDU? Yes. That's the approach to use. > Furthermore, exactly what does snmp_add_null_var() other than > attach an OID to a PDUs variable_list? So far it looks to me like > a dumbed down way to easily and quickly add OIDs without having to > explicitly touch the variable_list's. Yup - that's exactly what this does. > 3) The example on the website (looks like just one, which gets a single > OID, hense my confusion) uses snmp_add_null_var and read_objid both from > snmp_client.h. 'read_objid()' is used to determine what OID to ask for. (Converting from a user-accessible name, to the numeric OID that the protocol actually uses). Once you've got this numeric OID, then snmp_add_null_var is used to add the appropriate varbind to the PDU. > However it looks like there are adiquate calls in > snmp_api.h (namely, snmp_add_var()) to manipulate the PDUs but I don't > see calls to create the PDU or free it like the client API. Is this a > hint that maybe a good way to do all this is by using the calls in > snmp_api.h and rather than relying on client functions to create and > populate the PDUs to simply do it manually (directly setting values for > the PDU and Varlist structs)? I'm not sure I quite follow this. The two files 'snmp_api' and 'snmp_client' contain most of the useful API calls, but there isn't really a clean distinction between them. I certainly wouldn't read too much into using one rather than the other. (Though 'snmp_client' is probably a slightly higher level wrapper round 'snmp_api', so probably the better one to use in general). Have a look at how the client apps operate, and use those as a model. Dave ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.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