MFC r1.6 r1.30 r1.28 (HEAD):
[dragonfly.git] / usr.sbin / mrouted / rsrr.h
blobc88f8ce78e8ea3c5e1e7c7925921a17c1c55fc57
1 /*
2 * Copyright (c) 1993 by the University of Southern California
3 * All rights reserved.
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation in source and binary forms for non-commercial purposes
7 * and without fee is hereby granted, provided that the above copyright
8 * notice appear in all copies and that both the copyright notice and
9 * this permission notice appear in supporting documentation. and that
10 * any documentation, advertising materials, and other materials related
11 * to such distribution and use acknowledge that the software was
12 * developed by the University of Southern California, Information
13 * Sciences Institute. The name of the University may not be used to
14 * endorse or promote products derived from this software without
15 * specific prior written permission.
17 * THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about
18 * the suitability of this software for any purpose. THIS SOFTWARE IS
19 * PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 * Other copyrights might apply to parts of this software and are so
24 * noted when applicable.
27 #define RSRR_SERV_PATH "/var/run/rsrr_svr"
28 /* Note this needs to be 14 chars for 4.3 BSD compatibility */
29 /* Note This appears to be unused */
30 #define RSRR_CLI_PATH "/var/run/rsrr_cli"
32 #define RSRR_MAX_LEN 2048
33 #define RSRR_HEADER_LEN (sizeof(struct rsrr_header))
34 #define RSRR_RQ_LEN (RSRR_HEADER_LEN + sizeof(struct rsrr_rq))
35 #define RSRR_RR_LEN (RSRR_HEADER_LEN + sizeof(struct rsrr_rr))
36 #define RSRR_VIF_LEN (sizeof(struct rsrr_vif))
38 /* Current maximum number of vifs. */
39 #define RSRR_MAX_VIFS 32
41 /* Maximum acceptable version */
42 #define RSRR_MAX_VERSION 1
44 /* RSRR message types */
45 #define RSRR_ALL_TYPES 0
46 #define RSRR_INITIAL_QUERY 1
47 #define RSRR_INITIAL_REPLY 2
48 #define RSRR_ROUTE_QUERY 3
49 #define RSRR_ROUTE_REPLY 4
51 /* RSRR Initial Reply (Vif) Status bits
52 * Each definition represents the position of the bit from right to left.
54 * Right-most bit is the disabled bit, set if the vif is administratively
55 * disabled.
57 #define RSRR_DISABLED_BIT 0
58 /* All other bits are zeroes */
60 /* RSRR Route Query/Reply flag bits
61 * Each definition represents the position of the bit from right to left.
63 * Right-most bit is the Route Change Notification bit, set if the
64 * reservation protocol wishes to receive notification of
65 * a route change for the source-destination pair listed in the query.
66 * Notification is in the form of an unsolicitied Route Reply.
68 #define RSRR_NOTIFICATION_BIT 0
69 /* Next bit indicates an error returning the Route Reply. */
70 #define RSRR_ERROR_BIT 1
71 /* All other bits are zeroes */
73 /* Definition of an RSRR message header.
74 * An Initial Query uses only the header, and an Initial Reply uses
75 * the header and a list of vifs.
77 struct rsrr_header {
78 u_char version; /* RSRR Version, currently 1 */
79 u_char type; /* type of message, as defined above */
80 u_char flags; /* flags; defined by type */
81 u_char num; /* number; defined by type */
84 /* Definition of a vif as seen by the reservation protocol.
86 * Routing gives the reservation protocol a list of vifs in the
87 * Initial Reply.
89 * We explicitly list the ID because we can't assume that all routing
90 * protocols will use the same numbering scheme.
92 * The status is a bitmask of status flags, as defined above. It is the
93 * responsibility of the reservation protocol to perform any status checks
94 * if it uses the MULTICAST_VIF socket option.
96 * The threshold indicates the ttl an outgoing packet needs in order to
97 * be forwarded. The reservation protocol must perform this check itself if
98 * it uses the MULTICAST_VIF socket option.
100 * The local address is the address of the physical interface over which
101 * packets are sent.
103 struct rsrr_vif {
104 u_char id; /* vif id */
105 u_char threshold; /* vif threshold ttl */
106 u_short status; /* vif status bitmask */
107 struct in_addr local_addr; /* vif local address */
110 /* Definition of an RSRR Route Query.
112 * The query asks routing for the forwarding entry for a particular
113 * source and destination. The query ID uniquely identifies the query
114 * for the reservation protocol. Thus, the combination of the client's
115 * address and the query ID forms a unique identifier for routing.
116 * Flags are defined above.
118 struct rsrr_rq {
119 struct in_addr dest_addr; /* destination */
120 struct in_addr source_addr; /* source */
121 u_long query_id; /* query ID */
124 /* Definition of an RSRR Route Reply.
126 * Routing uses the reply to give the reservation protocol the
127 * forwarding entry for a source-destination pair. Routing copies the
128 * query ID from the query and fills in the incoming vif and a bitmask
129 * of the outgoing vifs.
130 * Flags are defined above.
132 struct rsrr_rr {
133 struct in_addr dest_addr; /* destination */
134 struct in_addr source_addr; /* source */
135 u_long query_id; /* query ID */
136 u_short in_vif; /* incoming vif */
137 u_short reserved; /* reserved */
138 u_long out_vif_bm; /* outgoing vif bitmask */