]> git.proxmox.com Git - mirror_frr.git/blame - lib/plist.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / lib / plist.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
718e3744 2/*
3 * Prefix list functions.
4 * Copyright (C) 1999 Kunihiro Ishiguro
718e3744 5 */
6
8cc4198f 7#ifndef _QUAGGA_PLIST_H
8#define _QUAGGA_PLIST_H
9
fd995a99
QY
10#include <zebra.h>
11
12#include "stream.h"
13#include "vty.h"
14
5e244469
RW
15#ifdef __cplusplus
16extern "C" {
17#endif
18
d62a17ae 19enum prefix_list_type {
20 PREFIX_DENY,
21 PREFIX_PERMIT,
718e3744 22};
23
a38401b6 24struct prefix_list;
2b6b16fc 25struct prefix_list_entry;
718e3744 26
d62a17ae 27struct orf_prefix {
d7c0a89a
QY
28 uint32_t seq;
29 uint8_t ge;
30 uint8_t le;
d62a17ae 31 struct prefix p;
718e3744 32};
33
34/* Prototypes. */
d62a17ae 35extern void prefix_list_init(void);
36extern void prefix_list_reset(void);
37extern void prefix_list_add_hook(void (*func)(struct prefix_list *));
38extern void prefix_list_delete_hook(void (*func)(struct prefix_list *));
39
40extern const char *prefix_list_name(struct prefix_list *);
427f8e61 41extern afi_t prefix_list_afi(struct prefix_list *);
d62a17ae 42extern struct prefix_list *prefix_list_lookup(afi_t, const char *);
ce94edc7
DS
43
44/*
45 * prefix_list_apply_which_prefix
46 *
47 * Allow calling function to learn which prefix
48 * caused the DENY or PERMIT.
49 *
50 * If no pointer is sent in, do not return anything.
51 * If it is a empty plist return a NULL pointer.
2b6b16fc
DL
52 *
53 * address_mode = the "prefix" being passed in is really an address, match
54 * regardless of prefix length (i.e. ge/le are ignored.) prefix->prefixlen
55 * must be /32.
ce94edc7 56 */
996c9314 57extern enum prefix_list_type
2b6b16fc
DL
58prefix_list_apply_ext(struct prefix_list *plist,
59 const struct prefix_list_entry **matches,
60 union prefixconstptr prefix,
61 bool address_mode);
62#define prefix_list_apply(A, B) \
63 prefix_list_apply_ext((A), NULL, (B), false)
d62a17ae 64
65extern struct prefix_list *prefix_bgp_orf_lookup(afi_t, const char *);
66extern struct stream *prefix_bgp_orf_entry(struct stream *,
d7c0a89a
QY
67 struct prefix_list *, uint8_t,
68 uint8_t, uint8_t);
d62a17ae 69extern int prefix_bgp_orf_set(char *, afi_t, struct orf_prefix *, int, int);
70extern void prefix_bgp_orf_remove_all(afi_t, char *);
94d4c685
DS
71extern int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name,
72 bool use_json);
718e3744 73
2fb71798
RZ
74extern struct prefix_list *prefix_list_get(afi_t afi, int orf,
75 const char *name);
76extern void prefix_list_delete(struct prefix_list *plist);
77extern int64_t prefix_new_seq_get(struct prefix_list *plist);
78
79extern struct prefix_list_entry *prefix_list_entry_new(void);
80extern void prefix_list_entry_delete(struct prefix_list *plist,
81 struct prefix_list_entry *pentry,
82 int update_list);
83extern struct prefix_list_entry *
84prefix_list_entry_lookup(struct prefix_list *plist, struct prefix *prefix,
85 enum prefix_list_type type, int64_t seq, int le,
86 int ge);
87
5e244469
RW
88#ifdef __cplusplus
89}
90#endif
91
8cc4198f 92#endif /* _QUAGGA_PLIST_H */