frr/zebra/zebra_srv6.h
Hiroki Shirokura 6e68a08484 zebra: ZAPI add new api to manipulate srv6-locator (step2)
This commit is a part of #5853 works that add new ZAPI to
configure SRv6 locator which manages chunk prefix for
SRv6 SID IPv6 address for each routing protocol daemons.

NEW-ZAPIs:
* ZEBRA_SRV6_LOCATOR_ADD
* ZEBRA_SRV6_LOCATOR_DELETE
* ZEBRA_SRV6_MANAGER_CONNECT
* ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK
* ZEBRA_SRV6_MANAGER_RELEASE_LOCATOR_CHUNK

Zclient can connect to zebra's srv6-manager with
ZEBRA_SRV6_MANAGER_CONNECT api like a label-manager.
Then zclient uses ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK to
allocated dedicated locator chunk for it's routing protocol.
Zebra works for only prefix reservation and distribute
the ownership of the locator chunks for zcliens.

Then, zclient installs SRv6 function with
ZEBRA_ROUTE_ADD api with nh_seg6local_* fields.
This feature is already implemented by another PR(#7680).

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:47 -04:00

80 lines
2.7 KiB
C

/*
* Zebra SRv6 definitions
* Copyright (C) 2020 Hiroki Shirokura, LINE Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _ZEBRA_SRV6_H
#define _ZEBRA_SRV6_H
#include <zebra.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include "qobj.h"
#include "prefix.h"
#include <pthread.h>
#include <plist.h>
/* SRv6 instance structure. */
struct zebra_srv6 {
struct list *locators;
};
/* declare hooks for the basic API, so that it can be specialized or served
* externally. Also declare a hook when those functions have been registered,
* so that any external module wanting to replace those can react
*/
DECLARE_HOOK(srv6_manager_client_connect,
(struct zserv *client, vrf_id_t vrf_id),
(client, vrf_id));
DECLARE_HOOK(srv6_manager_client_disconnect,
(struct zserv *client), (client));
DECLARE_HOOK(srv6_manager_get_chunk,
(struct srv6_locator **loc,
struct zserv *client,
const char *locator_name,
vrf_id_t vrf_id),
(mc, client, keep, size, base, vrf_id));
DECLARE_HOOK(srv6_manager_release_chunk,
(struct zserv *client,
const char *locator_name,
vrf_id_t vrf_id),
(client, locator_name, vrf_id));
extern void zebra_srv6_locator_add(struct srv6_locator *locator);
extern void zebra_srv6_locator_delete(struct srv6_locator *locator);
extern struct srv6_locator *zebra_srv6_locator_lookup(const char *name);
extern void zebra_srv6_init(void);
extern struct zebra_srv6 *zebra_srv6_get_default(void);
extern bool zebra_srv6_is_enable(void);
extern void srv6_manager_client_connect_call(struct zserv *client, vrf_id_t vrf_id);
extern void srv6_manager_get_locator_chunk_call(struct srv6_locator **loc,
struct zserv *client,
const char *locator_name,
vrf_id_t vrf_id);
extern void srv6_manager_release_locator_chunk_call(struct zserv *client,
const char *locator_name,
vrf_id_t vrf_id);
extern int srv6_manager_client_disconnect_cb(struct zserv *client);
extern int release_daemon_srv6_locator_chunks(struct zserv *client);
#endif /* _ZEBRA_SRV6_H */