Home | History | Annotate | Download | only in ipgpc
      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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     31 
     32 #include <ipp/ipgpc/classifier-objects.h>
     33 
     34 #ifdef	__cplusplus
     35 extern "C" {
     36 #endif
     37 
     38 /* Header file for filter management and configuration of IPGPC module */
     39 
     40 #define	NUM_TRIES			6
     41 #define	NUM_BA_TABLES			1
     42 #define	NUM_TABLES			6
     43 #define	TABLE_SIZE			11
     44 #define	IPGPC_DEFAULT_MAX_FILTERS	10007
     45 #define	IPGPC_DEFAULT_MAX_CLASSES	10007
     46 
     47 /* Globals */
     48 extern kmutex_t ipgpc_table_list_lock; /* table list lock */
     49 extern kmutex_t ipgpc_fid_list_lock; /* filter id list lock */
     50 extern kmutex_t ipgpc_cid_list_lock; /* class id list lock */
     51 extern trie_id_t ipgpc_trie_list[NUM_TRIES]; /* list of trie structure ids */
     52 extern table_id_t ipgpc_table_list[NUM_TABLES]; /* list of all table ids */
     53 extern ba_table_id_t ipgpc_ds_table_id; /* DiffServ field table id */
     54 extern fid_t *ipgpc_fid_list;	/* filter id list */
     55 extern cid_t *ipgpc_cid_list;	/* class id list */
     56 extern boolean_t ipgpc_gather_stats; /* should stats be performed for ipgpc */
     57 extern uint64_t ipgpc_npackets;	/* number of packets stat */
     58 extern uint64_t ipgpc_nbytes;	/* number of bytes stat */
     59 extern uint64_t ipgpc_epackets;	/* number of pkts in error */
     60 extern int ipgpc_def_class_id;	/* class id of default class */
     61 extern size_t ipgpc_max_filters; /* user tunable, max number of filters */
     62 extern size_t ipgpc_max_classes; /* user tunable, max number of classes */
     63 extern size_t ipgpc_max_num_filters; /* max number of allowable filters */
     64 extern size_t ipgpc_max_num_classes; /* max number of allowable classes */
     65 extern size_t ipgpc_num_fltrs; /* number of loaded filter */
     66 extern size_t ipgpc_num_cls;	/* number of loaded classes */
     67 
     68 
     69 /*
     70  * initialization function
     71  */
     72 extern int ipgpc_initialize(ipp_action_id_t);
     73 
     74 /*
     75  * modify functions
     76  */
     77 extern int ipgpc_addfilter(ipgpc_filter_t *, char *, ipp_flags_t);
     78 extern int ipgpc_addclass(ipgpc_class_t *, ipp_flags_t);
     79 extern void ipgpc_filter_destructor(ipgpc_filter_t *);
     80 extern int ipgpc_modifyfilter(nvlist_t **, ipp_flags_t);
     81 extern int ipgpc_modifyclass(nvlist_t **, ipp_flags_t);
     82 extern int ipgpc_parse_filter(ipgpc_filter_t *, nvlist_t *);
     83 extern int ipgpc_parse_class(ipgpc_class_t *, nvlist_t *);
     84 extern int ipgpc_removefilter(char *, int32_t, ipp_flags_t);
     85 extern int ipgpc_removeclass(char *, ipp_flags_t);
     86 extern int ipgpc_list_insert(linked_list *, key_t);
     87 extern boolean_t ipgpc_list_remove(linked_list *, key_t);
     88 extern unsigned name_hash(char *, size_t);
     89 
     90 /*
     91  * destroy function
     92  */
     93 extern void ipgpc_destroy(ipp_flags_t);
     94 
     95 /*
     96  * info functions
     97  */
     98 extern int ipgpc_params_info(int (*)(nvlist_t *, void *), void *);
     99 extern int ipgpc_classes_info(int (*)(nvlist_t *, void *), void *);
    100 extern int ipgpc_filters_info(int (*)(nvlist_t *, void *), void *);
    101 
    102 /*
    103  * invoke function
    104  */
    105 extern int ipgpc_findfilters(int, int, ht_match_t *);
    106 extern int ipgpc_findfilters6(int, in6_addr_t, ht_match_t *);
    107 extern int ipgpc_mark_found(uint16_t, linked_list, ht_match_t *);
    108 
    109 #ifdef	__cplusplus
    110 }
    111 #endif
    112 
    113 #endif	/* _IPP_IPGPC_FILTERS_H */
    114