Simone Moni <simonemon...@gmail.com> writes:

>         if ($request_info->getMode() == MODE_GET) {
>             # ... generally, you would calculate value from oid
>             if ($oid == new 
> NetSNMP::OID(".1.3.6.1.4.1.193.37.10.11.64.10.1.2.0")) {
>             $request->setValue(ASN_OCTET_STR, $default_SP);
>             }
>             if ($oid == new 
> NetSNMP::OID(".1.3.6.1.4.1.193.37.10.11.64.10.1.3.0")) {
>             $request->setValue(ASN_OCTET_STR, $default_PC);
>             }

If these are your two values, then your GETNEXT code needs to deal with
both.  But you have both answers in your GETNEXT code in the same spot.
You need another if statement for $oid < ... .1.3.0:

>         } elsif ($request_info->getMode() == MODE_GETNEXT) {
>             # ... generally, you would calculate value from oid
>             if ( $oid < new 
> NetSNMP::OID(".1.3.6.1.4.1.193.37.10.11.64.10.1.2.0")) {
>             $request->setOID(".1.3.6.1.4.1.193.37.10.11.64.10.1.2.0");
>             $request->setValue(ASN_OCTET_STR, $default_SP);
>             $request->setOID(".1.3.6.1.4.1.193.37.10.11.64.10.1.3.0");
>             $request->setValue(ASN_OCTET_STR, $default_PC);
>             }

You only have one if statement above, eg.

>         } elsif ($request_info->getMode() == MODE_SET_RESERVE1) {
>             if ( ( $oid != new 
> NetSNMP::OID(".1.3.6.1.4.1.193.37.10.11.64.10.1.2.0")) and ( $oid !=
> new NetSNMP::OID(".1.3.6.1.4.1.193.37.10.11.64.10.1.3.0")) ) {  # do error 
> checking here
>             $request->setError($request_info, SNMP_ERR_NOSUCHNAME);
>             }
>         } elsif ($request_info->getMode() == MODE_SET_ACTION) {
>             # ... (or use the value)
>             $value = $request->getValue();
>         }

You're setting the $value variable but never using it again -- you would
need to update the $default_SP or equivelent based on the incoming OID
(which you'll need an if statement for each inside the MODE_SET_ACTION check).
-- 
Wes Hardaker
Please mail all replies to net-snmp-coders@lists.sourceforge.net


_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to