diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-03 19:42:59 +0000 | 
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-03 20:57:35 +0000 | 
| commit | 121f9dee7ce9f1b1b8a81f8bd97eed39ed87b477 (patch) | |
| tree | 96db220e5aa1f111be363aafe8f5264a19970fed /eigrpd/eigrp_zebra.c | |
| parent | 6c33ca975ab61a869cc70fa64c0a10bcc6bc1e0d (diff) | |
*: use ZAPI_CALLBACK_ARGS macro for zapi handlers
This macro:
- Marks ZAPI callbacks for readability
- Standardizes argument names
- Makes it simple to add ZAPI arguments in the future
- Ensures proper types
- Looks better
- Shortens function declarations
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'eigrpd/eigrp_zebra.c')
| -rw-r--r-- | eigrpd/eigrp_zebra.c | 55 | 
1 files changed, 20 insertions, 35 deletions
diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index dc1ae675b0..0a74e86263 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -53,21 +53,15 @@  #include "eigrpd/eigrp_topology.h"  #include "eigrpd/eigrp_fsm.h" -static int eigrp_interface_add(int, struct zclient *, zebra_size_t, vrf_id_t); -static int eigrp_interface_delete(int, struct zclient *, zebra_size_t, -				  vrf_id_t); -static int eigrp_interface_address_add(int, struct zclient *, zebra_size_t, -				       vrf_id_t vrf_id); -static int eigrp_interface_address_delete(int, struct zclient *, zebra_size_t, -					  vrf_id_t vrf_id); -static int eigrp_interface_state_up(int, struct zclient *, zebra_size_t, -				    vrf_id_t vrf_id); -static int eigrp_interface_state_down(int, struct zclient *, zebra_size_t, -				      vrf_id_t vrf_id); +static int eigrp_interface_add(ZAPI_CALLBACK_ARGS); +static int eigrp_interface_delete(ZAPI_CALLBACK_ARGS); +static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS); +static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS); +static int eigrp_interface_state_up(ZAPI_CALLBACK_ARGS); +static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS);  static struct interface *zebra_interface_if_lookup(struct stream *); -static int eigrp_zebra_read_route(int, struct zclient *, zebra_size_t, -				  vrf_id_t vrf_id); +static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS);  /* Zebra structure to hold current status. */  struct zclient *zclient = NULL; @@ -77,8 +71,7 @@ extern struct thread_master *master;  struct in_addr router_id_zebra;  /* Router-id update message from zebra. */ -static int eigrp_router_id_update_zebra(int command, struct zclient *zclient, -					zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_router_id_update_zebra(ZAPI_CALLBACK_ARGS)  {  	struct eigrp *eigrp;  	struct prefix router_id; @@ -94,8 +87,7 @@ static int eigrp_router_id_update_zebra(int command, struct zclient *zclient,  	return 0;  } -static int eigrp_zebra_route_notify_owner(int command, struct zclient *zclient, -					  zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_zebra_route_notify_owner(ZAPI_CALLBACK_ARGS)  {  	struct prefix p;  	enum zapi_route_notify_owner note; @@ -134,8 +126,7 @@ void eigrp_zebra_init(void)  /* Zebra route add and delete treatment. */ -static int eigrp_zebra_read_route(int command, struct zclient *zclient, -				  zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS)  {  	struct zapi_route api;  	struct eigrp *eigrp; @@ -150,9 +141,9 @@ static int eigrp_zebra_read_route(int command, struct zclient *zclient,  	if (eigrp == NULL)  		return 0; -	if (command == ZEBRA_REDISTRIBUTE_ROUTE_ADD) { +	if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) { -	} else /* if (command == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */ +	} else /* if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */  	{  	} @@ -160,8 +151,7 @@ static int eigrp_zebra_read_route(int command, struct zclient *zclient,  }  /* Inteface addition message from zebra. */ -static int eigrp_interface_add(int command, struct zclient *zclient, -			       zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_interface_add(ZAPI_CALLBACK_ARGS)  {  	struct interface *ifp;  	struct eigrp_interface *ei; @@ -180,8 +170,7 @@ static int eigrp_interface_add(int command, struct zclient *zclient,  	return 0;  } -static int eigrp_interface_delete(int command, struct zclient *zclient, -				  zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_interface_delete(ZAPI_CALLBACK_ARGS)  {  	struct interface *ifp;  	struct stream *s; @@ -211,12 +200,11 @@ static int eigrp_interface_delete(int command, struct zclient *zclient,  	return 0;  } -static int eigrp_interface_address_add(int command, struct zclient *zclient, -				       zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS)  {  	struct connected *c; -	c = zebra_interface_address_read(command, zclient->ibuf, vrf_id); +	c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);  	if (c == NULL)  		return 0; @@ -233,14 +221,13 @@ static int eigrp_interface_address_add(int command, struct zclient *zclient,  	return 0;  } -static int eigrp_interface_address_delete(int command, struct zclient *zclient, -					  zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS)  {  	struct connected *c;  	struct interface *ifp;  	struct eigrp_interface *ei; -	c = zebra_interface_address_read(command, zclient->ibuf, vrf_id); +	c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);  	if (c == NULL)  		return 0; @@ -266,8 +253,7 @@ static int eigrp_interface_address_delete(int command, struct zclient *zclient,  	return 0;  } -static int eigrp_interface_state_up(int command, struct zclient *zclient, -				    zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_interface_state_up(ZAPI_CALLBACK_ARGS)  {  	struct interface *ifp; @@ -323,8 +309,7 @@ static int eigrp_interface_state_up(int command, struct zclient *zclient,  	return 0;  } -static int eigrp_interface_state_down(int command, struct zclient *zclient, -				      zebra_size_t length, vrf_id_t vrf_id) +static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS)  {  	struct interface *ifp;  | 
