~ubuntu-branches/ubuntu/utopic/tlsdate/utopic-proposed

« back to all changes in this revision

Viewing changes to src/tlsdate.h

  • Committer: Package Import Robot
  • Author(s): Jacob Appelbaum
  • Date: 2013-01-22 23:08:21 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130122230821-820ay2kh785on6yc
Tags: 0.0.5-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include <time.h>
19
19
#include <unistd.h>
20
20
 
21
 
#define UNPRIV_USER "nobody"
22
21
#define DEFAULT_HOST "www.ptb.de"
23
22
#define DEFAULT_PORT "443"
 
23
#define DEFAULT_PROXY "none"
24
24
#define DEFAULT_PROTOCOL "tlsv1"
25
25
#define DEFAULT_CERTDIR "/etc/ssl/certs"
 
26
#define DEFAULT_CERTFILE TLSDATE_CERTFILE
26
27
#define DEFAULT_DAEMON_CACHEDIR "/var/cache/tlsdated"
27
28
#define DEFAULT_DAEMON_TMPSUFFIX ".new"
28
29
#define DEFAULT_TLSDATE TLSDATE
 
30
#define DEFAULT_RTC_DEVICE "/dev/rtc"
 
31
#define DEFAULT_CONF_FILE TLSDATE_CONF_DIR "tlsdated.conf"
29
32
 
30
33
/* tlsdated magic numbers */
31
34
#define MAX_TRIES 10
38
41
#define DEFAULT_SAVE_TO_DISK 1
39
42
#define DEFAULT_USE_NETLINK 1
40
43
#define DEFAULT_DRY_RUN 0
 
44
#define MAX_SANE_BACKOFF 600 /* exponential backoff should only go this far */
41
45
 
42
46
#ifndef TLSDATED_MAX_DATE
43
47
#define TLSDATED_MAX_DATE 1999991337 /* this'll be a great bug some day */
52
56
/** The current version of tlsdate. */
53
57
#define tlsdate_version VERSION
54
58
 
 
59
struct source {
 
60
        struct source *next;
 
61
        char *host;
 
62
        char *port;
 
63
        char *proxy;
 
64
};
 
65
 
 
66
struct opts {
 
67
  int max_tries;
 
68
  int min_steady_state_interval;
 
69
  int wait_between_tries;
 
70
  int subprocess_tries;
 
71
  int subprocess_wait_between_tries;
 
72
  int steady_state_interval;
 
73
  const char *base_path;
 
74
  char **base_argv;
 
75
  char **argv;
 
76
  int should_sync_hwclock;
 
77
  int should_load_disk;
 
78
  int should_save_disk;
 
79
  int should_netlink;
 
80
  int dry_run;
 
81
  int jitter;
 
82
  char *conf_file;
 
83
  struct source *sources;
 
84
  struct source *cur_source;
 
85
};
 
86
 
55
87
int is_sane_time (time_t ts);
56
88
int load_disk_timestamp (const char *path, time_t * t);
57
89
void save_disk_timestamp (const char *path, time_t t);
58
 
int tlsdate (char *argv[], char *envp[], int tries, int wait_between_tries);
 
90
int add_jitter (int base, int jitter);
 
91
int tlsdate (struct opts *opts, char *argv[]);
59
92
 
60
93
/** This is where we store parsed commandline options. */
61
94
typedef struct {