]> git.proxmox.com Git - mirror_frr.git/blame - lib/distribute.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / lib / distribute.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
718e3744 2/* Distribute list functions header
3 * Copyright (C) 1999 Kunihiro Ishiguro
718e3744 4 */
5
6#ifndef _ZEBRA_DISTRIBUTE_H
7#define _ZEBRA_DISTRIBUTE_H
8
5734509c
PJ
9#include <zebra.h>
10#include "if.h"
1cc5e682 11#include "filter.h"
5734509c 12
5e244469
RW
13#ifdef __cplusplus
14extern "C" {
15#endif
16
214d8a60 17/* Distribute list types. */
d62a17ae 18enum distribute_type {
19 DISTRIBUTE_V4_IN,
20 DISTRIBUTE_V6_IN,
21 DISTRIBUTE_V4_OUT,
22 DISTRIBUTE_V6_OUT,
23 DISTRIBUTE_MAX
718e3744 24};
25
d62a17ae 26struct distribute {
27 /* Name of the interface. */
28 char *ifname;
718e3744 29
d62a17ae 30 /* Filter name of `in' and `out' */
31 char *list[DISTRIBUTE_MAX];
718e3744 32
d62a17ae 33 /* prefix-list name of `in' and `out' */
34 char *prefix[DISTRIBUTE_MAX];
718e3744 35};
36
03a38493
PG
37struct distribute_ctx {
38 /* Hash of distribute list. */
39 struct hash *disthash;
40
41 /* Hook functions. */
42 void (*distribute_add_hook)(struct distribute_ctx *ctx,
43 struct distribute *dist);
44 void (*distribute_delete_hook)(struct distribute_ctx *ctx,
45 struct distribute *dist);
46
47 /* vrf information */
48 struct vrf *vrf;
49};
50
718e3744 51/* Prototypes for distribute-list. */
03a38493
PG
52extern struct distribute_ctx *distribute_list_ctx_create(struct vrf *vrf);
53extern void distribute_list_delete(struct distribute_ctx **ctx);
54extern void distribute_list_add_hook(struct distribute_ctx *ctx,
55 void (*)(struct distribute_ctx *ctx,
56 struct distribute *));
57extern void distribute_list_delete_hook(struct distribute_ctx *ctx,
58 void (*)(struct distribute_ctx *ctx,
59 struct distribute *));
60extern struct distribute *distribute_lookup(struct distribute_ctx *ctx,
61 const char *ifname);
62extern int config_write_distribute(struct vty *vty,
63 struct distribute_ctx *ctx);
64extern int config_show_distribute(struct vty *vty,
65 struct distribute_ctx *ctx);
d62a17ae 66
67extern enum filter_type distribute_apply_in(struct interface *,
68 struct prefix *);
69extern enum filter_type distribute_apply_out(struct interface *,
70 struct prefix *);
718e3744 71
458133db
DS
72extern int distribute_list_parser(bool prefix, bool v4, const char *dir,
73 const char *list, const char *ifname);
74extern int distribute_list_no_parser(struct vty *vty, bool prefix, bool v4,
75 const char *dir, const char *list,
76 const char *ifname);
5e244469
RW
77#ifdef __cplusplus
78}
79#endif
80
718e3744 81#endif /* _ZEBRA_DISTRIBUTE_H */