2002-12-13 21:15:29 +01:00
|
|
|
/* Distribute list functions header
|
|
|
|
* Copyright (C) 1999 Kunihiro Ishiguro
|
|
|
|
*
|
|
|
|
* This file is part of GNU Zebra.
|
|
|
|
*
|
|
|
|
* GNU Zebra 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, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* GNU Zebra 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.
|
|
|
|
*
|
2017-05-13 10:25:29 +02:00
|
|
|
* 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
|
2002-12-13 21:15:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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"
|
2011-12-25 17:52:09 +01:00
|
|
|
|
2019-02-07 23:10:31 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Disctirubte list types. */
|
|
|
|
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);
|
2019-02-07 23:10:31 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* _ZEBRA_DISTRIBUTE_H */
|