library/src/network/httpd/BP-HTTPdDisplayUtilities.cc
// Display request handlers within the system registry
Display request handlers within the system registry
Display request handlers within the system registry
BP_ERROR_T BP_HTTPdDisplayRequestHandlers(P_BP_HTTPD_SESSION httpd)
{
	if(!httpd)
		return ERR_FAILURE;
	if(!httpd->system_hreg)
		return ERR_FAILURE;
	char * table_path[10] = {0};
	P_BP_HASH_TABLE_KEYED_ENTRY tmp_lookup = NULL;
	table_path[0] = "request_handlers";
	table_path[1] = NULL;
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(httpd->system_hreg);
	tmp_lookup = BP_HashRegLookupTableByPath(httpd->system_hreg, table_path);
	if(tmp_lookup->data)
	{
		printf("\n\n\t\t [+] Request Handlers");
		tmp_lookup = (P_BP_HASH_TABLE_KEYED_ENTRY) tmp_lookup->data;
		P_BP_HASH_TABLE_KEYED_ENTRY entry = NULL;
		P_BP_HASH_TABLE_KEYED_ENTRY tmp   = NULL;
		HASH_ITER(hh, tmp_lookup, entry, tmp)
		{
			P_BP_HTTPD_REQUEST_HANDLER request_handler = (P_BP_HTTPD_REQUEST_HANDLER) entry->data;
			if(request_handler)
			{
				printf("\n");
				BP_HTTPdDisplayRequestHandler(request_handler);
			}
		}
	}
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(httpd->system_hreg);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_HTTPdDisplayRequestHandlers ( P_BP_HTTPD_SESSION httpd ) { if ( ! httpd ) return ERR_FAILURE ; if ( ! httpd -> system_hreg ) return ERR_FAILURE ; char * table_path [ 10 ] = { 0 } ; P_BP_HASH_TABLE_KEYED_ENTRY tmp_lookup = NULL ; table_path [ 0 ] = " " ; table_path [ 1 ] = NULL ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( httpd -> system_hreg ) ; tmp_lookup = BP_HashRegLookupTableByPath ( httpd -> system_hreg , table_path ) ; if ( tmp_lookup -> data ) { printf ( " \n \n \t \t " ) ; tmp_lookup = ( P_BP_HASH_TABLE_KEYED_ENTRY ) tmp_lookup -> data ; P_BP_HASH_TABLE_KEYED_ENTRY entry = NULL ; P_BP_HASH_TABLE_KEYED_ENTRY tmp = NULL ; HASH_ITER ( hh , tmp_lookup , entry , tmp ) { P_BP_HTTPD_REQUEST_HANDLER request_handler = ( P_BP_HTTPD_REQUEST_HANDLER ) entry -> data ; if ( request_handler ) { printf ( " \n " ) ; BP_HTTPdDisplayRequestHandler ( request_handler ) ; } } } BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( httpd -> system_hreg ) ; return ERR_SUCCESS ; }
Display request handlers within the system registry
Display request handlers within the system registry
// ensure we have a httpd and a system registry // declare dynamic table path // declare the lookup pointer // set the table path // enter system hreg critical section // lookup the post table // iterate through users // add header // move the tmp lookup to the hash table children (since it's a table) // temporary iterator values used during the HASH_ITER loop below // iterate through all hashes and display // set variable // if the request handler is set, display it // display user (add newline before each entry) // BP_HTTPdDisplayUser(user, BP_FALSE); // leave system hreg critical section // return indicating success