Annotation of embedaddon/pimd/rsrr.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (c) 1993, 1998-2001.
                      3:  * The University of Southern California/Information Sciences Institute.
                      4:  * All rights reserved.
                      5:  *
                      6:  * Redistribution and use in source and binary forms, with or without
                      7:  * modification, are permitted provided that the following conditions
                      8:  * are met:
                      9:  * 1. Redistributions of source code must retain the above copyright
                     10:  *    notice, this list of conditions and the following disclaimer.
                     11:  * 2. Redistributions in binary form must reproduce the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer in the
                     13:  *    documentation and/or other materials provided with the distribution.
                     14:  * 3. Neither the name of the project nor the names of its contributors
                     15:  *    may be used to endorse or promote products derived from this software
                     16:  *    without specific prior written permission.
                     17:  *
                     18:  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
                     19:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     20:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     21:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
                     22:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     23:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     24:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     25:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     26:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     27:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     28:  * SUCH DAMAGE.
                     29:  */
                     30: 
                     31: #define RSRR_SERV_PATH "/tmp/.rsrr_svr"
                     32: /* Note this needs to be 14 chars for 4.3 BSD compatibility */
                     33: #define RSRR_CLI_PATH "/tmp/.rsrr_cli"
                     34: 
                     35: #define RSRR_MAX_LEN 2048
                     36: #define RSRR_HEADER_LEN (sizeof(struct rsrr_header))
                     37: #define RSRR_RQ_LEN (RSRR_HEADER_LEN + sizeof(struct rsrr_rq))
                     38: #define RSRR_RR_LEN (RSRR_HEADER_LEN + sizeof(struct rsrr_rr))
                     39: #define RSRR_VIF_LEN (sizeof(struct rsrr_vif))
                     40: 
                     41: /* Current maximum number of vifs. */
                     42: #define RSRR_MAX_VIFS 32
                     43: 
                     44: /* Maximum acceptable version */
                     45: #define RSRR_MAX_VERSION 1
                     46: 
                     47: /* RSRR message types */
                     48: #define RSRR_ALL_TYPES     0
                     49: #define RSRR_INITIAL_QUERY 1
                     50: #define RSRR_INITIAL_REPLY 2
                     51: #define RSRR_ROUTE_QUERY   3
                     52: #define RSRR_ROUTE_REPLY   4
                     53: 
                     54: /* Each definition represents the position of the bit from right to left. */
                     55: /* All not defined bits are zeroes */
                     56: 
                     57: /* RSRR Initial Reply (Vif) Status bits
                     58:  *
                     59:  * 0 = disabled bit, set if the vif is administratively disabled.
                     60:  */
                     61: #define RSRR_DISABLED_BIT 0
                     62: 
                     63: /* RSRR Route Query/Reply flag bits
                     64:  *
                     65:  * 0 = Route Change Notification bit, set if the reservation protocol
                     66:  *     wishes to receive notification of a route change for the
                     67:  *     source-destination pair listed in the query. Notification is in the
                     68:  *     form of an unsolicitied Route Reply.
                     69:  * 1 = Error bit, set if routing doesn't have a routing entry for
                     70:  *     the source-destination pair.
                     71:  * (TODO: XXX: currently not used by rsvpd?)
                     72:  * (2,3) = Shared tree (Reply only)
                     73:  *         = 01 if the listed sender is using a shared tree, but some other
                     74:  *              senders for the same destination use sender (source-specific)
                     75:  *              trees.
                     76:  *         = 10 if all senders for the destination use shared tree.
                     77:  *         = 00 otherwise
                     78:  */
                     79: #define RSRR_NOTIFICATION_BIT 0
                     80: #define RSRR_ERROR_BIT 1
                     81: #define RSRR_THIS_SENDER_SHARED_TREE 2
                     82: #define RSRR_ALL_SENDERS_SHARED_TREE 3
                     83: #define RSRR_SET_ALL_SENDERS_SHARED_TREE(X)             \
                     84:           BIT_SET((X), RSRR_ALL_SENDERS_SHARED_TREE);  \
                     85:           BIT_CLR((X), RSRR_THIS_SENDER_SHARED_TREE);
                     86: #define RSRR_THIS_SENDER_SHARED_TREE_SOME_OTHER_NOT(X)  \
                     87:           BIT_SET((X), RSRR_THIS_SENDER_SHARED_TREE);   \
                     88:           BIT_CLR((X), RSRR_ALL_SENDERS_SHARED_TREE)
                     89: 
                     90: /* Definition of an RSRR message header.
                     91:  * An Initial Query uses only the header, and an Initial Reply uses
                     92:  * the header and a list of vifs.
                     93:  */
                     94: struct rsrr_header {
                     95:     uint8_t version;                   /* RSRR Version, currently 1        */
                     96:     uint8_t type;                      /* type of message, as defined above*/
                     97:     uint8_t flags;                     /* flags; defined by type           */
                     98:     uint8_t num;                       /* number; defined by type          */
                     99: };
                    100: 
                    101: /* Definition of a vif as seen by the reservation protocol.
                    102:  *
                    103:  * Routing gives the reservation protocol a list of vifs in the
                    104:  * Initial Reply.
                    105:  *
                    106:  * We explicitly list the ID because we can't assume that all routing
                    107:  * protocols will use the same numbering scheme.
                    108:  *
                    109:  * The status is a bitmask of status flags, as defined above.  It is the
                    110:  * responsibility of the reservation protocol to perform any status checks
                    111:  * if it uses the MULTICAST_VIF socket option.
                    112:  *
                    113:  * The threshold indicates the ttl an outgoing packet needs in order to
                    114:  * be forwarded. The reservation protocol must perform this check itself if
                    115:  * it uses the MULTICAST_VIF socket option.
                    116:  *
                    117:  * The local address is the address of the physical interface over which
                    118:  * packets are sent.
                    119:  */
                    120: struct rsrr_vif {
                    121:     uint8_t id;                                /* vif id             */
                    122:     uint8_t threshold;                 /* vif threshold ttl  */
                    123:     uint16_t status;                   /* vif status bitmask */
                    124:     uint32_t local_addr;               /* vif local address  */
                    125: };
                    126: 
                    127: /* Definition of an RSRR Route Query.
                    128:  * 
                    129:  * The query asks routing for the forwarding entry for a particular
                    130:  * source and destination.  The query ID uniquely identifies the query
                    131:  * for the reservation protocol.  Thus, the combination of the client's
                    132:  * address and the query ID forms a unique identifier for routing.
                    133:  * Flags are defined above.
                    134:  */
                    135: struct rsrr_rq {
                    136:     uint32_t dest_addr;                        /* destination */
                    137:     uint32_t source_addr;              /* source      */
                    138:     uint32_t query_id;                 /* query ID    */
                    139: };
                    140: 
                    141: /* Definition of an RSRR Route Reply.
                    142:  *
                    143:  * Routing uses the reply to give the reservation protocol the
                    144:  * forwarding entry for a source-destination pair.  Routing copies the
                    145:  * query ID from the query and fills in the incoming vif and a bitmask
                    146:  * of the outgoing vifs.
                    147:  * Flags are defined above.
                    148:  */
                    149: /* TODO: XXX: in_vif is 16 bits here, but in rsrr_vif it is 8 bits.
                    150:  * Bug in the spec?
                    151:  */
                    152: struct rsrr_rr {
                    153:     uint32_t dest_addr;                /* destination          */
                    154:     uint32_t source_addr;              /* source               */
                    155:     uint32_t query_id;                 /* query ID             */
                    156:     uint16_t in_vif;                   /* incoming vif         */
                    157:     uint16_t reserved;                 /* reserved             */
                    158:     uint32_t out_vif_bm;               /* outgoing vif bitmask */
                    159: };
                    160: 
                    161: 
                    162: /* TODO: XXX: THIS IS NOT IN THE SPEC! (OBSOLETE?) */
                    163: #ifdef NOT_IN_THE_SPEC
                    164: /* Definition of an RSRR Service Query/Reply.
                    165:  * 
                    166:  * The query asks routing to perform a service for a particular
                    167:  * source/destination combination.  The query also lists the vif
                    168:  * that the service applies to.
                    169:  */
                    170: struct rsrr_sqr {
                    171:     uint32_t dest_addr;                  /* destination */
                    172:     uint32_t source_addr;                /* source      */
                    173:     uint32_t query_id;                   /* query ID    */
                    174:     uint16_t vif;                        /* vif         */
                    175:     uint16_t reserved;                   /* reserved    */
                    176: };
                    177: #endif /* NOT_IN_THE_SPEC */
                    178: 
                    179: /**
                    180:  * Local Variables:
                    181:  *  version-control: t
                    182:  *  indent-tabs-mode: t
                    183:  *  c-file-style: "ellemtel"
                    184:  *  c-basic-offset: 4
                    185:  * End:
                    186:  */

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