Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - marcelgrando

Pages: [1]
1
µTasker general / Re: coldstart trap on m5223x application
« on: June 08, 2011, 01:59:03 PM »
Hi Mark, thanks for the tips.
I looked the function fnRetry() and I saw that this function calls another function called fnResendSNMPTrap().
In fnResendSNMPTrap() I read the trap type and when the trap is coldstart one flag is increased and in the others iterations if the trap type is coldstart the function dont call the fnGenerateTrap() function.
Also I have included the guarda_trap variable because in the old way the function was called twice, sending out two traps despite the control.
The code is shown below:
Code: [Select]
static void fnResendSNMPTrap(void)
{
    static char coldstart_control = 0;
    int guarda_trap;
    guarda_trap = fnGenerateTrap(trap_list[0].ucTrapType, trap_list[0].ucTrapSpecificCode, 0, 0);
//    if (fnGenerateTrap(trap_list[0].ucTrapType, trap_list[0].ucTrapSpecificCode, 0, 0) == 0) {                     
if (guarda_trap == 0) {   
        int iTrapQueue = 1;                                              // frame could be delivered this time so delete it from the queue
        while (--ucTrapCnt != 0)
        {                                       // any further in queue are also sent now
            if(coldstart_control == 0 && trap_list[iTrapQueue].ucTrapType == SNMP_COLDSTART)
            {
            coldstart_control++;
            guarda_trap;
//            fnGenerateTrap(trap_list[iTrapQueue].ucTrapType, trap_list[iTrapQueue].ucTrapSpecificCode, 0, 0);
            iTrapQueue++;           
            } else {
            if(coldstart_control == 1 && trap_list[iTrapQueue].ucTrapType == SNMP_COLDSTART)
            {
            iTrapQueue++;
            } else {
            guarda_trap;
//            fnGenerateTrap(trap_list[iTrapQueue].ucTrapType, trap_list[iTrapQueue].ucTrapSpecificCode, 0, 0);
            iTrapQueue++;
            }
            }
        }
    }
}
Thanks for your time Mark

Best Regards,

Marcel.

2
µTasker general / coldstart trap on m5223x application
« on: May 25, 2011, 02:33:21 PM »
Hi Mark, in my application i'm monitoring some variables like a humidity, temperature... and using the snmp for sending traps. In the original code, the part of varbindings was not been implemented. Then I implemented the part of varbindings which I use when the traps are not standards.
My problem is, in the application i've an archive called "controleSNMPv1.c", and in the task fnTaskMonitoramentoSNMP only in the first iteration I send the coldstart trap like this:
Code: [Select]
void fnTaskMonitoramentoSNMP(TTASKTABLE * ptrTaskTable )
{
static unsigned char startTask = 0;
if(startTask == 0)
{
fnGenerateTrap(SNMP_COLDSTART, 0, 0, 0);
startTask++;
}
        :
        :
}

When I capture the traps in Wireshark, sometimes many of coldstart traps are sent. Why many of coldstart traps are sent if this is the only reference to coldstart trap in my code?

OBS: How i said, in the original code, the part of varbindings was not been implemented. Then I implemented the part of varbindings which I use when the traps are not standards. So the header of my fnGenerateTrap is:
Code: [Select]
int fnGenerateTrap(unsigned char ucTrap, unsigned char ucSpecificCode, unsigned char *varBinding, unsigned char tamanho);Where "*varBinding" is a pointer to the array of virBindings and "tamanho" is the size of this array.

Best Regards,

Marcel.

Pages: [1]