]> git.proxmox.com Git - mirror_frr.git/commit - ripd/rip_nb_config.c
*: change the signature of the northbound callbacks to be more flexible
authorRenato Westphal <renato@opensourcerouting.org>
Sat, 4 Apr 2020 16:38:51 +0000 (13:38 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Thu, 23 Apr 2020 13:14:32 +0000 (10:14 -0300)
commit60ee8be107c593212a9b53e8ed5c34c4c5e70af3
treef86993b9f63afab4a8e0291f27fd8f938f5dec8d
parent97cd849362b45ecbcb20194b5771c5ce777de6bc
*: change the signature of the northbound callbacks to be more flexible

Having a fixed set of parameters for each northbound callback isn't a
good idea since it makes it difficult to add new parameters whenever
that becomes necessary, as several hundreds or thousands of existing
callbacks need to be updated accordingly.

To remediate this issue, this commit changes the signature of all
northbound callbacks to have a single parameter: a pointer to a
'nb_cb_x_args' structure (where x is different for each type
of callback). These structures encapsulate all real parameters
(both input and output) the callbacks need to have access to. And
adding a new parameter to a given callback is as simple as adding
a new field to the corresponding 'nb_cb_x_args' structure, without
needing to update any instance of that callback in any daemon.

This commit includes a .cocci semantic patch that can be used to
update old code to the new format automatically.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
30 files changed:
bfdd/bfdd_nb.h
bfdd/bfdd_nb_config.c
bfdd/bfdd_nb_state.c
eigrpd/eigrp_northbound.c
isisd/isis_nb.h
isisd/isis_nb_config.c
isisd/isis_nb_state.c
lib/if.c
lib/if.h
lib/northbound.c
lib/northbound.h
lib/routemap.h
lib/routemap_northbound.c
lib/vrf.c
ripd/rip_nb.h
ripd/rip_nb_config.c
ripd/rip_nb_rpcs.c
ripd/rip_nb_state.c
ripngd/ripng_nb.h
ripngd/ripng_nb_config.c
ripngd/ripng_nb_rpcs.c
ripngd/ripng_nb_state.c
tests/lib/northbound/test_oper_data.c
tools/coccinelle/nb-cbs.cocci [new file with mode: 0644]
tools/gen_northbound_callbacks.c
vrrpd/vrrp_northbound.c
zebra/zebra_nb.h
zebra/zebra_nb_config.c
zebra/zebra_nb_rpcs.c
zebra/zebra_nb_state.c