summaryrefslogtreecommitdiff
path: root/usr.sbin/eigrpd/rde.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2016-09-02 16:44:34 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2016-09-02 16:44:34 +0000
commitfcf9752bb7cfa0955234368e43600610c4308242 (patch)
treef12e2cdd668aab5d8339150fa1af1dfada1dda77 /usr.sbin/eigrpd/rde.h
parentdcaa3316f517f3e75debd2dc1ae2838de28a7b02 (diff)
Make functions and variables static whenever possible.
style(9) says: "Function prototypes for private functions (i.e., functions not used elsewhere) go at the top of the first source module. In userland, functions local to one source module should be declared 'static'". The benefits of doing so include: * clean up of the eigrpd global namespace; * improved readability; * more hints to the compiler/linker to generate more efficient code. Additional changes: * Declare all extern variables in header files; * Clean up the indentation of all function prototypes and global variables. ok claudio@ benno@
Diffstat (limited to 'usr.sbin/eigrpd/rde.h')
-rw-r--r--usr.sbin/eigrpd/rde.h71
1 files changed, 18 insertions, 53 deletions
diff --git a/usr.sbin/eigrpd/rde.h b/usr.sbin/eigrpd/rde.h
index d95228bf24f..55122ffd41d 100644
--- a/usr.sbin/eigrpd/rde.h
+++ b/usr.sbin/eigrpd/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.10 2016/09/02 16:29:55 renato Exp $ */
+/* $OpenBSD: rde.h,v 1.11 2016/09/02 16:44:33 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -33,19 +33,21 @@ struct rde_nbr {
struct eigrp_iface *ei;
struct eigrp *eigrp;
TAILQ_HEAD(,reply_node) rijk; /* outstanding replies */
+
+ /*
+ * We have one "self" neighbor for each interface on which EIGRP is
+ * configured. This way we can inject local routes into the DUAL FSM
+ * just like any other route received from a remote neighbor. For each
+ * instance, we also have two additional special neighbors used to
+ * inject redistributed and summarized routes.
+ */
uint8_t flags;
-};
-/*
- * We have one "self" neighbor for each interface on which EIGRP is configured.
- * This way we can inject local routes into the DUAL FSM just like any other
- * route received from a remote neighbor. For each instance, we also have two
- * additional special neighbors used to inject redistributed and summarized
- * routes.
- */
#define F_RDE_NBR_SELF 0x01
#define F_RDE_NBR_LOCAL 0x02
#define F_RDE_NBR_REDIST 0x04
#define F_RDE_NBR_SUMMARY 0x08
+};
+RB_PROTOTYPE(rde_nbr_head, rde_nbr, entry, rde_nbr_compare)
struct reply_node {
TAILQ_ENTRY(reply_node) rn_entry;
@@ -90,6 +92,7 @@ struct rt_node {
struct classic_emetric emetric;
} successor;
};
+RB_PROTOTYPE(rt_tree, rt_node, entry, rt_compare)
/* DUAL states */
#define DUAL_STA_PASSIVE 0x0001
@@ -119,74 +122,33 @@ enum dual_event {
DUAL_EVT_16
};
+extern struct eigrpd_conf *rdeconf;
+extern struct rde_nbr_head rde_nbrs;
+
/* rde.c */
pid_t rde(int, int);
int rde_imsg_compose_parent(int, pid_t, void *, uint16_t);
int rde_imsg_compose_eigrpe(int, uint32_t, pid_t, void *,
uint16_t);
-
void rde_instance_init(struct eigrp *);
void rde_instance_del(struct eigrp *);
void rde_send_change_kroute(struct rt_node *, struct eigrp_route *);
void rde_send_delete_kroute(struct rt_node *, struct eigrp_route *);
-void rt_redist_set(struct kroute *, int);
void rt_summary_set(struct eigrp *, struct summary_addr *,
struct classic_metric *);
-void rt_snap(struct rde_nbr *);
-struct ctl_rt *rt_to_ctl(struct rt_node *, struct eigrp_route *);
-void rt_dump(struct ctl_show_topology_req *, pid_t);
-
-/* rde_nbr.c */
-struct rde_nbr *rde_nbr_find(uint32_t);
-struct rde_nbr *rde_nbr_new(uint32_t, struct rde_nbr *);
-void rde_nbr_del(struct rde_nbr *, int);
/* rde_dual.c */
-int dual_fsm(struct rt_node *, enum dual_event);
-struct rt_node *rt_find(struct eigrp *, struct rinfo *);
-struct rt_node *rt_new(struct eigrp *, struct rinfo *);
void rt_del(struct rt_node *);
-struct eigrp_route *route_find(struct rde_nbr *, struct rt_node *);
-struct eigrp_route *route_new(struct rt_node *, struct rde_nbr *,
- struct rinfo *);
-void route_del(struct rt_node *, struct eigrp_route *);
-uint32_t safe_sum_uint32(uint32_t, uint32_t);
-uint32_t safe_mul_uint32(uint32_t, uint32_t);
uint32_t eigrp_composite_delay(uint32_t);
uint32_t eigrp_real_delay(uint32_t);
uint32_t eigrp_composite_bandwidth(uint32_t);
uint32_t eigrp_real_bandwidth(uint32_t);
-uint32_t route_composite_metric(uint8_t *, uint32_t, uint32_t,
- uint8_t, uint8_t);
-void route_update_metrics(struct eigrp *,
- struct eigrp_route *, struct rinfo *);
-void reply_outstanding_add(struct rt_node *,
- struct rde_nbr *);
-struct reply_node *reply_outstanding_find(struct rt_node *,
- struct rde_nbr *);
-void reply_outstanding_remove(struct reply_node *);
void rinfo_fill_successor(struct rt_node *, struct rinfo *);
-void rinfo_fill_infinite(struct rt_node *, enum route_type,
- struct rinfo *);
-void rt_update_fib(struct rt_node *);
-void rt_set_successor(struct rt_node *,
- struct eigrp_route *);
-struct eigrp_route *rt_get_successor_fc(struct rt_node *);
-
struct summary_addr *rde_summary_check(struct eigrp_iface *,
union eigrpd_addr *, uint8_t);
-void rde_send_update(struct eigrp_iface *, struct rinfo *);
-void rde_send_update_all(struct rt_node *, struct rinfo *);
-void rde_send_query(struct eigrp_iface *, struct rinfo *,
- int);
-void rde_send_siaquery(struct rde_nbr *, struct rinfo *);
-void rde_send_query_all(struct eigrp *, struct rt_node *,
- int);
void rde_flush_queries(void);
-void rde_send_reply(struct rde_nbr *, struct rinfo *, int);
void rde_check_update(struct rde_nbr *, struct rinfo *);
void rde_check_query(struct rde_nbr *, struct rinfo *, int);
-void rde_last_reply(struct rt_node *);
void rde_check_reply(struct rde_nbr *, struct rinfo *, int);
void rde_check_link_down_rn(struct rde_nbr *,
struct rt_node *, struct eigrp_route *);
@@ -194,5 +156,8 @@ void rde_check_link_down_nbr(struct rde_nbr *);
void rde_check_link_down(unsigned int);
void rde_check_link_cost_change(struct rde_nbr *,
struct eigrp_iface *);
+struct rde_nbr *rde_nbr_find(uint32_t);
+struct rde_nbr *rde_nbr_new(uint32_t, struct rde_nbr *);
+void rde_nbr_del(struct rde_nbr *, int);
#endif /* _RDE_H_ */