Thank you, Ondrej! Choose int set solution С уважением, Борис Коваленко
На 19 февр. 2017 г., 5:10, в 5:10, Ondrej Zajicek <[email protected]> написал:>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: [email protected]) >OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) >"To err is human -- to blame it on a computer is even more so."
