FreeBSD/Linux Kernel Cross Reference
sys/altq/altq_afmap.h
1 /* $NetBSD: altq_afmap.h,v 1.2 2000/12/14 08:49:49 thorpej Exp $ */
2 /* $KAME: altq_afmap.h,v 1.5 2000/12/14 08:12:45 thorpej Exp $ */
3
4 /*
5 * Copyright (C) 1997-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
30 #ifndef _ALTQ_ALTQ_AFMAP_H_
31 #define _ALTQ_ALTQ_AFMAP_H_
32
33 #include <sys/queue.h>
34 #include <altq/altq.h>
35
36 struct atm_flowmap {
37 char af_ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
38 u_int8_t af_vpi;
39 u_int16_t af_vci;
40 u_int32_t af_pcr; /* peek cell rate */
41 union {
42 struct flowinfo afu_fi;
43 struct flowinfo_in afu_fi4;
44 #ifdef SIN6_LEN
45 struct flowinfo_in6 afu_fi6;
46 #endif
47 } af_fiu;
48 #define af_flowinfo af_fiu.afu_fi
49 #define af_flowinfo4 af_fiu.afu_fi4
50 #define af_flowinfo6 af_fiu.afu_fi6
51
52 /* statistics */
53 u_int32_t afs_packets; /* total packet count */
54 u_int32_t afs_bytes; /* total byte count */
55 };
56
57 /* set or get flowmap */
58 #define AFM_ADDFMAP _IOWR('F', 30, struct atm_flowmap)
59 #define AFM_DELFMAP _IOWR('F', 31, struct atm_flowmap)
60 #define AFM_CLEANFMAP _IOWR('F', 32, struct atm_flowmap)
61 #define AFM_GETFMAP _IOWR('F', 33, struct atm_flowmap)
62
63 #ifdef _KERNEL
64
65 /* per flow information */
66 struct afm {
67 LIST_ENTRY(afm) afm_list;
68 u_int16_t afm_vci;
69 u_int8_t afm_vpi;
70 union {
71 struct flowinfo afmu_fi;
72 struct flowinfo_in afmu_fi4;
73 #ifdef SIN6_LEN
74 struct flowinfo_in6 afmu_fi6;
75 #endif
76 } afm_fiu;
77 #define afm_flowinfo afm_fiu.afmu_fi
78 #define afm_flowinfo4 afm_fiu.afmu_fi4
79 #define afm_flowinfo6 afm_fiu.afmu_fi6
80
81 /* statistics */
82 u_int32_t afms_packets; /* total packet count */
83 u_int32_t afms_bytes; /* total byte count */
84 };
85
86 /* per interface */
87 struct afm_head {
88 LIST_ENTRY(afm_head) afh_chain;
89 LIST_HEAD(, afm) afh_head;
90 struct ifnet *afh_ifp;
91 };
92
93 struct afm *afm_top __P((struct ifnet *));
94 int afm_alloc __P((struct ifnet *));
95 int afm_dealloc __P((struct ifnet *));
96 int afm_add __P((struct ifnet *, struct atm_flowmap *));
97 int afm_remove __P((struct afm *));
98 int afm_removeall __P((struct ifnet *));
99 struct afm *afm_lookup __P((struct ifnet *, int, int));
100 struct afm *afm_match __P((struct ifnet *, struct flowinfo *));
101
102 #endif /* _KERNEL */
103
104 #endif /* _ALTQ_ALTQ_AFMAP_H_ */
Cache object: 84d72ef3cd8e6d1010ee53bdd21df297
|