This is a multi-part message in MIME format.

--===============1306836998==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C8AA06.D45C7DAC"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C8AA06.D45C7DAC
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

I have a problem controlling notificaton/traps generation. I used=0D=0Anet-=
snmp example=20=0D=0A=0D=0Anotification.c and I am getting this odd behavi=
or. I use=0D=0Asnmp_alarm_register()=20=0D=0A=0D=0Ato execute my function c=
heck_send_trap() every 5sec. check_send_trap()=0D=0Amonitors variable trapF=
lag=20=0D=0A=0D=0Ato decide whether to generate a trap. trapFlag is set by =
an api function=0D=0Awhen I want to=20=0D=0A=0D=0Asend a trap. When I chan=
ge the value of TrapFlag from the api,=0D=0Acheck_send_trap()=20=0D=0A=0D=0A=
apparently does not see the value of TrapFlag change =3F=3F=3F If I set=0D=0A=
TrapFlag initially=20=0D=0A=0D=0Athe trap is sent every 5s continually. If =
I clear TrapFlag initially no=0D=0Atraps get sent.=0D=0A=0D=0AI can see Tra=
pFlag change when I call my api function, but=0D=0Acheck_send_trap() never=
=20=0D=0A=0D=0Asees the value of TrapFlag change, and this is the same vari=
able!!!=0D=0A=0D=0AI tried referencing TrapFlag directly in check_send_trap=
(),also tried=0D=0Ausing=20=0D=0A=0D=0Athe callback data in the snmp_alarm_=
register() call to save a pointer to=0D=0ATrapFlag. Neither=0D=0A=0D=0Aappr=
oach works, its like check_send_trap() is looking at a different=0D=0Avaria=
ble=3F=3F=3F.=20=0D=0A=0D=0ACan you help me as I have spent 2 days trying t=
o figure out what I am=0D=0Adoing wrong=3F=20=0D=0A=0D=0AI have everything =
else (get, set,etc.) working and I thought traps would=0D=0Aeasy!!=0D=0A=0D=
=0AI am running Net-snmp v5.1.1 on montavista linux.=20=0D=0A=0D=0AThis is =
my code in case you can spot anything I am doing wrong:=0D=0A=0D=0A=20=0D=0A=0D=
=0A1. INIT notification function called by net-snmp:-=0D=0A=0D=0Avoid init_=
notification(void)=0D=0A=0D=0A{=0D=0A=0D=0A DEBUGMSGTL(("example_notific=
ation",=0D=0A=0D=0A "initializing (setting callback alarm)\n=
"));=0D=0A=0D=0A init_snmp_alarmtraps();=0D=0A=0D=0A}=0D=0A=0D=0A=
=20=0D=0A=0D=0A2. SETUP ALARM TO SEND TRAP EVERY 5s:=0D=0A=0D=0Avoid init_s=
nmp_alarmtraps(void)=0D=0A=0D=0A{=0D=0A=0D=0A// run check_send_trap() every=
5 seconds=0D=0A=0D=0A snmp_alarm_register(5, /* seconds */=0D=0A=0D=
=0A SA_REPEAT, /* repeat (every 5 seconds).=0D=
=0A*/=0D=0A=0D=0A check_send_trap,=0D=0A=0D=
=0A &trapFlag /* callback data needed */=0D=0A=0D=0A=
// NULL /* no callback data needed */=0D=0A=0D=0A =
);=0D=0A=0D=0A}=0D=0A=0D=0A=20=0D=0A=0D=0A3. CALLBACK FUNCTION check_=
send_trap:-=0D=0A=0D=0Avoid check_send_trap(unsigned int clientreg, void *c=
lientarg)=0D=0A=0D=0A{=0D=0A=0D=0A //decide to send a trap based=
on value of TrapFlag=0D=0A=0D=0A int sendTrap;=0D=0A=0D=0A =
//Get TrapFlag value from clientarg - also tried referencing=0D=0ATr=
apFlag directly=0D=0A=0D=0A sendTrap=3D*(int*)clientarg;=0D=0A=0D=
=0A=20=0D=0A=0D=0A printf("\ncheck_send_trap, sendTrap=3D%d\n",sendTrap)=
;fflush(stdout);=0D=0A=0D=0A if (sendTrap)=0D=0A=0D=0A =
{=0D=0A=0D=0A send_alarmTrap_trap(clientreg,client=
arg);=0D=0A=0D=0A }=0D=0A=0D=0A}=0D=0A=0D=0A=20=0D=0A=0D=0ANote:=
send_alarmTrap_trap() code from notification.c net-snmp example,=0D=0Awork=
s OK=0D=0A=0D=0A=20=0D=0A=0D=0AThanks in advance,=0D=0A=0D=0A=20=0D=0A=0D=0A=
Clive=20=0D=0A=0D=0Aclive.morgan@andrew.com
>=20=0D=0A=0D=0A=20=0D=0A=0D=0A=20=0D=0A=0D=0A=20=0 D=0A=0D=0A--------------=
---------------------------------------------------------------------------=
-------=0D=0AThis message is for the designated recipient only and may=0D=0A=
contain privileged, proprietary, or otherwise private information. =20=0D=0A=
If you have received it in error, please notify the sender=0D=0Aimmediately=
and delete the original. Any unauthorized use of=0D=0Athis email is prohi=
bited.=0D=0A---------------------------------------------------------------=
---------------------------------=0D=0A[mf2]=0D=0A
------_=_NextPart_001_01C8AA06.D45C7DAC
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

=3D"urn:schemas-microsoft-comfficeffice" xmlns:w=3D"urn:sc=
hemas-microsoft-comffice:word" xmlns=3D"http://www.w3.org/TR/REC-html40">=0D=
=0A=0D=0A=0D=0A charset=3Dus-ascii">=0D=0A 11 (filtered medium)">=0D=0A=0D=
=0A=0D=0A =0D=0A=0D=0A=0D=
=0A=0D=0A
=0D=0A=0D=0A

2 face=3DArial>I h=
ave a problem controlling notificaton/traps generation. I=0D=0Aused net-snm=
p example >>

=0D=0A=0D=0A

nt size=3D2 face=3DArial> Arial'>notification.c  and I am getting this odd behavior. I=0D=0Ause =
snmp_alarm_register() >>

=0D=0A=0D=0A

soNormal> font-family:Arial'>to execute my function check_send_trap() every 5sec.=0D=0A=
check_send_trap() monitors variable trapFlag >>

=0D=
=0A=0D=0A

nt-size:10.0pt;=0D=0Afont-family:Arial'>to decide whether to generate a tra=
p. trapFlag is set by an=0D=0Aapi function when I want to >>
>

=0D=0A=0D=0A


pan style=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>send a trap.  W=
hen I change the value of TrapFlag from=0D=0Athe api, check_send_trap() p>>

=0D=0A=0D=0A

ace=3DArial>appare=
ntly does not see the value of TrapFlag change =3F=3F=3F If=0D=0AI set Trap=
Flag initially >>

=0D=0A=0D=0A

l> mily:Arial'>the trap is sent every 5s continually. If I clear TrapFlag=0D=0A=
initially no traps get sent.>>

=0D=0A=0D=0A

ss=3DMsoNormal> =0Afont-family:Arial'>I can see TrapFlag  change when I call my api fu=
nction,=0D=0Abut check_send_trap() never >>

=0D=0A=0D=
=0A

e:10.0pt;=0D=0Afont-family:Arial'>sees the value of TrapFlag change, and th=
is is the same variable!!!>>

=0D=0A=0D=0A

=3DMsoNormal> =0Afont-family:Arial'>I tried referencing TrapFlag directly in check_send_t=
rap(),also=0D=0Atried using >>

=0D=0A=0D=0A

ss=3DMsoNormal> =0Afont-family:Arial'>the callback data in the snmp_alarm_register() call t=
o save=0D=0Aa pointer to TrapFlag. Neither>>

=0D=0A=0D=
=0A

e:10.0pt;=0D=0Afont-family:Arial'>approach works, its like check_send_trap(=
) is looking at a=0D=0Adifferent variable=3F=3F=3F. >>
t>

=0D=0A=0D=0A

yle=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>Can you help me as I have =
spent 2 days trying to figure out=0D=0Awhat I am doing wrong=3F >>=

=0D=0A=0D=0A

ial>I have everyth=
ing else (get, set,etc.) working and I thought=0D=0Atraps would easy!!>=
>

=0D=0A=0D=0A

e=3DArial>I am run=
ning Net-snmp v5.1.1 on montavista linux. >>

=0D=0A=0D=
=0A

e:10.0pt;=0D=0Afont-family:Arial'>This is my code in case you can spot anyt=
hing I am doing=0D=0Awrong:>>

=0D=0A=0D=0A

s=3DMsoNormal> =0Afont-family:Arial'>>

=0D=0A=0D=0A

ss=3DMsoNormal> =0Afont-family:Arial'>1. INIT notification function called by net-snmp:- p>>

=0D=0A=0D=0A

ace=3DArial>void i=
nit_notification(void)>>

=0D=0A=0D=0A

soNormal> font-family:Arial'>{>>

=0D=0A=0D=0A

Normal> nt-family:Arial'>   =0D=0ADEBUGMSGTL(("example_notifica=
tion",>>

=0D=0A=0D=0A

ont size=3D2 face=3DArial> :Arial'>           &=
nbsp;   =0D=0A"initializing (setting callback alarm)\n&=
quot);>>

=0D=0A=0D=0A

size=3D2 face=3DArial> ial'>            ini=
t_snmp_alarmtraps();>>

=0D=0A=0D=0A

Normal> nt-family:Arial'>}>>

=0D=0A=0D=0A

rmal> -family:Arial'>>

=0D=0A=0D=0A

oNormal> ont-family:Arial'>2. SETUP ALARM TO SEND TRAP EVERY 5s:>> font>

=0D=0A=0D=0A

style=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>void init_snmp_alarmtra=
ps(void)>>

=0D=0A=0D=0A

size=3D2 face=3DArial> ial'>{>>

=0D=0A=0D=0A

ize=3D2 face=3DArial> l'>// run check_send_trap() every 5 seconds>>

=0D=
=0A=0D=0A

nt-size:10.0pt;=0D=0Afont-family:Arial'>   =0D=0Asnmp_alarm_=
register(5,     /* seconds */>>
<=
/p>=0D=0A=0D=0A

=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>    &nbsp=
;            &n=
bsp;     =0D=0ASA_REPEAT,    &=
nbsp;    /* repeat (every 5=0D=0Aseconds). */>> an>

=0D=0A=0D=0A

=
   =
            &nb=
sp;            =
        check_send_trap,>> n>

=0D=0A=0D=0A

<=
span style=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>   &=
nbsp;           &nbs=
p;       =0D=0A&trapFlag /*  ca=
llback data needed */>>

=0D=0A=0D=0A

oNormal> ont-family:Arial'>//         &=
nbsp;           =0D=0A=
NULL    /* no callback data needed */>>
t>

=0D=0A=0D=0A

yle=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>    &n=
bsp;   );>>

=0D=0A=0D=0A

ormal> t-family:Arial'>}>>

=0D=0A=0D=0A

mal> family:Arial'>>

=0D=0A=0D=0A

Normal> nt-family:Arial'>3. CALLBACK FUNCTION check_send_trap:->> font>

=0D=0A=0D=0A

style=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>void check_send_trap(un=
signed int clientreg, void=0D=0A*clientarg)>>

=0D=
=0A=0D=0A

nt-size:10.0pt;=0D=0Afont-family:Arial'>{>>

=0D=0A=0D=
=0A

e:10.0pt;=0D=0Afont-family:Arial'>      &nbsp=
;     //decide=0D=0Ato send a trap based on value of Tr=
apFlag>>

=0D=0A=0D=0A

ize=3D2 face=3DArial> l'>            int=0D=
=0AsendTrap;>>

=0D=0A=0D=0A

<=
font size=3D2 face=3DArial> y:Arial'>           =
//Get=0D=0ATrapFlag value from clientarg - also tried referencing TrapFlag=
directly>>

=0D=0A=0D=0A

t size=3D2 face=3DArial> rial'>            se=
ndTrap=3D*(int*)clientarg;>>

=0D=0A=0D=0A

=3DMsoNormal> =0Afont-family:Arial'>>

=0D=0A=0D=0A

ss=3DMsoNormal> =0Afont-family:Arial'>    printf("\ncheck_send_trap,=0D=
=0AsendTrap=3D%d\n",sendTrap);fflush(stdout);>>
=

=0D=0A=0D=0A

e=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>    &nbs=
p;       if=0D=0A(sendTrap)>>
=

=0D=0A=0D=0A

an style=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>   &nb=
sp;       
=3D2 face=3DArial> al'>{>>

=0D=0A=0D=0A

ze=3D2 face=3DArial> mily:Arial'>          &nb=
sp;            =
send_alarmTrap_trap(clientreg,clientarg);>>

=0D=0A=0D=
=0A

'font-size:10.0pt;=0D=0Afont-family:Arial'>     &n=
bsp;     
Arial>}>>
>

