revert between 56095 -> 55830 in arch
[AROS.git] / workbench / prefs / network / prefsdata.h
blob0764a776eda91abcade9a1f04d7e7a2cddf6c43b
1 /*
2 Copyright © 2009-2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/types.h>
8 #define PREFS_PATH_ENV "ENV:AROSTCP"
9 #define PREFS_PATH_ENVARC "ENVARC:AROSTCP"
10 #define AROSTCP_PACKAGE_VARIABLE "SYS/Packages/AROSTCP"
12 #define IPBUFLEN (15 + 1)
13 #define NAMEBUFLEN 128
14 #define SMBBUFLEN (16 + 1)
16 #define IPCHARS "0123456789."
17 #define NAMECHARS "0123456789abcdefghijklmnopqrstuvwxyz-"
19 #define MAXINTERFACES 15
20 #define MAXHOSTS 30
21 #define MAXATCOMMANDS 5
23 #define DEFAULTNAME "net0"
24 #define DEFAULTIP "192.168.0.188"
25 #define DEFAULTMASK "255.255.255.0"
26 #define DEFAULTGATE "192.168.0.1"
27 #define DEFAULTDNS "192.168.0.1"
28 #define DEFAULTDEVICE "DEVS:networks/pcnet32.device"
29 #define DEFAULTHOST "arosbox"
30 #define DEFAULTDOMAIN "arosnet"
32 #define MAXNETWORKS 100
33 #define MAXSERVERS 10
35 #define WIRELESS_PATH_ENV "ENV:Sys"
36 #define WIRELESS_PATH_ENVARC "ENVARC:Sys"
38 #define MOBILEBB_PATH_ENV "ENV:"
39 #define MOBILEBB_PATH_ENVARC "ENVARC:"
41 #define SERVER_PATH_STORAGE "SYS:Storage/DOSDrivers"
42 #define SERVER_PATH_ENV "ENV:SMB"
43 #define AUTOMOUNT_VARIABLE "AROSTCP/ServerAutoMounts"
44 #define SERVER_HANDLER "smb-handler"
46 #define SSIDBUFLEN (32 + 1)
47 #define KEYBUFLEN (64 + 1)
49 #define DEFAULTSERVERDEV "SMB0"
51 enum ErrorCode
53 ALL_OK,
54 UNKNOWN_ERROR,
55 NOT_SAVED_PREFS_ENV,
56 NOT_SAVED_PREFS_ENVARC,
57 NOT_COPIED_FILES_ENV,
58 NOT_COPIED_FILES_ENVARC,
59 NOT_RESTARTED_STACK,
60 NOT_RESTARTED_WIRELESS,
61 NOT_RESTARTED_MOBILE,
62 MULTIPLE_IFACES
65 struct Interface
67 TEXT name[NAMEBUFLEN];
68 BOOL ifDHCP;
69 TEXT IP[IPBUFLEN];
70 TEXT mask[IPBUFLEN];
71 TEXT device[NAMEBUFLEN];
72 LONG unit;
73 BOOL up;
76 struct Host
78 TEXT address[IPBUFLEN];
79 TEXT names[NAMEBUFLEN];
82 struct Network
84 TEXT name[NAMEBUFLEN];
85 TEXT key[KEYBUFLEN];
86 UWORD encType;
87 BOOL hidden;
88 BOOL adHoc;
89 BOOL keyIsHex;
92 struct MobileBroadBand
94 TEXT devicename[NAMEBUFLEN];
95 LONG unit;
96 TEXT atcommand[MAXATCOMMANDS][NAMEBUFLEN];
97 TEXT username[NAMEBUFLEN];
98 TEXT password[NAMEBUFLEN];
99 LONG timeout;
100 BOOL autostart;
103 struct Server
105 TEXT device[SMBBUFLEN];
106 TEXT host[NAMEBUFLEN];
107 TEXT service[SMBBUFLEN];
108 TEXT user[SMBBUFLEN];
109 TEXT group[SMBBUFLEN];
110 TEXT pass[SMBBUFLEN];
111 BOOL active;
114 struct TCPPrefs
116 struct Interface interface[MAXINTERFACES];
117 LONG interfacecount;
118 BOOL DHCP;
119 TEXT gate[IPBUFLEN];
120 TEXT DNS[2][IPBUFLEN];
121 TEXT host[NAMEBUFLEN];
122 TEXT domain[NAMEBUFLEN];
123 BOOL autostart;
124 struct Host hosts[MAXHOSTS];
125 LONG hostCount;
126 struct Network networks[MAXNETWORKS];
127 LONG networkCount;
128 struct MobileBroadBand mobile;
129 STRPTR wirelessDevice;
130 LONG wirelessUnit;
131 struct Server servers[MAXSERVERS];
132 LONG serverCount;
135 void InitNetworkPrefs(CONST_STRPTR directory, BOOL use, BOOL save);
136 void InitInterface(struct Interface *iface);
137 enum ErrorCode SaveNetworkPrefs();
138 enum ErrorCode UseNetworkPrefs();
140 struct Interface * GetInterface(LONG index);
141 STRPTR GetName(struct Interface *iface);
142 BOOL GetIfDHCP(struct Interface *iface);
143 STRPTR GetIP(struct Interface *iface);
144 STRPTR GetMask(struct Interface *iface);
145 STRPTR GetDevice(struct Interface *iface);
146 LONG GetUnit(struct Interface *iface);
147 BOOL GetUp(struct Interface *iface);
149 BOOL GetDHCP(void);
150 STRPTR GetGate(void);
151 STRPTR GetDNS(LONG m);
152 STRPTR GetHostname(void);
153 STRPTR GetDomain(void);
154 LONG GetInterfaceCount(void);
155 BOOL GetAutostart(void);
157 void SetInterface
159 struct Interface *iface, STRPTR name, BOOL dhcp, STRPTR IP,
160 STRPTR mask, STRPTR device, LONG unit, BOOL up
162 void SetName(struct Interface *iface, STRPTR w);
163 void SetIfDHCP(struct Interface *iface, BOOL w);
164 void SetIP(struct Interface *iface, STRPTR w);
165 void SetMask(struct Interface *iface, STRPTR w);
166 void SetDevice(struct Interface *iface, STRPTR w);
167 void SetUnit(struct Interface *iface, LONG w);
168 void SetUp(struct Interface *iface, BOOL w);
170 void SetDHCP(BOOL w);
171 void SetGate(STRPTR w);
172 void SetDNS(LONG m, STRPTR w);
173 void SetHostname(STRPTR w);
174 void SetDomain(STRPTR w);
175 void SetInterfaceCount(LONG w);
176 void SetAutostart(BOOL w);
178 void InitHost(struct Host *host);
179 void InitNetwork(struct Network *net);
180 void InitServer(struct Server *server, char *workgroup);
182 struct Host *GetHost(LONG index);
183 STRPTR GetHostNames(struct Host *host);
184 STRPTR GetHostAddress(struct Host *host);
185 LONG GetHostCount(void);
187 struct Network *GetNetwork(LONG index);
188 STRPTR GetNetworkName(struct Network *net);
189 STRPTR GetKey(struct Network *net);
190 UWORD GetEncType(struct Network *net);
191 BOOL GetHidden(struct Network *net);
192 BOOL GetAdHoc(struct Network *net);
194 LONG GetNetworkCount(void);
195 STRPTR GetWirelessDevice(void);
196 LONG GetWirelessUnit(void);
198 BOOL GetMobile_Autostart(void);
199 STRPTR GetMobile_atcommand(ULONG i);
200 STRPTR GetMobile_devicename(void);
201 STRPTR GetMobile_username(void);
202 STRPTR GetMobile_password(void);
203 LONG GetMobile_unit(void);
204 LONG GetMobile_timeout(void);
205 LONG GetMobile_atcommandcount(void);
207 struct Server *GetServer(LONG index);
208 STRPTR GetServerDevice(struct Server *server);
209 STRPTR GetServerHost(struct Server *server);
210 STRPTR GetServerService(struct Server *server);
211 STRPTR GetServerUser(struct Server *server);
212 STRPTR GetServerGroup(struct Server *server);
213 STRPTR GetServerPass(struct Server *server);
214 BOOL GetServerActive(struct Server *server);
216 LONG GetServerCount(void);
218 void SetHost
220 struct Host *host, STRPTR name, STRPTR address
222 void SetHostNames(struct Host *host, STRPTR w);
223 void AddHostName(struct Host *host, STRPTR w);
224 void SetHostAddress(struct Host *host, STRPTR w);
226 void SetHostCount(LONG w);
228 void SetNetwork
230 struct Network *net, STRPTR name, UWORD encType, STRPTR key,
231 BOOL keyIsHex, BOOL hidden, BOOL adHoc
233 void SetNetworkName(struct Network *net, STRPTR w);
234 void SetKey(struct Network *net, STRPTR w, BOOL keyIsHex);
235 void SetEncType(struct Network *net, UWORD w);
236 void SetHidden(struct Network *net, BOOL w);
237 void SetAdHoc(struct Network *net, BOOL w);
239 void SetNetworkCount(LONG w);
240 void SetWirelessDevice(STRPTR w);
241 void SetWirelessUnit(LONG w);
243 void SetMobile_Autostart(BOOL w);
244 void SetMobile_atcommand(ULONG i,STRPTR w);
245 void SetMobile_devicename(STRPTR w);
246 void SetMobile_username(STRPTR w);
247 void SetMobile_password(STRPTR w);
248 void SetMobile_unit(LONG w);
249 void SetMobile_timeout(LONG w);
251 void SetServer
253 struct Server *server, STRPTR device, STRPTR host, STRPTR service,
254 STRPTR user, STRPTR group, STRPTR pass, BOOL active
256 void SetServerDevice(struct Server *server, STRPTR w);
257 void SetServerHost(struct Server *server, STRPTR w);
258 void SetServerService(struct Server *server, STRPTR w);
259 void SetServerUser(struct Server *server, STRPTR w);
260 void SetServerGroup(struct Server *server, STRPTR w);
261 void SetServerPass(struct Server *server, STRPTR w);
262 void SetServerActive(struct Server *net, BOOL w);
264 void SetServerCount(LONG w);