-
dynamic indexing..
This is a multi-part message in MIME format.
--===============0177566066==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C7913D.EDA0F31C"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C7913D.EDA0F31C
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Dear Friends,
Greetings to all,
Thanks for your help to solve the lot of issues related to my =
applications.
Here, i have a mib table indexed by internal index, generated by mib2c =
iterator config, net-snmp style of code.The snmp agent got values by =
other external subsystems.I have used the position count style loop =
context.So presently,i fixed the index range as 20. But i need the =
indexing should not be fixed.
Here with i have given my code of get{first,next}hooks and my index api =
also.
=20
/* New Definition */
typedef struct alarmHisTable_entry=20
{
/* Index values */
long alarmSerNo;
/* Column values */
long alarmID;
long alarmType;
char alarmName;
long alarmSeverity;
long alarmStatus;
char alarmTimeStamp;
}alarmHisTableEntry;
alarmHisTableEntry *AlarmHisEntry;
static oid alarmHisTable_oid[] =3D { 1,3,6,1,4,1,8723,1,1,1,1,9,4 };
static oid alarmHisIndex_oid[] =3D { 1,3,6,1,4,1,8723,1,1,1,1,9,4,1};
..
..
..
netsnmp_variable_list *
alarmHisTable_get_first_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list *put_index_data,
netsnmp_iterator_info *mydata)
{
netsnmp_variable_list *vptr;
alarmHisTableEntry *myEntry;
/* 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 getAlarmIndex();
*my_data_context =3D (void *)&myEntry[*position] /** XXX */ ;
=20
vptr =3D put_index_data;
snmp_set_var_value(vptr, (u_char *)&myEntry[*position].alarmSerNo,
sizeof(&myEntry[*position].alarmSerNo));
vptr =3D vptr->next_variable;
return put_index_data;
}
netsnmp_variable_list *
alarmHisTable_get_next_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list *put_index_data,
netsnmp_iterator_info *mydata)
{
netsnmp_variable_list *vptr;
alarmHisTableEntry *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)++;
=20
printf("Value of position =3D %d\n",*position);
/* Are we beyond the end? */
if (*position >=3D20 )=20
{
/* End of routes. stop here by returning NULL */
SNMP_FREE(position);
*my_loop_context =3D NULL;
*my_data_context =3D NULL;
return NULL;
}
*my_loop_context =3D position /** XXX */ ;
myEntry =3D getAlarmIndex();
*my_data_context =3D (void *)&myEntry[*position] /** XXX */ ;
vptr =3D put_index_data;
snmp_set_var_value(vptr, (u_char *)&myEntry[*position].alarmSerNo,
sizeof(&myEntry[*position].alarmSerNo));
=20
vptr =3D vptr->next_variable;
return put_index_data;
}
Is there alternate for this to make the index varying...
With thanks and Regards,
D.SenthilNathan
------_=_NextPart_001_01C7913D.EDA0F31C
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>dynamic indexing..</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=3D2>Dear Friends,<BR>
<BR>
Greetings to all,<BR>
Thanks for your help to solve the lot of issues related to my =
applications.<BR>
<BR>
Here, i have a mib table indexed by internal index, generated by mib2c =
iterator config, net-snmp style of code.The snmp agent got values by =
other external subsystems.I have used the position count style loop =
context.So presently,i fixed the index range as 20. But i need the =
indexing should not be fixed.<BR>
<BR>
<BR>
Here with i have given my code of get{first,next}hooks and my index api =
also.<BR>
<BR>
<BR>
/* New Definition */<BR>
typedef struct alarmHisTable_entry<BR>
{<BR>
/* Index values */<BR>
long alarmSerNo;<BR>
<BR>
/* Column values */<BR>
long alarmID;<BR>
long alarmType;<BR>
char alarmName;<BR>
long alarmSeverity;<BR>
long alarmStatus;<BR>
char alarmTimeStamp;<BR>
}alarmHisTableEntry;<BR>
<BR>
alarmHisTableEntry *AlarmHisEntry;<BR>
static oid alarmHisTable_oid[] =3D { 1,3,6,1,4,1,8723,1,1,1,1,9,4 };<BR>
static oid alarmHisIndex_oid[] =3D { =
1,3,6,1,4,1,8723,1,1,1,1,9,4,1};<BR>
<BR>
..<BR>
..<BR>
..<BR>
netsnmp_variable_list *<BR>
alarmHisTable_get_first_data_point(void **my_loop_context,<BR>
&=
nbsp; &n=
bsp; void **my_data_context,<BR>
&=
nbsp; &n=
bsp; netsnmp_variable_list *put_index_data,<BR>
&=
nbsp; &n=
bsp; netsnmp_iterator_info *mydata)<BR>
{<BR>
netsnmp_variable_list *vptr;<BR>
alarmHisTableEntry *myEntry;<BR>
/* We use the positinonal count as our loop context =
*/<BR>
int *position =3D (int*)malloc(sizeof(int));<BR>
*position =3D 0;<BR>
*my_loop_context =3D position /** XXX */ ;<BR>
myEntry =3D getAlarmIndex();<BR>
*my_data_context =3D (void *)&myEntry[*position] =
/** XXX */ ;<BR>
<BR>
vptr =3D put_index_data;<BR>
snmp_set_var_value(vptr, (u_char =
*)&myEntry[*position].alarmSerNo,<BR>
&=
nbsp; =
sizeof(&myEntry[*position].alarmSerNo));<BR>
vptr =3D vptr->next_variable;<BR>
return put_index_data;<BR>
}<BR>
<BR>
netsnmp_variable_list *<BR>
alarmHisTable_get_next_data_point(void **my_loop_context,<BR>
&=
nbsp; &n=
bsp; void **my_data_context,<BR>
&=
nbsp; &n=
bsp; netsnmp_variable_list *put_index_data,<BR>
&=
nbsp; &n=
bsp; netsnmp_iterator_info *mydata)<BR>
{<BR>
netsnmp_variable_list *vptr;<BR>
alarmHisTableEntry *myEntry;<BR>
int *position =3D (int *) *my_loop_context;<BR>
<BR>
/* make sure we were called correctly */<BR>
if (!position)<BR>
return NULL;<BR>
<BR>
/* go to the next route in the list */<BR>
(*position)++;<BR>
<BR>
printf("Value of =
position =3D %d\n",*position);<BR>
/* Are we beyond the end? */<BR>
if (*position >=3D20 )<BR>
{<BR>
/* End of routes. stop here by =
returning NULL */<BR>
SNMP_FREE(position);<BR>
*my_loop_context =3D =
NULL;<BR>
*my_data_context =3D =
NULL;<BR>
return NULL;<BR>
}<BR>
*my_loop_context =3D position /** XXX */ ;<BR>
myEntry =3D getAlarmIndex();<BR>
*my_data_context =3D (void *)&myEntry[*position] =
/** XXX */ ;<BR>
vptr =3D put_index_data;<BR>
snmp_set_var_value(vptr, (u_char =
*)&myEntry[*position].alarmSerNo,<BR>
&=
nbsp; =
sizeof(&myEntry[*position].alarmSerNo));<BR>
<BR>
vptr =3D vptr->next_variable;<BR>
return put_index_data;<BR>
}<BR>
Is there alternate for this to make the index varying...<BR>
<BR>
<BR>
With thanks and Regards,<BR>
D.SenthilNathan<BR>
<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C7913D.EDA0F31C--
--===============0177566066==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
[url]http://sourceforge.net/powerbar/db2/[/url]
--===============0177566066==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Net-snmp-coders mailing list
[email]Net-snmp-coders@lists.sourceforge.net[/email]
[url]https://lists.sourceforge.net/lists/listinfo/net-snmp-coders[/url]
--===============0177566066==--