[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serusers
Subject:    Re: [SR-Users] CFGUtils module question
From:       Fabian Borot <fborot () hotmail ! com>
Date:       2012-05-31 23:25:17
Message-ID: SNT110-W52E99CA3B322A7E0B3910DCD0B0 () phx ! gbl
[Download RAW message or body]


Txs a lot daniel, I got it now!







----------------------------------------
> Date: Thu, 31 May 2012 11:39:39 +0200
> From: miconda@gmail.com
> To: sr-users@lists.sip-router.org
> CC: fborot@hotmail.com
> Subject: Re: [SR-Users] CFGUtils module question
> 
> Hello,
> 
> On 5/30/12 11:33 PM, Fabian Borot wrote:
> > 
> > Hello
> > 
> > 
> > 
> > Can somebody help me understand the example given with MI command "is_gflag"?
> > 
> > 
> > 
> > 
> > 
> > ...
> > $ kamctl fifo set_gflag 1024
> > $ kamctl fifo is_gflag 1024
> > TRUE
> > $ kamctl fifo is_gflag 1025
> > TRUE
> > $ kamctl fifo is_gflag 1023
> > FALSE
> > $ kamctl fifo set_gflag 0x10
> > $ kamctl fifo is_gflag 1023
> > TRUE
> > $ kamctl fifo is_gflag 1007
> > FALSE
> > $ kamctl fifo is_gflag 16
> > TRUE
> > 
> > 
> > This is how I understand it. There are 32 posible flags (0..31), each one can be \
> > set independently. The commands "is_flag" and "set_gflag" expect a bitmask as \
> > value (decimal or hex) 
> > 
> > 
> > If I set "kamctl fifo set_gflag 1024", this means "100 0000 0000", I expect that \
> > the only flag that has been set to 1 is the position 10. How come the command \
> > "kamctl fifo is_gflag 1025" which is "100 0000 0001" can yield TRUE?. I expect it \
> > to be TRUE only if flags 0 and 10 are both set to 1. 
> > 
> > 
> > Same thing with setting the flag to 0x10 (16 in decimal, "1 0000" in binary), how \
> > come the "is_gflag 1023 and is_gflag 1007" can return TRUE?
> the test is done as bitwise AND operations and returns true if the
> result is not zero, meaning at least one of the flags is set.
> 
> Like: if(checkval & gflags) { return true} else {return false}
> 
> Cheers,
> Daniel
> 
> --
> Daniel-Constantin Mierla - http://www.asipto.com
> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - \
> http://asipto.com/u/katu Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 \
> - http://asipto.com/u/kpw 
> 
> 		 	   		  
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic