BSD.include.dist: Use spaces to indent (see etc/mtree/README).
[dragonfly.git] / usr.sbin / mrouted / prune.h
blob81ffe528ceb07814c3ba5790b47a5beddc0936ec
1 /*
2 * The mrouted program is covered by the license in the accompanying file
3 * named "LICENSE". Use of the mrouted program represents acceptance of
4 * the terms and conditions listed in that file.
6 * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
7 * Leland Stanford Junior University.
10 * $FreeBSD: src/usr.sbin/mrouted/prune.h,v 1.10 1999/08/28 01:17:08 peter Exp $
11 * $DragonFly: src/usr.sbin/mrouted/prune.h,v 1.2 2003/06/17 04:29:57 dillon Exp $
12 * prune.h,v 3.8.4.5 1998/02/27 22:45:43 fenner Exp
16 * Group table
18 * Each group entry is a member of two doubly-linked lists:
20 * a) A list hanging off of the routing table entry for this source (rt_groups)
21 * sorted by group address under the routing entry (gt_next, gt_prev)
22 * b) An independent list pointed to by kernel_table, which is a list of
23 * active source,group's (gt_gnext, gt_gprev).
26 struct gtable {
27 struct gtable *gt_next; /* pointer to the next entry */
28 struct gtable *gt_prev; /* back pointer for linked list */
29 struct gtable *gt_gnext; /* fwd pointer for group list */
30 struct gtable *gt_gprev; /* rev pointer for group list */
31 u_int32 gt_mcastgrp; /* multicast group associated */
32 vifbitmap_t gt_scope; /* scoped interfaces */
33 u_char gt_ttls[MAXVIFS]; /* ttl vector for forwarding */
34 vifbitmap_t gt_grpmems; /* forw. vifs for src, grp */
35 int gt_prsent_timer; /* prune timer for this group */
36 int gt_timer; /* timer for this group entry */
37 time_t gt_ctime; /* time of entry creation */
38 u_char gt_grftsnt; /* graft sent/retransmit timer */
39 nbrbitmap_t gt_prunes; /* bitmap of neighbors who pruned */
40 struct stable *gt_srctbl; /* source table */
41 struct ptable *gt_pruntbl; /* prune table */
42 struct rtentry *gt_route; /* parent route */
43 int gt_rexmit_timer; /* timer for prune retransmission */
44 int gt_prune_rexmit; /* time til prune retransmission */
45 #ifdef RSRR
46 struct rsrr_cache *gt_rsrr_cache; /* RSRR cache */
47 #endif /* RSRR */
51 * Source table
53 * When source-based prunes exist, there will be a struct ptable here as well.
55 struct stable
57 struct stable *st_next; /* pointer to the next entry */
58 u_int32 st_origin; /* host origin of multicasts */
59 u_long st_pktcnt; /* packet count for src-grp entry */
60 u_long st_savpkt; /* saved pkt cnt when no krnl entry */
61 time_t st_ctime; /* kernel entry creation time */
65 * structure to store incoming prunes. Can hang off of either group or source.
67 struct ptable
69 struct ptable *pt_next; /* pointer to the next entry */
70 u_int32 pt_router; /* router that sent this prune */
71 vifi_t pt_vifi; /* vif prune received on */
72 int pt_index; /* neighbor index of router */
73 int pt_timer; /* timer for prune */
76 #define MIN_PRUNE_LIFE TIMER_INTERVAL /* min prune lifetime to bother with */
79 * The packet format for a traceroute request.
81 struct tr_query {
82 u_int32 tr_src; /* traceroute source */
83 u_int32 tr_dst; /* traceroute destination */
84 u_int32 tr_raddr; /* traceroute response address */
85 #if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
86 struct {
87 u_int qid : 24; /* traceroute query id */
88 u_int ttl : 8; /* traceroute response ttl */
89 } q;
90 #else
91 struct {
92 u_int ttl : 8; /* traceroute response ttl */
93 u_int qid : 24; /* traceroute query id */
94 } q;
95 #endif /* BYTE_ORDER */
98 #define tr_rttl q.ttl
99 #define tr_qid q.qid
102 * Traceroute response format. A traceroute response has a tr_query at the
103 * beginning, followed by one tr_resp for each hop taken.
105 struct tr_resp {
106 u_int32 tr_qarr; /* query arrival time */
107 u_int32 tr_inaddr; /* incoming interface address */
108 u_int32 tr_outaddr; /* outgoing interface address */
109 u_int32 tr_rmtaddr; /* parent address in source tree */
110 u_int32 tr_vifin; /* input packet count on interface */
111 u_int32 tr_vifout; /* output packet count on interface */
112 u_int32 tr_pktcnt; /* total incoming packets for src-grp */
113 u_char tr_rproto; /* routing protocol deployed on router */
114 u_char tr_fttl; /* ttl required to forward on outvif */
115 u_char tr_smask; /* subnet mask for src addr */
116 u_char tr_rflags; /* forwarding error codes */
119 /* defs within mtrace */
120 #define QUERY 1
121 #define RESP 2
122 #define QLEN sizeof(struct tr_query)
123 #define RLEN sizeof(struct tr_resp)
125 /* fields for tr_rflags (forwarding error codes) */
126 #define TR_NO_ERR 0
127 #define TR_WRONG_IF 1
128 #define TR_PRUNED 2
129 #define TR_OPRUNED 3
130 #define TR_SCOPED 4
131 #define TR_NO_RTE 5
132 #define TR_NO_FWD 7
133 #define TR_NO_SPACE 0x81
134 #define TR_OLD_ROUTER 0x82
136 /* fields for tr_rproto (routing protocol) */
137 #define PROTO_DVMRP 1
138 #define PROTO_MOSPF 2
139 #define PROTO_PIM 3
140 #define PROTO_CBT 4
142 #define MASK_TO_VAL(x, i) { \
143 u_int32 _x = ntohl(x); \
144 (i) = 1; \
145 while ((_x) <<= 1) \
146 (i)++; \
149 #define VAL_TO_MASK(x, i) { \
150 x = i ? htonl(~((1 << (32 - (i))) - 1)) : 0; \
153 #define NBR_VERS(n) (((n)->al_pv << 8) + (n)->al_mv)