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