]> git.proxmox.com Git - mirror_frr.git/blame - ldpd/ldpd.h
ldpd: add in-process API for creating/deleting
[mirror_frr.git] / ldpd / ldpd.h
CommitLineData
8429abe0
RW
1/* $OpenBSD$ */
2
3/*
4 * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
5 * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
6 * Copyright (c) 2004 Esben Norby <norby@openbsd.org>
7 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
8 *
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */
21
22#ifndef _LDPD_H_
23#define _LDPD_H_
24
eac6e3f0
RW
25#include "openbsd-queue.h"
26#include "openbsd-tree.h"
27#include "imsg.h"
28#include "thread.h"
8429abe0
RW
29
30#include "ldp.h"
31
32#define CONF_FILE "/etc/ldpd.conf"
8429abe0
RW
33#define LDPD_USER "_ldpd"
34
35#define LDPD_OPT_VERBOSE 0x00000001
36#define LDPD_OPT_VERBOSE2 0x00000002
37#define LDPD_OPT_NOACTION 0x00000004
38
39#define TCP_MD5_KEY_LEN 80
40#define L2VPN_NAME_LEN 32
41
42#define RT_BUF_SIZE 16384
43#define MAX_RTSOCK_BUF 128 * 1024
44#define LDP_BACKLOG 128
45
46#define F_LDPD_INSERTED 0x0001
47#define F_CONNECTED 0x0002
48#define F_STATIC 0x0004
49#define F_DYNAMIC 0x0008
50#define F_REJECT 0x0010
51#define F_BLACKHOLE 0x0020
52#define F_REDISTRIBUTED 0x0040
53
54struct evbuf {
eac6e3f0
RW
55 struct msgbuf wbuf;
56 struct thread *ev;
57 int (*handler)(struct thread *);
58 void *arg;
8429abe0
RW
59};
60
61struct imsgev {
62 struct imsgbuf ibuf;
eac6e3f0
RW
63 int (*handler_write)(struct thread *);
64 struct thread *ev_write;
65 int (*handler_read)(struct thread *);
66 struct thread *ev_read;
8429abe0
RW
67};
68
69enum imsg_type {
70 IMSG_NONE,
71 IMSG_CTL_RELOAD,
72 IMSG_CTL_SHOW_INTERFACE,
73 IMSG_CTL_SHOW_DISCOVERY,
eac6e3f0
RW
74 IMSG_CTL_SHOW_DISC_IFACE,
75 IMSG_CTL_SHOW_DISC_TNBR,
76 IMSG_CTL_SHOW_DISC_ADJ,
8429abe0 77 IMSG_CTL_SHOW_NBR,
eac6e3f0
RW
78 IMSG_CTL_SHOW_NBR_DISC,
79 IMSG_CTL_SHOW_NBR_END,
8429abe0
RW
80 IMSG_CTL_SHOW_LIB,
81 IMSG_CTL_SHOW_L2VPN_PW,
82 IMSG_CTL_SHOW_L2VPN_BINDING,
83 IMSG_CTL_CLEAR_NBR,
84 IMSG_CTL_FIB_COUPLE,
85 IMSG_CTL_FIB_DECOUPLE,
86 IMSG_CTL_KROUTE,
87 IMSG_CTL_KROUTE_ADDR,
88 IMSG_CTL_IFINFO,
89 IMSG_CTL_END,
90 IMSG_CTL_LOG_VERBOSE,
91 IMSG_KLABEL_CHANGE,
92 IMSG_KLABEL_DELETE,
93 IMSG_KPWLABEL_CHANGE,
94 IMSG_KPWLABEL_DELETE,
95 IMSG_IFSTATUS,
96 IMSG_NEWADDR,
97 IMSG_DELADDR,
eac6e3f0 98 IMSG_RTRID_UPDATE,
8429abe0
RW
99 IMSG_LABEL_MAPPING,
100 IMSG_LABEL_MAPPING_FULL,
101 IMSG_LABEL_REQUEST,
102 IMSG_LABEL_RELEASE,
103 IMSG_LABEL_WITHDRAW,
104 IMSG_LABEL_ABORT,
105 IMSG_REQUEST_ADD,
106 IMSG_REQUEST_ADD_END,
107 IMSG_MAPPING_ADD,
108 IMSG_MAPPING_ADD_END,
109 IMSG_RELEASE_ADD,
110 IMSG_RELEASE_ADD_END,
111 IMSG_WITHDRAW_ADD,
112 IMSG_WITHDRAW_ADD_END,
113 IMSG_ADDRESS_ADD,
114 IMSG_ADDRESS_DEL,
115 IMSG_NOTIFICATION,
116 IMSG_NOTIFICATION_SEND,
117 IMSG_NEIGHBOR_UP,
118 IMSG_NEIGHBOR_DOWN,
119 IMSG_NETWORK_ADD,
134970a2 120 IMSG_NETWORK_ADD_END,
8429abe0
RW
121 IMSG_NETWORK_DEL,
122 IMSG_SOCKET_IPC,
123 IMSG_SOCKET_NET,
124 IMSG_CLOSE_SOCKETS,
125 IMSG_REQUEST_SOCKETS,
126 IMSG_SETUP_SOCKETS,
127 IMSG_RECONF_CONF,
128 IMSG_RECONF_IFACE,
129 IMSG_RECONF_TNBR,
130 IMSG_RECONF_NBRP,
131 IMSG_RECONF_L2VPN,
132 IMSG_RECONF_L2VPN_IF,
133 IMSG_RECONF_L2VPN_PW,
eac6e3f0
RW
134 IMSG_RECONF_L2VPN_IPW,
135 IMSG_RECONF_END,
136 IMSG_DEBUG_UPDATE,
137 IMSG_LOG
8429abe0
RW
138};
139
140union ldpd_addr {
141 struct in_addr v4;
142 struct in6_addr v6;
143};
144
145#define IN6_IS_SCOPE_EMBED(a) \
146 ((IN6_IS_ADDR_LINKLOCAL(a)) || \
147 (IN6_IS_ADDR_MC_LINKLOCAL(a)) || \
148 (IN6_IS_ADDR_MC_INTFACELOCAL(a)))
149
150/* interface states */
151#define IF_STA_DOWN 0x01
152#define IF_STA_ACTIVE 0x02
153
154/* targeted neighbor states */
155#define TNBR_STA_DOWN 0x01
156#define TNBR_STA_ACTIVE 0x02
157
158/* interface types */
159enum iface_type {
160 IF_TYPE_POINTOPOINT,
161 IF_TYPE_BROADCAST
162};
163
164/* neighbor states */
165#define NBR_STA_PRESENT 0x0001
166#define NBR_STA_INITIAL 0x0002
167#define NBR_STA_OPENREC 0x0004
168#define NBR_STA_OPENSENT 0x0008
169#define NBR_STA_OPER 0x0010
170#define NBR_STA_SESSION (NBR_STA_INITIAL | NBR_STA_OPENREC | \
171 NBR_STA_OPENSENT | NBR_STA_OPER)
172
173/* neighbor events */
174enum nbr_event {
175 NBR_EVT_NOTHING,
176 NBR_EVT_MATCH_ADJ,
177 NBR_EVT_CONNECT_UP,
178 NBR_EVT_CLOSE_SESSION,
179 NBR_EVT_INIT_RCVD,
180 NBR_EVT_KEEPALIVE_RCVD,
181 NBR_EVT_PDU_RCVD,
182 NBR_EVT_PDU_SENT,
183 NBR_EVT_INIT_SENT
184};
185
186/* neighbor actions */
187enum nbr_action {
188 NBR_ACT_NOTHING,
189 NBR_ACT_RST_KTIMEOUT,
190 NBR_ACT_SESSION_EST,
191 NBR_ACT_RST_KTIMER,
192 NBR_ACT_CONNECT_SETUP,
193 NBR_ACT_PASSIVE_INIT,
194 NBR_ACT_KEEPALIVE_SEND,
195 NBR_ACT_CLOSE_SESSION
196};
197
198TAILQ_HEAD(mapping_head, mapping_entry);
199
200struct map {
201 uint8_t type;
202 uint32_t msg_id;
203 union {
204 struct {
205 uint16_t af;
206 union ldpd_addr prefix;
207 uint8_t prefixlen;
208 } prefix;
209 struct {
210 uint16_t type;
211 uint32_t pwid;
212 uint32_t group_id;
213 uint16_t ifmtu;
214 } pwid;
215 } fec;
216 struct {
217 uint32_t status_code;
218 uint32_t msg_id;
219 uint16_t msg_type;
220 } st;
221 uint32_t label;
222 uint32_t requestid;
223 uint32_t pw_status;
224 uint8_t flags;
225};
226#define F_MAP_REQ_ID 0x01 /* optional request message id present */
227#define F_MAP_STATUS 0x02 /* status */
228#define F_MAP_PW_CWORD 0x04 /* pseudowire control word */
229#define F_MAP_PW_ID 0x08 /* pseudowire connection id */
230#define F_MAP_PW_IFMTU 0x10 /* pseudowire interface parameter */
231#define F_MAP_PW_STATUS 0x20 /* pseudowire status */
232
233struct notify_msg {
234 uint32_t status_code;
235 uint32_t msg_id; /* network byte order */
236 uint16_t msg_type; /* network byte order */
237 uint32_t pw_status;
238 struct map fec;
239 uint8_t flags;
240};
241#define F_NOTIF_PW_STATUS 0x01 /* pseudowire status tlv present */
242#define F_NOTIF_FEC 0x02 /* fec tlv present */
243
244struct if_addr {
245 LIST_ENTRY(if_addr) entry;
246 int af;
247 union ldpd_addr addr;
248 uint8_t prefixlen;
249 union ldpd_addr dstbrd;
250};
251LIST_HEAD(if_addr_head, if_addr);
252
253struct iface_af {
254 struct iface *iface;
255 int af;
256 int enabled;
257 int state;
258 LIST_HEAD(, adj) adj_list;
259 time_t uptime;
eac6e3f0 260 struct thread *hello_timer;
8429abe0
RW
261 uint16_t hello_holdtime;
262 uint16_t hello_interval;
263};
264
265struct iface {
266 LIST_ENTRY(iface) entry;
267 char name[IF_NAMESIZE];
268 unsigned int ifindex;
269 struct if_addr_head addr_list;
270 struct in6_addr linklocal;
271 enum iface_type type;
8429abe0 272 uint16_t flags;
8429abe0
RW
273 struct iface_af ipv4;
274 struct iface_af ipv6;
275};
276
277/* source of targeted hellos */
278struct tnbr {
279 LIST_ENTRY(tnbr) entry;
eac6e3f0 280 struct thread *hello_timer;
8429abe0
RW
281 struct adj *adj;
282 int af;
283 union ldpd_addr addr;
284 int state;
8429abe0
RW
285 uint16_t pw_count;
286 uint8_t flags;
287};
288#define F_TNBR_CONFIGURED 0x01
289#define F_TNBR_DYNAMIC 0x02
290
291enum auth_method {
292 AUTH_NONE,
293 AUTH_MD5SIG
294};
295
296/* neighbor specific parameters */
297struct nbr_params {
298 LIST_ENTRY(nbr_params) entry;
299 struct in_addr lsr_id;
300 uint16_t keepalive;
301 int gtsm_enabled;
302 uint8_t gtsm_hops;
303 struct {
304 enum auth_method method;
305 char md5key[TCP_MD5_KEY_LEN];
306 uint8_t md5key_len;
307 } auth;
308 uint8_t flags;
309};
310#define F_NBRP_KEEPALIVE 0x01
311#define F_NBRP_GTSM 0x02
312#define F_NBRP_GTSM_HOPS 0x04
313
314struct l2vpn_if {
315 LIST_ENTRY(l2vpn_if) entry;
316 struct l2vpn *l2vpn;
317 char ifname[IF_NAMESIZE];
318 unsigned int ifindex;
319 uint16_t flags;
8429abe0
RW
320};
321
322struct l2vpn_pw {
323 LIST_ENTRY(l2vpn_pw) entry;
324 struct l2vpn *l2vpn;
325 struct in_addr lsr_id;
326 int af;
327 union ldpd_addr addr;
328 uint32_t pwid;
329 char ifname[IF_NAMESIZE];
330 unsigned int ifindex;
331 uint32_t remote_group;
332 uint16_t remote_mtu;
333 uint32_t remote_status;
334 uint8_t flags;
335};
336#define F_PW_STATUSTLV_CONF 0x01 /* status tlv configured */
337#define F_PW_STATUSTLV 0x02 /* status tlv negotiated */
338#define F_PW_CWORD_CONF 0x04 /* control word configured */
339#define F_PW_CWORD 0x08 /* control word negotiated */
340#define F_PW_STATUS_UP 0x10 /* pseudowire is operational */
eac6e3f0 341#define F_PW_STATIC_NBR_ADDR 0x20 /* static neighbor address configured */
8429abe0
RW
342
343struct l2vpn {
344 LIST_ENTRY(l2vpn) entry;
345 char name[L2VPN_NAME_LEN];
346 int type;
347 int pw_type;
348 int mtu;
349 char br_ifname[IF_NAMESIZE];
350 unsigned int br_ifindex;
351 LIST_HEAD(, l2vpn_if) if_list;
352 LIST_HEAD(, l2vpn_pw) pw_list;
eac6e3f0 353 LIST_HEAD(, l2vpn_pw) pw_inactive_list;
8429abe0
RW
354};
355#define L2VPN_TYPE_VPWS 1
356#define L2VPN_TYPE_VPLS 2
357
358/* ldp_conf */
359enum ldpd_process {
360 PROC_MAIN,
361 PROC_LDP_ENGINE,
362 PROC_LDE_ENGINE
363} ldpd_process;
364
365enum socket_type {
366 LDP_SOCKET_DISC,
367 LDP_SOCKET_EDISC,
368 LDP_SOCKET_SESSION
369};
370
371enum hello_type {
372 HELLO_LINK,
373 HELLO_TARGETED
374};
375
376struct ldpd_af_conf {
377 uint16_t keepalive;
eac6e3f0
RW
378 uint16_t lhello_holdtime;
379 uint16_t lhello_interval;
8429abe0
RW
380 uint16_t thello_holdtime;
381 uint16_t thello_interval;
382 union ldpd_addr trans_addr;
383 int flags;
384};
385#define F_LDPD_AF_ENABLED 0x0001
386#define F_LDPD_AF_THELLO_ACCEPT 0x0002
387#define F_LDPD_AF_EXPNULL 0x0004
388#define F_LDPD_AF_NO_GTSM 0x0008
389
390struct ldpd_conf {
391 struct in_addr rtr_id;
392 struct ldpd_af_conf ipv4;
393 struct ldpd_af_conf ipv6;
394 LIST_HEAD(, iface) iface_list;
395 LIST_HEAD(, tnbr) tnbr_list;
396 LIST_HEAD(, nbr_params) nbrp_list;
397 LIST_HEAD(, l2vpn) l2vpn_list;
eac6e3f0
RW
398 uint16_t lhello_holdtime;
399 uint16_t lhello_interval;
400 uint16_t thello_holdtime;
401 uint16_t thello_interval;
8429abe0
RW
402 uint16_t trans_pref;
403 int flags;
404};
405#define F_LDPD_NO_FIB_UPDATE 0x0001
406#define F_LDPD_DS_CISCO_INTEROP 0x0002
eac6e3f0 407#define F_LDPD_ENABLED 0x0004
8429abe0
RW
408
409struct ldpd_af_global {
eac6e3f0
RW
410 struct thread *disc_ev;
411 struct thread *edisc_ev;
8429abe0
RW
412 int ldp_disc_socket;
413 int ldp_edisc_socket;
414 int ldp_session_socket;
415};
416
417struct ldpd_global {
418 int cmd_opts;
419 time_t uptime;
eac6e3f0 420 struct in_addr rtr_id;
8429abe0
RW
421 struct ldpd_af_global ipv4;
422 struct ldpd_af_global ipv6;
423 uint32_t conf_seqnum;
424 int pfkeysock;
425 struct if_addr_head addr_list;
426 LIST_HEAD(, adj) adj_list;
427 struct in_addr mcast_addr_v4;
428 struct in6_addr mcast_addr_v6;
429 TAILQ_HEAD(, pending_conn) pending_conns;
430};
431
432/* kroute */
433struct kroute {
434 int af;
435 union ldpd_addr prefix;
436 uint8_t prefixlen;
437 union ldpd_addr nexthop;
438 uint32_t local_label;
439 uint32_t remote_label;
440 unsigned short ifindex;
441 uint8_t priority;
442 uint16_t flags;
443};
444
445struct kpw {
446 unsigned short ifindex;
447 int pw_type;
448 int af;
449 union ldpd_addr nexthop;
450 uint32_t local_label;
451 uint32_t remote_label;
452 uint8_t flags;
453};
454
455struct kaddr {
456 unsigned short ifindex;
457 int af;
458 union ldpd_addr addr;
459 uint8_t prefixlen;
460 union ldpd_addr dstbrd;
461};
462
463struct kif {
464 char ifname[IF_NAMESIZE];
465 unsigned short ifindex;
466 int flags;
8429abe0 467 int mtu;
8429abe0
RW
468};
469
470/* control data structures */
471struct ctl_iface {
472 int af;
473 char name[IF_NAMESIZE];
474 unsigned int ifindex;
475 int state;
476 uint16_t flags;
8429abe0 477 enum iface_type type;
8429abe0
RW
478 uint16_t hello_holdtime;
479 uint16_t hello_interval;
480 time_t uptime;
481 uint16_t adj_cnt;
482};
483
eac6e3f0
RW
484struct ctl_disc_if {
485 char name[IF_NAMESIZE];
486 int active_v4;
487 int active_v6;
488 int no_adj;
489};
490
491struct ctl_disc_tnbr {
492 int af;
493 union ldpd_addr addr;
494 int no_adj;
495};
496
8429abe0
RW
497struct ctl_adj {
498 int af;
499 struct in_addr id;
500 enum hello_type type;
501 char ifname[IF_NAMESIZE];
502 union ldpd_addr src_addr;
503 uint16_t holdtime;
504 union ldpd_addr trans_addr;
505};
506
507struct ctl_nbr {
508 int af;
509 struct in_addr id;
510 union ldpd_addr laddr;
eac6e3f0 511 in_port_t lport;
8429abe0 512 union ldpd_addr raddr;
eac6e3f0
RW
513 in_port_t rport;
514 uint16_t holdtime;
8429abe0
RW
515 time_t uptime;
516 int nbr_state;
517};
518
519struct ctl_rt {
520 int af;
521 union ldpd_addr prefix;
522 uint8_t prefixlen;
523 struct in_addr nexthop; /* lsr-id */
524 uint32_t local_label;
525 uint32_t remote_label;
526 uint8_t flags;
527 uint8_t in_use;
eac6e3f0 528 int first;
8429abe0
RW
529};
530
531struct ctl_pw {
532 uint16_t type;
eac6e3f0 533 char l2vpn_name[L2VPN_NAME_LEN];
8429abe0
RW
534 char ifname[IF_NAMESIZE];
535 uint32_t pwid;
536 struct in_addr lsr_id;
537 uint32_t local_label;
538 uint32_t local_gid;
539 uint16_t local_ifmtu;
eac6e3f0 540 uint8_t local_cword;
8429abe0
RW
541 uint32_t remote_label;
542 uint32_t remote_gid;
543 uint16_t remote_ifmtu;
eac6e3f0 544 uint8_t remote_cword;
8429abe0
RW
545 uint32_t status;
546};
547
548extern struct ldpd_conf *ldpd_conf;
549extern struct ldpd_global global;
550
551/* parse.y */
552struct ldpd_conf *parse_config(char *);
553int cmdline_symset(char *);
554
555/* kroute.c */
8429abe0
RW
556void kif_redistribute(const char *);
557int kr_change(struct kroute *);
558int kr_delete(struct kroute *);
8429abe0
RW
559int kmpw_set(struct kpw *);
560int kmpw_unset(struct kpw *);
561
562/* util.c */
563uint8_t mask2prefixlen(in_addr_t);
564uint8_t mask2prefixlen6(struct sockaddr_in6 *);
565in_addr_t prefixlen2mask(uint8_t);
566struct in6_addr *prefixlen2mask6(uint8_t);
567void ldp_applymask(int, union ldpd_addr *,
568 const union ldpd_addr *, int);
569int ldp_addrcmp(int, const union ldpd_addr *,
570 const union ldpd_addr *);
571int ldp_addrisset(int, const union ldpd_addr *);
572int ldp_prefixcmp(int, const union ldpd_addr *,
573 const union ldpd_addr *, uint8_t);
574int bad_addr_v4(struct in_addr);
575int bad_addr_v6(struct in6_addr *);
576int bad_addr(int, union ldpd_addr *);
577void embedscope(struct sockaddr_in6 *);
578void recoverscope(struct sockaddr_in6 *);
579void addscope(struct sockaddr_in6 *, uint32_t);
580void clearscope(struct in6_addr *);
581struct sockaddr *addr2sa(int af, union ldpd_addr *, uint16_t);
eac6e3f0
RW
582void sa2addr(struct sockaddr *, int *, union ldpd_addr *,
583 in_port_t *);
584socklen_t sockaddr_len(struct sockaddr *);
8429abe0
RW
585
586/* ldpd.c */
eac6e3f0 587int ldp_write_handler(struct thread *);
8429abe0
RW
588void main_imsg_compose_ldpe(int, pid_t, void *, uint16_t);
589void main_imsg_compose_lde(int, pid_t, void *, uint16_t);
eac6e3f0
RW
590int main_imsg_compose_both(enum imsg_type, void *,
591 uint16_t);
8429abe0 592void imsg_event_add(struct imsgev *);
eac6e3f0
RW
593int imsg_compose_event(struct imsgev *, uint16_t, uint32_t,
594 pid_t, int, void *, uint16_t);
8429abe0
RW
595void evbuf_enqueue(struct evbuf *, struct ibuf *);
596void evbuf_event_add(struct evbuf *);
eac6e3f0
RW
597void evbuf_init(struct evbuf *, int,
598 int (*)(struct thread *), void *);
8429abe0
RW
599void evbuf_clear(struct evbuf *);
600struct ldpd_af_conf *ldp_af_conf_get(struct ldpd_conf *, int);
601struct ldpd_af_global *ldp_af_global_get(struct ldpd_global *, int);
602int ldp_is_dual_stack(struct ldpd_conf *);
eac6e3f0
RW
603in_addr_t ldp_rtr_id_get(struct ldpd_conf *);
604int ldp_reload(struct ldpd_conf *);
b67c140b
RW
605int ldp_reload_ref(struct ldpd_conf *, void **);
606struct ldpd_conf *ldp_dup_config_ref(struct ldpd_conf *, void **ref);
eac6e3f0
RW
607struct ldpd_conf *ldp_dup_config(struct ldpd_conf *);
608void ldp_clear_config(struct ldpd_conf *);
8429abe0
RW
609void merge_config(struct ldpd_conf *, struct ldpd_conf *);
610struct ldpd_conf *config_new_empty(void);
611void config_clear(struct ldpd_conf *);
612
bbee85d2
RW
613/* ldp_vty_conf.c */
614/* NOTE: the parameters' names should be preserved because of codegen */
615struct iface *iface_new_api(struct ldpd_conf *cfg,
616 const char *name);
617void iface_del_api(struct iface *iface);
618struct tnbr *tnbr_new_api(struct ldpd_conf *cfg, int af,
619 union ldpd_addr *addr);
620void tnbr_del_api(struct tnbr *tnbr);
621struct nbr_params *nbrp_new_api(struct ldpd_conf *cfg,
622 struct in_addr lsr_id);
623void nbrp_del_api(struct nbr_params *nbrp);
624struct l2vpn *l2vpn_new_api(struct ldpd_conf *cfg, const char *name);
625void l2vpn_del_api(struct l2vpn *l2vpn);
626struct l2vpn_if *l2vpn_if_new_api(struct ldpd_conf *conf,
627 struct l2vpn *l2vpn, const char *ifname);
628void l2vpn_if_del_api(struct l2vpn_if *lif);
629struct l2vpn_pw *l2vpn_pw_new_api(struct ldpd_conf *conf,
630 struct l2vpn *l2vpn, const char *ifname);
631void l2vpn_pw_del_api(struct l2vpn_pw *pw);
632
8429abe0
RW
633/* socket.c */
634int ldp_create_socket(int, enum socket_type);
eac6e3f0
RW
635void sock_set_nonblock(int);
636void sock_set_cloexec(int);
8429abe0
RW
637void sock_set_recvbuf(int);
638int sock_set_reuse(int, int);
639int sock_set_bindany(int, int);
eac6e3f0 640int sock_set_md5sig(int, int, union ldpd_addr *, const char *);
8429abe0 641int sock_set_ipv4_tos(int, int);
eac6e3f0
RW
642int sock_set_ipv4_pktinfo(int, int);
643int sock_set_ipv4_recvdstaddr(int, int);
8429abe0
RW
644int sock_set_ipv4_recvif(int, int);
645int sock_set_ipv4_minttl(int, int);
646int sock_set_ipv4_ucast_ttl(int fd, int);
647int sock_set_ipv4_mcast_ttl(int, uint8_t);
648int sock_set_ipv4_mcast(struct iface *);
649int sock_set_ipv4_mcast_loop(int);
650int sock_set_ipv6_dscp(int, int);
651int sock_set_ipv6_pktinfo(int, int);
652int sock_set_ipv6_minhopcount(int, int);
653int sock_set_ipv6_ucast_hops(int, int);
654int sock_set_ipv6_mcast_hops(int, int);
655int sock_set_ipv6_mcast(struct iface *);
656int sock_set_ipv6_mcast_loop(int);
657
eac6e3f0
RW
658/* quagga */
659extern struct thread_master *master;
660
661/* ldp_zebra.c */
662void ldp_zebra_init(struct thread_master *);
663
664/* compatibility */
665#ifndef __OpenBSD__
666#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
667#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
668#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \
669 (IN6_IS_ADDR_MULTICAST(a) && \
670 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_INTFACELOCAL))
671#endif
8429abe0
RW
672
673#endif /* _LDPD_H_ */