File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / pimdd / rsrr.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jun 12 07:58:55 2017 UTC (7 years ago) by misho
Branches: pimdd, MAIN
CVS tags: v0_2_1p0, v0_2_1, HEAD
pimdd-dense 0.2.1.0_2

    1: /*
    2:  * Copyright (c) 1993, 1998 by the University of Southern California
    3:  * All rights reserved.
    4:  *
    5:  * Permission to use, copy, modify, and distribute this software and its
    6:  * documentation in source and binary forms for lawful 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.
   16:  *
   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.
   22:  *
   23:  * Other copyrights might apply to parts of this software and are so
   24:  * noted when applicable.
   25:  */
   26: 
   27: #define RSRR_SERV_PATH "/tmp/.rsrr_svr"
   28: /* Note this needs to be 14 chars for 4.3 BSD compatibility */
   29: #define RSRR_CLI_PATH "/tmp/.rsrr_cli"
   30: 
   31: #define RSRR_MAX_LEN 2048
   32: #define RSRR_HEADER_LEN (sizeof(struct rsrr_header))
   33: #define RSRR_RQ_LEN (RSRR_HEADER_LEN + sizeof(struct rsrr_rq))
   34: #define RSRR_RR_LEN (RSRR_HEADER_LEN + sizeof(struct rsrr_rr))
   35: #define RSRR_VIF_LEN (sizeof(struct rsrr_vif))
   36: 
   37: /* Current maximum number of vifs. */
   38: #define RSRR_MAX_VIFS 32
   39: 
   40: /* Maximum acceptable version */
   41: #define RSRR_MAX_VERSION 1
   42: 
   43: /* RSRR message types */
   44: #define RSRR_ALL_TYPES     0
   45: #define RSRR_INITIAL_QUERY 1
   46: #define RSRR_INITIAL_REPLY 2
   47: #define RSRR_ROUTE_QUERY   3
   48: #define RSRR_ROUTE_REPLY   4
   49: 
   50: 
   51: /* Each definition represents the position of the bit from right to left. */
   52: /* All not defined bits are zeroes */
   53: 
   54: /* RSRR Initial Reply (Vif) Status bits
   55:  *
   56:  * 0 = disabled bit, set if the vif is administratively disabled.
   57:  */
   58: #define RSRR_DISABLED_BIT 0
   59: 
   60: /* RSRR Route Query/Reply flag bits
   61:  *
   62:  * 0 = Route Change Notification bit, set if the reservation protocol
   63:  *     wishes to receive notification of a route change for the
   64:  *     source-destination pair listed in the query. Notification is in the
   65:  *     form of an unsolicitied Route Reply.
   66:  * 1 = Error bit, set if routing doesn't have a routing entry for
   67:  *     the source-destination pair.
   68:  * (TODO: XXX: currently not used by rsvpd?)
   69:  * (2,3) = Shared tree (Reply only)
   70:  *         = 01 if the listed sender is using a shared tree, but some other
   71:  *              senders for the same destination use sender (source-specific)
   72:  *              trees.
   73:  *         = 10 if all senders for the destination use shared tree.
   74:  *         = 00 otherwise
   75:  */
   76: #define RSRR_NOTIFICATION_BIT 0
   77: #define RSRR_ERROR_BIT 1
   78: #define RSRR_THIS_SENDER_SHARED_TREE 2
   79: #define RSRR_ALL_SENDERS_SHARED_TREE 3
   80: #define RSRR_SET_ALL_SENDERS_SHARED_TREE(X)             \
   81:           BIT_SET((X), RSRR_ALL_SENDERS_SHARED_TREE);  \
   82:           BIT_CLR((X), RSRR_THIS_SENDER_SHARED_TREE);
   83: #define RSRR_THIS_SENDER_SHARED_TREE_SOME_OTHER_NOT(X)  \
   84:           BIT_SET((X), RSRR_THIS_SENDER_SHARED_TREE);   \
   85:           BIT_CLR((X), RSRR_ALL_SENDERS_SHARED_TREE)
   86: 
   87: /* Definition of an RSRR message header.
   88:  * An Initial Query uses only the header, and an Initial Reply uses
   89:  * the header and a list of vifs.
   90:  */
   91: struct rsrr_header {
   92:     u_int8 version;			/* RSRR Version, currently 1        */
   93:     u_int8 type;			/* type of message, as defined above*/
   94:     u_int8 flags;			/* flags; defined by type           */
   95:     u_int8 num;				/* number; defined by type          */
   96: };
   97: 
   98: /* Definition of a vif as seen by the reservation protocol.
   99:  *
  100:  * Routing gives the reservation protocol a list of vifs in the
  101:  * Initial Reply.
  102:  *
  103:  * We explicitly list the ID because we can't assume that all routing
  104:  * protocols will use the same numbering scheme.
  105:  *
  106:  * The status is a bitmask of status flags, as defined above.  It is the
  107:  * responsibility of the reservation protocol to perform any status checks
  108:  * if it uses the MULTICAST_VIF socket option.
  109:  *
  110:  * The threshold indicates the ttl an outgoing packet needs in order to
  111:  * be forwarded. The reservation protocol must perform this check itself if
  112:  * it uses the MULTICAST_VIF socket option.
  113:  *
  114:  * The local address is the address of the physical interface over which
  115:  * packets are sent.
  116:  */
  117: struct rsrr_vif {
  118:     u_int8 id;				/* vif id             */
  119:     u_int8 threshold;			/* vif threshold ttl  */
  120:     u_int16 status;			/* vif status bitmask */
  121:     u_int32 local_addr; 		/* vif local address  */
  122: };
  123: 
  124: /* Definition of an RSRR Route Query.
  125:  * 
  126:  * The query asks routing for the forwarding entry for a particular
  127:  * source and destination.  The query ID uniquely identifies the query
  128:  * for the reservation protocol.  Thus, the combination of the client's
  129:  * address and the query ID forms a unique identifier for routing.
  130:  * Flags are defined above.
  131:  */
  132: struct rsrr_rq {
  133:     u_int32   dest_addr;		/* destination */
  134:     u_int32 source_addr;		/* source      */
  135:     u_int32 query_id;			/* query ID    */
  136: };
  137: 
  138: /* Definition of an RSRR Route Reply.
  139:  *
  140:  * Routing uses the reply to give the reservation protocol the
  141:  * forwarding entry for a source-destination pair.  Routing copies the
  142:  * query ID from the query and fills in the incoming vif and a bitmask
  143:  * of the outgoing vifs.
  144:  * Flags are defined above.
  145:  */
  146: /* TODO: XXX: in_vif is 16 bits here, but in rsrr_vif it is 8 bits.
  147:  * Bug in the spec?
  148:  */
  149: struct rsrr_rr {
  150:     u_int32 dest_addr;  		/* destination          */
  151:     u_int32 source_addr;		/* source               */
  152:     u_int32 query_id;			/* query ID             */
  153:     u_int16 in_vif;			/* incoming vif         */
  154:     u_int16 reserved;			/* reserved             */
  155:     u_int32 out_vif_bm;			/* outgoing vif bitmask */
  156: };
  157: 
  158: 
  159: /* TODO: XXX: THIS IS NOT IN THE SPEC! (OBSOLETE?) */
  160: #ifdef NOT_IN_THE_SPEC
  161: /* Definition of an RSRR Service Query/Reply.
  162:  * 
  163:  * The query asks routing to perform a service for a particular
  164:  * source/destination combination.  The query also lists the vif
  165:  * that the service applies to.
  166:  */
  167: struct rsrr_sqr {
  168:     u_int32 dest_addr;                  /* destination */
  169:     u_int32 source_addr;                /* source      */
  170:     u_int32 query_id;                   /* query ID    */
  171:     u_int16 vif;                        /* vif         */
  172:     u_int16 reserved;                   /* reserved    */
  173: };
  174: #endif /* NOT_IN_THE_SPEC */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>