2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* Prefix list functions.
|
|
|
|
* Copyright (C) 1999 Kunihiro Ishiguro
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
#ifndef _QUAGGA_PLIST_H
|
|
|
|
#define _QUAGGA_PLIST_H
|
|
|
|
|
2017-03-02 03:02:52 +01:00
|
|
|
#include <zebra.h>
|
|
|
|
|
|
|
|
#include "stream.h"
|
|
|
|
#include "vty.h"
|
|
|
|
|
2019-02-07 23:10:31 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
enum prefix_list_type {
|
|
|
|
PREFIX_DENY,
|
|
|
|
PREFIX_PERMIT,
|
|
|
|
};
|
|
|
|
|
2015-04-13 10:21:34 +02:00
|
|
|
struct prefix_list;
|
2021-04-20 06:11:57 +02:00
|
|
|
struct prefix_list_entry;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
struct orf_prefix {
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t seq;
|
|
|
|
uint8_t ge;
|
|
|
|
uint8_t le;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct prefix p;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Prototypes. */
|
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 void prefix_list_init(void);
|
|
|
|
extern void prefix_list_reset(void);
|
|
|
|
extern void prefix_list_add_hook(void (*func)(struct prefix_list *));
|
|
|
|
extern void prefix_list_delete_hook(void (*func)(struct prefix_list *));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-04-13 10:21:34 +02:00
|
|
|
extern const char *prefix_list_name(struct prefix_list *);
|
2017-08-23 16:54:15 +02:00
|
|
|
extern afi_t prefix_list_afi(struct prefix_list *);
|
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 struct prefix_list *prefix_list_lookup(afi_t, const char *);
|
2017-08-29 14:29:34 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* prefix_list_apply_which_prefix
|
|
|
|
*
|
|
|
|
* Allow calling function to learn which prefix
|
|
|
|
* caused the DENY or PERMIT.
|
|
|
|
*
|
|
|
|
* If no pointer is sent in, do not return anything.
|
|
|
|
* If it is a empty plist return a NULL pointer.
|
2021-04-20 06:11:57 +02:00
|
|
|
*
|
|
|
|
* address_mode = the "prefix" being passed in is really an address, match
|
|
|
|
* regardless of prefix length (i.e. ge/le are ignored.) prefix->prefixlen
|
|
|
|
* must be /32.
|
2017-08-29 14:29:34 +02:00
|
|
|
*/
|
|
|
|
extern enum prefix_list_type
|
2021-04-20 06:11:57 +02:00
|
|
|
prefix_list_apply_ext(struct prefix_list *plist,
|
|
|
|
const struct prefix_list_entry **matches,
|
|
|
|
union prefixconstptr prefix,
|
|
|
|
bool address_mode);
|
|
|
|
#define prefix_list_apply(A, B) \
|
|
|
|
prefix_list_apply_ext((A), NULL, (B), false)
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-04-13 10:21:35 +02:00
|
|
|
extern struct prefix_list *prefix_bgp_orf_lookup(afi_t, const char *);
|
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 struct stream *prefix_bgp_orf_entry(struct stream *,
|
2018-03-27 21:13:34 +02:00
|
|
|
struct prefix_list *, uint8_t,
|
|
|
|
uint8_t, uint8_t);
|
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 int prefix_bgp_orf_set(char *, afi_t, struct orf_prefix *, int, int);
|
2015-04-13 10:21:35 +02:00
|
|
|
extern void prefix_bgp_orf_remove_all(afi_t, char *);
|
2018-08-30 17:54:46 +02:00
|
|
|
extern int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name,
|
|
|
|
bool use_json);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2019-11-12 00:21:25 +01:00
|
|
|
extern struct prefix_list *prefix_list_get(afi_t afi, int orf,
|
|
|
|
const char *name);
|
|
|
|
extern void prefix_list_delete(struct prefix_list *plist);
|
|
|
|
extern int64_t prefix_new_seq_get(struct prefix_list *plist);
|
|
|
|
|
|
|
|
extern struct prefix_list_entry *prefix_list_entry_new(void);
|
|
|
|
extern void prefix_list_entry_delete(struct prefix_list *plist,
|
|
|
|
struct prefix_list_entry *pentry,
|
|
|
|
int update_list);
|
|
|
|
extern struct prefix_list_entry *
|
|
|
|
prefix_list_entry_lookup(struct prefix_list *plist, struct prefix *prefix,
|
|
|
|
enum prefix_list_type type, int64_t seq, int le,
|
|
|
|
int ge);
|
|
|
|
|
2019-02-07 23:10:31 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
#endif /* _QUAGGA_PLIST_H */
|