library/src/network/nmap/BP-NMAP.cc
// This picks up events in the main loop and processes/destroys them.
This picks up events in the main loop and processes/destroys them.
This picks up events in the main loop and processes / destroys them .
BP_ERROR_T BP_NmapPickupEventsFromMainLoop(P_BP_NMAP nmap)
{
	if(!nmap)
		return ERR_FAILURE;
	if(!nmap->evm)
		return ERR_FAILURE;
	if(!nmap->evm->events_polled_for_main_loop)
	{
		printf("\n [!!] map has no events to process here.");
		return ERR_FAILURE;
	}
	printf("\n [+] Attempting to pickup nmap events from main loop!!");
	if(nmap->start_event_uuid)
	{
		P_BP_EVENT start_event = BP_EventLoopPickupEventFromPollRegistryByName
		(
			nmap->evm,
			nmap->start_event_uuid
		);
		if(start_event)
		{
			P_BP_NMAP_EVENT_DATA start_event_data = (P_BP_NMAP_EVENT_DATA) start_event->event_data;
			if(start_event_data->status	== BP_NMAP_EVENT_STATUS_RUNNING)
			{
				nmap->run_status = BP_NMAP_EVENT_STATUS_RUNNING;
				ht_free(nmap->system_hreg, nmap->start_event_uuid);
				nmap->start_event_uuid = NULL;
			}
		}
	}
	if(nmap->stop_event_uuid)
	{
		P_BP_EVENT stop_event = BP_EventLoopPickupEventFromPollRegistryByName
		(
			nmap->evm,
			nmap->stop_event_uuid
		);
		if(stop_event)
		{
			P_BP_NMAP_EVENT_DATA stop_event_data = (P_BP_NMAP_EVENT_DATA) stop_event->event_data;
			if(stop_event_data->status	== BP_NMAP_EVENT_STATUS_FINISHED)
			{
				nmap->run_status = BP_NMAP_EVENT_STATUS_FINISHED;
				ht_free(nmap->system_hreg, nmap->stop_event_uuid);
				nmap->stop_event_uuid = NULL;
			}
		}
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_NmapPickupEventsFromMainLoop ( P_BP_NMAP nmap ) { if ( ! nmap ) return ERR_FAILURE ; if ( ! nmap -> evm ) return ERR_FAILURE ; if ( ! nmap -> evm -> events_polled_for_main_loop ) { printf ( " \n " ) ; return ERR_FAILURE ; } printf ( " \n " ) ; if ( nmap -> start_event_uuid ) { P_BP_EVENT start_event = BP_EventLoopPickupEventFromPollRegistryByName ( nmap -> evm , nmap -> start_event_uuid ) ; if ( start_event ) { P_BP_NMAP_EVENT_DATA start_event_data = ( P_BP_NMAP_EVENT_DATA ) start_event -> event_data ; if ( start_event_data -> status == BP_NMAP_EVENT_STATUS_RUNNING ) { nmap -> run_status = BP_NMAP_EVENT_STATUS_RUNNING ; ht_free ( nmap -> system_hreg , nmap -> start_event_uuid ) ; nmap -> start_event_uuid = NULL ; } } } if ( nmap -> stop_event_uuid ) { P_BP_EVENT stop_event = BP_EventLoopPickupEventFromPollRegistryByName ( nmap -> evm , nmap -> stop_event_uuid ) ; if ( stop_event ) { P_BP_NMAP_EVENT_DATA stop_event_data = ( P_BP_NMAP_EVENT_DATA ) stop_event -> event_data ; if ( stop_event_data -> status == BP_NMAP_EVENT_STATUS_FINISHED ) { nmap -> run_status = BP_NMAP_EVENT_STATUS_FINISHED ; ht_free ( nmap -> system_hreg , nmap -> stop_event_uuid ) ; nmap -> stop_event_uuid = NULL ; } } } return ERR_SUCCESS ; }
This picks up events in the main loop and processes/destroys them.
This picks up events in the main loop and processes / destroys them .
// basic null checks // ensure we have an event registry in the manager // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Process Start Event %%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // if we have a start event uuid, go ahead and attempt an event lookup // attempt to pickup the uuid // process start event // set start event data // if the event reports that we're running, mark it so // set  status to running // destroy start uuid // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Process Stop Event %%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // if we have a stop event uuid, go ahead and attempt an event lookup // attempt to pickup the uuid // process stop event // set stop event data // if the event reports that we're running, mark it so // set nmap status to finished // destroy stop uuid // return indicating success