summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces/interface.h
blob: fc064fe6cf812421ab48741f583e7d216e97e9d4 (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
#ifndef INTERFACE_H
#define INTERFACE_H

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

class Module;

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);
  virtual ~Interface(){};
  
  virtual QString getInterfaceName(){ QString n(this->name()); return n; };
  
  virtual bool getStatus(){ return status; };
  virtual void setStatus(bool newStatus);

  virtual bool isAttached(){ return attached; };
  virtual void setAttached(bool isAttached=false);
  
  virtual QString getHardwareName(){ return hardwareName; };
  virtual void setHardwareName(QString name="Unknown");
  
  virtual Module* getModuleOwner(){ return moduleOwner; };
  virtual void setModuleOwner(Module *owner=NULL);

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

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

private:
  // Interface information
  bool status;
  bool attached;
  QString hardwareName;
  Module *moduleOwner;
  
  // Network information
  QString macAddress;
  QString ip;
  QString broadcast;
  QString subnetMask;
  bool dhcp;
  QString dhcpServerIp;
  QString leaseObtained;
  QString leaseExpires;

};

#endif

// interface.h