1190214Srpaulo/*
2190214Srpaulo *  fad-sita.c: Packet capture interface additions for SITA ACN devices
3190214Srpaulo *
4190214Srpaulo *  Copyright (c) 2007 Fulko Hew, SITA INC Canada, Inc <fulko.hew@sita.aero>
5190214Srpaulo *
6190214Srpaulo *  License: BSD
7190214Srpaulo *
8190214Srpaulo *  Redistribution and use in source and binary forms, with or without
9190214Srpaulo *  modification, are permitted provided that the following conditions
10190214Srpaulo *  are met:
11190214Srpaulo *
12190214Srpaulo *  1. Redistributions of source code must retain the above copyright
13190214Srpaulo *     notice, this list of conditions and the following disclaimer.
14190214Srpaulo *  2. Redistributions in binary form must reproduce the above copyright
15190214Srpaulo *     notice, this list of conditions and the following disclaimer in
16190214Srpaulo *     the documentation and/or other materials provided with the
17190214Srpaulo *     distribution.
18190214Srpaulo *  3. The names of the authors may not be used to endorse or promote
19190214Srpaulo *     products derived from this software without specific prior
20190214Srpaulo *     written permission.
21190214Srpaulo *
22190214Srpaulo *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
23190214Srpaulo *  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
24190214Srpaulo *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25190214Srpaulo */
26190214Srpaulo
27190214Srpaulo /* $Id: fad-sita.c */
28190214Srpaulo
29190214Srpaulo#ifdef HAVE_CONFIG_H
30190214Srpaulo#include "config.h"
31190214Srpaulo#endif
32190214Srpaulo
33190214Srpaulo#include <string.h>
34190214Srpaulo#include "pcap-int.h"
35190214Srpaulo
36190214Srpaulo#include "pcap-sita.h"
37190214Srpaulo
38190214Srpauloextern pcap_if_t	*acn_if_list;								/* pcap's list of available interfaces */
39190214Srpaulo
40251129Sdelphijint pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) {
41190214Srpaulo
42190214Srpaulo	//printf("pcap_findalldevs()\n");				// fulko
43190214Srpaulo
44190214Srpaulo	*alldevsp = 0;												/* initialize the returned variables before we do anything */
45190214Srpaulo	strcpy(errbuf, "");
46190214Srpaulo	if (acn_parse_hosts_file(errbuf))							/* scan the hosts file for potential IOPs */
47190214Srpaulo		{
48190214Srpaulo		//printf("pcap_findalldevs() returning BAD after parsehosts\n");				// fulko
49190214Srpaulo		return -1;
50190214Srpaulo		}
51190214Srpaulo	//printf("pcap_findalldevs() got hostlist now finding devs\n");				// fulko
52190214Srpaulo	if (acn_findalldevs(errbuf))								/* then ask the IOPs for their monitorable devices */
53190214Srpaulo		{
54190214Srpaulo		//printf("pcap_findalldevs() returning BAD after findalldevs\n");				// fulko
55190214Srpaulo		return -1;
56190214Srpaulo		}
57190214Srpaulo	*alldevsp = acn_if_list;
58190214Srpaulo	acn_if_list = 0;											/* then forget our list head, because someone will call pcap_freealldevs() to empty the malloc'ed stuff */
59190214Srpaulo	//printf("pcap_findalldevs() returning ZERO OK\n");				// fulko
60190214Srpaulo	return 0;
61190214Srpaulo}
62