=0D=0A=0D=0A


pan style=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>}>><=
/font>

=0D=0A=0D=0A

n style=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>> n>

=0D=0A=0D=0A

<=
span style=3D'font-size:10.0pt;=0D=0Afont-family:Arial'>Note: send_alarmTra=
p_trap() code from notification.c=0D=0Anet-snmp example, works OK>=
>

=0D=0A=0D=0A


rial> o>

=0D=0A=0D=0A

Arial>Thanks in ad=
vance,>>

=0D=0A=0D=0A

ize=3D2 face=3DArial> l'>>

=0D=0A=0D=0A

t size=3D1 face=3D"Lucida Bright"> -family:"Lucida Bright"'>Clive >>

=0D=0A=0D=0A

class=3DMsoNormal> nt-size:=0D=0A12.0pt'> =3D1=0D=0Aface=3D"Lucida Bright"> ont-family:"Lucida Bright"'>clive.morgan@andrew.com
>
>>

=0D=0A=0D=0A


soNormal> =3D'font-size:12.0pt'> >>

=0D=0A=0D=0A

ss=3DMsoNormal> size:=0D=0A12.0pt'>>

=0D=0A=0D=0A

MsoNormal> =0A12.0pt'>>

=0D=0A=0D=0A
=0D=0A=0D=0A=



----------=
---------------------------------------------------------------------------=
-----------
=0D=0AThis message is for the desig=
nated recipient only and may
=0D=0Acontain priv=
ileged, proprietary, or otherwise private informat =
ion.  
=0D=0AIf you have received it =
in error, please notify the sender
=0D=0Aimmedi=
ately and delete the original.  Any unau=
thorized use of
=0D=0Athis email is prohibited.=

=0D=0A-----------------------------------------------------------------=
-------------------------------
=0D=0A[mf2]
=0D=0A=0D=
=0A=0D=0A
------_=_NextPart_001_01C8AA06.D45C7DAC--



--===============1306836998==
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 the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757...un.com/javaone
--===============1306836998==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
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

--===============1306836998==--