Home | History | Annotate | Download | only in libpcap
      1 /*
      2  *  fad-sita.c: Packet capture interface additions for SITA ACN devices
      3  *
      4  *  Copyright (c) 2007 Fulko Hew, SITA INC Canada, Inc <fulko.hew (at) sita.aero>
      5  *
      6  *  License: BSD
      7  *
      8  *  Redistribution and use in source and binary forms, with or without
      9  *  modification, are permitted provided that the following conditions
     10  *  are met:
     11  *
     12  *  1. Redistributions of source code must retain the above copyright
     13  *     notice, this list of conditions and the following disclaimer.
     14  *  2. Redistributions in binary form must reproduce the above copyright
     15  *     notice, this list of conditions and the following disclaimer in
     16  *     the documentation and/or other materials provided with the
     17  *     distribution.
     18  *  3. The names of the authors may not be used to endorse or promote
     19  *     products derived from this software without specific prior
     20  *     written permission.
     21  *
     22  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
     23  *  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
     24  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
     25  */
     26 
     27 #ifdef HAVE_CONFIG_H
     28 #include "config.h"
     29 #endif
     30 
     31 #include <string.h>
     32 #include "pcap-int.h"
     33 
     34 #include "pcap-sita.h"
     35 
     36 extern pcap_if_t	*acn_if_list;								/* pcap's list of available interfaces */
     37 
     38 int pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) {
     39 
     40 	//printf("pcap_findalldevs()\n");				// fulko
     41 
     42 	*alldevsp = 0;												/* initialize the returned variables before we do anything */
     43 	strcpy(errbuf, "");
     44 	if (acn_parse_hosts_file(errbuf))							/* scan the hosts file for potential IOPs */
     45 		{
     46 		//printf("pcap_findalldevs() returning BAD after parsehosts\n");				// fulko
     47 		return -1;
     48 		}
     49 	//printf("pcap_findalldevs() got hostlist now finding devs\n");				// fulko
     50 	if (acn_findalldevs(errbuf))								/* then ask the IOPs for their monitorable devices */
     51 		{
     52 		//printf("pcap_findalldevs() returning BAD after findalldevs\n");				// fulko
     53 		return -1;
     54 		}
     55 	*alldevsp = acn_if_list;
     56 	acn_if_list = 0;											/* then forget our list head, because someone will call pcap_freealldevs() to empty the malloc'ed stuff */
     57 	//printf("pcap_findalldevs() returning ZERO OK\n");				// fulko
     58 	return 0;
     59 }
     60