summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces/interface.h
blob: e9ab0c23abcd43e1f528e7683623258c147db16e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef INTERFACE_H
#define INTERFACE_H

#include <qstring.h>
#include <qobject.h>

class Module;

/**
 * A Interface represents a physical device. You can
 * inherit it and create also virtual devices. Like saved
 * ppp dial ups or vpn. Interface is used for representing
 * your interface to the User and its actions.
 *
 */
class Interface : public QObject{
  Q_OBJECT

signals:
  void updateInterface(Interface *i);
  void updateMessage(const QString &message);

public:
  Interface(QObject * parent=0, const char * name= "unknown", bool status = false);

  QString getInterfaceName() const { QString n(this->name()); return n; };
  void setInterfaceName( const QString &n ) { this->setName(n); };

  bool getStatus() const { return status; };
  void setStatus(bool newStatus);

  bool isAttached() const { return attached; };
  void setAttached(bool isAttached=false);

  QString getHardwareName() const { return hardwareName; };
  void setHardwareName(const QString &name="Unknown");

  Module* getModuleOwner() const { return moduleOwner; };
  void setModuleOwner(Module *owner=NULL);

  // inet information.
  QString getMacAddress() const { return macAddress; };
  QString getIp() const { return ip; };
  QString getSubnetMask() const { return subnetMask; };
  QString getBroadcast() const { return broadcast; };
  bool isDhcp() const { return dhcp; };
  QString getDhcpServerIp() const { return dhcpServerIp; };
  QString getLeaseObtained() const { return leaseObtained; };
  QString getLeaseExpires() const { return leaseExpires; };

 public slots:
  virtual bool refresh();
  virtual void start();
  virtual void stop();
  virtual void restart();

protected:
  bool callProcess( const QStringList& name );
  // Interface information
  QString hardwareName;
  Module *moduleOwner;
  bool status;
  bool attached;

  // Network information
  bool dhcp;
  QString dhcpServerIp;
  QString leaseObtained;
  QString leaseExpires;

  QString macAddress;
  QString ip;
  QString broadcast;
  QString subnetMask;

};

#endif

// interface.h