]>
Commit | Line | Data |
---|---|---|
6833ae01 | 1 | /* Zebra PW code |
2 | * Copyright (C) 2016 Volta Networks, Inc. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but | |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; see the file COPYING; if not, write to the | |
16 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | |
17 | * MA 02110-1301 USA | |
18 | */ | |
19 | ||
20 | #ifndef ZEBRA_PW_H_ | |
21 | #define ZEBRA_PW_H_ | |
22 | ||
23 | #include <net/if.h> | |
24 | #include <netinet/in.h> | |
25 | ||
bf094f69 QY |
26 | #include "lib/hook.h" |
27 | #include "lib/qobj.h" | |
28 | #include "lib/pw.h" | |
29 | ||
30 | #include "zebra/zebra_vrf.h" | |
6833ae01 | 31 | |
51e94aa7 EDP |
32 | #ifdef __cplusplus |
33 | extern "C" { | |
34 | #endif | |
35 | ||
6833ae01 | 36 | #define PW_INSTALL_RETRY_INTERVAL 30 |
37 | ||
38 | struct zebra_pw { | |
2dd0d726 | 39 | RB_ENTRY(zebra_pw) pw_entry, static_pw_entry; |
6833ae01 | 40 | vrf_id_t vrf_id; |
41 | char ifname[IF_NAMESIZE]; | |
42 | ifindex_t ifindex; | |
43 | int type; | |
44 | int af; | |
45 | union g_addr nexthop; | |
46 | uint32_t local_label; | |
47 | uint32_t remote_label; | |
48 | uint8_t flags; | |
49 | union pw_protocol_fields data; | |
50 | int enabled; | |
51 | int status; | |
52 | uint8_t protocol; | |
53 | struct zserv *client; | |
731a75fe | 54 | struct rnh *rnh; |
6833ae01 | 55 | struct thread *install_retry_timer; |
2dd0d726 | 56 | QOBJ_FIELDS |
6833ae01 | 57 | }; |
2dd0d726 | 58 | DECLARE_QOBJ_TYPE(zebra_pw) |
6833ae01 | 59 | |
60 | RB_HEAD(zebra_pw_head, zebra_pw); | |
2dd0d726 RW |
61 | RB_PROTOTYPE(zebra_pw_head, zebra_pw, pw_entry, zebra_pw_compare); |
62 | ||
63 | RB_HEAD(zebra_static_pw_head, zebra_pw); | |
64 | RB_PROTOTYPE(zebra_static_pw_head, zebra_pw, static_pw_entry, zebra_pw_compare); | |
6833ae01 | 65 | |
66 | DECLARE_HOOK(pw_install, (struct zebra_pw * pw), (pw)) | |
67 | DECLARE_HOOK(pw_uninstall, (struct zebra_pw * pw), (pw)) | |
68 | ||
97d8d05a MS |
69 | struct zebra_pw *zebra_pw_add(struct zebra_vrf *zvrf, const char *ifname, |
70 | uint8_t protocol, struct zserv *client); | |
6833ae01 | 71 | void zebra_pw_del(struct zebra_vrf *, struct zebra_pw *); |
72 | void zebra_pw_change(struct zebra_pw *, ifindex_t, int, int, union g_addr *, | |
73 | uint32_t, uint32_t, uint8_t, union pw_protocol_fields *); | |
74 | struct zebra_pw *zebra_pw_find(struct zebra_vrf *, const char *); | |
75 | void zebra_pw_update(struct zebra_pw *); | |
76 | void zebra_pw_install_failure(struct zebra_pw *); | |
6833ae01 | 77 | void zebra_pw_init(struct zebra_vrf *); |
78 | void zebra_pw_exit(struct zebra_vrf *); | |
2dd0d726 | 79 | void zebra_pw_vty_init(void); |
6833ae01 | 80 | |
51e94aa7 EDP |
81 | #ifdef __cplusplus |
82 | } | |
83 | #endif | |
84 | ||
6833ae01 | 85 | #endif /* ZEBRA_PW_H_ */ |