nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* capture_file.h
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21  
22 #ifndef CAPTURE_FILE_H
23 #define CAPTURE_FILE_H
24  
25 #include <QObject>
26  
27 #include <config.h>
28  
29 #include <glib.h>
30  
31 typedef struct _capture_file capture_file;
32 typedef struct _capture_session capture_session;
33  
34 struct _packet_info;
35  
36 class CaptureFile : public QObject
37 {
38 Q_OBJECT
39 public:
40 explicit CaptureFile(QObject *parent = 0, capture_file *cap_file = NULL);
41 ~CaptureFile();
42  
43 capture_file *capFile() const { return isValid() ? cap_file_ : NULL; }
44 void setCapFile(capture_file *cap_file) { cap_file_ = cap_file; }
45  
46 /** Check capture file validity
47 *
48 * @return true if the file is open, readable, and tappable. false if the file
49 * is closed.
50 */
51 bool isValid() const;
52  
53 /** Get the current selected row
54 *
55 * @return the current selected index of the packet list if the capture
56 * file is open and a packet is selected, otherwise -1.
57 */
58 int currentRow();
59  
60 /** Return a filename suitable for use in a window title.
61 *
62 * @return One of: the basename of the capture file without an extension,
63 * the basename followed by "[closing]", "[closed]", or "[no capture file]".
64 */
65 const QString fileTitle() { return fileName() + file_state_; }
66  
67 /** Return the plain filename.
68 *
69 * @return The basename of the capture file without an extension.
70 */
71 const QString fileName();
72  
73 /** Return the current packet information.
74 *
75 * @return A pointer to the current packet_info struct or NULL.
76 */
77 struct _packet_info *packetInfo();
78  
79 /** Timestamp precision for the current file.
80 * @return One of the WTAP_TSPREC_x values defined in wiretap/wtap.h,
81 * or WTAP_TSPREC_UNKNOWN if no file is open.
82 */
83 int timestampPrecision();
84  
85 /** Reload the capture file
86 */
87 void reload();
88  
89 // XXX This shouldn't be needed.
90 static capture_file *globalCapFile();
91  
92 gpointer window();
93  
94 signals:
95 void captureFileOpened() const;
96 void captureFileReadStarted() const;
97 void captureFileReadFinished() const;
98 void captureFileReloadStarted() const;
99 void captureFileReloadFinished() const;
100 void captureFileRescanStarted() const;
101 void captureFileRescanFinished() const;
102 void captureFileRetapStarted() const;
103 void captureFileRetapFinished() const;
104 void captureFileClosing() const;
105 void captureFileClosed() const;
106 void captureFileSaveStarted(const QString &file_path) const;
107 void captureFileSaveFinished() const;
108 void captureFileSaveFailed() const;
109 void captureFileSaveStopped() const;
110 void captureFileFlushTapsData() const;
111  
112 void captureCapturePrepared(capture_session *cap_session);
113 void captureCaptureUpdateStarted(capture_session *cap_session);
114 void captureCaptureUpdateContinue(capture_session *cap_session);
115 void captureCaptureUpdateFinished(capture_session *cap_session);
116 void captureCaptureFixedStarted(capture_session *cap_session);
117 void captureCaptureFixedContinue(capture_session *cap_session);
118 void captureCaptureFixedFinished(capture_session *cap_session);
119 void captureCaptureStopping(capture_session *cap_session);
120 void captureCaptureFailed(capture_session *cap_session);
121  
122 public slots:
123 /** Retap the capture file. Convenience wrapper for cf_retap_packets.
124 * Application events are processed periodically via update_progress_dlg.
125 */
126 void retapPackets();
127  
128 /** Retap the capture file after the current batch of application events
129 * is processed. If you call this instead of retapPackets or
130 * cf_retap_packets in a dialog's constructor it will be displayed before
131 * tapping starts.
132 */
133 void delayedRetapPackets();
134  
135 /** Cancel any tapping that might be in progress.
136 */
137 void stopLoading();
138  
139 /** Sets the capture file's "stop_flag" member.
140 *
141 * @param stop_flag If true, stops the current capture file operation.
142 */
143 void setCaptureStopFlag(bool stop_flag = true);
144  
145 private:
146 static void captureFileCallback(gint event, gpointer data, gpointer user_data);
147 #ifdef HAVE_LIBPCAP
148 static void captureCallback(gint event, capture_session *cap_session, gpointer user_data);
149 #endif
150  
151 void captureFileEvent(int event, gpointer data);
152 void captureEvent(int event, capture_session *cap_session);
153 const QString &getFileBasename();
154  
155 static QString no_capture_file_;
156  
157 capture_file *cap_file_;
158 QString file_name_;
159 QString file_state_;
160 };
161  
162 #endif // CAPTURE_FILE_H
163  
164 /*
165 * Editor modelines
166 *
167 * Local Variables:
168 * c-basic-offset: 4
169 * tab-width: 8
170 * indent-tabs-mode: nil
171 * End:
172 *
173 * ex: set shiftwidth=4 tabstop=8 expandtab:
174 * :indentSize=4:tabSize=8:noTabs=true:
175 */