]> git.ipfire.org Git - people/stevee/aiccu.git/blob - common/aiccu.h
Add setup script functionality to Linux client
[people/stevee/aiccu.git] / common / aiccu.h
1 /**********************************************************
2 SixXS - Automatic IPv6 Connectivity Configuration Utility
3 ***********************************************************
4 Copyright 2003-2005 SixXS - http://www.sixxs.net
5 ***********************************************************
6 common/aiccu.h - Abstracted Functions and Configuration
7 All compile-time configurable items are in this file
8 ***********************************************************
9 $Author: jeroen $
10 $Id: aiccu.h,v 1.23 2007-01-15 12:01:43 jeroen Exp $
11 $Date: 2007-01-15 12:01:43 $
12 **********************************************************/
13
14 #ifndef AICCU_H
15 #define AICCU_H "H5K7:W3NDY5UU5N1K1N1C0l3"
16
17 #include "common.h"
18 #include "tic.h"
19 #include "heartbeat.h"
20 #include "ayiya.h"
21 #include "resolver.h"
22
23 #ifdef NEWSTUFF_TSP
24 #include "tsp.h"
25 #endif
26 #ifdef NEWSTUFF_TSP
27 #include "teepee.h"
28 #endif
29
30 /* AICCU Version */
31 #define AICCU_VER "2007.01.15"
32 #define AICCU_VERSION_NUM 2007,01,15,0
33 /* _NUM = required for Windows Resources */
34
35 #ifdef _WIN32
36 #define AICCU_TYPE "win32"
37 #endif
38
39 /* Append -gui or -console? */
40 #ifndef AICCU_CONSOLE
41 #ifdef AICCU_TYPE
42 #define AICCU_VERSION AICCU_VER "-gui-" AICCU_TYPE
43 #else
44 #define AICCU_VERSION AICCU_VER "-gui"
45 #endif
46 #else
47 #ifdef AICCU_TYPE
48 #define AICCU_VERSION AICCU_VER "-console-" AICCU_TYPE
49 #else
50 #define AICCU_VERSION AICCU_VER "-console"
51 #endif
52 #endif
53
54 /* Needed for TIC */
55 #define TIC_CLIENT_NAME "AICCU"
56 #define TIC_CLIENT_VERSION AICCU_VERSION
57
58 /* Needed for TSP */
59 #define TSP_CLIENT_NAME TIC_CLIENT_NAME
60 #define TSP_CLIENT_VERSION TIC_CLIENT_VERSION
61
62 /*
63 * AICCU configuration Cache
64 * allows reconnects even when we don't update
65 * the data. Could be useful in the event
66 * where we can't make contact to the main server
67 */
68 #define AICCU_CACHE "/var/cache/aiccu.cache"
69
70 /* The PID we are running as when daemonized */
71 #define AICCU_PID "/var/run/aiccu.pid"
72
73 /* AICCU Configuration file */
74 #ifdef _WIN32
75 /* GetWindowsDirectory() is used to figure out the directory to store the config */
76 #define AICCU_CONFIG "aiccu.conf"
77 #else
78 #define AICCU_CONFIG "/etc/aiccu.conf"
79 #endif
80
81 /* Inbound listen queue */
82 #define LISTEN_QUEUE 128
83
84 #ifndef UNUSED
85 #ifdef _AIX
86 #define UNUSED
87 #else
88 #define UNUSED __attribute__ ((__unused__))
89 #endif
90 #endif
91
92 /* AICCU Configuration */
93 struct AICCU_conf
94 {
95 /* Only for AICCU */
96 char *username; /* Username */
97 char *password; /* Password */
98 char *protocol; /* TIC/TSP/L2TP */
99 char *server; /* TIC/TSP etc server */
100 char *ipv6_interface; /* IPv6 interface (tunnel interface: sit0, tun0 etc) */
101 char *tunnel_id; /* ID of the tunnel to use */
102 char *local_ipv4_override; /* Local IPv4 override, for behind-NAT scenario's */
103 char *setupscript; /* Script to run after having set up the tunnel */
104 char *pidfile; /* File to store the PID */
105
106 /* used by other parts */
107
108 struct TIC_conf *tic; /* TIC Structure */
109 #ifdef NEWSTUFF_TSP
110 struct TSP_conf *tsp; /* TSP Structure */
111 #endif
112
113 #ifdef AICCU_GNUTLS
114 gnutls_certificate_credentials tls_cred; /* GNUTLS credentials */
115 #endif
116
117 bool daemonize; /* Daemonize? */
118 bool verbose; /* Verbosity */
119 bool running; /* Still running? */
120 bool tunrunning; /* Is the tundev running? */
121
122 bool automatic; /* Try to be totally automatic? */
123 bool behindnat; /* Behind a NAT */
124 bool requiretls; /* Require TLS for TIC? */
125 bool makebeats; /* Make heartbeats? */
126 bool noconfigure; /* No configuration (used to only send heartbeats) */
127 bool defaultroute; /* Configure a default route */
128 };
129
130 /* Global configuration */
131 extern struct AICCU_conf *g_aiccu;
132
133 /* AICCU Abstracted Functions */
134 bool aiccu_InitConfig(void);
135 bool aiccu_LoadConfig(const char *filename);
136 bool aiccu_SaveConfig(const char *filename);
137 void aiccu_FreeConfig(void);
138
139 void aiccu_install(void);
140 bool aiccu_setup(struct TIC_Tunnel *hTunnel, bool firstrun);
141 void aiccu_beat(struct TIC_Tunnel *hTunnel);
142 void aiccu_reconfig(struct TIC_Tunnel *hTunnel);
143 void aiccu_delete(struct TIC_Tunnel *hTunnel);
144 void aiccu_test(struct TIC_Tunnel *hTunnel, bool automatic);
145 bool aiccu_exec(const char *fmt, ...);
146 const char *aiccu_license(void);
147
148 /* OS Specific */
149 bool aiccu_os_install(void);
150 bool aiccu_os_setup(struct TIC_Tunnel *hTunnel);
151 void aiccu_os_reconfig(struct TIC_Tunnel *hTunnel);
152 void aiccu_os_delete(struct TIC_Tunnel *hTunnel);
153 void aiccu_os_test(struct TIC_Tunnel *hTunnel, bool automatic);
154
155 #ifdef _WIN32
156 void aiccu_win32_rename_adapter(const char *orig);
157 #endif
158
159 #endif /* AICCU_H */