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
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).
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 */
46 struct rsrr_cache
*gt_rsrr_cache
; /* RSRR cache */
53 * When source-based prunes exist, there will be a struct ptable here as well.
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.
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.
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)
87 u_int qid
: 24; /* traceroute query id */
88 u_int ttl
: 8; /* traceroute response ttl */
92 u_int ttl
: 8; /* traceroute response ttl */
93 u_int qid
: 24; /* traceroute query id */
95 #endif /* BYTE_ORDER */
102 * Traceroute response format. A traceroute response has a tr_query at the
103 * beginning, followed by one tr_resp for each hop taken.
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 */
122 #define QLEN sizeof(struct tr_query)
123 #define RLEN sizeof(struct tr_resp)
125 /* fields for tr_rflags (forwarding error codes) */
127 #define TR_WRONG_IF 1
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
142 #define MASK_TO_VAL(x, i) { \
143 u_int32 _x = ntohl(x); \
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)