На 19 февр. 2017 г., в 5:10, Ondrej Zajicek <
santiago@crfreenet.org> написал:
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();