[BACK]Return to altq_var.h CVS log [TXT][DIR] Up to [local] / sys / altq

Annotation of sys/altq/altq_var.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: altq_var.h,v 1.14 2004/04/27 02:56:20 kjc Exp $       */
                      2: /*     $KAME: altq_var.h,v 1.8 2001/02/09 09:44:41 kjc Exp $   */
                      3:
                      4: /*
                      5:  * Copyright (C) 1998-2000
                      6:  *     Sony Computer Science Laboratories Inc.  All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  *
                     17:  * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
                     18:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     19:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     20:  * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
                     21:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     22:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     23:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     25:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     26:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     27:  * SUCH DAMAGE.
                     28:  */
                     29: #ifndef _ALTQ_ALTQ_VAR_H_
                     30: #define        _ALTQ_ALTQ_VAR_H_
                     31:
                     32: #ifdef _KERNEL
                     33:
                     34: #include <sys/param.h>
                     35: #include <sys/kernel.h>
                     36: #include <sys/queue.h>
                     37:
                     38: #ifndef ALTQ_RED
                     39: #define ALTQ_RED               /* RED is enabled by default */
                     40: #endif
                     41: #ifndef ALTQ_CBQ
                     42: #define ALTQ_CBQ               /* CBQ is enabled by default */
                     43: #endif
                     44: #ifndef ALTQ_PRIQ
                     45: #define ALTQ_PRIQ              /* PRIQ is enabled by default */
                     46: #endif
                     47: #ifndef ALTQ_HFSC
                     48: #define ALTQ_HFSC              /* HFSC is enabled by default */
                     49: #endif
                     50:
                     51: /*
                     52:  * machine dependent clock
                     53:  * a 64bit high resolution time counter.
                     54:  */
                     55: extern int machclk_usepcc;
                     56: extern u_int32_t machclk_freq;
                     57: extern u_int32_t machclk_per_tick;
                     58: extern void init_machclk(void);
                     59: extern u_int64_t read_machclk(void);
                     60:
                     61: /*
                     62:  * debug support
                     63:  */
                     64: #ifdef ALTQ_DEBUG
                     65: #ifdef __STDC__
                     66: #define        ASSERT(e)       ((e) ? (void)0 : altq_assert(__FILE__, __LINE__, #e))
                     67: #else  /* PCC */
                     68: #define        ASSERT(e)       ((e) ? (void)0 : altq_assert(__FILE__, __LINE__, "e"))
                     69: #endif
                     70: #else
                     71: #define        ASSERT(e)       ((void)0)
                     72: #endif
                     73:
                     74: /*
                     75:  * misc stuff for compatibility
                     76:  */
                     77:
                     78: /* macro for timeout/untimeout */
                     79: #include <sys/timeout.h>
                     80: /* callout structure as a wrapper of struct timeout */
                     81: struct callout {
                     82:        struct timeout  c_to;
                     83: };
                     84: #define        CALLOUT_INIT(c)         do { bzero((c), sizeof(*(c))); } while (0)
                     85: #define        CALLOUT_RESET(c,t,f,a)  do { if (!timeout_initialized(&(c)->c_to))  \
                     86:                                         timeout_set(&(c)->c_to, (f), (a)); \
                     87:                                     timeout_add(&(c)->c_to, (t)); } while (0)
                     88: #define        CALLOUT_STOP(c)         timeout_del(&(c)->c_to)
                     89: #define        CALLOUT_INITIALIZER     { { { NULL }, NULL, NULL, 0, 0 } }
                     90:
                     91: typedef void (timeout_t)(void *);
                     92:
                     93: #define        m_pktlen(m)             ((m)->m_pkthdr.len)
                     94:
                     95: struct ifnet; struct mbuf;
                     96: struct pf_altq; struct pf_qstats;
                     97:
                     98: void   *altq_lookup(char *, int);
                     99: u_int8_t read_dsfield(struct mbuf *, struct altq_pktattr *);
                    100: void   write_dsfield(struct mbuf *, struct altq_pktattr *, u_int8_t);
                    101: void   altq_assert(const char *, int, const char *);
                    102: int    tbr_set(struct ifaltq *, struct tb_profile *);
                    103: int    tbr_get(struct ifaltq *, struct tb_profile *);
                    104: int    altq_pfattach(struct pf_altq *);
                    105:
                    106: int    altq_pfdetach(struct pf_altq *);
                    107: int    altq_add(struct pf_altq *);
                    108: int    altq_remove(struct pf_altq *);
                    109: int    altq_add_queue(struct pf_altq *);
                    110: int    altq_remove_queue(struct pf_altq *);
                    111: int    altq_getqstats(struct pf_altq *, void *, int *);
                    112:
                    113: int    cbq_pfattach(struct pf_altq *);
                    114: int    cbq_add_altq(struct pf_altq *);
                    115: int    cbq_remove_altq(struct pf_altq *);
                    116: int    cbq_add_queue(struct pf_altq *);
                    117: int    cbq_remove_queue(struct pf_altq *);
                    118: int    cbq_getqstats(struct pf_altq *, void *, int *);
                    119:
                    120: int    priq_pfattach(struct pf_altq *);
                    121: int    priq_add_altq(struct pf_altq *);
                    122: int    priq_remove_altq(struct pf_altq *);
                    123: int    priq_add_queue(struct pf_altq *);
                    124: int    priq_remove_queue(struct pf_altq *);
                    125: int    priq_getqstats(struct pf_altq *, void *, int *);
                    126:
                    127: int    hfsc_pfattach(struct pf_altq *);
                    128: int    hfsc_add_altq(struct pf_altq *);
                    129: int    hfsc_remove_altq(struct pf_altq *);
                    130: int    hfsc_add_queue(struct pf_altq *);
                    131: int    hfsc_remove_queue(struct pf_altq *);
                    132: int    hfsc_getqstats(struct pf_altq *, void *, int *);
                    133:
                    134: #endif /* _KERNEL */
                    135: #endif /* _ALTQ_ALTQ_VAR_H_ */

CVSweb