]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_pw.h
zebra: add pseudowire manager
[mirror_frr.git] / zebra / zebra_pw.h
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
26 #include "hook.h"
27
28 #define PW_INSTALL_RETRY_INTERVAL 30
29
30 struct zebra_pw {
31 RB_ENTRY(zebra_pw) entry;
32 vrf_id_t vrf_id;
33 char ifname[IF_NAMESIZE];
34 ifindex_t ifindex;
35 int type;
36 int af;
37 union g_addr nexthop;
38 uint32_t local_label;
39 uint32_t remote_label;
40 uint8_t flags;
41 union pw_protocol_fields data;
42 int enabled;
43 int status;
44 uint8_t protocol;
45 struct zserv *client;
46 struct thread *install_retry_timer;
47 };
48
49 RB_HEAD(zebra_pw_head, zebra_pw);
50 RB_PROTOTYPE(zebra_pw_head, zebra_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 *, const char *,
56 uint8_t, struct zserv *);
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 *);
63 void zebra_pw_client_close(struct zserv *);
64 void zebra_pw_init(struct zebra_vrf *);
65 void zebra_pw_exit(struct zebra_vrf *);
66
67 #endif /* ZEBRA_PW_H_ */