summaryrefslogtreecommitdiff
path: root/ldpd/ldpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'ldpd/ldpd.h')
-rw-r--r--ldpd/ldpd.h72
1 files changed, 46 insertions, 26 deletions
diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h
index 630b192489..4d575597ae 100644
--- a/ldpd/ldpd.h
+++ b/ldpd/ldpd.h
@@ -196,7 +196,10 @@ enum nbr_action {
NBR_ACT_CLOSE_SESSION
};
-TAILQ_HEAD(mapping_head, mapping_entry);
+/* forward declarations */
+RB_HEAD(global_adj_head, adj);
+RB_HEAD(nbr_adj_head, adj);
+RB_HEAD(ia_adj_head, adj);
struct map {
uint8_t type;
@@ -256,7 +259,7 @@ struct iface_af {
int af;
int enabled;
int state;
- LIST_HEAD(, adj) adj_list;
+ struct ia_adj_head adj_tree;
time_t uptime;
struct thread *hello_timer;
uint16_t hello_holdtime;
@@ -264,7 +267,7 @@ struct iface_af {
};
struct iface {
- LIST_ENTRY(iface) entry;
+ RB_ENTRY(iface) entry;
char name[IF_NAMESIZE];
unsigned int ifindex;
struct if_addr_head addr_list;
@@ -275,11 +278,13 @@ struct iface {
struct iface_af ipv6;
QOBJ_FIELDS
};
+RB_HEAD(iface_head, iface);
+RB_PROTOTYPE(iface_head, iface, entry, iface_compare);
DECLARE_QOBJ_TYPE(iface)
/* source of targeted hellos */
struct tnbr {
- LIST_ENTRY(tnbr) entry;
+ RB_ENTRY(tnbr) entry;
struct thread *hello_timer;
struct adj *adj;
int af;
@@ -289,6 +294,8 @@ struct tnbr {
uint8_t flags;
QOBJ_FIELDS
};
+RB_HEAD(tnbr_head, tnbr);
+RB_PROTOTYPE(tnbr_head, tnbr, entry, tnbr_compare);
DECLARE_QOBJ_TYPE(tnbr)
#define F_TNBR_CONFIGURED 0x01
#define F_TNBR_DYNAMIC 0x02
@@ -300,7 +307,7 @@ enum auth_method {
/* neighbor specific parameters */
struct nbr_params {
- LIST_ENTRY(nbr_params) entry;
+ RB_ENTRY(nbr_params) entry;
struct in_addr lsr_id;
uint16_t keepalive;
int gtsm_enabled;
@@ -313,23 +320,27 @@ struct nbr_params {
uint8_t flags;
QOBJ_FIELDS
};
+RB_HEAD(nbrp_head, nbr_params);
+RB_PROTOTYPE(nbrp_head, nbr_params, entry, nbr_params_compare);
DECLARE_QOBJ_TYPE(nbr_params)
#define F_NBRP_KEEPALIVE 0x01
#define F_NBRP_GTSM 0x02
#define F_NBRP_GTSM_HOPS 0x04
struct l2vpn_if {
- LIST_ENTRY(l2vpn_if) entry;
+ RB_ENTRY(l2vpn_if) entry;
struct l2vpn *l2vpn;
char ifname[IF_NAMESIZE];
unsigned int ifindex;
uint16_t flags;
QOBJ_FIELDS
};
+RB_HEAD(l2vpn_if_head, l2vpn_if);
+RB_PROTOTYPE(l2vpn_if_head, l2vpn_if, entry, l2vpn_if_compare);
DECLARE_QOBJ_TYPE(l2vpn_if)
struct l2vpn_pw {
- LIST_ENTRY(l2vpn_pw) entry;
+ RB_ENTRY(l2vpn_pw) entry;
struct l2vpn *l2vpn;
struct in_addr lsr_id;
int af;
@@ -343,6 +354,8 @@ struct l2vpn_pw {
uint8_t flags;
QOBJ_FIELDS
};
+RB_HEAD(l2vpn_pw_head, l2vpn_pw);
+RB_PROTOTYPE(l2vpn_pw_head, l2vpn_pw, entry, l2vpn_pw_compare);
DECLARE_QOBJ_TYPE(l2vpn_pw)
#define F_PW_STATUSTLV_CONF 0x01 /* status tlv configured */
#define F_PW_STATUSTLV 0x02 /* status tlv negotiated */
@@ -352,18 +365,20 @@ DECLARE_QOBJ_TYPE(l2vpn_pw)
#define F_PW_STATIC_NBR_ADDR 0x20 /* static neighbor address configured */
struct l2vpn {
- LIST_ENTRY(l2vpn) entry;
+ RB_ENTRY(l2vpn) entry;
char name[L2VPN_NAME_LEN];
int type;
int pw_type;
int mtu;
char br_ifname[IF_NAMESIZE];
unsigned int br_ifindex;
- LIST_HEAD(, l2vpn_if) if_list;
- LIST_HEAD(, l2vpn_pw) pw_list;
- LIST_HEAD(, l2vpn_pw) pw_inactive_list;
+ struct l2vpn_if_head if_tree;
+ struct l2vpn_pw_head pw_tree;
+ struct l2vpn_pw_head pw_inactive_tree;
QOBJ_FIELDS
};
+RB_HEAD(l2vpn_head, l2vpn);
+RB_PROTOTYPE(l2vpn_head, l2vpn, entry, l2vpn_compare);
DECLARE_QOBJ_TYPE(l2vpn)
#define L2VPN_TYPE_VPWS 1
#define L2VPN_TYPE_VPLS 2
@@ -404,10 +419,10 @@ struct ldpd_conf {
struct in_addr rtr_id;
struct ldpd_af_conf ipv4;
struct ldpd_af_conf ipv6;
- LIST_HEAD(, iface) iface_list;
- LIST_HEAD(, tnbr) tnbr_list;
- LIST_HEAD(, nbr_params) nbrp_list;
- LIST_HEAD(, l2vpn) l2vpn_list;
+ struct iface_head iface_tree;
+ struct tnbr_head tnbr_tree;
+ struct nbrp_head nbrp_tree;
+ struct l2vpn_head l2vpn_tree;
uint16_t lhello_holdtime;
uint16_t lhello_interval;
uint16_t thello_holdtime;
@@ -438,7 +453,7 @@ struct ldpd_global {
uint32_t conf_seqnum;
int pfkeysock;
struct if_addr_head addr_list;
- LIST_HEAD(, adj) adj_list;
+ struct global_adj_head adj_tree;
struct in_addr mcast_addr_v4;
struct in6_addr mcast_addr_v6;
TAILQ_HEAD(, pending_conn) pending_conns;
@@ -627,23 +642,28 @@ void config_clear(struct ldpd_conf *);
/* ldp_vty_conf.c */
/* NOTE: the parameters' names should be preserved because of codegen */
-struct iface *iface_new_api(struct ldpd_conf *cfg,
+struct iface *iface_new_api(struct ldpd_conf *conf,
const char *name);
-void iface_del_api(struct iface *iface);
-struct tnbr *tnbr_new_api(struct ldpd_conf *cfg, int af,
+void iface_del_api(struct ldpd_conf *conf,
+ struct iface *iface);
+struct tnbr *tnbr_new_api(struct ldpd_conf *conf, int af,
union ldpd_addr *addr);
-void tnbr_del_api(struct tnbr *tnbr);
-struct nbr_params *nbrp_new_api(struct ldpd_conf *cfg,
+void tnbr_del_api(struct ldpd_conf *conf, struct tnbr *tnbr);
+struct nbr_params *nbrp_new_api(struct ldpd_conf *conf,
struct in_addr lsr_id);
-void nbrp_del_api(struct nbr_params *nbrp);
-struct l2vpn *l2vpn_new_api(struct ldpd_conf *cfg, const char *name);
-void l2vpn_del_api(struct l2vpn *l2vpn);
+void nbrp_del_api(struct ldpd_conf *conf,
+ struct nbr_params *nbrp);
+struct l2vpn *l2vpn_new_api(struct ldpd_conf *conf, const char *name);
+void l2vpn_del_api(struct ldpd_conf *conf,
+ struct l2vpn *l2vpn);
struct l2vpn_if *l2vpn_if_new_api(struct ldpd_conf *conf,
struct l2vpn *l2vpn, const char *ifname);
-void l2vpn_if_del_api(struct l2vpn_if *lif);
+void l2vpn_if_del_api(struct l2vpn *l2vpn,
+ struct l2vpn_if *lif);
struct l2vpn_pw *l2vpn_pw_new_api(struct ldpd_conf *conf,
struct l2vpn *l2vpn, const char *ifname);
-void l2vpn_pw_del_api(struct l2vpn_pw *pw);
+void l2vpn_pw_del_api(struct l2vpn *l2vpn,
+ struct l2vpn_pw *pw);
/* socket.c */
int ldp_create_socket(int, enum socket_type);