summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehw/tdenetworkdevice.cpp
blob: ad4b71a6bc070b848b6c35c52acd0646614cfa12 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* This file is part of the TDE libraries
   Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
             (C) 2013 Golubev Alexander <fatzer2@gmail.com>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#include "tdenetworkdevice.h"

// Network connection manager
#include "tdenetworkconnections.h"

#include "config.h"

#ifdef WITH_NETWORK_MANAGER_BACKEND
	#include "network-manager.h"
#endif // WITH_NETWORK_MANAGER_BACKEND


TDENetworkDevice::TDENetworkDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) {
	m_rxbytes = -1;
	m_txbytes = -1;
	m_rxpackets = -1;
	m_txpackets = -1;
	m_connectionManager = NULL;
}

TDENetworkDevice::~TDENetworkDevice() {
	if (m_connectionManager) {
		delete m_connectionManager;
	}
}

TQString TDENetworkDevice::macAddress() {
	return m_macAddress;
}

void TDENetworkDevice::internalSetMacAddress(TQString ma) {
	m_macAddress = ma;
}

TQString TDENetworkDevice::state() {
	return m_state;
}

void TDENetworkDevice::internalSetState(TQString st) {
	m_state = st;
}

bool TDENetworkDevice::carrierPresent() {
	return m_carrier;
}

void TDENetworkDevice::internalSetCarrierPresent(bool cp) {
	m_carrier = cp;
}

bool TDENetworkDevice::dormant() {
	return m_dormant;
}

void TDENetworkDevice::internalSetDormant(bool dm) {
	m_dormant = dm;
}

TQString TDENetworkDevice::ipV4Address() {
	return m_ipV4Address;
}

void TDENetworkDevice::internalSetIpV4Address(TQString ad) {
	m_ipV4Address = ad;
}

TQString TDENetworkDevice::ipV6Address() {
	return m_ipV6Address;
}

void TDENetworkDevice::internalSetIpV6Address(TQString ad) {
	m_ipV6Address = ad;
}

TQString TDENetworkDevice::ipV4Netmask() {
	return m_ipV4Netmask;
}

void TDENetworkDevice::internalSetIpV4Netmask(TQString nm) {
	m_ipV4Netmask = nm;
}

TQString TDENetworkDevice::ipV6Netmask() {
	return m_ipV6Netmask;
}

void TDENetworkDevice::internalSetIpV6Netmask(TQString nm) {
	m_ipV6Netmask = nm;
}

TQString TDENetworkDevice::ipV4Broadcast() {
	return m_ipV4Broadcast;
}

void TDENetworkDevice::internalSetIpV4Broadcast(TQString br) {
	m_ipV4Broadcast = br;
}

TQString TDENetworkDevice::ipV6Broadcast() {
	return m_ipV6Broadcast;
}

void TDENetworkDevice::internalSetIpV6Broadcast(TQString br) {
	m_ipV6Broadcast = br;
}

TQString TDENetworkDevice::ipV4Destination() {
	return m_ipV4Destination;
}

void TDENetworkDevice::internalSetIpV4Destination(TQString ds) {
	m_ipV4Destination = ds;
}

TQString TDENetworkDevice::ipV6Destination() {
	return m_ipV6Destination;
}

void TDENetworkDevice::internalSetIpV6Destination(TQString ds) {
	m_ipV6Destination = ds;
}

double TDENetworkDevice::rxBytes() {
	return m_rxbytes;
}

void TDENetworkDevice::internalSetRxBytes(double rx) {
	m_rxbytes = rx;
}

double TDENetworkDevice::txBytes() {
	return m_txbytes;
}

void TDENetworkDevice::internalSetTxBytes(double tx) {
	m_txbytes = tx;
}

double TDENetworkDevice::rxPackets() {
	return m_rxpackets;
}

void TDENetworkDevice::internalSetRxPackets(double rx) {
	m_rxpackets = rx;
}

double TDENetworkDevice::txPackets() {
	return m_txpackets;
}

void TDENetworkDevice::internalSetTxPackets(double tx) {
	m_txpackets = tx;
}

TDENetworkConnectionManager* TDENetworkDevice::connectionManager() {
#ifdef WITH_NETWORK_MANAGER_BACKEND
	if (!m_connectionManager) {
		m_connectionManager = new TDENetworkConnectionManager_BackendNM(this);
	}
#endif // WITH_NETWORK_MANAGER_BACKEND

	return m_connectionManager;
}

void TDENetworkDevice::internalSetConnectionManager(TDENetworkConnectionManager* mgr) {
	m_connectionManager = mgr;
}

#include "tdenetworkdevice.moc"