]>
Commit | Line | Data |
---|---|---|
b4e381a8 MT |
1 | /* SmoothWall libsmooth. |
2 | * | |
3 | * This program is distributed under the terms of the GNU General Public | |
4 | * Licence. See the file COPYING for details. | |
5 | * | |
6 | * (c) Lawrence Manning, 2001 | |
7 | * Contains prototypes for library functions. | |
8 | * | |
b4e381a8 MT |
9 | */ |
10 | ||
11 | #ifndef ___LIBSMOOTH_H | |
12 | #define ___LIBSMOOTH_H | |
13 | ||
14 | #include <stdio.h> | |
15 | #include <stdlib.h> | |
16 | #include <string.h> | |
17 | #include <ctype.h> | |
18 | #include <wchar.h> | |
19 | #include <locale.h> | |
20 | #include <unistd.h> | |
21 | #include <sys/file.h> | |
22 | #include <sys/types.h> | |
23 | #include <sys/stat.h> | |
24 | #include <fcntl.h> | |
25 | #include <newt.h> | |
26 | #include <dirent.h> | |
27 | #include <sys/mount.h> | |
28 | ||
29 | #include <sys/socket.h> | |
30 | #include <netinet/in.h> | |
31 | #include <arpa/inet.h> | |
32 | ||
33 | #include <linux/cdrom.h> | |
34 | #include <sys/ioctl.h> | |
35 | ||
36 | #include "langs.h" | |
37 | ||
555637d1 | 38 | #define STRING_SIZE 1024 |
b4e381a8 MT |
39 | |
40 | #define ADDRESS 0 | |
41 | #define NETADDRESS 1 | |
42 | #define NETMASK 2 | |
43 | #define DHCP 3 | |
44 | #define NETCHANGE_TOTAL 4 | |
45 | ||
75ae2191 | 46 | #define SCANNED_NICS "/var/ipfire/ethernet/scanned_nics" |
eea0467a | 47 | #define SYSDIR "/sys/class/net" |
75ae2191 | 48 | |
5057b611 HS |
49 | #define _GREEN_CARD_ 0 |
50 | #define _RED_CARD_ 1 | |
51 | #define _ORANGE_CARD_ 2 | |
52 | #define _BLUE_CARD_ 3 | |
53 | ||
b4e381a8 MT |
54 | struct keyvalue |
55 | { | |
56 | char key[STRING_SIZE]; | |
57 | char value[STRING_SIZE]; | |
58 | struct keyvalue *next; | |
59 | }; | |
b4e381a8 MT |
60 | struct nic |
61 | { | |
f9cc0d70 | 62 | char driver[80]; |
75ae2191 MT |
63 | char description[256]; |
64 | char macaddr[20]; | |
96ed9998 | 65 | char nic[20]; |
b4e381a8 | 66 | }; |
5057b611 | 67 | |
75ae2191 | 68 | struct knic |
b4e381a8 | 69 | { |
f9cc0d70 | 70 | char driver[80]; |
75ae2191 MT |
71 | char description[256]; |
72 | char macaddr[20]; | |
5057b611 | 73 | char colour[20]; |
b4e381a8 MT |
74 | }; |
75 | ||
5057b611 | 76 | |
b4e381a8 MT |
77 | /* libsmooth.c */ |
78 | void reboot(void); | |
79 | void stripnl(char *s); | |
80 | int mysystem(char *command); | |
81 | void errorbox(char *message); | |
e0bbaf87 AF |
82 | int statuswindowscroll(int width, int height, char *title, char *text, ...); |
83 | int disclaimerbox(char *message); | |
b4e381a8 MT |
84 | void statuswindow(int width, int height, char *title, char *text, ...); |
85 | int runcommandwithprogress(int width, int height, char *title, char *command, | |
86 | int lines, char *text, ...); | |
87 | int runcommandwithstatus(char *command, char *message); | |
88 | int runhiddencommandwithstatus(char *command, char *message); | |
89 | int checkformodule(char *module); | |
90 | int replace(char filename1[], char *from, char *to); | |
91 | char* get_version(void); | |
92 | ||
93 | /* netstuff.c */ | |
94 | int changeaddress(struct keyvalue *kv, char *colour, int typeflag, | |
95 | char *defaultdhcphostname); | |
96 | int gettype(char *type); | |
97 | int setnetaddress(struct keyvalue *kv, char *colour); | |
98 | void networkdialogcallbacktype(newtComponent cm, void *data); | |
99 | int interfacecheck(struct keyvalue *kv, char *colour); | |
eea0467a | 100 | int rename_nics(void); |
9c1c1c57 | 101 | int init_knics(void); |
84e975ba | 102 | int create_udev(void); |
5057b611 | 103 | int scan_network_cards(void); |
9b040aa0 HS |
104 | int nicmenu(int colour); |
105 | int clear_card_entry(int cards); | |
106 | int ask_clear_card_entry(int cards); | |
b4e381a8 | 107 | int manualdriver(char *driver, char *driveroptions); |
b4e381a8 | 108 | |
d10e55d1 | 109 | /* varval.c */ |
b4e381a8 MT |
110 | struct keyvalue *initkeyvalues(void); |
111 | void freekeyvalues(struct keyvalue *head); | |
112 | int readkeyvalues(struct keyvalue *head, char *filename); | |
113 | int writekeyvalues(struct keyvalue *head, char *filename); | |
114 | int findkey(struct keyvalue *head, char *key, char *value); | |
115 | void appendkeyvalue(struct keyvalue *head, char *key, char *value); | |
116 | void replacekeyvalue(struct keyvalue *head, char *key, char *value); | |
117 | ||
118 | #endif | |
119 |