During getBulk

This is a discussion on During getBulk within the SNMP Coders forums, part of the Networking and Network Related category; This is a multi-part message in MIME format. --===============0585076610== Content-class: urn:content-classes:message Content-Type: multipart/alternative; ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-29-2007
Senthil Nathan
 
Posts: n/a
Default During getBulk

This is a multi-part message in MIME format.

--===============0585076610==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C771FD.7254412B"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C771FD.7254412B
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Hi,
Greetings to everyone.

Regarding my project , i am using Net Snmp 5.3.0.1
I have generated the .c code by using mib2c tool with iterator conf =
option.
The Snmp agent implement like that i wont have the data directly,it will =
be getting by other lower layers.

In the get_first and get_next routines, i am using position coount as my =
loop context.
Here with i have given the sample code for you reference.

The issue, i have faced, During getBulk query ,i have retrieved all the =
rows from the table e.g 40 rows.
After that, it will call netsnmp next table handler api.

Any one of you, help me to resolve this issue, so that during getbulk, =
it wont start call another table api.

Here is the sample code...

netsnmp_variable_list *
ontEqpmtTable_get_first_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list *put_index_data,
netsnmp_iterator_info *mydata)
{ =20
netsnmp_variable_list *vptr;
ontEqpmtTableEntry* myEntry;
=09
/* We use the positinonal count as our loop context */
int *position =3D (int*)malloc(sizeof(int));
*position =3D 0;


*my_loop_context =3D position /** XXX */ ;

myEntry =3D getEqpmtOntIndex();

*my_data_context =3D (void *)&myEntry[*position] /** XXX */ ;

vptr =3D put_index_data;

snmp_set_var_value(vptr, (u_char *)&myEntry[*position].ontID,
sizeof(&myEntry[*position].ontID));
=09
vptr =3D vptr->next_variable;

return put_index_data;
}


netsnmp_variable_list *
ontEqpmtTable_get_next_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list *put_index_data,
netsnmp_iterator_info *mydata)
{
=20
netsnmp_variable_list *vptr;
ontEqpmtTableEntry *myEntry;

int *position =3D (int *) *my_loop_context;

/* make sure we were called correctly */
if (!position)
return NULL;

/* go to the next route in the list */
(*position)++;

printf("Value of position =3D %d\n",*position);
/* change for no of rows.....*/
/* Are we beyond the end? */
if (*position > 32 ) =20
{
=09
=09
/* End of routes. stop here by returning NULL */
SNMP_FREE(position);
*my_loop_context =3D NULL;
*my_data_context =3D NULL;
free(Eqpmtentry);
return NULL;
}

*my_loop_context =3D position /** XXX */ ;

myEntry =3D getEqpmtOntIndex();

*my_data_context =3D (void *)&myEntry[*position] /** XXX */ ;

vptr =3D put_index_data;

snmp_set_var_value(vptr, (u_char *)&myEntry[*position].ontID,
sizeof(&myEntry[*position].ontID));
=20
vptr =3D vptr->next_variable;

return put_index_data;
}








With thanks and Regards,
D.SenthilNathan




------_=_NextPart_001_01C771FD.7254412B
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7651.59">
<TITLE>During getBulk </TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

