]>
Commit | Line | Data |
---|---|---|
1 | // SPDX-License-Identifier: GPL-2.0-or-later | |
2 | /* Zebra PW code | |
3 | * Copyright (C) 2016 Volta Networks, Inc. | |
4 | */ | |
5 | ||
6 | #ifndef ZEBRA_PW_H_ | |
7 | #define ZEBRA_PW_H_ | |
8 | ||
9 | #include <net/if.h> | |
10 | #include <netinet/in.h> | |
11 | ||
12 | #include "lib/hook.h" | |
13 | #include "lib/qobj.h" | |
14 | #include "lib/pw.h" | |
15 | ||
16 | #include "zebra/zebra_vrf.h" | |
17 | ||
18 | #ifdef __cplusplus | |
19 | extern "C" { | |
20 | #endif | |
21 | ||
22 | #define PW_INSTALL_RETRY_INTERVAL 30 | |
23 | ||
24 | struct zebra_pw { | |
25 | RB_ENTRY(zebra_pw) pw_entry, static_pw_entry; | |
26 | vrf_id_t vrf_id; | |
27 | char ifname[INTERFACE_NAMSIZ]; | |
28 | ifindex_t ifindex; | |
29 | int type; | |
30 | int af; | |
31 | union g_addr nexthop; | |
32 | uint32_t local_label; | |
33 | uint32_t remote_label; | |
34 | uint8_t flags; | |
35 | union pw_protocol_fields data; | |
36 | int enabled; | |
37 | int status; | |
38 | uint8_t protocol; | |
39 | struct zserv *client; | |
40 | struct rnh *rnh; | |
41 | struct event *install_retry_timer; | |
42 | QOBJ_FIELDS; | |
43 | }; | |
44 | DECLARE_QOBJ_TYPE(zebra_pw); | |
45 | ||
46 | RB_HEAD(zebra_pw_head, zebra_pw); | |
47 | RB_PROTOTYPE(zebra_pw_head, zebra_pw, pw_entry, zebra_pw_compare); | |
48 | ||
49 | RB_HEAD(zebra_static_pw_head, zebra_pw); | |
50 | RB_PROTOTYPE(zebra_static_pw_head, zebra_pw, static_pw_entry, zebra_pw_compare); | |
51 | ||
52 | DECLARE_HOOK(pw_install, (struct zebra_pw * pw), (pw)); | |
53 | DECLARE_HOOK(pw_uninstall, (struct zebra_pw * pw), (pw)); | |
54 | ||
55 | struct zebra_pw *zebra_pw_add(struct zebra_vrf *zvrf, const char *ifname, | |
56 | uint8_t protocol, struct zserv *client); | |
57 | void zebra_pw_del(struct zebra_vrf *, struct zebra_pw *); | |
58 | void zebra_pw_change(struct zebra_pw *, ifindex_t, int, int, union g_addr *, | |
59 | uint32_t, uint32_t, uint8_t, union pw_protocol_fields *); | |
60 | struct zebra_pw *zebra_pw_find(struct zebra_vrf *, const char *); | |
61 | void zebra_pw_update(struct zebra_pw *); | |
62 | void zebra_pw_install_failure(struct zebra_pw *pw, int pwstatus); | |
63 | void zebra_pw_init(struct zebra_vrf *); | |
64 | void zebra_pw_exit(struct zebra_vrf *); | |
65 | void zebra_pw_vty_init(void); | |
66 | ||
67 | #ifdef __cplusplus | |
68 | } | |
69 | #endif | |
70 | ||
71 | #endif /* ZEBRA_PW_H_ */ |