1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*
* Copyright (C) 2006-2007 Aconex. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*/
#ifndef PMTIME_H
#define PMTIME_H
#include <sys/time.h>
typedef enum {
PM_TCTL_SET = (1<<0), // client -> server
PM_TCTL_STEP = (1<<1), // server -> clients
PM_TCTL_TZ = (1<<2), // server -> clients
PM_TCTL_VCRMODE = (1<<3), // server -> clients
PM_TCTL_VCRMODE_DRAG= (1<<4), // server -> clients
PM_TCTL_GUISHOW = (1<<5), // client -> server
PM_TCTL_GUIHIDE = (1<<6), // client -> server
PM_TCTL_BOUNDS = (1<<7), // client -> server
PM_TCTL_ACK = (1<<8), // client -> server (except handshake)
} pm_tctl_command;
typedef enum {
PM_STATE_STOP = 0,
PM_STATE_FORWARD = 1,
PM_STATE_BACKWARD = 2,
} pm_tctl_state;
typedef enum {
PM_MODE_STEP = 0,
PM_MODE_NORMAL = 1,
PM_MODE_FAST = 2,
} pm_tctl_mode;
typedef enum {
PM_SOURCE_NONE = -1,
PM_SOURCE_HOST = 0,
PM_SOURCE_ARCHIVE = 1,
} pm_tctl_source;
#define PMTIME_MAGIC 0x54494D45 /* "TIME" */
typedef struct {
unsigned int magic;
unsigned int length;
pm_tctl_command command;
pm_tctl_source source;
pm_tctl_state state;
pm_tctl_mode mode;
struct timeval delta;
struct timeval position;
struct timeval start; /* archive only */
struct timeval end; /* archive only */
char data[0]; /* arbitrary length info (e.g. $TZ) */
} pmTime;
extern int pmTimeSendAck(int, struct timeval *);
extern int pmTimeConnect(int, pmTime *);
extern int pmTimeShowDialog(int, int);
extern int pmTimeRecv(int, pmTime **);
/*
* Time state management API for simple clients
*/
typedef void (*pmTimeStateResume)(void);
typedef void (*pmTimeStateRewind)(void);
typedef void (*pmTimeStateExited)(void);
typedef void (*pmTimeStateBoundary)(void);
typedef void (*pmTimeStatePosition)(struct timeval);
typedef void (*pmTimeStateInterval)(struct timeval);
typedef void (*pmTimeStateStepped)(struct timeval);
typedef void (*pmTimeStateNewZone)(char *, char *);
typedef struct {
pmTimeStateResume resume;
pmTimeStateRewind rewind;
pmTimeStateExited exited;
pmTimeStateBoundary boundary;
pmTimeStatePosition position;
pmTimeStateInterval interval;
pmTimeStateStepped stepped;
pmTimeStateNewZone newzone;
struct timeval delta;
int fd;
int showgui;
int context;
int padding;
} pmTimeControls;
extern pmTime *pmTimeStateSetup(pmTimeControls *, int, int,
struct timeval, struct timeval,
struct timeval, struct timeval, char *, char *);
extern void pmTimeStateAck(pmTimeControls *, pmTime *);
extern void pmTimeStateMode(int, struct timeval, struct timeval *);
extern int pmTimeStateVector(pmTimeControls *, pmTime *);
extern void pmTimeStateBounds(pmTimeControls *, pmTime *);
#endif /* PMTIME_H */
|