]>
git.proxmox.com Git - mirror_frr.git/blob - ldpd/lde.h
4 * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
5 * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
6 * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 #include "openbsd-queue.h"
25 #include "openbsd-tree.h"
39 struct in_addr prefix
;
43 struct in6_addr prefix
;
49 struct in_addr lsr_id
;
53 RB_HEAD(fec_tree
, fec
);
54 RB_PROTOTYPE(fec_tree
, fec
, entry
, fec_compare
)
65 struct lde_map_head
*head
; /* fec_node's upstream/downstream */
66 RB_ENTRY(lde_map
) entry
;
67 struct lde_nbr
*nexthop
;
70 RB_HEAD(lde_map_head
, lde_map
);
71 RB_PROTOTYPE(lde_map_head
, lde_map
, entry
, lde_map_cmp
);
73 /* withdraw entries */
79 /* Addresses belonging to neighbor */
81 TAILQ_ENTRY(lde_addr
) entry
;
86 /* just the info LDE needs */
88 RB_ENTRY(lde_nbr
) entry
;
91 int v4_enabled
; /* announce/process v4 msgs */
92 int v6_enabled
; /* announce/process v6 msgs */
93 struct fec_tree recv_req
;
94 struct fec_tree sent_req
;
95 struct fec_tree recv_map
;
96 struct fec_tree sent_map
;
97 struct fec_tree sent_wdraw
;
98 TAILQ_HEAD(, lde_addr
) addr_list
;
100 RB_HEAD(nbr_tree
, lde_nbr
);
101 RB_PROTOTYPE(nbr_tree
, lde_nbr
, entry
, lde_nbr_compare
)
104 LIST_ENTRY(fec_nh
) entry
;
106 union ldpd_addr nexthop
;
108 uint32_t remote_label
;
112 #define F_FEC_NH_NEW 0x01
117 LIST_HEAD(, fec_nh
) nexthops
; /* fib nexthops */
118 struct lde_map_head downstream
; /* recv mappings */
119 struct lde_map_head upstream
; /* sent mappings */
121 uint32_t local_label
;
122 void *data
; /* fec specific data */
125 #define LDE_GC_INTERVAL 300
127 extern struct ldpd_conf
*ldeconf
;
128 extern struct fec_tree ft
;
129 extern struct nbr_tree lde_nbrs
;
130 extern struct thread
*gc_timer
;
133 void lde(const char *, const char *);
134 int lde_imsg_compose_parent(int, pid_t
, void *, uint16_t);
135 int lde_imsg_compose_ldpe(int, uint32_t, pid_t
, void *, uint16_t);
136 uint32_t lde_assign_label(void);
137 void lde_send_change_klabel(struct fec_node
*, struct fec_nh
*);
138 void lde_send_delete_klabel(struct fec_node
*, struct fec_nh
*);
139 void lde_fec2map(struct fec
*, struct map
*);
140 void lde_map2fec(struct map
*, struct in_addr
, struct fec
*);
141 void lde_send_labelmapping(struct lde_nbr
*, struct fec_node
*,
143 void lde_send_labelwithdraw(struct lde_nbr
*, struct fec_node
*,
144 uint32_t, struct status_tlv
*);
145 void lde_send_labelwithdraw_all(struct fec_node
*, uint32_t);
146 void lde_send_labelrelease(struct lde_nbr
*, struct fec_node
*,
148 void lde_send_notification(uint32_t, uint32_t, uint32_t, uint16_t);
149 struct lde_nbr
*lde_nbr_find_by_lsrid(struct in_addr
);
150 struct lde_nbr
*lde_nbr_find_by_addr(int, union ldpd_addr
*);
151 struct lde_map
*lde_map_add(struct lde_nbr
*, struct fec_node
*, int);
152 void lde_map_del(struct lde_nbr
*, struct lde_map
*, int);
153 struct lde_req
*lde_req_add(struct lde_nbr
*, struct fec
*, int);
154 void lde_req_del(struct lde_nbr
*, struct lde_req
*, int);
155 struct lde_wdraw
*lde_wdraw_add(struct lde_nbr
*, struct fec_node
*);
156 void lde_wdraw_del(struct lde_nbr
*, struct lde_wdraw
*);
157 void lde_change_egress_label(int, int);
158 struct lde_addr
*lde_address_find(struct lde_nbr
*, int,
162 void fec_init(struct fec_tree
*);
163 struct fec
*fec_find(struct fec_tree
*, struct fec
*);
164 int fec_insert(struct fec_tree
*, struct fec
*);
165 int fec_remove(struct fec_tree
*, struct fec
*);
166 void fec_clear(struct fec_tree
*, void (*)(void *));
168 void fec_snap(struct lde_nbr
*);
169 void fec_tree_clear(void);
170 struct fec_nh
*fec_nh_find(struct fec_node
*, int, union ldpd_addr
*,
172 uint32_t egress_label(enum fec_type
);
173 void lde_kernel_insert(struct fec
*, int, union ldpd_addr
*,
174 ifindex_t
, uint8_t, int, void *);
175 void lde_kernel_remove(struct fec
*, int, union ldpd_addr
*,
177 void lde_kernel_reevaluate(struct fec
*);
178 void lde_check_mapping(struct map
*, struct lde_nbr
*);
179 void lde_check_request(struct map
*, struct lde_nbr
*);
180 void lde_check_release(struct map
*, struct lde_nbr
*);
181 void lde_check_release_wcard(struct map
*, struct lde_nbr
*);
182 void lde_check_withdraw(struct map
*, struct lde_nbr
*);
183 void lde_check_withdraw_wcard(struct map
*, struct lde_nbr
*);
184 int lde_gc_timer(struct thread
*);
185 void lde_gc_start_timer(void);
186 void lde_gc_stop_timer(void);
189 struct l2vpn
*l2vpn_new(const char *);
190 struct l2vpn
*l2vpn_find(struct ldpd_conf
*, const char *);
191 void l2vpn_del(struct l2vpn
*);
192 void l2vpn_init(struct l2vpn
*);
193 void l2vpn_exit(struct l2vpn
*);
194 struct l2vpn_if
*l2vpn_if_new(struct l2vpn
*, struct kif
*);
195 struct l2vpn_if
*l2vpn_if_find(struct l2vpn
*, unsigned int);
196 struct l2vpn_if
*l2vpn_if_find_name(struct l2vpn
*, const char *);
197 struct l2vpn_pw
*l2vpn_pw_new(struct l2vpn
*, struct kif
*);
198 struct l2vpn_pw
*l2vpn_pw_find(struct l2vpn
*, unsigned int);
199 struct l2vpn_pw
*l2vpn_pw_find_name(struct l2vpn
*, const char *);
200 void l2vpn_pw_init(struct l2vpn_pw
*);
201 void l2vpn_pw_exit(struct l2vpn_pw
*);
202 void l2vpn_pw_reset(struct l2vpn_pw
*);
203 int l2vpn_pw_ok(struct l2vpn_pw
*, struct fec_nh
*);
204 int l2vpn_pw_negotiate(struct lde_nbr
*, struct fec_node
*,
206 void l2vpn_send_pw_status(uint32_t, uint32_t, struct fec
*);
207 void l2vpn_recv_pw_status(struct lde_nbr
*, struct notify_msg
*);
208 void l2vpn_sync_pws(int, union ldpd_addr
*);
209 void l2vpn_pw_ctl(pid_t
);
210 void l2vpn_binding_ctl(pid_t
);