library/src/network/httpd/BP-HTTPdRequestHandlerParameterFilters.cc
// Attempt to lookup a parameter filter set child-table.
Attempt to lookup a parameter filter set child-table.
Attempt to lookup a parameter filter set child - table .
P_BP_HASH_TABLE_KEYED_ENTRY BP_HTTPdRequestHandlerParameterFilterSetLookup
(
	P_BP_HTTPD_REQUEST_HANDLER                request_handler,
	BP_HTTPD_REQUEST_VAR_TYPE                 var_type,
	char                                    * key
)
{
	if(!request_handler)
		return NULL;
	if(!var_type)
		return NULL;
	if(!key)
		return NULL;
	if(!BP_StringIsReasonablePrintableString(key, bpstrlen(key), BP_FALSE, BP_FALSE))
		return NULL;
	char *lookup_path[10];
	BP_ZERO_STACK(lookup_path);
	size_t path_idx = 0;
	lookup_path[path_idx] = "filters";
	path_idx++;
	switch(var_type)
	{
		case BP_HTTPD_REQUEST_VAR_TYPE_POST_TMPFILE:
			lookup_path[path_idx] = "BP_HTTPD_REQUEST_VAR_TYPE_POST_TMPFILE";
			path_idx++;
			break;
		case BP_HTTPD_REQUEST_VAR_TYPE_POST_DATA:
			lookup_path[path_idx] = "BP_HTTPD_REQUEST_VAR_TYPE_POST_DATA";
			path_idx++;
			break;
		case BP_HTTPD_REQUEST_VAR_TYPE_GET:
			lookup_path[path_idx] = "BP_HTTPD_REQUEST_VAR_TYPE_GET";
			path_idx++;
			break;
		case BP_HTTPD_REQUEST_VAR_TYPE_COOKIE:
			lookup_path[path_idx] = "BP_HTTPD_REQUEST_VAR_TYPE_COOKIE";
			path_idx++;
			break;
		case BP_HTTPD_REQUEST_VAR_TYPE_HEADER:
			lookup_path[path_idx] = "BP_HTTPD_REQUEST_VAR_TYPE_HEADER";
			path_idx++;
			break;
		default:
			break;
	}
	lookup_path[path_idx] = key;
	path_idx++;
	lookup_path[path_idx] = "filter_set";
	P_BP_HASH_TABLE_KEYED_ENTRY filter_table = BP_HashRegLookupTableByPath(request_handler->parameter_filters, (char **) &lookup_path);
	if(!filter_table)
		return NULL;
	return (P_BP_HASH_TABLE_KEYED_ENTRY) filter_table->data;
}
P_BP_HASH_TABLE_KEYED_ENTRY BP_HTTPdRequestHandlerParameterFilterSetLookup ( P_BP_HTTPD_REQUEST_HANDLER request_handler , BP_HTTPD_REQUEST_VAR_TYPE var_type , char * key ) { if ( ! request_handler ) return NULL ; if ( ! var_type ) return NULL ; if ( ! key ) return NULL ; if ( ! BP_StringIsReasonablePrintableString ( key , bpstrlen ( key ) , BP_FALSE , BP_FALSE ) ) return NULL ; char * lookup_path [ 10 ] ; BP_ZERO_STACK ( lookup_path ) ; size_t path_idx = 0 ; lookup_path [ path_idx ] = " " ; path_idx ++ ; switch ( var_type ) { case BP_HTTPD_REQUEST_VAR_TYPE_POST_TMPFILE : lookup_path [ path_idx ] = " " ; path_idx ++ ; break ; case BP_HTTPD_REQUEST_VAR_TYPE_POST_DATA : lookup_path [ path_idx ] = " " ; path_idx ++ ; break ; case BP_HTTPD_REQUEST_VAR_TYPE_GET : lookup_path [ path_idx ] = " " ; path_idx ++ ; break ; case BP_HTTPD_REQUEST_VAR_TYPE_COOKIE : lookup_path [ path_idx ] = " " ; path_idx ++ ; break ; case BP_HTTPD_REQUEST_VAR_TYPE_HEADER : lookup_path [ path_idx ] = " " ; path_idx ++ ; break ; default : break ; } lookup_path [ path_idx ] = key ; path_idx ++ ; lookup_path [ path_idx ] = " " ; P_BP_HASH_TABLE_KEYED_ENTRY filter_table = BP_HashRegLookupTableByPath ( request_handler -> parameter_filters , ( char * * ) & lookup_path ) ; if ( ! filter_table ) return NULL ; return ( P_BP_HASH_TABLE_KEYED_ENTRY ) filter_table -> data ; }
Attempt to lookup a parameter filter set child-table.
Attempt to lookup a parameter filter set child - table .
// ensure we have a request handler // ensure key is reasonable printable // create lookup path on the stack // path index // set initial path to filters // switch on the var type // post tmpfile type // post data type // set get // set cookie // set header path // default case is to break // set the id path from key parameter // set the filterset parameter to cap it off // attempt to lookup the table by path // return