bit operators
Ondrej Zajicek
santiago at crfreenet.org
Sun Feb 19 01:10:46 CET 2017
On Sat, Feb 18, 2017 at 06:52:56PM +0000, Борис Коваленко wrote:
> Hello!
>
> I have an idea to write common filters like
>
> define RF_REDISTRIBUTE_CONNECTED 0x10
> define RF_REDISTRIBUTE_STATIC 0x20
> .....
>
> protocol ospf main_ospf {
> export where f_main_ospf_e(RF_REDISTRIBUTE_CONNECTED |
> RF_REDISTRIBUTE_STATIC);
> .....
> }
>
> function f_main_ospf_e(int flags) {
> if(source ~ [RTS_STATIC, RTS_STATIC_DEVICE] && (flags &
> RF_REDISTRIBUTE_STATIC)
> ........
> }
>
> Unfortunatelly there are not bit operators :( But may be there is another
> way?
Well, you could add multiple arguments to functions.
Or you could add 'int set' argument to function:
export where f_main_ospf_e([RF_REDISTRIBUTE_CONNECTED, RF_REDISTRIBUTE_STATIC]);
Or could use specific functions for each type:
export where f_ospf_redistribute_connected() || f_ospf_redistribute_static();
--
Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170219/f7490b7c/attachment.asc>
More information about the Bird-users
mailing list