2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Distribute list functions header
|
|
|
|
* Copyright (C) 1999 Kunihiro Ishiguro
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ZEBRA_DISTRIBUTE_H
|
|
|
|
#define _ZEBRA_DISTRIBUTE_H
|
|
|
|
|
2011-12-25 17:52:09 +01:00
|
|
|
#include <zebra.h>
|
|
|
|
#include "if.h"
|
2015-03-03 08:55:54 +01:00
|
|
|
#include "filter.h"
|
2024-01-21 14:12:39 +01:00
|
|
|
#include "northbound.h"
|
2011-12-25 17:52:09 +01:00
|
|
|
|
2019-02-07 23:10:31 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-10-05 23:33:14 +02:00
|
|
|
/* Distribute list types. */
|
2002-12-13 21:15:29 +01:00
|
|
|
enum distribute_type {
|
2016-09-22 23:11:07 +02:00
|
|
|
DISTRIBUTE_V4_IN,
|
|
|
|
DISTRIBUTE_V6_IN,
|
|
|
|
DISTRIBUTE_V4_OUT,
|
|
|
|
DISTRIBUTE_V6_OUT,
|
2002-12-13 21:15:29 +01:00
|
|
|
DISTRIBUTE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct distribute {
|
|
|
|
/* Name of the interface. */
|
|
|
|
char *ifname;
|
|
|
|
|
|
|
|
/* Filter name of `in' and `out' */
|
|
|
|
char *list[DISTRIBUTE_MAX];
|
|
|
|
|
|
|
|
/* prefix-list name of `in' and `out' */
|
|
|
|
char *prefix[DISTRIBUTE_MAX];
|
|
|
|
};
|
|
|
|
|
lib, rip, ripng, babel, eigrp: add ctx pointer to distribute api
a distribute_ctx context pointer is returned after initialisation to the
calling daemon. this context pointer will be further used to do
discussion with distribute service. Today, there is no specific problem
with old api, since the pointer is the same in all the memory process.
but the pointer will be different if we have multiple instances. Right
now, this is not the case, but if that happens, that work will be used
for that.
distribute-list initialisation is split in two. the vty initialisation
is done at global level, while the context initialisation is done for
each routing daemon instance.
babel daemon is being equipped with a routing returning the main babel
instance.
also, a delete routine is available when the daemon routing instance is
suppressed.
a list of contexts is used inside distribute_list. This will permit
distribute_list utility to handle in the same daemon to handle more than
one context. This will be very useful in the vrf context.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-12-04 15:45:57 +01:00
|
|
|
struct distribute_ctx {
|
|
|
|
/* Hash of distribute list. */
|
|
|
|
struct hash *disthash;
|
|
|
|
|
|
|
|
/* Hook functions. */
|
|
|
|
void (*distribute_add_hook)(struct distribute_ctx *ctx,
|
|
|
|
struct distribute *dist);
|
|
|
|
void (*distribute_delete_hook)(struct distribute_ctx *ctx,
|
|
|
|
struct distribute *dist);
|
|
|
|
|
|
|
|
/* vrf information */
|
|
|
|
struct vrf *vrf;
|
|
|
|
};
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Prototypes for distribute-list. */
|
lib, rip, ripng, babel, eigrp: add ctx pointer to distribute api
a distribute_ctx context pointer is returned after initialisation to the
calling daemon. this context pointer will be further used to do
discussion with distribute service. Today, there is no specific problem
with old api, since the pointer is the same in all the memory process.
but the pointer will be different if we have multiple instances. Right
now, this is not the case, but if that happens, that work will be used
for that.
distribute-list initialisation is split in two. the vty initialisation
is done at global level, while the context initialisation is done for
each routing daemon instance.
babel daemon is being equipped with a routing returning the main babel
instance.
also, a delete routine is available when the daemon routing instance is
suppressed.
a list of contexts is used inside distribute_list. This will permit
distribute_list utility to handle in the same daemon to handle more than
one context. This will be very useful in the vrf context.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-12-04 15:45:57 +01:00
|
|
|
extern struct distribute_ctx *distribute_list_ctx_create(struct vrf *vrf);
|
|
|
|
extern void distribute_list_delete(struct distribute_ctx **ctx);
|
|
|
|
extern void distribute_list_add_hook(struct distribute_ctx *ctx,
|
|
|
|
void (*)(struct distribute_ctx *ctx,
|
|
|
|
struct distribute *));
|
|
|
|
extern void distribute_list_delete_hook(struct distribute_ctx *ctx,
|
|
|
|
void (*)(struct distribute_ctx *ctx,
|
|
|
|
struct distribute *));
|
|
|
|
extern struct distribute *distribute_lookup(struct distribute_ctx *ctx,
|
|
|
|
const char *ifname);
|
|
|
|
extern int config_write_distribute(struct vty *vty,
|
|
|
|
struct distribute_ctx *ctx);
|
|
|
|
extern int config_show_distribute(struct vty *vty,
|
|
|
|
struct distribute_ctx *ctx);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-05-06 Paul Jakma <paul@dishone.st>
* (general) extern and static'ification of functions in code and
header.
Cleanup any definitions with unspecified arguments.
Add casts for callback assignments where the callback is defined,
typically, as passing void *, but the function being assigned has
some other pointer type defined as its argument, as gcc complains
about casts from void * to X* via function arguments.
Fix some old K&R style function argument definitions.
Add noreturn gcc attribute to some functions, as appropriate.
Add unused gcc attribute to some functions (eg ones meant to help
while debugging)
Add guard defines to headers which were missing them.
* command.c: (install_node) add const qualifier, still doesnt shut
up the warning though, because of the double pointer.
(cmp_node) ditto
* keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived
fromn vty.h ones to fix some of the (long) < 0 warnings.
* thread.c: (various) use thread_empty
(cpu_record_hash_key) should cast to uintptr_t, a stdint.h type
* vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they
removed from ospfd/ospf_vty.h
* zebra.h: Move definition of ZEBRA_PORT to here, to remove
dependence of lib on zebra/zserv.h
2005-05-06 23:25:49 +02:00
|
|
|
extern enum filter_type distribute_apply_in(struct interface *,
|
|
|
|
struct prefix *);
|
|
|
|
extern enum filter_type distribute_apply_out(struct interface *,
|
|
|
|
struct prefix *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-02-08 17:36:05 +01:00
|
|
|
extern int distribute_list_parser(bool prefix, bool v4, const char *dir,
|
|
|
|
const char *list, const char *ifname);
|
|
|
|
extern int distribute_list_no_parser(struct vty *vty, bool prefix, bool v4,
|
|
|
|
const char *dir, const char *list,
|
|
|
|
const char *ifname);
|
2024-01-21 14:12:39 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Northbound
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define your own create callback and then call thes helper with your
|
|
|
|
* distribute list context when a list entry is created. Additionally, plug the
|
|
|
|
* destroy callback into the frr_module_yang_info struct, or call it if you have
|
|
|
|
* your own callback destroy function.
|
|
|
|
*/
|
|
|
|
extern int group_distribute_list_create_helper(struct nb_cb_create_args *args,
|
|
|
|
struct distribute_ctx *ctx);
|
|
|
|
extern int group_distribute_list_destroy(struct nb_cb_destroy_args *args);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Plug 3 of these handlers in for your distribute-list for all the northbound
|
|
|
|
* distribute_list leaf callbacks. If you need multi-protocol then use the
|
|
|
|
* grouping twice under 2 different containers.
|
|
|
|
*/
|
|
|
|
extern int group_distribute_list_ipv4_modify(struct nb_cb_modify_args *args);
|
|
|
|
extern int group_distribute_list_ipv4_destroy(struct nb_cb_destroy_args *args);
|
|
|
|
extern void group_distribute_list_ipv4_cli_show(struct vty *vty,
|
|
|
|
const struct lyd_node *dnode,
|
|
|
|
bool show_defaults);
|
|
|
|
extern int group_distribute_list_ipv6_modify(struct nb_cb_modify_args *args);
|
|
|
|
extern int group_distribute_list_ipv6_destroy(struct nb_cb_destroy_args *args);
|
|
|
|
extern void group_distribute_list_ipv6_cli_show(struct vty *vty,
|
|
|
|
const struct lyd_node *dnode,
|
|
|
|
bool show_defaults);
|
2019-02-07 23:10:31 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* _ZEBRA_DISTRIBUTE_H */
|