summaryrefslogtreecommitdiff
path: root/noncore/net/networksetup/interfaces/interfaces.h
Unidiff
Diffstat (limited to 'noncore/net/networksetup/interfaces/interfaces.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/interfaces/interfaces.h77
1 files changed, 0 insertions, 77 deletions
diff --git a/noncore/net/networksetup/interfaces/interfaces.h b/noncore/net/networksetup/interfaces/interfaces.h
deleted file mode 100644
index bac2a7e..0000000
--- a/noncore/net/networksetup/interfaces/interfaces.h
+++ b/dev/null
@@ -1,77 +0,0 @@
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 */
22class Interfaces {
23
24public:
25 Interfaces(QString useInterfacesFile = "/etc/network/interfaces");
26 QStringList getInterfaceList();
27
28 bool isAuto(const QString &interface) const ;
29 bool setAuto(const QString &interface, bool setAuto);
30
31 bool removeInterface();
32 bool addInterface(const QString &interface, const QString &family, const QString &method);
33 bool copyInterface(const QString &oldInterface, const QString &newInterface);
34 bool setInterface(QString interface);
35 bool isInterfaceSet() const ;
36 QString getInterfaceName(bool &error);
37 bool setInterfaceName(const QString &newName);
38 QString getInterfaceFamily(bool &error);
39 bool setInterfaceFamily(const QString &newName);
40 QString getInterfaceMethod(bool &error);
41 bool setInterfaceMethod(const QString &newName);
42 QString getInterfaceOption(const QString &option, bool &error);
43 bool setInterfaceOption(const QString &option, const QString &value);
44 bool removeInterfaceOption(const QString &option, const QString &value);
45 bool removeAllInterfaceOptions();
46
47 bool setMapping(const QString &interface);
48 bool removeMapping();
49 void addMapping(const QString &options);
50 bool setMap(const QString &map, const QString &value);
51 bool removeMap(const QString &map, const QString &value);
52 QString getMap(const QString &map, bool &error);
53 bool setScript(const QString &argument);
54 QString getScript(bool &error);
55
56 bool write();
57
58private:
59 bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator);
60 bool removeStanza(QStringList::Iterator &stanza);
61 bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value);
62 bool removeAllOptions(const QStringList::Iterator &start);
63 bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value);
64 QString getOption(const QStringList::Iterator &start, const QString &option, bool &error);
65
66 QString interfacesFile;
67 QStringList interfaces;
68 QStringList::Iterator currentIface;
69 QStringList::Iterator currentMapping;
70
71 QStringList acceptedFamily;
72};
73
74#endif
75
76// interfaces
77