dsniff/daemon_tmpl.c
void configure_handler(void)
{
    if(pcap_findalldevs( &sn_param.alldevsp, sn_param.errbuf) )
	{
		fprintf (stderr,"Unable to perform device lookup.");
		exit(1);
	}
	
	fprintf (logfile,"\nGathering available DevInfo :\n");
	for(sn_param.device = sn_param.alldevsp, sn_param.count = 1 ; sn_param.device != NULL ; sn_param.device = sn_param.device->next)
	{
		fprintf (logfile, "%d. %s - %s\n" , sn_param.count , sn_param.device->name , sn_param.device->description);
		if(sn_param.device->name != NULL)
			strcpy(sn_param.devs[sn_param.count] , sn_param.device->name);
		
		sn_param.count++;
	}
	fprintf (logfile,"\n^Perform sniffing interface on id: %d\n", daemon_info.sniff_on_id );

	sn_param.handle = pcap_open_live(sn_param.devs[daemon_info.sniff_on_id], 65536 , 1 , 0 , sn_param.errbuf);
	
	if (sn_param.handle == NULL) 
	{
		fprintf (stderr, "Couldn't open device %s : %s\n" , sn_param.devname , sn_param.errbuf);
		exit(1);
	}
	pcap_setnonblock(sn_param.handle, -1 , sn_param.errbuf);
}
//gather devices info and create/update handler based on current sniff_on_id
gather devices info and create/update handler based on current sniff_on_id
gather devices info and create / update handler based on current sniff_on_id
void configure_handler(void)
{
    if(pcap_findalldevs( &sn_param.alldevsp, sn_param.errbuf) )
	{
		fprintf (stderr,"Unable to perform device lookup.");
		exit(1);
	}
	fprintf (logfile,"\nGathering available DevInfo :\n");
	for(sn_param.device = sn_param.alldevsp, sn_param.count = 1 ; sn_param.device != NULL ; sn_param.device = sn_param.device->next)
	{
		fprintf (logfile, "%d. %s - %s\n" , sn_param.count , sn_param.device->name , sn_param.device->description);
		if(sn_param.device->name != NULL)
			strcpy(sn_param.devs[sn_param.count] , sn_param.device->name);
		sn_param.count++;
	}
	fprintf (logfile,"\n^Perform sniffing interface on id: %d\n", daemon_info.sniff_on_id );
	sn_param.handle = pcap_open_live(sn_param.devs[daemon_info.sniff_on_id], 65536 , 1 , 0 , sn_param.errbuf);
	if (sn_param.handle == NULL) 
	{
		fprintf (stderr, "Couldn't open device %s : %s\n" , sn_param.devname , sn_param.errbuf);
		exit(1);
	}
	pcap_setnonblock(sn_param.handle, -1 , sn_param.errbuf);
}
void configure_handler ( void ) { if ( pcap_findalldevs ( & sn_param . alldevsp , sn_param . errbuf ) ) { fprintf ( stderr , " " ) ; exit ( 1 ) ; } fprintf ( logfile , " \n \n " ) ; for ( sn_param . device = sn_param . alldevsp , sn_param . count = 1 ; sn_param . device != NULL ; sn_param . device = sn_param . device -> next ) { fprintf ( logfile , " \n " , sn_param . count , sn_param . device -> name , sn_param . device -> description ) ; if ( sn_param . device -> name != NULL ) strcpy ( sn_param . devs [ sn_param . count ] , sn_param . device -> name ) ; sn_param . count ++ ; } fprintf ( logfile , " \n \n " , daemon_info . sniff_on_id ) ; sn_param . handle = pcap_open_live ( sn_param . devs [ daemon_info . sniff_on_id ] , 65536 , 1 , 0 , sn_param . errbuf ) ; if ( sn_param . handle == NULL ) { fprintf ( stderr , " \n " , sn_param . devname , sn_param . errbuf ) ; exit ( 1 ) ; } pcap_setnonblock ( sn_param . handle , -1 , sn_param . errbuf ) ; }
gather devices info and create/update handler based on current sniff_on_id
gather devices info and create / update handler based on current sniff_on_id