]> git.proxmox.com Git - mirror_frr.git/blob - lib/if_rmap.h
6f5fb578f00267a9d913c78203ddb3c35f8499a9
[mirror_frr.git] / lib / if_rmap.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* route-map for interface.
3 * Copyright (C) 1999 Kunihiro Ishiguro
4 */
5
6 #ifndef _ZEBRA_IF_RMAP_H
7 #define _ZEBRA_IF_RMAP_H
8
9 #include "typesafe.h"
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 struct lyd_node;
16 struct vty;
17
18 enum if_rmap_type { IF_RMAP_IN, IF_RMAP_OUT, IF_RMAP_MAX };
19
20 struct if_rmap {
21 /* Name of the interface. */
22 const char *ifname;
23
24 char *routemap[IF_RMAP_MAX];
25 };
26
27 struct if_rmap_ctx {
28 /* if_rmap */
29 struct hash *ifrmaphash;
30
31 /* Hook functions. */
32 void (*if_rmap_add_hook)(struct if_rmap_ctx *ctx,
33 struct if_rmap *ifrmap);
34 void (*if_rmap_delete_hook)(struct if_rmap_ctx *ctx,
35 struct if_rmap *ifrmap);
36
37 /* naming information */
38 char *name;
39 };
40
41 extern struct if_rmap_ctx *if_rmap_ctx_create(const char *name);
42 extern void if_rmap_ctx_delete(struct if_rmap_ctx *ctx);
43 extern void if_rmap_init(int node);
44 extern void if_rmap_terminate(void);
45 void if_rmap_hook_add(struct if_rmap_ctx *ctx,
46 void (*func)(struct if_rmap_ctx *ctx,
47 struct if_rmap *));
48 void if_rmap_hook_delete(struct if_rmap_ctx *ctx,
49 void (*func)(struct if_rmap_ctx *ctx,
50 struct if_rmap *));
51 extern struct if_rmap *if_rmap_lookup(struct if_rmap_ctx *ctx,
52 const char *ifname);
53 extern void if_rmap_yang_modify_cb(struct if_rmap_ctx *ctx,
54 const struct lyd_node *dnode,
55 enum if_rmap_type type, bool del);
56 extern void if_rmap_yang_destroy_cb(struct if_rmap_ctx *ctx,
57 const struct lyd_node *dnode);
58 extern int config_write_if_rmap(struct vty *, struct if_rmap_ctx *ctx);
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64 #endif /* _ZEBRA_IF_RMAP_H */