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