]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/zclient.h
Merge pull request #2392 from chiragshah6/evpn_dev
[mirror_frr.git] / lib / zclient.h
index 04f2a5c17868bc5873f0e374c6146b93e1e65e39..ad98b8db8776d39d7bd2f65839184e5dc4893f57 100644 (file)
  */
 #define ZAPI_TCP_PATHNAME             "@tcp"
 
+/* IPset size name stands for the name of the ipset entry
+ * that can be created by using some zapi interfaces
+ */
+#define ZEBRA_IPSET_NAME_SIZE   32
+
+/* IPTable action is defined by two values: either
+ * forward or drop
+ */
+#define ZEBRA_IPTABLES_FORWARD 0
+#define ZEBRA_IPTABLES_DROP    1
+
 extern struct sockaddr_storage zclient_addr;
 extern socklen_t zclient_addr_len;
 
@@ -74,6 +85,7 @@ typedef enum {
        ZEBRA_ROUTER_ID_DELETE,
        ZEBRA_ROUTER_ID_UPDATE,
        ZEBRA_HELLO,
+       ZEBRA_CAPABILITIES,
        ZEBRA_NEXTHOP_REGISTER,
        ZEBRA_NEXTHOP_UNREGISTER,
        ZEBRA_NEXTHOP_UPDATE,
@@ -112,6 +124,8 @@ typedef enum {
        ZEBRA_ADVERTISE_DEFAULT_GW,
        ZEBRA_ADVERTISE_SUBNET,
        ZEBRA_ADVERTISE_ALL_VNI,
+       ZEBRA_LOCAL_ES_ADD,
+       ZEBRA_LOCAL_ES_DEL,
        ZEBRA_VNI_ADD,
        ZEBRA_VNI_DEL,
        ZEBRA_L3VNI_ADD,
@@ -135,6 +149,15 @@ typedef enum {
        ZEBRA_TABLE_MANAGER_CONNECT,
        ZEBRA_GET_TABLE_CHUNK,
        ZEBRA_RELEASE_TABLE_CHUNK,
+       ZEBRA_IPSET_CREATE,
+       ZEBRA_IPSET_DESTROY,
+       ZEBRA_IPSET_ENTRY_ADD,
+       ZEBRA_IPSET_ENTRY_DELETE,
+       ZEBRA_IPSET_NOTIFY_OWNER,
+       ZEBRA_IPSET_ENTRY_NOTIFY_OWNER,
+       ZEBRA_IPTABLE_ADD,
+       ZEBRA_IPTABLE_DELETE,
+       ZEBRA_IPTABLE_NOTIFY_OWNER,
 } zebra_message_types_t;
 
 struct redist_proto {
@@ -142,6 +165,11 @@ struct redist_proto {
        struct list *instances;
 };
 
+struct zclient_capabilities {
+       uint32_t ecmp;
+       bool mpls_enabled;
+};
+
 /* Structure for the zebra client. */
 struct zclient {
        /* The thread master we schedule ourselves on */
@@ -186,6 +214,7 @@ struct zclient {
 
        /* Pointer to the callback functions. */
        void (*zebra_connected)(struct zclient *);
+       void (*zebra_capabilities)(struct zclient_capabilities *cap);
        int (*router_id_update)(int, struct zclient *, uint16_t, vrf_id_t);
        int (*interface_add)(int, struct zclient *, uint16_t, vrf_id_t);
        int (*interface_delete)(int, struct zclient *, uint16_t, vrf_id_t);
@@ -210,6 +239,10 @@ struct zclient {
        int (*redistribute_route_del)(int, struct zclient *, uint16_t,
                                      vrf_id_t);
        int (*fec_update)(int, struct zclient *, uint16_t);
+       int (*local_es_add)(int command, struct zclient *zclient,
+                           uint16_t length, vrf_id_t vrf_id);
+       int (*local_es_del)(int command, struct zclient *zclient,
+                           uint16_t length, vrf_id_t vrf_id);
        int (*local_vni_add)(int, struct zclient *, uint16_t, vrf_id_t);
        int (*local_vni_del)(int, struct zclient *, uint16_t, vrf_id_t);
        int (*local_l3vni_add)(int, struct zclient *, uint16_t, vrf_id_t);
@@ -223,6 +256,18 @@ struct zclient {
                                  uint16_t length, vrf_id_t vrf_id);
        int (*rule_notify_owner)(int command, struct zclient *zclient,
                                 uint16_t length, vrf_id_t vrf_id);
+       void (*label_chunk)(int command, struct zclient *zclient,
+                               uint16_t length, vrf_id_t vrf_id);
+       int (*ipset_notify_owner)(int command, struct zclient *zclient,
+                                uint16_t length, vrf_id_t vrf_id);
+       int (*ipset_entry_notify_owner)(int command,
+                                      struct zclient *zclient,
+                                      uint16_t length,
+                                      vrf_id_t vrf_id);
+       int (*iptable_notify_owner)(int command,
+                                   struct zclient *zclient,
+                                   uint16_t length,
+                                   vrf_id_t vrf_id);
 };
 
 /* Zebra API message flag. */
@@ -263,6 +308,8 @@ struct zapi_nexthop {
        /* MPLS labels for BGP-LU or Segment Routing */
        uint8_t label_num;
        mpls_label_t labels[MPLS_MAX_LABELS];
+
+       struct ethaddr rmac;
 };
 
 /*
@@ -303,8 +350,6 @@ struct zapi_route {
        vrf_id_t vrf_id;
 
        uint32_t tableid;
-
-       struct ethaddr rmac;
 };
 
 /* Zebra IPv4 route message API. */
@@ -369,6 +414,35 @@ enum zapi_rule_notify_owner {
        ZAPI_RULE_FAIL_INSTALL,
        ZAPI_RULE_INSTALLED,
        ZAPI_RULE_REMOVED,
+       ZAPI_RULE_FAIL_REMOVE,
+};
+
+enum ipset_type {
+       IPSET_NET_NET = 1,
+       IPSET_NET_PORT_NET,
+       IPSET_NET_PORT,
+       IPSET_NET
+};
+
+enum zapi_ipset_notify_owner {
+       ZAPI_IPSET_FAIL_INSTALL,
+       ZAPI_IPSET_INSTALLED,
+       ZAPI_IPSET_REMOVED,
+       ZAPI_IPSET_FAIL_REMOVE,
+};
+
+enum zapi_ipset_entry_notify_owner {
+       ZAPI_IPSET_ENTRY_FAIL_INSTALL,
+       ZAPI_IPSET_ENTRY_INSTALLED,
+       ZAPI_IPSET_ENTRY_REMOVED,
+       ZAPI_IPSET_ENTRY_FAIL_REMOVE,
+};
+
+enum zapi_iptable_notify_owner {
+       ZAPI_IPTABLE_FAIL_INSTALL,
+       ZAPI_IPTABLE_INSTALLED,
+       ZAPI_IPTABLE_REMOVED,
+       ZAPI_IPTABLE_FAIL_REMOVE,
 };
 
 /* Zebra MAC types */
@@ -383,7 +457,7 @@ struct zclient_options {
 extern struct zclient *zclient_new(struct thread_master *);
 
 /* clang-format off */
-#if CONFDATE > 20181101
+#if defined(VERSION_TYPE_DEV) && CONFDATE > 20181101
 CPP_NOTICE("zclient_new_notify can take over or zclient_new now");
 #endif
 /* clang-format on */
@@ -524,7 +598,7 @@ extern void zebra_interface_if_set_value(struct stream *, struct interface *);
 extern void zebra_router_id_update_read(struct stream *s, struct prefix *rid);
 
 /* clang-format off */
-#if CONFDATE > 20180823
+#if defined(VERSION_TYPE_DEV) && CONFDATE > 20180823
 CPP_NOTICE("zapi_ipv4_route, zapi_ipv6_route, zapi_ipv4_route_ipv6_nexthop as well as the zapi_ipv4 and zapi_ipv6 data structures should be removed now");
 #endif
 /* clang-format on */
@@ -535,6 +609,11 @@ extern int zapi_ipv4_route(uint8_t, struct zclient *, struct prefix_ipv4 *,
 extern struct interface *zebra_interface_link_params_read(struct stream *);
 extern size_t zebra_interface_link_params_write(struct stream *,
                                                struct interface *);
+extern int zclient_send_get_label_chunk(
+       struct zclient  *zclient,
+       uint8_t         keep,
+       uint32_t        chunk_size);
+
 extern int lm_label_manager_connect(struct zclient *zclient);
 extern int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
                              uint32_t chunk_size, uint32_t *start,
@@ -605,6 +684,20 @@ bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
                             uint32_t *priority, uint32_t *unique,
                             ifindex_t *ifindex,
                             enum zapi_rule_notify_owner *note);
+bool zapi_ipset_notify_decode(struct stream *s,
+                             uint32_t *unique,
+                            enum zapi_ipset_notify_owner *note);
+
+#define ZEBRA_IPSET_NAME_SIZE   32
+
+bool zapi_ipset_entry_notify_decode(struct stream *s,
+           uint32_t *unique,
+           char *ipset_name,
+           enum zapi_ipset_entry_notify_owner *note);
+bool zapi_iptable_notify_decode(struct stream *s,
+               uint32_t *unique,
+               enum zapi_iptable_notify_owner *note);
+
 extern struct nexthop *nexthop_from_zapi_nexthop(struct zapi_nexthop *znh);
 extern bool zapi_nexthop_update_decode(struct stream *s,
                                       struct zapi_route *nhr);