wmem: allow wmem_destroy_list to ignore a NULL list.
[wireshark-sm.git] / ui / time_shift.h
blobe2dfb84ad165e318bf787f3837222f86965b08a6
1 /** @file
3 * Submitted by Edwin Groothuis <wireshark@mavetju.org>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __TIME_SHIFT_H__
13 #define __TIME_SHIFT_H__
15 #include "cfile.h"
16 #include <wsutil/nstime.h>
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
23 * XXX - We might want to move all of this somewhere more accessible to
24 * editcap so that we can make its time adjustments more versatile.
27 /**
28 * Parse a time string and fill in each component.
30 * If year, month, and day are non-NULL a full time format "[YYYY-MM-DD] hh:mm:ss[.decimals]"
31 * is allowed. Otherwise an offset format "[-][[hh:]mm:]ss[.decimals]" is allowed.
33 * @param time_text Time string
34 * @param year Year. May be NULL
35 * @param month Month. May be NULL
36 * @param day Day. May be NULL.
37 * @param negative Time offset is negative. May be NULL if year, month, and day are not NULL.
38 * @param hour Hours. Must not be NULL.
39 * @param minute Minutes. Must not be NULL.
40 * @param second Seconds. Must not be NULL.
42 * @return NULL on success or an error description on failure.
45 const char * time_string_parse(const char *time_text, int *year, int *month, int *day, bool *negative, int *hour, int *minute, long double *second);
47 /** Shift all packets by an offset
49 * @param cf Capture file to shift
50 * @param offset_text String representation of the offset.
52 * @return NULL on success or an error description on failure.
54 const char * time_shift_all(capture_file *cf, const char *offset_text);
56 /* Set the time for a single packet
58 * @param cf Capture file to set
59 * @param packet_num Packet to set
60 * @param time_text String representation of the time
62 * @return NULL on success or an error description on failure.
64 const char * time_shift_settime(capture_file *cf, unsigned packet_num, const char *time_text);
66 /* Set the time for two packets and extrapolate the rest
68 * @param cf Capture file to set
69 * @param packet1_num First packet to set
70 * @param time1_text String representation of the first packet time
71 * @param packet2_num Second packet to set
72 * @param time2_text String representation of the second packet time
74 * @return NULL on success or an error description on failure.
76 const char * time_shift_adjtime(capture_file *cf, unsigned packet1_num, const char *time1_text, unsigned packet2_num, const char *time2_text);
78 /* Reset the times for all packets
80 * @param cf Capture file to set
82 * @return NULL on success or an error description on failure.
84 const char * time_shift_undo(capture_file *cf);
86 #ifdef __cplusplus
88 #endif /* __cplusplus */
90 #endif /* __TIME_SHIFT_H__ */