forked from Mirror/frr
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:
parent
453844abd7
commit
d864709552
|
@ -290,7 +290,7 @@ void label_manager_init(char *lm_zserv_path)
|
||||||
ibuf = stream_new(ZEBRA_MAX_PACKET_SIZ);
|
ibuf = stream_new(ZEBRA_MAX_PACKET_SIZ);
|
||||||
obuf = 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,7 +78,7 @@ void table_manager_enable(ns_id_t ns_id)
|
||||||
return;
|
return;
|
||||||
tbl_mgr.lc_list = list_new();
|
tbl_mgr.lc_list = list_new();
|
||||||
tbl_mgr.lc_list->del = delete_table_chunk;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Zebra API server.
|
* Zebra API message creation & consumption.
|
||||||
* Portions:
|
* Portions:
|
||||||
* Copyright (C) 1997-1999 Kunihiro Ishiguro
|
* Copyright (C) 1997-1999 Kunihiro Ishiguro
|
||||||
* Copyright (C) 2015-2018 Cumulus Networks, Inc.
|
* Copyright (C) 2015-2018 Cumulus Networks, Inc.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Zebra API server.
|
* Zebra API message creation & consumption.
|
||||||
* Portions:
|
* Portions:
|
||||||
* Copyright (C) 1997-1999 Kunihiro Ishiguro
|
* Copyright (C) 1997-1999 Kunihiro Ishiguro
|
||||||
* Copyright (C) 2015-2018 Cumulus Networks, Inc.
|
* Copyright (C) 2015-2018 Cumulus Networks, Inc.
|
||||||
|
|
|
@ -2916,5 +2916,5 @@ void zebra_mpls_init(void)
|
||||||
if (!mpls_processq_init(&zebrad))
|
if (!mpls_processq_init(&zebrad))
|
||||||
mpls_enabled = 1;
|
mpls_enabled = 1;
|
||||||
|
|
||||||
hook_register(client_close, zebra_mpls_cleanup_fecs_for_client);
|
hook_register(zapi_client_close, zebra_mpls_cleanup_fecs_for_client);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ void zebra_ptm_init(void)
|
||||||
|
|
||||||
ptm_cb.ptm_sock = -1;
|
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)
|
void zebra_ptm_finish(void)
|
||||||
|
|
|
@ -292,7 +292,7 @@ void zebra_pw_init(struct zebra_vrf *zvrf)
|
||||||
RB_INIT(zebra_pw_head, &zvrf->pseudowires);
|
RB_INIT(zebra_pw_head, &zvrf->pseudowires);
|
||||||
RB_INIT(zebra_static_pw_head, &zvrf->static_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)
|
void zebra_pw_exit(struct zebra_vrf *zvrf)
|
||||||
|
|
|
@ -73,7 +73,7 @@ int zebra_rnh_ipv6_default_route = 0;
|
||||||
|
|
||||||
void zebra_rnh_init(void)
|
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,
|
static inline struct route_table *get_rnh_table(vrf_id_t vrfid, int family,
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <zebra.h>
|
#include <zebra.h>
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
#include <errno.h> /* for errno */
|
#include <errno.h> /* for errno */
|
||||||
#include <netinet/in.h> /* for sockaddr_in */
|
#include <netinet/in.h> /* for sockaddr_in */
|
||||||
#include <stdint.h> /* for uint8_t */
|
#include <stdint.h> /* for uint8_t */
|
||||||
|
@ -53,12 +54,11 @@
|
||||||
#include "lib/zclient.h" /* for zmsghdr, ZEBRA_HEADER_SIZE, ZEBRA... */
|
#include "lib/zclient.h" /* for zmsghdr, ZEBRA_HEADER_SIZE, ZEBRA... */
|
||||||
|
|
||||||
#include "zebra/debug.h" /* for various debugging macros */
|
#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/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/zapi_msg.h" /* for zserv_handle_commands */
|
||||||
#include "zebra/zebra_vrf.h" /* for zebra_vrf_lookup_by_id, zvrf */
|
#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. */
|
/* Event list of zebra. */
|
||||||
enum event { ZEBRA_READ, ZEBRA_WRITE };
|
enum event { ZEBRA_READ, ZEBRA_WRITE };
|
||||||
|
@ -80,13 +80,13 @@ int zebra_server_send_message(struct zserv *client, struct stream *msg)
|
||||||
/* Lifecycle ---------------------------------------------------------------- */
|
/* Lifecycle ---------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Hooks for client connect / disconnect */
|
/* Hooks for client connect / disconnect */
|
||||||
DEFINE_HOOK(client_connect, (struct zserv *client), (client));
|
DEFINE_HOOK(zapi_client_connect, (struct zserv * client), (client));
|
||||||
DEFINE_KOOH(client_close, (struct zserv *client), (client));
|
DEFINE_KOOH(zapi_client_close, (struct zserv * client), (client));
|
||||||
|
|
||||||
/* free zebra client information. */
|
/* free zebra client information. */
|
||||||
static void zebra_client_free(struct zserv *client)
|
static void zebra_client_free(struct zserv *client)
|
||||||
{
|
{
|
||||||
hook_call(client_close, client);
|
hook_call(zapi_client_close, client);
|
||||||
|
|
||||||
/* Close file descriptor. */
|
/* Close file descriptor. */
|
||||||
if (client->sock) {
|
if (client->sock) {
|
||||||
|
@ -179,7 +179,7 @@ static void zebra_client_create(int sock)
|
||||||
|
|
||||||
zebra_vrf_update_all(client);
|
zebra_vrf_update_all(client);
|
||||||
|
|
||||||
hook_call(client_connect, client);
|
hook_call(zapi_client_connect, client);
|
||||||
|
|
||||||
/* start read loop */
|
/* start read loop */
|
||||||
zebra_event(client, ZEBRA_READ);
|
zebra_event(client, ZEBRA_READ);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#ifndef _ZEBRA_ZSERV_H
|
#ifndef _ZEBRA_ZSERV_H
|
||||||
#define _ZEBRA_ZSERV_H
|
#define _ZEBRA_ZSERV_H
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
#include <stdint.h> /* for uint32_t, uint8_t */
|
#include <stdint.h> /* for uint32_t, uint8_t */
|
||||||
#include <time.h> /* for time_t */
|
#include <time.h> /* for time_t */
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
#include "lib/hook.h" /* for DECLARE_HOOK, DECLARE_KOOH */
|
#include "lib/hook.h" /* for DECLARE_HOOK, DECLARE_KOOH */
|
||||||
|
|
||||||
#include "zebra/zebra_vrf.h" /* for zebra_vrf */
|
#include "zebra/zebra_vrf.h" /* for zebra_vrf */
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
/* Default port information. */
|
/* Default port information. */
|
||||||
#define ZEBRA_VTY_PORT 2601
|
#define ZEBRA_VTY_PORT 2601
|
||||||
|
@ -143,8 +145,8 @@ struct zserv {
|
||||||
struct zebra_vrf *zvrf
|
struct zebra_vrf *zvrf
|
||||||
|
|
||||||
/* Hooks for client connect / disconnect */
|
/* Hooks for client connect / disconnect */
|
||||||
DECLARE_HOOK(client_connect, (struct zserv *client), (client));
|
DECLARE_HOOK(zapi_client_connect, (struct zserv * client), (client));
|
||||||
DECLARE_KOOH(client_close, (struct zserv *client), (client));
|
DECLARE_KOOH(zapi_client_close, (struct zserv * client), (client));
|
||||||
|
|
||||||
/* Zebra instance */
|
/* Zebra instance */
|
||||||
struct zebra_t {
|
struct zebra_t {
|
||||||
|
|
Loading…
Reference in a new issue