]>
Commit | Line | Data |
---|---|---|
d98f6a46 SS |
1 | /********************************************************** |
2 | SixXS - Automatic IPv6 Connectivity Configuration Utility | |
3 | *********************************************************** | |
4 | Copyright 2003-2005 SixXS - http://www.sixxs.net | |
5 | *********************************************************** | |
6 | common/tic.h - Tunnel Information & Control Protocol | |
7 | *********************************************************** | |
8 | $Author: jeroen $ | |
9 | $Id: tic.h,v 1.12 2006-12-21 14:08:50 jeroen Exp $ | |
10 | $Date: 2006-12-21 14:08:50 $ | |
11 | **********************************************************/ | |
12 | ||
13 | #ifndef TIC_H | |
14 | #define TIC_H "H5K7:W3NDY5UU5N1K1N1C0l3" | |
15 | ||
16 | #include "common.h" | |
17 | ||
18 | /* | |
19 | * Tunnel Information Control Protocol | |
20 | * server | |
21 | */ | |
22 | /* port - uses TCP over IPv4 */ | |
23 | #define TIC_PORT "3874" | |
24 | ||
25 | /* TIC version (which document this should conform to) */ | |
26 | #define TIC_VERSION "draft-00" | |
27 | ||
28 | struct TIC_sTunnel | |
29 | { | |
30 | struct TIC_sTunnel *next; /* Next in list */ | |
31 | char *sId; /* Tunnel Id */ | |
32 | char *sIPv6; /* Local IPv6 Endpoint */ | |
33 | char *sIPv4; /* Local IPv4 Endpoint */ | |
34 | char *sPOPId; /* POP Id */ | |
35 | }; | |
36 | ||
37 | struct TIC_Tunnel | |
38 | { | |
39 | char *sId; /* Tunnel Id */ | |
40 | char *sType; /* Tunnel Type */ | |
41 | ||
42 | /* IPv4 information */ | |
43 | char *sIPv4_Local; /* Local endpoint (*) */ | |
44 | char *sIPv4_POP; /* POP endpoint */ | |
45 | ||
46 | /* IPv6 information */ | |
47 | char *sIPv6_Local; /* Local endpoint */ | |
48 | char *sIPv6_POP; /* POP endpoint */ | |
49 | char *sIPv6_LinkLocal; /* Link local address */ | |
50 | ||
51 | /* POP information */ | |
52 | char *sPOP_Id; /* POP's Id */ | |
53 | ||
54 | /* States */ | |
55 | char *sUserState; /* Userstate */ | |
56 | char *sAdminState; /* Adminstate */ | |
57 | ||
58 | /* AYIYA & Heartbeat */ | |
59 | char *sPassword; /* Password for the tunnel */ | |
60 | uint32_t nHeartbeat_Interval; /* Heartbeat interval */ | |
61 | ||
62 | /* Misc */ | |
63 | uint32_t uses_tundev; /* Uses Tunnel (tun/tap) device? */ | |
64 | uint32_t nIPv6_PrefixLength; /* Length of the prefix's */ | |
65 | uint32_t nMTU; /* MTU size */ | |
66 | }; | |
67 | ||
68 | /* * = 0.0.0.0 for all the dynamic tunnels */ | |
69 | ||
70 | struct TIC_sRoute | |
71 | { | |
72 | struct TIC_sRoute *next; /* Next in list */ | |
73 | char *sId; /* Route Id */ | |
74 | char *sTunnelId; /* Tunnel Id */ | |
75 | char *sIPv6; /* Prefix */ | |
76 | }; | |
77 | ||
78 | struct TIC_Route | |
79 | { | |
80 | char *sId; /* Route Id */ | |
81 | char *sTunnelId; /* Tunnel Id */ | |
82 | struct in6_addr xIPv6; /* Prefix */ | |
83 | uint32_t nPrefixLength; /* Length of the prefix */ | |
84 | uint32_t __pad; | |
85 | }; | |
86 | ||
87 | ||
88 | struct TIC_sPOP | |
89 | { | |
90 | struct TIC_sPOP *next; /* Next in list */ | |
91 | char *sId; /* POP's Id */ | |
92 | }; | |
93 | ||
94 | struct TIC_POP | |
95 | { | |
96 | char *sId; /* POP's Id */ | |
97 | char *sCity; /* POP's City */ | |
98 | char *sCountry; /* POP's Country */ | |
99 | char *sIPv4; /* POP's Primary IPv4 address */ | |
100 | char *sIPv6; /* POP's Primary IPv6 address */ | |
101 | ||
102 | char *sISP_Short; /* ISP's Short name */ | |
103 | char *sISP_Name; /* ISP's Name */ | |
104 | char *sISP_Website; /* ISP's Website */ | |
105 | char *sISP_ASN; /* ISP's ASN */ | |
106 | char *sISP_LIR; /* ISP's LIR */ | |
107 | }; | |
108 | ||
109 | /* | |
110 | * This structure makes TIC a bit more abstracted | |
111 | * which makes this cleaner instead of passing 'sock' everywhere | |
112 | */ | |
113 | struct TIC_conf | |
114 | { | |
115 | TLSSOCKET sock; /* The socket to which we are connected */ | |
116 | }; | |
117 | ||
118 | /********************************************************** | |
119 | TIC Functions | |
120 | **********************************************************/ | |
121 | ||
122 | /* Login to/Logout from the TIC Server */ | |
123 | bool tic_Login(struct TIC_conf *tic, const char *username, const char *password, const char *server); | |
124 | void tic_Logout(struct TIC_conf *tic, const char *quitmsg); | |
125 | ||
126 | /* Check if the time is in range */ | |
127 | int tic_checktime(time_t epochtime); | |
128 | ||
129 | /* Get Tunnel/Route/POP List */ | |
130 | struct TIC_sTunnel *tic_ListTunnels(struct TIC_conf *tic); | |
131 | struct TIC_sRoute *tic_ListRoutes(struct TIC_conf *tic); | |
132 | struct TIC_sPOP *tic_ListPOPs(struct TIC_conf *tic); | |
133 | ||
134 | /* Get Tunnel/Route/POP Information */ | |
135 | struct TIC_Tunnel *tic_GetTunnel(struct TIC_conf *tic, const char *sId); | |
136 | struct TIC_Route *tic_GetRoute(struct TIC_conf *tic, const char *sId); | |
137 | struct TIC_POP *tic_GetPOP(struct TIC_conf *tic, const char *sId); | |
138 | ||
139 | /* Free Information structures */ | |
140 | void tic_Free_sTunnel(struct TIC_sTunnel *tun); | |
141 | void tic_Free_sRoute(struct TIC_sRoute *rt); | |
142 | void tic_Free_sPOP(struct TIC_sPOP *pop); | |
143 | void tic_Free_Tunnel(struct TIC_Tunnel *tun); | |
144 | void tic_Free_Route(struct TIC_Route *rt); | |
145 | void tic_Free_POP(struct TIC_POP *pop); | |
146 | ||
147 | #endif /* TIC_H */ |