diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 19:08:37 +0200 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 19:12:35 +0200 |
commit | 2560505196b924f5c447f6c1d493ed9b74a13108 (patch) | |
tree | 515278e4362bf4f9c9418168df90a90b74946c20 /ripd | |
parent | Merge pull request #9788 from idryzhov/ospf6-clear-interface-vrf (diff) | |
download | frr-2560505196b924f5c447f6c1d493ed9b74a13108.tar.xz frr-2560505196b924f5c447f6c1d493ed9b74a13108.zip |
lib: northbound cli show/cmd functions must not modify data nodes
To ensure this, add a const modifier to functions' arguments. Would be
great do this initially and avoid this large code change, but better
late than never.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'ripd')
-rw-r--r-- | ripd/rip_cli.c | 53 | ||||
-rw-r--r-- | ripd/rip_nb.h | 53 |
2 files changed, 58 insertions, 48 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c index 8a3ce24f5..5590b1833 100644 --- a/ripd/rip_cli.c +++ b/ripd/rip_cli.c @@ -83,7 +83,7 @@ DEFPY_YANG (no_router_rip, return nb_cli_apply_changes_clear_pending(vty, NULL); } -void cli_show_router_rip(struct vty *vty, struct lyd_node *dnode, +void cli_show_router_rip(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *vrf_name; @@ -112,7 +112,7 @@ DEFPY_YANG (rip_allow_ecmp, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_allow_ecmp(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_allow_ecmp(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { if (!yang_dnode_get_bool(dnode, NULL)) @@ -138,7 +138,7 @@ DEFPY_YANG (rip_default_information_originate, } void cli_show_rip_default_information_originate(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults) { if (!yang_dnode_get_bool(dnode, NULL)) @@ -174,7 +174,7 @@ DEFPY_YANG (no_rip_default_metric, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_default_metric(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_default_metric(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " default-metric %s\n", @@ -208,7 +208,7 @@ DEFPY_YANG (no_rip_distance, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_distance(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_distance(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { if (yang_dnode_is_default(dnode, NULL)) @@ -243,7 +243,7 @@ DEFPY_YANG (rip_distance_source, prefix_str); } -void cli_show_rip_distance_source(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_distance_source(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " distance %s %s", @@ -271,7 +271,7 @@ DEFPY_YANG (rip_neighbor, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_neighbor(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_neighbor(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " neighbor %s\n", yang_dnode_get_string(dnode, NULL)); @@ -293,7 +293,7 @@ DEFPY_YANG (rip_network_prefix, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_network_prefix(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_network_prefix(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " network %s\n", yang_dnode_get_string(dnode, NULL)); @@ -315,7 +315,8 @@ DEFPY_YANG (rip_network_if, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_network_interface(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_network_interface(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " network %s\n", yang_dnode_get_string(dnode, NULL)); @@ -348,7 +349,7 @@ DEFPY_YANG (rip_offset_list, ifname ? ifname : "*", direction); } -void cli_show_rip_offset_list(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_offset_list(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *interface; @@ -380,7 +381,7 @@ DEFPY_YANG (rip_passive_default, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_passive_default(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_passive_default(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { if (!yang_dnode_get_bool(dnode, NULL)) @@ -417,14 +418,16 @@ DEFPY_YANG (rip_passive_interface, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_passive_interface(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_passive_interface(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " passive-interface %s\n", yang_dnode_get_string(dnode, NULL)); } -void cli_show_rip_non_passive_interface(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_non_passive_interface(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " no passive-interface %s\n", @@ -460,7 +463,7 @@ DEFPY_YANG (rip_redistribute, protocol); } -void cli_show_rip_redistribute(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_redistribute(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " redistribute %s", @@ -490,7 +493,7 @@ DEFPY_YANG (rip_route, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_route(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_route(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " route %s\n", yang_dnode_get_string(dnode, NULL)); @@ -535,7 +538,7 @@ DEFPY_YANG (no_rip_timers, return nb_cli_apply_changes(vty, "./timers"); } -void cli_show_rip_timers(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_timers(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " timers basic %s %s %s\n", @@ -573,7 +576,7 @@ DEFPY_YANG (no_rip_version, return nb_cli_apply_changes(vty, NULL); } -void cli_show_rip_version(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_version(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { /* @@ -619,7 +622,8 @@ DEFPY_YANG (ip_rip_split_horizon, return nb_cli_apply_changes(vty, "./frr-ripd:rip"); } -void cli_show_ip_rip_split_horizon(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip_rip_split_horizon(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults) { int value; @@ -655,7 +659,7 @@ DEFPY_YANG (ip_rip_v2_broadcast, return nb_cli_apply_changes(vty, "./frr-ripd:rip"); } -void cli_show_ip_rip_v2_broadcast(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip_rip_v2_broadcast(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { if (!yang_dnode_get_bool(dnode, NULL)) @@ -711,7 +715,8 @@ DEFPY_YANG (no_ip_rip_receive_version, return nb_cli_apply_changes(vty, "./frr-ripd:rip"); } -void cli_show_ip_rip_receive_version(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip_rip_receive_version(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults) { switch (yang_dnode_get_enum(dnode, NULL)) { @@ -780,7 +785,7 @@ DEFPY_YANG (no_ip_rip_send_version, return nb_cli_apply_changes(vty, "./frr-ripd:rip"); } -void cli_show_ip_rip_send_version(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip_rip_send_version(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { switch (yang_dnode_get_enum(dnode, NULL)) { @@ -860,7 +865,7 @@ DEFPY_YANG (no_ip_rip_authentication_mode, } void cli_show_ip_rip_authentication_scheme(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults) { switch (yang_dnode_get_enum(dnode, "./mode")) { @@ -933,7 +938,7 @@ DEFPY_YANG (no_ip_rip_authentication_string, } void cli_show_ip_rip_authentication_string(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " ip rip authentication string %s\n", @@ -982,7 +987,7 @@ DEFPY_YANG (no_ip_rip_authentication_key_chain, } void cli_show_ip_rip_authentication_key_chain(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " ip rip authentication key-chain %s\n", diff --git a/ripd/rip_nb.h b/ripd/rip_nb.h index 26bb3cb3b..1e29f3b77 100644 --- a/ripd/rip_nb.h +++ b/ripd/rip_nb.h @@ -128,57 +128,62 @@ void ripd_instance_redistribute_apply_finish( void ripd_instance_timers_apply_finish(struct nb_cb_apply_finish_args *args); /* Optional 'cli_show' callbacks. */ -void cli_show_router_rip(struct vty *vty, struct lyd_node *dnode, +void cli_show_router_rip(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_allow_ecmp(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_allow_ecmp(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); void cli_show_rip_default_information_originate(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_default_metric(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_default_metric(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_distance(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_distance(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_distance_source(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_distance_source(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_neighbor(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_neighbor(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_network_prefix(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_network_prefix(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_network_interface(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_network_interface(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_offset_list(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_offset_list(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_passive_default(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_passive_default(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_passive_interface(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_passive_interface(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_non_passive_interface(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_non_passive_interface(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_redistribute(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_redistribute(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_route(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_route(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_timers(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_timers(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_rip_version(struct vty *vty, struct lyd_node *dnode, +void cli_show_rip_version(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_ip_rip_split_horizon(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip_rip_split_horizon(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults); -void cli_show_ip_rip_v2_broadcast(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip_rip_v2_broadcast(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_ip_rip_receive_version(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip_rip_receive_version(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults); -void cli_show_ip_rip_send_version(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip_rip_send_version(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); void cli_show_ip_rip_authentication_scheme(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults); void cli_show_ip_rip_authentication_string(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults); void cli_show_ip_rip_authentication_key_chain(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults); /* Notifications. */ |