<P><FONT SIZE=3D2>Hi,<BR>
Greetings to everyone.<BR>
<BR>
Regarding my project , i am using Net Snmp 5.3.0.1<BR>
I have generated the .c code by using mib2c tool with iterator =
conf&nbsp; option.<BR>
The Snmp agent implement like that i wont have the data directly,it will =
be getting by other lower layers.<BR>
<BR>
In the get_first and get_next routines, i am using position coount as my =
loop context.<BR>
Here with i have given the sample code for you reference.<BR>
<BR>
The issue, i have faced, During getBulk query ,i have retrieved all the =
rows from the table e.g 40 rows.<BR>
After that, it will call netsnmp next table handler api.<BR>
<BR>
Any one of you, help me to resolve this issue, so that during getbulk, =
it wont start call another table api.<BR>
<BR>
Here is the sample code...<BR>
<BR>
netsnmp_variable_list *<BR>
ontEqpmtTable_get_first_data_point(void **my_loop_context,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp; void **my_data_context,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp; netsnmp_variable_list *put_index_data,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp; netsnmp_iterator_info *mydata)<BR>
{&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp; netsnmp_variable_list *vptr;<BR>
&nbsp;&nbsp;&nbsp; ontEqpmtTableEntry* myEntry;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp; /* We use the positinonal count as our loop context =
*/<BR>
&nbsp;&nbsp;&nbsp; int *position =3D (int*)malloc(sizeof(int));<BR>
&nbsp;&nbsp;&nbsp; *position =3D 0;<BR>
<BR>
<BR>
&nbsp;&nbsp;&nbsp; *my_loop_context =3D position /** XXX */ ;<BR>
<BR>
&nbsp;&nbsp;&nbsp; myEntry =3D getEqpmtOntIndex();<BR>
<BR>
&nbsp;&nbsp;&nbsp; *my_data_context =3D (void *)&amp;myEntry[*position] =
/** XXX */ ;<BR>
<BR>
&nbsp;&nbsp;&nbsp; vptr =3D put_index_data;<BR>
<BR>
&nbsp;&nbsp;&nbsp; snmp_set_var_value(vptr, (u_char =
*)&amp;myEntry[*position].ontID,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp; =
sizeof(&amp;myEntry[*position].ontID));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp; vptr =3D vptr-&gt;next_variable;<BR>
<BR>
&nbsp;&nbsp;&nbsp; return put_index_data;<BR>
}<BR>
<BR>
<BR>
netsnmp_variable_list *<BR>
ontEqpmtTable_get_next_data_point(void **my_loop_context,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp; void **my_data_context,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp; netsnmp_variable_list *put_index_data,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&n=
bsp; netsnmp_iterator_info *mydata)<BR>
{<BR>
&nbsp;&nbsp;<BR>
&nbsp;&nbsp; netsnmp_variable_list *vptr;<BR>
&nbsp;&nbsp; ontEqpmtTableEntry *myEntry;<BR>
<BR>
&nbsp;&nbsp;&nbsp; int *position =3D (int *) *my_loop_context;<BR>
<BR>
&nbsp;&nbsp;&nbsp; /* make sure we were called correctly */<BR>
&nbsp;&nbsp;&nbsp; if (!position)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return NULL;<BR>
<BR>
&nbsp;&nbsp;&nbsp; /* go to the next route in the list */<BR>
&nbsp;&nbsp;&nbsp; (*position)++;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;Value of =
position =3D %d\n&quot;,*position);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* change for no of =
rows.....*/<BR>
&nbsp;&nbsp;&nbsp; /* Are we beyond the end? */<BR>
&nbsp;&nbsp;&nbsp; if (*position &gt; 32 )&nbsp;<BR>
&nbsp;&nbsp;&nbsp; {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* End of routes.&nbsp; stop =
here by returning NULL */<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SNMP_FREE(position);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *my_loop_context =3D =
NULL;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *my_data_context =3D =
NULL;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; free(Eqpmtentry);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return NULL;<BR>
&nbsp;&nbsp;&nbsp; }<BR>
<BR>
&nbsp;&nbsp;&nbsp; *my_loop_context =3D position /** XXX */ ;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myEntry =3D getEqpmtOntIndex();<BR>
<BR>
&nbsp;&nbsp;&nbsp; *my_data_context =3D (void *)&amp;myEntry[*position] =
/** XXX */ ;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vptr =3D put_index_data;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; snmp_set_var_value(vptr, (u_char =
*)&amp;myEntry[*position].ontID,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp; =
sizeof(&amp;myEntry[*position].ontID));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<BR>
&nbsp;&nbsp;&nbsp; vptr =3D vptr-&gt;next_variable;<BR>
<BR>
&nbsp;&nbsp;&nbsp; return put_index_data;<BR>
}<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
With thanks and Regards,<BR>
D.SenthilNathan<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C771FD.7254412B--


--===============0585076610==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?p...rge&CID=DEVDEV
--===============0585076610==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============0585076610==--

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:51 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0