No empty .Rs/.Re
[netbsd-mini2440.git] / usr.sbin / mrouted / prune.h
blob9f0ad8b8e95b495efeeb8a1379b7f71e685cc16d
1 /* $NetBSD: prune.h,v 1.1 2002/10/01 03:31:09 itojun Exp $ */
3 /*
4 * The mrouted program is covered by the license in the accompanying file
5 * named "LICENSE". Use of the mrouted program represents acceptance of
6 * the terms and conditions listed in that file.
8 * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
9 * Leland Stanford Junior University.
13 * Group table
15 * Each group entry is a member of two doubly-linked lists:
17 * a) A list hanging off of the routing table entry for this source (rt_groups)
18 * sorted by group address under the routing entry (gt_next, gt_prev)
19 * b) An independent list pointed to by kernel_table, which is a list of
20 * active source,group's (gt_gnext, gt_gprev).
23 struct gtable {
24 struct gtable *gt_next; /* pointer to the next entry */
25 struct gtable *gt_prev; /* back pointer for linked list */
26 struct gtable *gt_gnext; /* fwd pointer for group list */
27 struct gtable *gt_gprev; /* rev pointer for group list */
28 u_int32_t gt_mcastgrp; /* multicast group associated */
29 vifbitmap_t gt_scope; /* scoped interfaces */
30 u_char gt_ttls[MAXVIFS]; /* ttl vector for forwarding */
31 vifbitmap_t gt_grpmems; /* forw. vifs for src, grp */
32 int gt_prsent_timer; /* prune timer for this group */
33 int gt_timer; /* timer for this group entry */
34 time_t gt_ctime; /* time of entry creation */
35 u_char gt_grftsnt; /* graft sent/retransmit timer */
36 struct stable *gt_srctbl; /* source table */
37 struct ptable *gt_pruntbl; /* prune table */
38 struct rtentry *gt_route; /* parent route */
39 #ifdef RSRR
40 struct rsrr_cache *gt_rsrr_cache; /* RSRR cache */
41 #endif /* RSRR */
45 * Source table
47 * When source-based prunes exist, there will be a struct ptable here as well.
49 struct stable
51 struct stable *st_next; /* pointer to the next entry */
52 u_int32_t st_origin; /* host origin of multicasts */
53 u_long st_pktcnt; /* packet count for src-grp entry */
57 * structure to store incoming prunes. Can hang off of either group or source.
59 struct ptable
61 struct ptable *pt_next; /* pointer to the next entry */
62 u_int32_t pt_router; /* router that sent this prune */
63 vifi_t pt_vifi; /* vif prune received on */
64 int pt_timer; /* timer for prune */
68 * The packet format for a traceroute request.
70 struct tr_query {
71 u_int32_t tr_src; /* traceroute source */
72 u_int32_t tr_dst; /* traceroute destination */
73 u_int32_t tr_raddr; /* traceroute response address */
74 #if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
75 struct {
76 u_int qid : 24; /* traceroute query id */
77 u_int ttl : 8; /* traceroute response ttl */
78 } q;
79 #else
80 struct {
81 u_int ttl : 8; /* traceroute response ttl */
82 u_int qid : 24; /* traceroute query id */
83 } q;
84 #endif /* BYTE_ORDER */
87 #define tr_rttl q.ttl
88 #define tr_qid q.qid
91 * Traceroute response format. A traceroute response has a tr_query at the
92 * beginning, followed by one tr_resp for each hop taken.
94 struct tr_resp {
95 u_int32_t tr_qarr; /* query arrival time */
96 u_int32_t tr_inaddr; /* incoming interface address */
97 u_int32_t tr_outaddr; /* outgoing interface address */
98 u_int32_t tr_rmtaddr; /* parent address in source tree */
99 u_int32_t tr_vifin; /* input packet count on interface */
100 u_int32_t tr_vifout; /* output packet count on interface */
101 u_int32_t tr_pktcnt; /* total incoming packets for src-grp */
102 u_char tr_rproto; /* routing protocol deployed on router */
103 u_char tr_fttl; /* ttl required to forward on outvif */
104 u_char tr_smask; /* subnet mask for src addr */
105 u_char tr_rflags; /* forwarding error codes */
108 /* defs within mtrace */
109 #define QUERY 1
110 #define RESP 2
111 #define QLEN sizeof(struct tr_query)
112 #define RLEN sizeof(struct tr_resp)
114 /* fields for tr_rflags (forwarding error codes) */
115 #define TR_NO_ERR 0
116 #define TR_WRONG_IF 1
117 #define TR_PRUNED 2
118 #define TR_OPRUNED 3
119 #define TR_SCOPED 4
120 #define TR_NO_RTE 5
121 #define TR_NO_FWD 7
122 #define TR_RP_OR_CORE 8
123 #define TR_RPF_INT 9
124 #define TR_NO_MULTICAST 10
125 #define TR_NO_SPACE 0x81
126 #define TR_OLD_ROUTER 0x82
127 #define TR_ADMIN_DENY 0x83
129 /* fields for tr_rproto (routing protocol) */
130 #define PROTO_DVMRP 1
131 #define PROTO_MOSPF 2
132 #define PROTO_PIM 3
133 #define PROTO_CBT 4
134 #define PROTO_PIM_SPEC 5
135 #define PROTO_PIM_STAT 6
136 #define PROTO_DVMRP_STAT 7
137 #define PROTO_PIM_MBGP 8
139 #define MASK_TO_VAL(x, i) { \
140 u_int32_t _x = ntohl(x); \
141 (i) = 1; \
142 while ((_x) <<= 1) \
143 (i)++; \
146 #define VAL_TO_MASK(x, i) { \
147 x = htonl(~((1 << (32 - (i))) - 1)); \
150 #define NBR_VERS(n) (((n)->al_pv << 8) + (n)->al_mv)