classifier-objects.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _IPP_IPGPC_CLASSIFIER_OBJECTS_H
#define _IPP_IPGPC_CLASSIFIER_OBJECTS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/* common objects and defines used by the ipgpc code base */
/* default wildcard and unspecified value for selectors */
#define IPGPC_WILDCARD -1
#define IPGPC_UNSPECIFIED 0
/* trie id's */
#define IPGPC_TRIE_SPORTID 0
#define IPGPC_TRIE_DPORTID 1
#define IPGPC_TRIE_SADDRID 2
#define IPGPC_TRIE_DADDRID 3
/*
* IPv6 trie id's
* note: tries for SPORT, DPORT are shared between IPv4 and IPv6 filters
*/
#define IPGPC_TRIE_SADDRID6 4
#define IPGPC_TRIE_DADDRID6 5
/* ba table id's */
#define IPGPC_BA_DSID 6
/* table id's */
#define IPGPC_TABLE_PROTOID 7
#define IPGPC_TABLE_UID 8
#define IPGPC_TABLE_PROJID 9
#define IPGPC_TABLE_IF 10
#define IPGPC_TABLE_IF_GRPNM 11
#define IPGPC_TABLE_DIR 12
#define TABLE_ID_OFFSET IPGPC_TABLE_PROTOID
/* Match types for selector searching */
#define NORMAL_MATCH 0
#define NO_MATCHES 1
#define DONTCARE_ONLY_MATCH 2
/* match masks */
#define PROTO_MASK 0x01
#define DS_MASK 0x02
#define SPORT_MASK 0x04
#define DPORT_MASK 0x08
#define SADDR_MASK 0x10
#define DADDR_MASK 0x20
#define SADDR6_MASK SADDR_MASK
#define DADDR6_MASK DADDR_MASK
#define UID_MASK 0x40
#define PROJID_MASK 0x80
#define IF_MASK 0x100
#define IF_GRPNM_MASK 0x200
#define DIR_MASK 0x400
/* used when inserting values into selector structures */
#define NORMAL_VALUE 0 /* a valid value was insert */
/* filter definition structure */
typedef struct ipgpc_filter_s {
/* exact match selectors */
/*
* packet direction
* value = IPP_LOCAL_IN | IPP_LOCAL_OUT |
* IPP_FWD_IN | IPP_FWD_OUT | 0 for wildcard
*/
/* non-exact match selectors */
/* IP Addresses are represented as IPV6 address structures */
char *saddr_hostname; /* hostname of source address, optional */
char *daddr_hostname; /* hostname of destination address, optional */
/* filter ranking variables */
/*
* filter_type accepted values =
* IPGPC_GENERIC_FLTR | IPGPC_V4_FLTR |
* IPGPC_V6_FLTR
*/
char *filter_comment; /* optional and unused by ipgpc */
typedef struct ipgpc_class_stats_s {
/* linked list Element node structure */
typedef struct element_node_s *linked_list;
typedef struct element_node_s *plink;
typedef struct element_node_s {
void (*element_ref)(struct element_node_s *);
void (*element_unref)(struct element_node_s *);
int id;
/* trie node structure */
typedef struct node_s {
} node_t;
/* hashtable node structure */
typedef struct ht_node_s *hash_table;
typedef struct ht_node_s {
int key; /* key stored at this node */
int info;
} ht_node_t;
/* behavior aggregate table element structure */
typedef struct ba_table_element_s {
/* behavior aggregate table structure */
typedef struct ba_table_s {
} ba_table_t;
/* selector information structure */
typedef struct sel_info_s {
} sel_info_t;
/* selector statistics structure */
typedef struct sel_stats_s {
} sel_stats_t;
/* identification structure for a trie */
typedef struct trie_id_s {
} trie_id_t;
/* identification structure for a table */
typedef struct table_id_s {
int wildcard; /* wildcard value for this selector */
} table_id_t;
/* identification structure for a ba_table */
typedef struct ba_table_id_s {
/* class definition structure */
typedef struct ipgpc_class_s {
/* filter id association data structure */
typedef struct fid_s {
int info; /* 0 if unused, -1 if dirty, 1 if used */
int class_id; /* id of class associated with filter */
} fid_t;
/* class_id structure */
typedef struct cid_s {
int info; /* 0 if unused, -1 if dirty, 1 if used */
} cid_t;
/* ipp_stat global stats structure */
typedef struct globalstats_s {
/* ipp_stat class stats structure */
typedef struct classstats_s {
} classstats_t;
/* matching hash table element */
typedef struct ht_match_s *ht_chain;
typedef struct ht_match_s {
int key; /* key stored at this node in the table */
} ht_match_t;
extern kmem_cache_t *ht_node_cache;
extern kmem_cache_t *element_node_cache;
extern kmem_cache_t *ht_match_cache;
extern kmem_cache_t *trie_node_cache;
#ifdef __cplusplus
}
#endif
#endif /* _IPP_IPGPC_CLASSIFIER_OBJECTS_H */