/*
* 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"
/* Implementation file for behavior aggregate (BA) lookup table */
/*
* ba_insert(bataid, filter_id, val, mask)
*
* inserts filter_id into element list of bataid->table->masked_values
* at position val& mask, mask is inserted into the mask list.
* filter_id shouldn't already exist in element list at
* bataid->table->masked_values[val], an error message is printed if this
* occurs.
* return DONTCARE_VALUE if mask == 0, NORMAL_VALUE otherwise
*/
int
{
/* dontcares are not inserted */
if (mask == 0) {
return (DONTCARE_VALUE);
}
}
ipgpc0dbg(("ba_insert():filter_id %d EEXIST in ba_table",
filter_id));
} else {
/* insert mask */
/* update stats */
}
return (NORMAL_VALUE);
}
/*
* ba_retrieve(bataid, value, fid_table)
*
* searches for all filters matching value in bataid->table
* search is performed by appling each mask in bataid->table->masks list
* to value and then looking value up in bataid->table->masked_values.
* Each filter id that is matched, is inserted into fid_table
* returns number of matched filters or (-1) if memory error
*/
int
{
element_node_t *p;
int num_found = 0;
int ret;
int masked_value = 0;
/* special case, if value == 0, no need to apply masks */
if (value == 0) {
/* masked value will always be 0 for this case */
return (-1); /* signifies a memory error */
}
return (num_found);
}
/* apply each mask to the value and do the look up in the ba table */
/* masked_value has 0 filters associated with it */
continue;
}
fid_table)) == -1) {
return (-1); /* signifies a memory error */
}
}
return (num_found);
}
/*
* ba_remove(bataid, filter_id, value, mask)
*
* removes filter_id from bataid->table->masked_values[mask & value]
* mask is removed from bataid->table->masks if refcnt == 0 for that list
*/
void
{
/* dontcares are not inserted */
if (mask == 0) {
return;
}
/* update stats */
/*
* check to see if removing this entry will result in
* don't cares only inserted in the table
*/
}
/* remove mask if refcnt == 0 */
}
}