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




charset=3Diso-8859-1">
6.5.7651.59">
dynamic indexing..




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.





/* New Definition */

typedef struct alarmHisTable_entry

{

    /* 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,

            &=
nbsp;           &n=
bsp; void **my_data_context,

            &=
nbsp;           &n=
bsp; netsnmp_variable_list *put_index_data,

            &=
nbsp;           &n=
bsp; 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 */ ;

   

    vptr =3D put_index_data;

    snmp_set_var_value(vptr, (u_char =
*)&myEntry[*position].alarmSerNo,

            &=
nbsp;         =
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,

            &=
nbsp;           &n=
bsp; void **my_data_context,

            &=
nbsp;           &n=
bsp; netsnmp_variable_list *put_index_data,

            &=
nbsp;           &n=
bsp; 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)++;

   

        printf("Value of =
position =3D %d\n",*position);

   /* Are we beyond the end? */

    if (*position >=3D20 )

   {

      /* 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,

            &=
nbsp;         =
sizeof(&myEntry[*position].alarmSerNo));

         

    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--


--===============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.
http://sourceforge.net/powerbar/db2/
--===============0177566066==
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

--===============0177566066==--