Allocate memory on 8-byte boundaries again. Tweak the way we
[obnox/wireshark/wip.git] / capture_sync.h
1 /* capture_sync.h
2  * Synchronisation between Ethereal capture parent and child instances
3  *
4  * $Id$
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25
26 /** @file
27  *  
28  *  Sync mode capture (internal interface).
29  *
30  *  Will start a new Ethereal child instance which will do the actual capture 
31  *  work.
32  */
33
34 #ifndef __CAPTURE_SYNC_H__
35 #define __CAPTURE_SYNC_H__
36
37 /** Name we give to the child process when doing a "-S" capture. */
38 #define CHILD_NAME      "ethereal-capture"
39
40
41 /* Size of buffer to hold decimal representation of
42    signed/unsigned 64-bit int */
43 #define SP_DECISIZE 20
44
45 /*
46  * Indications sent out on the sync pipe (from child to parent).
47  */
48 #define SP_FILE         'F'     /* the name of the recently opened file */
49 #define SP_ERROR_MSG    'E'     /* error message */
50 #define SP_PACKET_COUNT 'P'     /* count of packets captured since last message */
51 #define SP_DROPS        'D'     /* count of packets dropped in capture */
52 /*
53  * Win32 only: Indications sent out on the signal pipe (from parent to child)
54  * (UNIX-like sends signals for this)
55  */
56 #define SP_QUIT         'Q'     /* "gracefully" capture quit message (SIGUSR1) */
57
58
59
60 /** 
61  * Start a new capture session.
62  *  Create a capture child which is doing the real capture work.
63  *  The various capture_input_... functions will be called, if something had 
64  *  happened.
65  *
66  *  Most of the parameters are passed through the global capture_opts.
67  *
68  *  @param capture_opts the options
69  *  @return             TRUE if a capture could be started, FALSE if not
70  */
71 extern gboolean 
72 sync_pipe_start(capture_options *capture_opts);
73
74 /** User wants to stop capturing, gracefully close the capture child */
75 extern void
76 sync_pipe_stop(capture_options *capture_opts);
77
78 /** User wants to stop the program, just kill the child as soon as possible */
79 extern void
80 sync_pipe_kill(capture_options *capture_opts);
81
82
83 /** the child has opened a new capture file, notify the parent */
84 extern void
85 sync_pipe_filename_to_parent(const char *filename);
86
87 /** the child captured some new packets, notify the parent */
88 extern void
89 sync_pipe_packet_count_to_parent(int packet_count);
90
91 /** the child stopped capturing, notify the parent */
92 extern void
93 sync_pipe_drops_to_parent(int drops);
94
95 /** the child encountered an error, notify the parent */
96 extern void 
97 sync_pipe_errmsg_to_parent(const char *errmsg);
98
99
100 #endif /* capture_sync.h */