2 Copyright © 2009-2012, The AROS Development Team. All rights reserved.
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
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
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"
56 NOT_SAVED_PREFS_ENVARC
,
58 NOT_COPIED_FILES_ENVARC
,
60 NOT_RESTARTED_WIRELESS
,
67 TEXT name
[NAMEBUFLEN
];
71 TEXT device
[NAMEBUFLEN
];
78 TEXT address
[IPBUFLEN
];
79 TEXT names
[NAMEBUFLEN
];
84 TEXT name
[NAMEBUFLEN
];
92 struct MobileBroadBand
94 TEXT devicename
[NAMEBUFLEN
];
96 TEXT atcommand
[MAXATCOMMANDS
][NAMEBUFLEN
];
97 TEXT username
[NAMEBUFLEN
];
98 TEXT password
[NAMEBUFLEN
];
105 TEXT device
[SMBBUFLEN
];
106 TEXT host
[NAMEBUFLEN
];
107 TEXT service
[SMBBUFLEN
];
108 TEXT user
[SMBBUFLEN
];
109 TEXT group
[SMBBUFLEN
];
110 TEXT pass
[SMBBUFLEN
];
116 struct Interface interface
[MAXINTERFACES
];
120 TEXT DNS
[2][IPBUFLEN
];
121 TEXT host
[NAMEBUFLEN
];
122 TEXT domain
[NAMEBUFLEN
];
124 struct Host hosts
[MAXHOSTS
];
126 struct Network networks
[MAXNETWORKS
];
128 struct MobileBroadBand mobile
;
129 STRPTR wirelessDevice
;
131 struct Server servers
[MAXSERVERS
];
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
);
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);
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);
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
);
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
);
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
);