In some dialogs, have *no* auto-default buttons on macOS.
[metze/wireshark/wip.git] / ui / time_shift.h
1 /* time_shift.h
2  * Submitted by Edwin Groothuis <wireshark@mavetju.org>
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later*/
9
10 #ifndef __TIME_SHIFT_H__
11 #define __TIME_SHIFT_H__
12
13 #include "cfile.h"
14 #include <wsutil/nstime.h>
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19
20 /*
21  * XXX - We might want to move all of this somewhere more accessible to
22  * editcap so that we can make its time adjustments more versatile.
23  */
24
25 /**
26  * Parse a time string and fill in each component.
27  *
28  * If year, month, and day are non-NULL a full time format "[YYYY-MM-DD] hh:mm:ss[.decimals]"
29  * is allowed. Otherwise an offset format "[-][[hh:]mm:]ss[.decimals]" is allowed.
30  *
31  * @param time_text Time string
32  * @param year Year. May be NULL
33  * @param month Month. May be NULL
34  * @param day Day. May be NULL.
35  * @param negative Time offset is negative. May be NULL if year, month, and day are not NULL.
36  * @param hour Hours. Must not be NULL.
37  * @param minute Minutes. Must not be NULL.
38  * @param second Seconds. Must not be NULL.
39  *
40  * @return NULL on success or an error description on failure.
41  */
42
43 const gchar * time_string_parse(const gchar *time_text, int *year, int *month, int *day, gboolean *negative, int *hour, int *minute, long double *second);
44
45 /** Shift all packets by an offset
46  *
47  * @param cf Capture file to shift
48  * @param offset_text String representation of the offset.
49  *
50  * @return NULL on success or an error description on failure.
51  */
52 const gchar * time_shift_all(capture_file *cf, const gchar *offset_text);
53
54 /* Set the time for a single packet
55  *
56  * @param cf Capture file to set
57  * @param packet_num Packet to set
58  * @param time_text String representation of the time
59  *
60  * @return NULL on success or an error description on failure.
61  */
62 const gchar * time_shift_settime(capture_file *cf, guint packet_num, const gchar *time_text);
63
64 /* Set the time for two packets and extrapolate the rest
65  *
66  * @param cf Capture file to set
67  * @param packet1_num First packet to set
68  * @param time1_text String representation of the first packet time
69  * @param packet2_num Second packet to set
70  * @param time2_text String representation of the second packet time
71  *
72  * @return NULL on success or an error description on failure.
73  */
74 const gchar * time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text, guint packet2_num, const gchar *time2_text);
75
76 /* Reset the times for all packets
77  *
78  * @param cf Capture file to set
79  *
80  * @return NULL on success or an error description on failure.
81  */
82 const gchar * time_shift_undo(capture_file *cf);
83
84 #ifdef __cplusplus
85 }
86 #endif /* __cplusplus */
87
88 #endif /* __TIME_SHIFT_H__ */
89
90 /*
91  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
92  *
93  * Local variables:
94  * c-basic-offset: 4
95  * tab-width: 8
96  * indent-tabs-mode: nil
97  * End:
98  *
99  * vi: set shiftwidth=4 tabstop=8 expandtab:
100  * :indentSize=4:tabSize=8:noTabs=true:
101  */