home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.lbl.gov / 2014.05.ftp.ee.lbl.gov.tar / ftp.ee.lbl.gov / cbq-1.1.tar.Z / cbq-1.1.tar / rm_class.h < prev   
C/C++ Source or Header  |  1995-08-09  |  4KB  |  90 lines

  1. /*
  2.  * $Header: rm_class.h,v 1.2 95/08/09 18:58:26 van Exp $ (LBL)
  3.  *
  4.  * Copyright (c) 1995 The Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Redistributions in binary form must reproduce the above copyright
  13.  *    notice, this list of conditions and the following disclaimer in the
  14.  *    documentation and/or other materials provided with the distribution.
  15.  * 3. All advertising materials mentioning features or use of this software
  16.  *    must display the following acknowledgement:
  17.  *     This product includes software developed by the Network Research
  18.  *     Group at Lawrence Berkeley National Laboratory.
  19.  * 4. Neither the name of the University nor of the Laboratory may be used
  20.  *    to endorse or promote products derived from this software without
  21.  *    specific prior written permission.
  22.  *
  23.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  24.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  27.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  29.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  30.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  31.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  32.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33.  * SUCH DAMAGE.
  34.  */
  35.  
  36. #define RM_MAXPRIO 7        /* priorities run 0..7 */
  37. #define RM_FILTER_GAIN 5    /* log2 of gain, e.g., 5 => 31/32 */
  38.  
  39. struct rm_class {
  40.     struct mbuf *tail;        /* tail of circularly linked output q */
  41.     struct timeval    last;        /* time last packet sent */
  42.     struct timeval    undertime;    /* time can next send */
  43.     int    sleeping;        /* != 0 if delaying */
  44.     int    qcnt;            /* # packets in queue */
  45.     int    avgidle;
  46.  
  47.     int    npackets;        /* packets sent in this class */
  48.     int    nbytes;            /* bytes sent in this class */
  49.     int    over;            /* # times went over limit */
  50.     int    borrows;        /* # times tried to borrow */
  51.     int    drops;            /* # times dropped packets */
  52.     int    overactions;        /* # times invoked overlimit action */
  53.  
  54.     struct rm_class *peer;
  55.     struct rm_class *borrow;
  56.     struct rm_class *parent;
  57.     struct rm_ifdat *ifdat;
  58.     int    priority;
  59.     int    maxidle;
  60.     int    offtime;
  61.     int    qmax;
  62.     void    (*overlimit)();
  63.     int    len2time[1536];        /*XXX - should be based on if mtu */
  64. };
  65.  
  66. struct rm_ifdat {
  67.     int    queued;        /* # packets queued downstream */
  68.     int    csum;
  69.     struct rm_class *class;    /* class we're currently sending */
  70.     int    curlen;        /* size of packet we're sending */
  71.     struct rm_class *defaultclass;
  72.     struct ifnet *ifp;
  73.     void    (*restart)();
  74.     int    maxqueued;    /* max packets we can queue downstream */
  75.     struct rm_class *classlist[RM_MAXPRIO];
  76.     int    activecnt[RM_MAXPRIO];
  77.     struct rm_class *classes[RM_MAXPRIO];
  78. };
  79.  
  80. extern u_char rmc_mask2pri[];
  81.  
  82. extern void rmc_init();
  83. extern int rmc_under_limit();
  84. extern struct mbuf *rmc_dequeue_next();
  85. extern void rmc_update_util();
  86. extern void rmc_drop_action();
  87. extern void rmc_delay_action();
  88. extern void rmc_restart();
  89. extern struct rm_class *rmc_find_class();
  90.