Kerberos: add kerberos_inject_longterm_key() helper function
[wireshark-sm.git] / ui / qt / capture_file.h
blob89be807f57433f5750a0512227a8691da95701c7
1 /** @file
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #ifndef CAPTURE_FILE_H
11 #define CAPTURE_FILE_H
13 #include <QObject>
15 #include <config.h>
17 #include "cfile.h"
18 #include "capture_event.h"
20 class CaptureFile : public QObject
22 Q_OBJECT
23 public:
24 explicit CaptureFile(QObject *parent = 0, capture_file *cap_file = NULL);
25 ~CaptureFile();
27 capture_file *capFile() const { return isValid() ? cap_file_ : NULL; }
28 void setCapFile(capture_file *cap_file) { cap_file_ = cap_file; }
30 /** Check capture file validity
32 * @return true if the file is open, readable, and tappable. false if the file
33 * is closed.
35 bool isValid() const;
37 /** Return the full pathname.
39 * @return The entire pathname, converted from the native OS's encoding
40 * to Unicode if necessary, or a null string if the conversion can't
41 * be done.
43 const QString filePath();
45 /** Return the plain filename.
47 * @return The last component of the pathname, including the extension,
48 * converted from the native OS's encoding to Unicode if necessary, or
49 * a null string if the conversion can't be done.
51 const QString fileName();
53 /** Return the plain filename without an extension.
55 * @return The last component of the pathname, without the extension,
56 * converted from the native OS's encoding to Unicode if necessary, or
57 * a null string if the conversion can't be done.
59 const QString fileBaseName();
61 /** Return a string representing the file suitable for use for
62 * display in the UI in places such as a main window title.
64 * @return One of:
66 * the devices on which the capture was done, if the file is a
67 * temporary file for a capture;
69 * the last component of the capture file's name, converted
70 * from the native OS's encoding to Unicode if necessary (and
71 * with REPLACEMENT CHARACTER inserted if the string can't
72 * be converted).
74 * a null string, if there is no capture file.
76 const QString fileDisplayName();
78 /** Return a string representing the file suitable for use in an
79 * auxiliary window title.
81 * @return One of:
83 * the result of fileDisplayName(), if the file is open;
85 * the result of fileDisplayName() followed by [closing], if
86 * the file is being closed;
88 * the result of fileDisplayName() followed by [closed], if
89 * the file has been closed;
91 * [no capture file], if there is no capture file.
93 const QString fileTitle();
95 /** Return the current packet information.
97 * @return A pointer to the current packet_info struct or NULL.
99 struct _packet_info *packetInfo();
101 /** Timestamp precision for the current file.
102 * @return One of the WTAP_TSPREC_x values defined in wiretap/wtap.h,
103 * or WTAP_TSPREC_UNKNOWN if no file is open.
105 int timestampPrecision();
107 /** Reload the capture file
109 void reload();
111 /** Return any set display filter
113 QString displayFilter() const;
115 // XXX This shouldn't be needed.
116 static capture_file *globalCapFile();
118 void *window();
120 signals:
121 void captureEvent(CaptureEvent);
123 public slots:
124 /** Retap the capture file. Convenience wrapper for cf_retap_packets.
125 * Application events are processed periodically via update_progress_dlg.
127 void retapPackets();
129 /** Retap the capture file after the current batch of application events
130 * is processed. If you call this instead of retapPackets or
131 * cf_retap_packets in a dialog's constructor it will be displayed before
132 * tapping starts.
134 void delayedRetapPackets();
136 /** Cancel any tapping that might be in progress.
138 void stopLoading();
140 /** Sets the capture file's "stop_flag" member.
142 * @param stop_flag If true, stops the current capture file operation.
144 void setCaptureStopFlag(bool stop_flag = true);
146 private:
147 static void captureFileCallback(int event, void *data, void *user_data);
148 #ifdef HAVE_LIBPCAP
149 static void captureCallback(int event, capture_session *cap_session, void *user_data);
150 #endif
152 void captureFileEvent(int event, void *data);
153 void captureSessionEvent(int event, capture_session *cap_session);
154 const QString &getFileBasename();
156 static QString no_capture_file_;
158 capture_file *cap_file_;
159 QString file_state_;
162 #endif // CAPTURE_FILE_H