altq_afmap.h revision 1.1 1 /* $KAME: altq_afmap.h,v 1.5 2000/12/14 08:12:45 thorpej Exp $ */
2
3 /*
4 * Copyright (C) 1997-2000
5 * Sony Computer Science Laboratories Inc. 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 *
16 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29 #ifndef _ALTQ_ALTQ_AFMAP_H_
30 #define _ALTQ_ALTQ_AFMAP_H_
31
32 #include <sys/queue.h>
33 #include <altq/altq.h>
34
35 struct atm_flowmap {
36 char af_ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
37 u_int8_t af_vpi;
38 u_int16_t af_vci;
39 u_int32_t af_pcr; /* peek cell rate */
40 union {
41 struct flowinfo afu_fi;
42 struct flowinfo_in afu_fi4;
43 #ifdef SIN6_LEN
44 struct flowinfo_in6 afu_fi6;
45 #endif
46 } af_fiu;
47 #define af_flowinfo af_fiu.afu_fi
48 #define af_flowinfo4 af_fiu.afu_fi4
49 #define af_flowinfo6 af_fiu.afu_fi6
50
51 /* statistics */
52 u_int32_t afs_packets; /* total packet count */
53 u_int32_t afs_bytes; /* total byte count */
54 };
55
56 /* set or get flowmap */
57 #define AFM_ADDFMAP _IOWR('F', 30, struct atm_flowmap)
58 #define AFM_DELFMAP _IOWR('F', 31, struct atm_flowmap)
59 #define AFM_CLEANFMAP _IOWR('F', 32, struct atm_flowmap)
60 #define AFM_GETFMAP _IOWR('F', 33, struct atm_flowmap)
61
62 #ifdef _KERNEL
63
64 /* per flow information */
65 struct afm {
66 LIST_ENTRY(afm) afm_list;
67 u_int16_t afm_vci;
68 u_int8_t afm_vpi;
69 union {
70 struct flowinfo afmu_fi;
71 struct flowinfo_in afmu_fi4;
72 #ifdef SIN6_LEN
73 struct flowinfo_in6 afmu_fi6;
74 #endif
75 } afm_fiu;
76 #define afm_flowinfo afm_fiu.afmu_fi
77 #define afm_flowinfo4 afm_fiu.afmu_fi4
78 #define afm_flowinfo6 afm_fiu.afmu_fi6
79
80 /* statistics */
81 u_int32_t afms_packets; /* total packet count */
82 u_int32_t afms_bytes; /* total byte count */
83 };
84
85 /* per interface */
86 struct afm_head {
87 LIST_ENTRY(afm_head) afh_chain;
88 LIST_HEAD(, afm) afh_head;
89 struct ifnet *afh_ifp;
90 };
91
92 struct afm *afm_top __P((struct ifnet *));
93 int afm_alloc __P((struct ifnet *));
94 int afm_dealloc __P((struct ifnet *));
95 int afm_add __P((struct ifnet *, struct atm_flowmap *));
96 int afm_remove __P((struct afm *));
97 int afm_removeall __P((struct ifnet *));
98 struct afm *afm_lookup __P((struct ifnet *, int, int));
99 struct afm *afm_match __P((struct ifnet *, struct flowinfo *));
100
101 #endif /* _KERNEL */
102
103 #endif /* _ALTQ_ALTQ_AFMAP_H_ */
104