xref: /illumos-gate/usr/src/uts/common/ipp/ipgpc/filters.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2002-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _IPP_IPGPC_FILTERS_H
28 #define	_IPP_IPGPC_FILTERS_H
29 
30 #include <ipp/ipgpc/classifier-objects.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /* Header file for filter management and configuration of IPGPC module */
37 
38 #define	NUM_TRIES			6
39 #define	NUM_BA_TABLES			1
40 #define	NUM_TABLES			6
41 #define	TABLE_SIZE			11
42 #define	IPGPC_DEFAULT_MAX_FILTERS	10007
43 #define	IPGPC_DEFAULT_MAX_CLASSES	10007
44 
45 /* Globals */
46 extern kmutex_t ipgpc_table_list_lock; /* table list lock */
47 extern kmutex_t ipgpc_fid_list_lock; /* filter id list lock */
48 extern kmutex_t ipgpc_cid_list_lock; /* class id list lock */
49 extern trie_id_t ipgpc_trie_list[NUM_TRIES]; /* list of trie structure ids */
50 extern table_id_t ipgpc_table_list[NUM_TABLES]; /* list of all table ids */
51 extern ba_table_id_t ipgpc_ds_table_id; /* DiffServ field table id */
52 extern fid_t *ipgpc_fid_list;	/* filter id list */
53 extern cid_t *ipgpc_cid_list;	/* class id list */
54 extern boolean_t ipgpc_gather_stats; /* should stats be performed for ipgpc */
55 extern uint64_t ipgpc_npackets;	/* number of packets stat */
56 extern uint64_t ipgpc_nbytes;	/* number of bytes stat */
57 extern uint64_t ipgpc_epackets;	/* number of pkts in error */
58 extern int ipgpc_def_class_id;	/* class id of default class */
59 extern size_t ipgpc_max_filters; /* user tunable, max number of filters */
60 extern size_t ipgpc_max_classes; /* user tunable, max number of classes */
61 extern size_t ipgpc_max_num_filters; /* max number of allowable filters */
62 extern size_t ipgpc_max_num_classes; /* max number of allowable classes */
63 extern size_t ipgpc_num_fltrs; /* number of loaded filter */
64 extern size_t ipgpc_num_cls;	/* number of loaded classes */
65 
66 
67 /*
68  * initialization function
69  */
70 extern int ipgpc_initialize(ipp_action_id_t);
71 
72 /*
73  * modify functions
74  */
75 extern int ipgpc_addfilter(ipgpc_filter_t *, char *, ipp_flags_t);
76 extern int ipgpc_addclass(ipgpc_class_t *, ipp_flags_t);
77 extern void ipgpc_filter_destructor(ipgpc_filter_t *);
78 extern int ipgpc_modifyfilter(nvlist_t **, ipp_flags_t);
79 extern int ipgpc_modifyclass(nvlist_t **, ipp_flags_t);
80 extern int ipgpc_parse_filter(ipgpc_filter_t *, nvlist_t *);
81 extern int ipgpc_parse_class(ipgpc_class_t *, nvlist_t *);
82 extern int ipgpc_removefilter(char *, int32_t, ipp_flags_t);
83 extern int ipgpc_removeclass(char *, ipp_flags_t);
84 extern int ipgpc_list_insert(linked_list *, key_t);
85 extern boolean_t ipgpc_list_remove(linked_list *, key_t);
86 extern unsigned name_hash(char *, size_t);
87 
88 /*
89  * destroy function
90  */
91 extern void ipgpc_destroy(ipp_flags_t);
92 
93 /*
94  * info functions
95  */
96 extern int ipgpc_params_info(int (*)(nvlist_t *, void *), void *);
97 extern int ipgpc_classes_info(int (*)(nvlist_t *, void *), void *);
98 extern int ipgpc_filters_info(int (*)(nvlist_t *, void *), void *);
99 
100 /*
101  * invoke function
102  */
103 extern int ipgpc_findfilters(int, int, ht_match_t *);
104 extern int ipgpc_findfilters6(int, in6_addr_t, ht_match_t *);
105 extern int ipgpc_mark_found(uint16_t, linked_list, ht_match_t *);
106 
107 #ifdef	__cplusplus
108 }
109 #endif
110 
111 #endif	/* _IPP_IPGPC_FILTERS_H */
112