On 22 Jan 2008 15:03:29 -0000, girish wrote:
>
> >What does the code *around* this fragment look like?
> >In particular, how is the variable 'requestvb' assigned?


> Here is the code which handles response:
> Response_handle(unsigned char *Buffer,int size, netsnmp_request_info *requests)
> {
> ptr = (unsigned char *)pbuf;
> netsnmp_variable_list *Vbsvd = NULL;
> for (Vbsvd = requests->requestvb; Vbsvd; Vbsvd = Vbsvd->next_variable )


No - you don't step through the 'requestvb' list.
You step through the 'requests' list.

Try
netsnmp_request_info *r;

for ( r=requests; r; r=r->next ) {
requestvb = r->requestvb;


> case TYPE_STRING:
> snmp_set_var_typed_value(requestvb,ASN_OCTET_STR,( u_char *) ptr, str_len);
> break;


You've never actually given 'requestvb' a value.
Your loop uses the variable 'Vbsvb' (although this is wrong anyway).
'requestvb' will probably have some random junk in it, so might easily
blow up when you try to access it.



> and requestvb at the time of debugging looks like this(for the 1st attribute):


I didn't ask what it looked like.
I asked how you *assigned* its value.
The answer appears to be that you don't.




Please try with the code fragments shown above.
It might also be worth starting with a fresh mib2c template output,
which should have a cleaner codebase. You seem to have mangled
this fairly effectively!

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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/...net-snmp-users