author | benmeyer <benmeyer> | 2002-09-30 14:26:33 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-09-30 14:26:33 (UTC) |
commit | 9965bd5c49ff2f22d640d132ac343fdec97b3fb4 (patch) (unidiff) | |
tree | 45e8f1d1bf414530b637692ba43b730110611856 /noncore/net/networksetup/interfaces.h | |
parent | 5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d (diff) | |
download | opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.zip opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.tar.gz opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.tar.bz2 |
Initial commit
Diffstat (limited to 'noncore/net/networksetup/interfaces.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/networksetup/interfaces.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/noncore/net/networksetup/interfaces.h b/noncore/net/networksetup/interfaces.h new file mode 100644 index 0000000..2cc9689 --- a/dev/null +++ b/noncore/net/networksetup/interfaces.h | |||
@@ -0,0 +1,70 @@ | |||
1 | #ifndef INTERFACES_H | ||
2 | #define INTERFACES_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | #include <qstringlist.h> | ||
6 | |||
7 | #define INTERFACES_LOOPBACK "loopback" | ||
8 | |||
9 | #define INTERFACES_FAMILY_INET "inet" | ||
10 | #define INTERFACES_FAMILY_IPX "ipx" | ||
11 | #define INTERFACES_FAMILY_INET6 "inet6" | ||
12 | |||
13 | #define INTERFACES_METHOD_DHCP "dhcp" | ||
14 | #define INTERFACES_METHOD_STATIC "static" | ||
15 | #define INTERFACES_METHOD_PPP "ppp" | ||
16 | |||
17 | /** | ||
18 | * This class provides a clean frontend for parsing the network interfaces file. | ||
19 | * It provides helper functions to minipulate the options within the file. | ||
20 | * See the interfaces man page for the syntax rules. | ||
21 | */ | ||
22 | class Interfaces { | ||
23 | |||
24 | public: | ||
25 | Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); | ||
26 | |||
27 | bool isAuto(QString interface); | ||
28 | bool setAuto(QString interface, bool setAuto); | ||
29 | |||
30 | bool removeInterface(); | ||
31 | bool addInterface(QString interface, QString family, QString method); | ||
32 | bool setInterface(QString interface); | ||
33 | bool isInterfaceSet(); | ||
34 | QString getInterfaceName(bool &error); | ||
35 | bool setInterfaceName(QString newName); | ||
36 | QString getInterfaceFamily(bool &error); | ||
37 | bool setInterfaceFamily(QString newName); | ||
38 | QString getInterfaceMethod(bool &error); | ||
39 | bool setInterfaceMethod(QString newName); | ||
40 | QString getInterfaceOption(QString option, bool &error); | ||
41 | bool setInterfaceOption(QString option, QString value); | ||
42 | bool removeAllInterfaceOptions(); | ||
43 | |||
44 | bool setMapping(QString interface); | ||
45 | void addMapping(QString interfaces); | ||
46 | bool setMap(QString map, QString value); | ||
47 | QString getMap(QString map, bool &error); | ||
48 | bool setScript(QString); | ||
49 | QString getScript(bool &error); | ||
50 | |||
51 | bool write(); | ||
52 | |||
53 | private: | ||
54 | bool setStanza(QString stanza, QString option,QStringList::Iterator &iterator); | ||
55 | bool setOption(QStringList::Iterator start, QString option, QString value); | ||
56 | QString getOption(QStringList::Iterator start, QString option, bool &error); | ||
57 | bool removeAllOptions(QStringList::Iterator start); | ||
58 | |||
59 | QString interfacesFile; | ||
60 | QStringList interfaces; | ||
61 | QStringList::Iterator currentIface; | ||
62 | QStringList::Iterator currentMapping; | ||
63 | |||
64 | QStringList acceptedFamily; | ||
65 | }; | ||
66 | |||
67 | #endif | ||
68 | |||
69 | // interfaces | ||
70 | |||