1*c60d41a9Swiz /* $NetBSD: rsrr.h,v 1.4 2003/03/05 21:05:40 wiz Exp $ */ 2*c60d41a9Swiz 3*c60d41a9Swiz /* 4*c60d41a9Swiz * Copyright (c) 1993, 1998-2001. 5*c60d41a9Swiz * The University of Southern California/Information Sciences Institute. 6*c60d41a9Swiz * All rights reserved. 7*c60d41a9Swiz * 8*c60d41a9Swiz * Redistribution and use in source and binary forms, with or without 9*c60d41a9Swiz * modification, are permitted provided that the following conditions 10*c60d41a9Swiz * are met: 11*c60d41a9Swiz * 1. Redistributions of source code must retain the above copyright 12*c60d41a9Swiz * notice, this list of conditions and the following disclaimer. 13*c60d41a9Swiz * 2. Redistributions in binary form must reproduce the above copyright 14*c60d41a9Swiz * notice, this list of conditions and the following disclaimer in the 15*c60d41a9Swiz * documentation and/or other materials provided with the distribution. 16*c60d41a9Swiz * 3. Neither the name of the project nor the names of its contributors 17*c60d41a9Swiz * may be used to endorse or promote products derived from this software 18*c60d41a9Swiz * without specific prior written permission. 19*c60d41a9Swiz * 20*c60d41a9Swiz * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 21*c60d41a9Swiz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22*c60d41a9Swiz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23*c60d41a9Swiz * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 24*c60d41a9Swiz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25*c60d41a9Swiz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26*c60d41a9Swiz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27*c60d41a9Swiz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28*c60d41a9Swiz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29*c60d41a9Swiz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30*c60d41a9Swiz * SUCH DAMAGE. 31*c60d41a9Swiz */ 32*c60d41a9Swiz 33*c60d41a9Swiz #define RSRR_SERV_PATH "/tmp/.rsrr_svr" 34*c60d41a9Swiz /* Note this needs to be 14 chars for 4.3 BSD compatibility */ 35*c60d41a9Swiz #define RSRR_CLI_PATH "/tmp/.rsrr_cli" 36*c60d41a9Swiz 37*c60d41a9Swiz #define RSRR_MAX_LEN 2048 38*c60d41a9Swiz #define RSRR_HEADER_LEN (sizeof(struct rsrr_header)) 39*c60d41a9Swiz #define RSRR_RQ_LEN (RSRR_HEADER_LEN + sizeof(struct rsrr_rq)) 40*c60d41a9Swiz #define RSRR_RR_LEN (RSRR_HEADER_LEN + sizeof(struct rsrr_rr)) 41*c60d41a9Swiz #define RSRR_VIF_LEN (sizeof(struct rsrr_vif)) 42*c60d41a9Swiz 43*c60d41a9Swiz /* Current maximum number of vifs. */ 44*c60d41a9Swiz #define RSRR_MAX_VIFS 32 45*c60d41a9Swiz 46*c60d41a9Swiz /* Maximum acceptable version */ 47*c60d41a9Swiz #define RSRR_MAX_VERSION 1 48*c60d41a9Swiz 49*c60d41a9Swiz /* RSRR message types */ 50*c60d41a9Swiz #define RSRR_ALL_TYPES 0 51*c60d41a9Swiz #define RSRR_INITIAL_QUERY 1 52*c60d41a9Swiz #define RSRR_INITIAL_REPLY 2 53*c60d41a9Swiz #define RSRR_ROUTE_QUERY 3 54*c60d41a9Swiz #define RSRR_ROUTE_REPLY 4 55*c60d41a9Swiz 56*c60d41a9Swiz /* RSRR Initial Reply (Vif) Status bits 57*c60d41a9Swiz * Each definition represents the position of the bit from right to left. 58*c60d41a9Swiz * 59*c60d41a9Swiz * Right-most bit is the disabled bit, set if the vif is administratively 60*c60d41a9Swiz * disabled. 61*c60d41a9Swiz */ 62*c60d41a9Swiz #define RSRR_DISABLED_BIT 0 63*c60d41a9Swiz /* All other bits are zeroes */ 64*c60d41a9Swiz 65*c60d41a9Swiz /* RSRR Route Query/Reply flag bits 66*c60d41a9Swiz * Each definition represents the position of the bit from right to left. 67*c60d41a9Swiz * 68*c60d41a9Swiz * Right-most bit is the Route Change Notification bit, set if the 69*c60d41a9Swiz * reservation protocol wishes to receive notification of 70*c60d41a9Swiz * a route change for the source-destination pair listed in the query. 71*c60d41a9Swiz * Notification is in the form of an unsolicitied Route Reply. 72*c60d41a9Swiz */ 73*c60d41a9Swiz #define RSRR_NOTIFICATION_BIT 0 74*c60d41a9Swiz /* Next bit indicates an error returning the Route Reply. */ 75*c60d41a9Swiz #define RSRR_ERROR_BIT 1 76*c60d41a9Swiz /* All other bits are zeroes */ 77*c60d41a9Swiz 78*c60d41a9Swiz /* Definition of an RSRR message header. 79*c60d41a9Swiz * An Initial Query uses only the header, and an Initial Reply uses 80*c60d41a9Swiz * the header and a list of vifs. 81*c60d41a9Swiz */ 82*c60d41a9Swiz struct rsrr_header { 83*c60d41a9Swiz u_char version; /* RSRR Version, currently 1 */ 84*c60d41a9Swiz u_char type; /* type of message, as defined above */ 85*c60d41a9Swiz u_char flags; /* flags; defined by type */ 86*c60d41a9Swiz u_char num; /* number; defined by type */ 87*c60d41a9Swiz }; 88*c60d41a9Swiz 89*c60d41a9Swiz /* Definition of a vif as seen by the reservation protocol. 90*c60d41a9Swiz * 91*c60d41a9Swiz * Routing gives the reservation protocol a list of vifs in the 92*c60d41a9Swiz * Initial Reply. 93*c60d41a9Swiz * 94*c60d41a9Swiz * We explicitly list the ID because we can't assume that all routing 95*c60d41a9Swiz * protocols will use the same numbering scheme. 96*c60d41a9Swiz * 97*c60d41a9Swiz * The status is a bitmask of status flags, as defined above. It is the 98*c60d41a9Swiz * responsibility of the reservation protocol to perform any status checks 99*c60d41a9Swiz * if it uses the MULTICAST_VIF socket option. 100*c60d41a9Swiz * 101*c60d41a9Swiz * The threshold indicates the ttl an outgoing packet needs in order to 102*c60d41a9Swiz * be forwarded. The reservation protocol must perform this check itself if 103*c60d41a9Swiz * it uses the MULTICAST_VIF socket option. 104*c60d41a9Swiz * 105*c60d41a9Swiz * The local address is the address of the physical interface over which 106*c60d41a9Swiz * packets are sent. 107*c60d41a9Swiz */ 108*c60d41a9Swiz struct rsrr_vif { 109*c60d41a9Swiz u_char id; /* vif id */ 110*c60d41a9Swiz u_char threshold; /* vif threshold ttl */ 111*c60d41a9Swiz u_short status; /* vif status bitmask */ 112*c60d41a9Swiz struct in_addr local_addr; /* vif local address */ 113*c60d41a9Swiz }; 114*c60d41a9Swiz 115*c60d41a9Swiz /* Definition of an RSRR Route Query. 116*c60d41a9Swiz * 117*c60d41a9Swiz * The query asks routing for the forwarding entry for a particular 118*c60d41a9Swiz * source and destination. The query ID uniquely identifies the query 119*c60d41a9Swiz * for the reservation protocol. Thus, the combination of the client's 120*c60d41a9Swiz * address and the query ID forms a unique identifier for routing. 121*c60d41a9Swiz * Flags are defined above. 122*c60d41a9Swiz */ 123*c60d41a9Swiz struct rsrr_rq { 124*c60d41a9Swiz struct in_addr dest_addr; /* destination */ 125*c60d41a9Swiz struct in_addr source_addr; /* source */ 126*c60d41a9Swiz u_long query_id; /* query ID */ 127*c60d41a9Swiz }; 128*c60d41a9Swiz 129*c60d41a9Swiz /* Definition of an RSRR Route Reply. 130*c60d41a9Swiz * 131*c60d41a9Swiz * Routing uses the reply to give the reservation protocol the 132*c60d41a9Swiz * forwarding entry for a source-destination pair. Routing copies the 133*c60d41a9Swiz * query ID from the query and fills in the incoming vif and a bitmask 134*c60d41a9Swiz * of the outgoing vifs. 135*c60d41a9Swiz * Flags are defined above. 136*c60d41a9Swiz */ 137*c60d41a9Swiz struct rsrr_rr { 138*c60d41a9Swiz struct in_addr dest_addr; /* destination */ 139*c60d41a9Swiz struct in_addr source_addr; /* source */ 140*c60d41a9Swiz u_long query_id; /* query ID */ 141*c60d41a9Swiz u_short in_vif; /* incoming vif */ 142*c60d41a9Swiz u_short reserved; /* reserved */ 143*c60d41a9Swiz u_long out_vif_bm; /* outgoing vif bitmask */ 144*c60d41a9Swiz }; 145