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