1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Zebra API message creation & consumption.
5 * Copyright (C) 1997-1999 Kunihiro Ishiguro
6 * Copyright (C) 2015-2018 Cumulus Networks, Inc.
12 #include "lib/zclient.h"
15 #include "zebra/rib.h"
16 #include "zebra/zserv.h"
17 #include "zebra/zebra_pbr.h"
18 #include "zebra/zebra_errors.h"
19 #include "zebra/label_manager.h"
20 #include "zebra/zebra_srv6.h"
28 * This is called to process inbound ZAPI messages.
31 * the client datastructure
36 extern void zserv_handle_commands(struct zserv
*client
,
37 struct stream_fifo
*fifo
);
39 extern int zsend_vrf_add(struct zserv
*zclient
, struct zebra_vrf
*zvrf
);
40 extern int zsend_vrf_delete(struct zserv
*zclient
, struct zebra_vrf
*zvrf
);
41 extern int zsend_interface_add(struct zserv
*zclient
, struct interface
*ifp
);
42 extern int zsend_interface_delete(struct zserv
*zclient
, struct interface
*ifp
);
43 extern int zsend_interface_addresses(struct zserv
*zclient
,
44 struct interface
*ifp
);
45 extern int zsend_interface_address(int cmd
, struct zserv
*zclient
,
46 struct interface
*ifp
,
47 struct connected
*ifc
);
48 extern void nbr_connected_add_ipv6(struct interface
*ifp
,
49 struct in6_addr
*address
);
50 extern void nbr_connected_delete_ipv6(struct interface
*ifp
,
51 struct in6_addr
*address
);
52 extern int zsend_interface_update(int cmd
, struct zserv
*client
,
53 struct interface
*ifp
);
54 extern int zsend_redistribute_route(int cmd
, struct zserv
*zclient
,
55 const struct route_node
*rn
,
56 const struct route_entry
*re
);
58 extern int zsend_router_id_update(struct zserv
*zclient
, afi_t afi
,
59 struct prefix
*p
, vrf_id_t vrf_id
);
60 extern int zsend_interface_vrf_update(struct zserv
*zclient
,
61 struct interface
*ifp
, vrf_id_t vrf_id
);
62 extern int zsend_interface_link_params(struct zserv
*zclient
,
63 struct interface
*ifp
);
64 extern int zsend_pw_update(struct zserv
*client
, struct zebra_pw
*pw
);
65 extern int zsend_route_notify_owner(const struct route_node
*rn
,
66 struct route_entry
*re
,
67 enum zapi_route_notify_owner note
,
68 afi_t afi
, safi_t safi
);
69 extern int zsend_route_notify_owner_ctx(const struct zebra_dplane_ctx
*ctx
,
70 enum zapi_route_notify_owner note
);
72 extern void zsend_rule_notify_owner(const struct zebra_dplane_ctx
*ctx
,
73 enum zapi_rule_notify_owner note
);
75 extern void zsend_iptable_notify_owner(const struct zebra_dplane_ctx
*ctx
,
76 enum zapi_iptable_notify_owner note
);
77 extern void zsend_ipset_notify_owner(const struct zebra_dplane_ctx
*ctx
,
78 enum zapi_ipset_notify_owner note
);
80 zsend_ipset_entry_notify_owner(const struct zebra_dplane_ctx
*ctx
,
81 enum zapi_ipset_entry_notify_owner note
);
82 extern bool zserv_nexthop_num_warn(const char *caller
, const struct prefix
*p
,
83 const unsigned int nexthop_num
);
85 extern void zsend_capabilities_all_clients(void);
86 extern int zsend_assign_label_chunk_response(struct zserv
*client
,
88 struct label_manager_chunk
*lmc
);
89 extern int zsend_label_manager_connect_response(struct zserv
*client
,
91 unsigned short result
);
92 extern int zsend_sr_policy_notify_status(uint32_t color
,
93 struct ipaddr
*endpoint
, char *name
,
95 extern void zsend_nhrp_neighbor_notify(int cmd
, struct interface
*ifp
,
96 struct ipaddr
*ipaddr
, int ndm_state
,
97 union sockunion
*link_layer_ipv4
);
99 extern int zsend_client_close_notify(struct zserv
*client
,
100 struct zserv
*closed_client
);
102 int zsend_nhg_notify(uint16_t type
, uint16_t instance
, uint32_t session_id
,
103 uint32_t id
, enum zapi_nhg_notify_owner note
);
105 extern void zapi_re_opaque_free(struct re_opaque
*opaque
);
107 extern int zsend_zebra_srv6_locator_add(struct zserv
*client
,
108 struct srv6_locator
*loc
);
109 extern int zsend_zebra_srv6_locator_delete(struct zserv
*client
,
110 struct srv6_locator
*loc
);
111 extern int zsend_srv6_manager_get_locator_chunk_response(struct zserv
*client
,
112 vrf_id_t vrf_id
, struct srv6_locator
*loc
);