/*
* 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-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* table structure used for exact-match classification of selectors */
/* Statics */
static int ht_hash(int);
static void remove_num_inserted(table_id_t *);
/*
* ht_hash(a)
*
* hash function for keys (a) of type int
*/
static int
ht_hash(int a)
{
return (a % TABLE_SIZE);
}
/*
* ht_insert(taid, id, key)
*
* inserts id into table with filter_id as the value
* if key == taid->wildcard, the key is inserted as a wildcard
* statistics are updated after insert is successful
* returns DONTCARE_VALUE if key == wildcard, NORMAL_VALUE otherwise
*/
int
{
int x;
ht_node_t *p;
/* check if dontcare */
return (DONTCARE_VALUE);
}
/*
* insert if key matches and entry is being used or if entry is empty
*/
} else {
while (p != NULL) {
(p->info == 0)) {
p->info = 1;
}
return (NORMAL_VALUE);
}
p = p->next;
}
p->info = 1;
}
/* update stats */
}
return (NORMAL_VALUE);
}
/*
* ht_search(table, key)
*
* searches for key and returns the linked list value associated with key if
* found in table. NULL is returned if key not found
*/
static linked_list
{
int x;
} else {
while (p != NULL) {
return (p->elements);
}
p = p->next;
}
return (NULL);
}
}
/*
* ht_retrieve(taid, key, fid_table)
*
* All exact matches and wildcard matches are collected and inserted
* into the fid_table
* the number of found filters that match the input key are returned
* returns (-1) if memory error
*/
int
{
int num_found = 0;
return (0);
} else {
return (-1); /* signifies memory error */
}
}
}
return (num_found);
}
/*
* remove_num_inserted(taid)
*
* updates the num_inserted statistics along with reseting the dontcareonly
* flag when applicable and decrementing the total inserted
*/
static void
{
}
}
/*
* ht_remove(taid, id, key)
*
* removes a single filter id item from the linked_list associated with id in
* table
*/
void
{
int x;
ht_node_t *p;
ht_node_t *t;
/* check if dontcare */
return;
}
/* remove entry if key matches and entry is being used */
/* update stats */
}
}
/* reclaim memory if possible */
} else {
}
}
} else {
p = &table[x];
/* update stats */
}
/* reclaim memory if possible */
p->next);
} else {
t = p->next;
t);
}
}
return;
}
p = p->next;
}
}
}