]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zserv.h
zebra: reorganize zserv, batch i/o
[mirror_frr.git] / zebra / zserv.h
index 6077dc105a42e26cb50c55d2d14d03ae42bf9302..a055a28c0100addf4f59dfa99456916124934d65 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "zebra/zebra_ns.h"
 #include "zebra/zebra_pw.h"
+//#include "zebra/zebra_pbr.h"
 
 /* Default port information. */
 #define ZEBRA_VTY_PORT                2601
@@ -46,8 +47,12 @@ struct zserv {
        int sock;
 
        /* Input/output buffer to the client. */
-       struct stream *ibuf;
-       struct stream *obuf;
+       struct stream_fifo *ibuf_fifo;
+       struct stream_fifo *obuf_fifo;
+
+       /* Private I/O buffers */
+       struct stream *ibuf_work;
+       struct stream *obuf_work;
 
        /* Buffer of data waiting to be written to client. */
        struct buffer *wb;
@@ -110,8 +115,12 @@ struct zserv {
        u_int32_t bfd_client_reg_cnt;
        u_int32_t vniadd_cnt;
        u_int32_t vnidel_cnt;
+       u_int32_t l3vniadd_cnt;
+       u_int32_t l3vnidel_cnt;
        u_int32_t macipadd_cnt;
        u_int32_t macipdel_cnt;
+       u_int32_t prefixadd_cnt;
+       u_int32_t prefixdel_cnt;
 
        time_t connect_time;
        time_t last_read_time;
@@ -124,6 +133,19 @@ struct zserv {
        int last_write_cmd;
 };
 
+/* ZAPI protocol structs */
+struct zmsghdr {
+       uint16_t length;
+       uint8_t marker;
+       uint8_t version;
+       uint32_t vrf_id;
+       uint16_t command;
+};
+
+#define ZAPI_HANDLER_ARGS                                                      \
+       struct zserv *client, struct zmsghdr *hdr, struct stream *msg,         \
+               struct zebra_vrf *zvrf
+
 /* Zebra instance */
 struct zebra_t {
        /* Thread master */
@@ -133,37 +155,23 @@ struct zebra_t {
        /* default table */
        u_int32_t rtm_table_default;
 
-       /* rib work queue */
-       #define ZEBRA_RIB_PROCESS_HOLD_TIME 10
+/* rib work queue */
+#define ZEBRA_RIB_PROCESS_HOLD_TIME 10
        struct work_queue *ribq;
        struct meta_queue *mq;
 
        /* LSP work queue */
        struct work_queue *lsp_process_q;
 
-       #define ZEBRA_ZAPI_PACKETS_TO_PROCESS 10
+#define ZEBRA_ZAPI_PACKETS_TO_PROCESS 10
        u_int32_t packets_to_process;
 };
 extern struct zebra_t zebrad;
 extern unsigned int multipath_num;
 
 /* Prototypes. */
-extern void zebra_init(void);
-extern void zebra_if_init(void);
+extern void zserv_init(void);
 extern void zebra_zserv_socket_init(char *path);
-extern void hostinfo_get(void);
-extern void rib_init(void);
-extern void interface_list(struct zebra_ns *);
-extern void route_read(struct zebra_ns *);
-extern void macfdb_read(struct zebra_ns *);
-extern void macfdb_read_for_bridge(struct zebra_ns *, struct interface *,
-                                  struct interface *);
-extern void neigh_read(struct zebra_ns *);
-extern void neigh_read_for_vlan(struct zebra_ns *, struct interface *);
-extern void kernel_init(struct zebra_ns *);
-extern void kernel_terminate(struct zebra_ns *);
-extern void zebra_route_map_init(void);
-extern void zebra_vty_init(void);
 
 extern int zsend_vrf_add(struct zserv *, struct zebra_vrf *);
 extern int zsend_vrf_delete(struct zserv *, struct zebra_vrf *);
@@ -185,17 +193,16 @@ extern int zsend_interface_vrf_update(struct zserv *, struct interface *,
 extern int zsend_interface_link_params(struct zserv *, struct interface *);
 extern int zsend_pw_update(struct zserv *, struct zebra_pw *);
 
-extern int zsend_route_notify_owner(u_char proto, u_short instance,
-                                   vrf_id_t vrf_id, struct prefix *p,
+extern int zsend_route_notify_owner(struct route_entry *re, struct prefix *p,
                                    enum zapi_route_notify_owner note);
 
-extern pid_t pid;
+struct zebra_pbr_rule;
+extern void zsend_rule_notify_owner(struct zebra_pbr_rule *rule,
+                                   enum zapi_rule_notify_owner note);
 
-extern void zserv_create_header(struct stream *s, uint16_t cmd,
-                               vrf_id_t vrf_id);
 extern void zserv_nexthop_num_warn(const char *, const struct prefix *,
                                   const unsigned int);
-extern int zebra_server_send_message(struct zserv *client);
+extern int zebra_server_send_message(struct zserv *client, struct stream *msg);
 
 extern struct zserv *zebra_find_client(u_char proto, u_short instance);