Hi Anish,
Thanks for responding.
The output of print_variable is:
00 02 04 08 10 20 40 7E 0C 1E 3B 00 00 0B 0B 0D
09 01 01 16 FF FF FF 00 09 01 01 03 FF FF FF 00
00 00 00 00 00 00 00 00
The ouput of snmpget command is:
SNMPv2-SMI::enterprises.29665.101.1.0 = Hex-STRING: 00 02 04 08 10 20 40 7E
0C 1E 3B 00 00 0B 0B 0D
09 01 01 16 FF FF FF 00 09 01 01 03 FF FF FF 00
00 00 00 00 00 00 00 00
Its showing the Hex-STRING
Thanks & Regards
On Tue, Sep 10, 2013 at 12:59 AM, Anish <anish2g...@yahoo.co.in> wrote:
> Hi Geet,
>
> Please send the value of the following,
>
> for(vars = response->variables; vars; vars = vars->next_variable)
> print_variable(vars->name, vars->name_length, vars);
>
>
>
> ------------------------------
> *From:* Geet Bhatia <geetbhati...@gmail.com>
> *To:* Net-snmp-coders@lists.sourceforge.net
> *Sent:* Monday, 9 September 2013 2:22 PM
> *Subject:* Problem in snmpget
>
>
> Hi,
>
> I have written a code to send snmp request and receive response from
> agent. The program is also processing the response. For this I memcpy the
> response in a buffer. I am using the following code to copy the response
> after receiving it in "response" snmp_pdu variable:
>
> for(vars=response->variables;vars;vars=vars->next_variable)
> {
> if(vars->type == ASN_OCTET_STR)
> {
> char *sp = (char*)malloc(1+vars->val_len);
> memcpy(sp,vars->val.string,vars->val_len);
> sp[vars->val_len] = '\0';
>
> //process the sp buffer
>
> }
> }
>
> The response is of 40 Bytes of ASN_OCTET_STR. The first byte of response
> is always 0.
>
> *Problem*: The problem is I am not getting anything in vars->val.string.
> Though the length returned by vars->val_len is 40 and data type returned by
> vars->type is ASN_OCTET_STR.
> The value sent by agent is correct. I have checked it on wireshark. Even
> the print_variable is printing correct value on console. But I am not able
> to get this value copied in buffer.
> I have also used the function snprint_variable but that too is copying 0
> in buffer.
> I have also debug the code and the value in vars->val.string is zero.
>
> Please help me in resolving this problem.
>
> Thanks & Regards
> Geet Bhatia
>
>
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
>
>
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders