in reply to Re: Re: SNMP String format
in thread SNMP String format

the SNMP (or Net::SNMP) module will take care of that for you. at least it does for me.

$res = $sess->set_request(-varbindlist => [ '1.3.6.1.4.1.5624.1.2.9.1.2.1.1.4.34603010', OCTET_STRING, "b +lahfoo", ]);

Replies are listed 'Best First'.
Re: Re: Re: Re: SNMP String format
by traveler (Parson) on Mar 11, 2003 at 23:00 UTC
    Yes, but mugster has:
    use SNMP_Session; use BER;
    I dont't see any reference to SNMP or Net::SNMP. I think these modules must behave differently than Net::SNMP. BER probably has the encode functions that do the BER encoding.

    --traveler

Re: Re: Re: Re: SNMP String format
by zengargoyle (Deacon) on Mar 11, 2003 at 23:23 UTC

    then this:

    ($type eq 'string') && do { $value = encode_string($value); push @enoid, [$oid,$value]; next; };

    should probably be this:

    ($type eq 'string') && do { $value = encode_string( pack "C*" map {hex} split /\s/, $value ); push @enoid, [$oid,$value]; next; };

    because you likely want to encode "\xAA\xBB\xCC\xDD" and not "AA BB CC DD".