1 /**
2  * @file fg_pcap.h
3  * @brief Packet capture support for the Flowgrind daemon
4  */
5 
6 /*
7  * Copyright (C) 2010-2013 Christian Samsel <christian.samsel@rwth-aachen.de>
8  * Copyright (C) 2009 Tim Kosse <tim.kosse@gmx.de>
9  * Copyright (C) 2007-2008 Daniel Schaffrath <daniel.schaffrath@mac.com>
10  *
11  * This file is part of Flowgrind.
12  *
13  * Flowgrind is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * Flowgrind is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with Flowgrind.  If not, see <http://www.gnu.org/licenses/>.
25  *
26  */
27 
28 #ifndef _FG_PCAP_H_
29 #define _FG_PCAP_H_
30 
31 #ifdef HAVE_CONFIG_H
32 #include "config.h"
33 #endif /* HAVE_CONFIG_H */
34 
35 #include "daemon.h"
36 
37 /**
38  * Initialize flowgrind's pcap library.
39  *
40  * This method fills internal structures on which other methods of this library
41  * depend.  It is therefore crucial to call it before any call to other methods
42  * of this library.
43  *
44  * @return return 0 for success, or -1 for failure
45  */
46 int fg_pcap_init(void);
47 
48 /**
49  * Start a tcpdump to capture traffic of the provided flow.
50  *
51  * If the flow was not configured for tcp dumping or dumping is already in
52  * progress the method will do nothing and return immediately. Otherwise the
53  * method blocks until the actual capturing starts. In case an error occurs a
54  * log message is created.
55  *
56  * @param[in] flow the flow whose traffic should be captured
57  */
58 void fg_pcap_go(struct flow *flow);
59 
60 #endif /* _FG_PCAP_H_ */
61