zebra: cleanup for zapi_msg.c split

* Rename client_connect and client_close hooks to zapi_client_connect
  and zapi_client_close
* Remove some more unnecessary headers
* Fix a copy-paste error in zapi_msg.[ch] header comments
* Fix an inclusion comment in zserv.c

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2018-04-22 22:10:54 -04:00
parent 453844abd7
commit d864709552
10 changed files with 20 additions and 18 deletions

View file

@ -290,7 +290,7 @@ void label_manager_init(char *lm_zserv_path)
ibuf = stream_new(ZEBRA_MAX_PACKET_SIZ);
obuf = stream_new(ZEBRA_MAX_PACKET_SIZ);
hook_register(client_close, release_daemon_label_chunks);
hook_register(zapi_client_close, release_daemon_label_chunks);
}
/**

View file

@ -78,7 +78,7 @@ void table_manager_enable(ns_id_t ns_id)
return;
tbl_mgr.lc_list = list_new();
tbl_mgr.lc_list->del = delete_table_chunk;
hook_register(client_close, release_daemon_table_chunks);
hook_register(zapi_client_close, release_daemon_table_chunks);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Zebra API server.
* Zebra API message creation & consumption.
* Portions:
* Copyright (C) 1997-1999 Kunihiro Ishiguro
* Copyright (C) 2015-2018 Cumulus Networks, Inc.

View file

@ -1,5 +1,5 @@
/*
* Zebra API server.
* Zebra API message creation & consumption.
* Portions:
* Copyright (C) 1997-1999 Kunihiro Ishiguro
* Copyright (C) 2015-2018 Cumulus Networks, Inc.

View file

@ -2916,5 +2916,5 @@ void zebra_mpls_init(void)
if (!mpls_processq_init(&zebrad))
mpls_enabled = 1;
hook_register(client_close, zebra_mpls_cleanup_fecs_for_client);
hook_register(zapi_client_close, zebra_mpls_cleanup_fecs_for_client);
}

View file

@ -126,7 +126,7 @@ void zebra_ptm_init(void)
ptm_cb.ptm_sock = -1;
hook_register(client_close, zebra_ptm_bfd_client_deregister);
hook_register(zapi_client_close, zebra_ptm_bfd_client_deregister);
}
void zebra_ptm_finish(void)

View file

@ -292,7 +292,7 @@ void zebra_pw_init(struct zebra_vrf *zvrf)
RB_INIT(zebra_pw_head, &zvrf->pseudowires);
RB_INIT(zebra_static_pw_head, &zvrf->static_pseudowires);
hook_register(client_close, zebra_pw_client_close);
hook_register(zapi_client_close, zebra_pw_client_close);
}
void zebra_pw_exit(struct zebra_vrf *zvrf)

View file

@ -73,7 +73,7 @@ int zebra_rnh_ipv6_default_route = 0;
void zebra_rnh_init(void)
{
hook_register(client_close, zebra_client_cleanup_rnh);
hook_register(zapi_client_close, zebra_client_cleanup_rnh);
}
static inline struct route_table *get_rnh_table(vrf_id_t vrfid, int family,

View file

@ -22,6 +22,7 @@
#include <zebra.h>
/* clang-format off */
#include <errno.h> /* for errno */
#include <netinet/in.h> /* for sockaddr_in */
#include <stdint.h> /* for uint8_t */
@ -53,12 +54,11 @@
#include "lib/zclient.h" /* for zmsghdr, ZEBRA_HEADER_SIZE, ZEBRA... */
#include "zebra/debug.h" /* for various debugging macros */
#include "zebra/label_manager.h" /* for release_daemon_label_chunks, rele... */
#include "zebra/rib.h" /* for rib_score_proto */
#include "zebra/table_manager.h" /* for release_daemon_table_chunks */
#include "zebra/zapi_msg.h" /* for zserv_handle_commands */
#include "zebra/zebra_vrf.h" /* for zebra_vrf_lookup_by_id, zvrf */
#include "zebra/zserv.h" /* for zclient */
#include "zebra/zserv.h" /* for zserv */
/* clang-format on */
/* Event list of zebra. */
enum event { ZEBRA_READ, ZEBRA_WRITE };
@ -80,13 +80,13 @@ int zebra_server_send_message(struct zserv *client, struct stream *msg)
/* Lifecycle ---------------------------------------------------------------- */
/* Hooks for client connect / disconnect */
DEFINE_HOOK(client_connect, (struct zserv *client), (client));
DEFINE_KOOH(client_close, (struct zserv *client), (client));
DEFINE_HOOK(zapi_client_connect, (struct zserv * client), (client));
DEFINE_KOOH(zapi_client_close, (struct zserv * client), (client));
/* free zebra client information. */
static void zebra_client_free(struct zserv *client)
{
hook_call(client_close, client);
hook_call(zapi_client_close, client);
/* Close file descriptor. */
if (client->sock) {
@ -179,7 +179,7 @@ static void zebra_client_create(int sock)
zebra_vrf_update_all(client);
hook_call(client_connect, client);
hook_call(zapi_client_connect, client);
/* start read loop */
zebra_event(client, ZEBRA_READ);

View file

@ -23,6 +23,7 @@
#ifndef _ZEBRA_ZSERV_H
#define _ZEBRA_ZSERV_H
/* clang-format off */
#include <stdint.h> /* for uint32_t, uint8_t */
#include <time.h> /* for time_t */
@ -37,6 +38,7 @@
#include "lib/hook.h" /* for DECLARE_HOOK, DECLARE_KOOH */
#include "zebra/zebra_vrf.h" /* for zebra_vrf */
/* clang-format on */
/* Default port information. */
#define ZEBRA_VTY_PORT 2601
@ -143,8 +145,8 @@ struct zserv {
struct zebra_vrf *zvrf
/* Hooks for client connect / disconnect */
DECLARE_HOOK(client_connect, (struct zserv *client), (client));
DECLARE_KOOH(client_close, (struct zserv *client), (client));
DECLARE_HOOK(zapi_client_connect, (struct zserv * client), (client));
DECLARE_KOOH(zapi_client_close, (struct zserv * client), (client));
/* Zebra instance */
struct zebra_t {