You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(18) |
Oct
(11) |
Nov
(3) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
(17) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <f-r...@us...> - 2011-02-12 23:42:23
|
Revision: 245
http://netemul.svn.sourceforge.net/netemul/?rev=245&view=rev
Author: f-r-o-s-t
Date: 2011-02-12 23:42:17 +0000 (Sat, 12 Feb 2011)
Log Message:
-----------
mm to m fixed
Modified Paths:
--------------
trunk/src/dialogs/programdialog.h
Modified: trunk/src/dialogs/programdialog.h
===================================================================
--- trunk/src/dialogs/programdialog.h 2011-02-12 21:06:36 UTC (rev 244)
+++ trunk/src/dialogs/programdialog.h 2011-02-12 23:42:17 UTC (rev 245)
@@ -20,7 +20,7 @@
#ifndef PROGRAMMDIALOG_H
#define PROGRAMMDIALOG_H
-#include "ui_programmdialog.h"
+#include "ui_programdialog.h"
class SmartDevice;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-12 21:06:44
|
Revision: 244
http://netemul.svn.sourceforge.net/netemul/?rev=244&view=rev
Author: f-r-o-s-t
Date: 2011-02-12 21:06:36 +0000 (Sat, 12 Feb 2011)
Log Message:
-----------
All troubles of last revision are resolved, dhcp program works
Modified Paths:
--------------
trunk/src/deviceport.cpp
trunk/src/dialogs/dhcpserverproperty.cpp
trunk/src/dialogs/programdialog.cpp
trunk/src/dialogs/programdialog.h
trunk/src/forms/programdialog.ui
trunk/src/programs/dhcpserverprogram.cpp
trunk/src/programs/dhcpserverprogram.h
trunk/src/programs/programs.pri
Added Paths:
-----------
trunk/src/programs/dhcpdaemon.cpp
trunk/src/programs/dhcpdaemon.h
Removed Paths:
-------------
trunk/src/programs/dhcpdemon.cpp
trunk/src/programs/dhcpdemon.h
Modified: trunk/src/deviceport.cpp
===================================================================
--- trunk/src/deviceport.cpp 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/deviceport.cpp 2011-02-12 21:06:36 UTC (rev 244)
@@ -21,7 +21,7 @@
#include "cabledev.h"
#include "frame.h"
-DevicePort::DevicePort(QObject *parent)
+DevicePort::DevicePort(QObject *parent) :QObject(parent)
{
myShared = false;
myCable = 0;
Modified: trunk/src/dialogs/dhcpserverproperty.cpp
===================================================================
--- trunk/src/dialogs/dhcpserverproperty.cpp 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/dialogs/dhcpserverproperty.cpp 2011-02-12 21:06:36 UTC (rev 244)
@@ -135,11 +135,11 @@
return;
}
myDaemon->setTurnOn(cb_turnOn->isChecked());
- myDaemon->setBeginIp(ie_begin->ipAddress());
- myDaemon->setEndIp(ie_end->ipAddress());
+ myDaemon->setBeginIp(ie_begin->ipText());
+ myDaemon->setEndIp(ie_end->ipText());
myDaemon->setDynamic(cb_dynamic->isChecked());
- myDaemon->setGateway(ie_gatew->ipAddress());
- myDaemon->setMask(ie_mask->ipAddress());
+ myDaemon->setGateway(ie_gatew->ipText());
+ myDaemon->setMask(ie_mask->ipText());
myDaemon->setTime(sb_time->value());
myDaemon->setWaitingTime(sb_waitingTime->value());
}
Modified: trunk/src/dialogs/programdialog.cpp
===================================================================
--- trunk/src/dialogs/programdialog.cpp 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/dialogs/programdialog.cpp 2011-02-12 21:06:36 UTC (rev 244)
@@ -17,12 +17,12 @@
** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
** 02111-1307 USA.
****************************************************************************************/
-#include "programmdialog.h"
+#include "programdialog.h"
#include "smartdevice.h"
#include "installdialog.h"
#include <QCheckBox>
-programmDialog::programmDialog(QWidget *parent) : QDialog(parent)
+ProgramDialog::ProgramDialog(QWidget *parent) : QDialog(parent)
{
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
@@ -31,7 +31,7 @@
/*!
Обновляет список программ.
*/
-void programmDialog::updateList()
+void ProgramDialog::updateList()
{
list->clear();
foreach ( Program *i, s->programs() ){
@@ -44,13 +44,13 @@
}
}
//-------------------------------------------------
-void programmDialog::programmChanged()
+void ProgramDialog::programmChanged()
{
btn_remove->setEnabled( list->currentItem() );
btn_settings->setEnabled( list->currentItem() );
}
-void programmDialog::stateChanged(QListWidgetItem *item)
+void ProgramDialog::stateChanged(QListWidgetItem *item)
{
if ( !item ) return;
Program *p = s->programAt( item->data( Qt::UserRole).toInt() );
@@ -58,7 +58,7 @@
p->updateView();
}
-void programmDialog::setDevice( SmartDevice *d )
+void ProgramDialog::setDevice( SmartDevice *d )
{
s = d;
updateList();
@@ -67,7 +67,7 @@
Слот, вызываемый при нажатии на кнопку Ok,
выполняет все принятые изменения, закрывает диалог.
*/
-void programmDialog::apply()
+void ProgramDialog::apply()
{
for ( int i = 0; i < list->count(); i++) {
QListWidgetItem *n = list->item(i);
@@ -81,7 +81,7 @@
Слот вызывает диалог установки программ,
обновляет список установленных программ.
*/
-void programmDialog::add()
+void ProgramDialog::add()
{
installDialog *d = new installDialog;
d->setDevice( s );
@@ -93,20 +93,20 @@
/*!
Слот удаляет выделенную программу.
*/
-void programmDialog::remove()
+void ProgramDialog::remove()
{
QListWidgetItem *w = list->currentItem();
s->removeProgram( s->programAt(w->data(Qt::UserRole).toInt() ) );
updateList();
}
-void programmDialog::settings()
+void ProgramDialog::settings()
{
s->programAt( list->currentItem()->data(Qt::UserRole).toInt() )->showProperty();
}
//-----------------------------------------------------
-void programmDialog::changeEvent(QEvent *e)
+void ProgramDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
Modified: trunk/src/dialogs/programdialog.h
===================================================================
--- trunk/src/dialogs/programdialog.h 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/dialogs/programdialog.h 2011-02-12 21:06:36 UTC (rev 244)
@@ -27,11 +27,12 @@
/*!
Реализует диалог установленных пограмм устройства.
*/
-class programmDialog : public QDialog, private Ui::programmDialog {
+class ProgramDialog : public QDialog, private Ui::ProgramDialog
+{
Q_OBJECT
- Q_DISABLE_COPY(programmDialog)
+ Q_DISABLE_COPY(ProgramDialog)
public:
- programmDialog(QWidget *parent = 0);
+ ProgramDialog(QWidget *parent = 0);
void setDevice( SmartDevice *d );
protected:
void updateList();
Modified: trunk/src/forms/programdialog.ui
===================================================================
--- trunk/src/forms/programdialog.ui 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/forms/programdialog.ui 2011-02-12 21:06:36 UTC (rev 244)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>programmDialog</class>
- <widget class="QDialog" name="programmDialog">
+ <class>ProgramDialog</class>
+ <widget class="QDialog" name="ProgramDialog">
<property name="geometry">
<rect>
<x>0</x>
@@ -60,7 +60,7 @@
<string>Add</string>
</property>
<property name="icon">
- <iconset>
+ <iconset resource="../../netemul.qrc">
<normaloff>:/im/images/edit_add.png</normaloff>:/im/images/edit_add.png</iconset>
</property>
</widget>
@@ -74,7 +74,7 @@
<string>Settings</string>
</property>
<property name="icon">
- <iconset>
+ <iconset resource="../../netemul.qrc">
<normaloff>:/im/images/setting.png</normaloff>:/im/images/setting.png</iconset>
</property>
</widget>
@@ -88,7 +88,7 @@
<string>Delete</string>
</property>
<property name="icon">
- <iconset>
+ <iconset resource="../../netemul.qrc">
<normaloff>:/im/images/edit_remove.png</normaloff>:/im/images/edit_remove.png</iconset>
</property>
</widget>
@@ -112,7 +112,7 @@
<string>Ok</string>
</property>
<property name="icon">
- <iconset>
+ <iconset resource="../../netemul.qrc">
<normaloff>:/im/images/ok.png</normaloff>:/im/images/ok.png</iconset>
</property>
</widget>
@@ -123,7 +123,7 @@
<string>Cancel</string>
</property>
<property name="icon">
- <iconset>
+ <iconset resource="../../netemul.qrc">
<normaloff>:/im/images/not.png</normaloff>:/im/images/not.png</iconset>
</property>
</widget>
@@ -134,12 +134,14 @@
</item>
</layout>
</widget>
- <resources/>
+ <resources>
+ <include location="../../netemul.qrc"/>
+ </resources>
<connections>
<connection>
<sender>btn_cancel</sender>
<signal>clicked()</signal>
- <receiver>programmDialog</receiver>
+ <receiver>ProgramDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
@@ -155,7 +157,7 @@
<connection>
<sender>btn_ok</sender>
<signal>clicked()</signal>
- <receiver>programmDialog</receiver>
+ <receiver>ProgramDialog</receiver>
<slot>apply()</slot>
<hints>
<hint type="sourcelabel">
@@ -171,7 +173,7 @@
<connection>
<sender>btn_add</sender>
<signal>clicked()</signal>
- <receiver>programmDialog</receiver>
+ <receiver>ProgramDialog</receiver>
<slot>add()</slot>
<hints>
<hint type="sourcelabel">
@@ -187,7 +189,7 @@
<connection>
<sender>btn_remove</sender>
<signal>clicked()</signal>
- <receiver>programmDialog</receiver>
+ <receiver>ProgramDialog</receiver>
<slot>remove()</slot>
<hints>
<hint type="sourcelabel">
@@ -203,7 +205,7 @@
<connection>
<sender>btn_settings</sender>
<signal>clicked()</signal>
- <receiver>programmDialog</receiver>
+ <receiver>ProgramDialog</receiver>
<slot>settings()</slot>
<hints>
<hint type="sourcelabel">
@@ -219,7 +221,7 @@
<connection>
<sender>list</sender>
<signal>currentRowChanged(int)</signal>
- <receiver>programmDialog</receiver>
+ <receiver>ProgramDialog</receiver>
<slot>programmChanged()</slot>
<hints>
<hint type="sourcelabel">
@@ -235,7 +237,7 @@
<connection>
<sender>list</sender>
<signal>itemClicked(QListWidgetItem*)</signal>
- <receiver>programmDialog</receiver>
+ <receiver>ProgramDialog</receiver>
<slot>stateChanged(QListWidgetItem*)</slot>
<hints>
<hint type="sourcelabel">
Copied: trunk/src/programs/dhcpdaemon.cpp (from rev 243, trunk/src/programs/dhcpdemon.cpp)
===================================================================
--- trunk/src/programs/dhcpdaemon.cpp (rev 0)
+++ trunk/src/programs/dhcpdaemon.cpp 2011-02-12 21:06:36 UTC (rev 244)
@@ -0,0 +1,254 @@
+#include "dhcpdaemon.h"
+#include "interface.h"
+#include "udppacket.h"
+#include "dhcppacket.h"
+#include "dhcpservermodel.h"
+
+void DhcpDaemon::setInterface(Interface *inter)
+{
+ myInterface = inter;
+ connect(myInterface, SIGNAL(receivedPacket(IpPacket)), SLOT(execute(IpPacket)));
+}
+
+DhcpDaemon::DhcpDaemon(QObject *parent) : QObject(parent)
+{
+ myInterface = 0;
+ initialize();
+}
+
+DhcpDaemon::DhcpDaemon(Interface *inter, QObject *parent) : QObject(parent)
+{
+ setInterface(inter);
+ myInterfaceName = inter->name();
+ myDhcpModel = new DhcpServerModel(this);
+ initialize();
+}
+
+DhcpDaemon::~DhcpDaemon() {
+ delete myDhcpModel;
+ clients.clear();
+}
+
+void DhcpDaemon::initialize()
+{
+ myDynamic = false;
+ myTime = 300;
+ myWaitingTime = 60;
+}
+
+void DhcpDaemon::executeDiscover(DhcpPacket packet)
+{
+ ClientState *client = findClient( packet.xid() );
+ if ( client && client->state == ClientState::IN_USE ) return;
+ client = chooseStatic(packet);
+ if ( client ) {
+ makeAnswer(client, DhcpPacket::DHCPOFFER);
+ return;
+ }
+ if ( !myDynamic ) return;
+ client = chooseDynamic(packet);
+ if ( client ) makeAnswer(client,DhcpPacket::DHCPOFFER);
+}
+
+void DhcpDaemon::executeRequest(DhcpPacket packet)
+{
+ ClientState *client = findClient( packet.xid() );
+ if ( !client ) return;
+ if ( packet.siaddr() != myInterface->ip() ) {
+ clients.removeOne(client);
+ delete client;
+ return;
+ }
+ makeAnswer( client, DhcpPacket::DHCPACK );
+}
+
+void DhcpDaemon::executeDecline(DhcpPacket packet)
+{
+ ClientState *client = findClient(packet.yiaddr());
+ if ( !client ) return;
+ client->state = ClientState::DECLINE;
+}
+
+ClientState* DhcpDaemon::chooseStatic(DhcpPacket packet)
+{
+ StaticDhcpRecord *rec = myDhcpModel->recordWithMac(packet.chaddr());
+ if ( !rec ) return 0;
+ ClientState *client = new ClientState(rec);
+ if ( findClient(client->ip) ) return 0;
+ client->requestTimer = 0;
+ client->xid = packet.xid();
+ clients << client;
+ return client;
+}
+
+/*!
+ Выбираем адрес из динамического диапазона.
+ @return указатель на созданную запись.
+ */
+ClientState* DhcpDaemon::chooseDynamic(DhcpPacket packet)
+{
+ ClientState *cl = new ClientState;
+ cl->requestTimer = 0;
+ ClientState *c = findClient(packet.yiaddr());
+ if ( !packet.yiaddr().isEmpty() && !c ) cl->ip = packet.yiaddr();
+ else cl->ip = giveDynamicIp();
+ if ( cl->ip.isEmpty() ) return NULL;
+ cl->mac = packet.chaddr();
+ cl->xid = packet.xid();
+ cl->time = myTime;
+ cl->mask = myMask;
+ cl->gateway = myGateway;
+ clients << cl;
+ return cl;
+}
+
+/*!
+ Создаем dhcp пакет.
+ @param client - запись клиента на основе которой будем создавать пакет.
+ @param state - тип отправляемого сообщения.
+ @return созданный пакет.
+ */
+DhcpPacket DhcpDaemon::createDhcpPacket( ClientState *client, int state ) const
+{
+ if ( state == DhcpPacket::DHCPOFFER ) client->state = ClientState::WAIT_REQUEST;
+ else client->state = ClientState::IN_USE;
+ DhcpPacket p;
+ p.setType( state );
+ p.setXid( client->xid );
+ p.setChaddr( client->mac );
+ p.setYiaddr( client->ip );
+ p.setMask( client->mask );
+ p.setGateway( client->gateway );
+ p.setSiaddr( myInterface->ip() );
+ p.setTime( client->time );
+ return p;
+}
+//------------------------------------------------------------
+
+void DhcpDaemon::sendDhcp(DhcpPacket packet) const
+{
+ UdpPacket udp;
+ udp.setSender( SERVER_SOCKET );
+ udp.setReceiver( CLIENT_SOCKET );
+ udp.pack( packet.toData() );
+ IpPacket p( myInterface->ip(), IpAddress::full() );
+ p.pack( udp.toData() );
+ p.setUpProtocol( IpPacket::udp );
+ myInterface->sendPacket(p);
+}
+
+void DhcpDaemon::makeAnswer(ClientState *client, int type)
+{
+ DhcpPacket dhcp = createDhcpPacket(client,type);
+ sendDhcp(dhcp);
+}
+
+/*! Ищет в списке клиента с данным идентификатрором и проверкой состояния записи.
+ @param xid - идентификатрор.
+ @return указатель на запись из списка, если xid совпали, или 0 в противном случае.
+ */
+ClientState* DhcpDaemon::findClient(int xid) const
+{
+ foreach ( ClientState *i, clients )
+ if ( i->xid == xid && i->state != ClientState::DECLINE ) return i;
+ return 0;
+}
+//------------------------------------------------------------
+/*! Ищет в списке клиента с данным ip-адресом.
+ @param ip - адрес.
+ @return указатель на запись из списка, если ip совпали, или 0 в противном случае.
+ */
+ClientState* DhcpDaemon::findClient(IpAddress ip) const
+{
+ foreach ( ClientState *i, clients )
+ if ( i->ip == ip ) return i;
+ return 0;
+}
+//--------------------------------------------------------------
+/*!
+ Выбирает ip-адрес из динамического диапазона
+ @return выбранный адрес, или "0.0.0.0", если нет свободных адресов.
+ */
+IpAddress DhcpDaemon::giveDynamicIp() const
+{
+ bool isContains = false;
+ quint32 i = myBeginIp.toInt();
+ while ( i <= myEndIp.toInt() ) {
+ isContains = myDhcpModel->containRecord( IpAddress(i) ) || findClient(IpAddress(i))
+ || myInterface->ip().toInt() == i;
+ if ( isContains ) {
+ i++;
+ isContains = false;
+ }
+ else {
+ return IpAddress(i);
+ }
+ }
+ return IpAddress("0.0.0.0");
+}
+//-------------------------------------------------------------
+void DhcpDaemon::incTime() {
+ bool canDelete = false;
+ foreach ( ClientState *i, clients ) {
+ if ( i->state == ClientState::WAIT_REQUEST ) {
+ if ( ++i->requestTimer == myWaitingTime ) canDelete = true;
+ }
+ else if ( i->state == ClientState::IN_USE && --i->time == 0 ) canDelete = true;
+ if ( canDelete ) {
+ canDelete = false;
+ clients.removeOne(i);
+ delete i;
+ }
+ }
+}
+
+void DhcpDaemon::addDhcpServerModel(DhcpServerModel *model)
+{
+ myDhcpModel = model;
+}
+
+//--------------------Public slots------------------
+void DhcpDaemon::execute(IpPacket p)
+{
+ if ( !isTurnOn() ) return;
+ if ( p.receiverSocket() == DhcpDaemon::SERVER_SOCKET ) {
+ UdpPacket u( p.unpack() );
+ DhcpPacket d(u.unpack());
+ switch ( d.type() ) {
+ case DhcpPacket::DHCPDISCOVER :
+ executeDiscover(d);
+ break;
+ case DhcpPacket::DHCPREQUEST :
+ executeRequest(d);
+ break;
+ case DhcpPacket::DHCPDECLINE :
+ executeDecline(d);
+ break;
+ }
+ }
+}
+
+//--------------------------------------------------
+
+
+void DhcpDaemon::read(QDataStream &stream)
+{
+ stream >> myInterfaceName;
+ stream >> myBeginIp;
+ stream >> myEndIp;
+ stream >> myMask;
+ stream >> myGateway;
+ stream >> myTime;
+ stream >> myDynamic;
+ stream >> myWaitingTime;
+}
+
+//-----------------------------------------------------------------
+ClientState::ClientState(StaticDhcpRecord *rec)
+{
+ ip = rec->yiaddr;
+ mac = rec->chaddr;
+ mask = rec->mask;
+ gateway = rec->gateway;
+ time = rec->time;
+}
Copied: trunk/src/programs/dhcpdaemon.h (from rev 243, trunk/src/programs/dhcpdemon.h)
===================================================================
--- trunk/src/programs/dhcpdaemon.h (rev 0)
+++ trunk/src/programs/dhcpdaemon.h 2011-02-12 21:06:36 UTC (rev 244)
@@ -0,0 +1,115 @@
+#ifndef DHCPDEMON_H
+#define DHCPDEMON_H
+
+#include "ipaddress.h"
+#include "macaddress.h"
+#include "ippacket.h"
+
+class UdpSocket;
+class DhcpPacket;
+class Interface;
+class StaticDhcpRecord;
+class DhcpServerModel;
+
+struct ClientState {
+ int xid;
+ int state;
+ MacAddress mac;
+ IpAddress ip;
+ IpAddress mask;
+ IpAddress gateway;
+ int time;
+ int requestTimer;
+ enum { WAIT_REQUEST = 0, IN_USE = 1, DECLINE = 2 };
+ ClientState(StaticDhcpRecord *rec);
+ ClientState() { }
+};
+
+class DhcpDaemon : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY( QString interfaceName READ interfaceName WRITE setInterfaceName )
+ Q_PROPERTY( QString beginIp READ beginIp WRITE setBeginIp )
+ Q_PROPERTY( QString endIp READ endIp WRITE setEndIp )
+ Q_PROPERTY( QString mask READ mask WRITE setMask )
+ Q_PROPERTY( QString gateway READ gateway WRITE setGateway )
+ Q_PROPERTY( int time READ time WRITE setTime )
+ Q_PROPERTY( int waitingTime READ waitingTime WRITE setWaitingTime )
+ Q_PROPERTY( bool dynamic READ dynamic WRITE setDynamic )
+ Q_PROPERTY( bool turnOn READ isTurnOn WRITE setTurnOn )
+public:
+ enum { CLIENT_SOCKET = 67 , SERVER_SOCKET = 68 };
+
+ DhcpDaemon(QObject* parent = 0);
+ DhcpDaemon(Interface *inter, QObject* parent = 0);
+ ~DhcpDaemon();
+ void setInterface(Interface *inter);
+ void setInterfaceName(const QString &inter) { myInterfaceName = inter; }
+ void setBeginIp(const QString &ip) { myBeginIp.setIp(ip); }
+ void setEndIp(const QString &ip) { myEndIp.setIp(ip); }
+ void setMask(const QString &ip) { myMask.setIp(ip); }
+ void setGateway(const QString &ip) { myGateway.setIp(ip); }
+ void setTime(int t) { myTime = t; }
+ void setWaitingTime(int t) { myWaitingTime = t; }
+ void setDynamic(bool b) { myDynamic = b; }
+ void setTurnOn(bool b) { myTurnOn = b; }
+ Interface* interface() const { return myInterface; }
+ QString interfaceName() const { return myInterfaceName; }
+ QString beginIp() const { return myBeginIp.toString(); }
+ QString endIp() const { return myEndIp.toString(); }
+ QString mask() const { return myMask.toString(); }
+ QString gateway() const { return myGateway.toString(); }
+ int time() const { return myTime; }
+ int waitingTime() const { return myWaitingTime; }
+ bool dynamic() const { return myDynamic; }
+ bool isTurnOn() const { return myTurnOn; }
+ DhcpServerModel* dhcpModel() { return myDhcpModel; }
+ void incTime();
+ IpAddress giveDynamicIp() const;
+
+ void read(QDataStream &stream);
+
+ Q_INVOKABLE void addDhcpServerModel(DhcpServerModel *model);
+
+// Обработка пакетов
+public:
+ void executeDiscover(DhcpPacket packet);
+ void executeRequest(DhcpPacket packet);
+ void executeDecline(DhcpPacket packet);
+
+public slots:
+ void execute(IpPacket p);
+
+// Функция инициализации для конструкторов
+private:
+ void initialize();
+
+// Функции создания и отправки ответа
+private:
+ void makeAnswer(ClientState* client, int type);
+ void sendDhcp(DhcpPacket packet) const;
+ DhcpPacket createDhcpPacket(ClientState *client, int state) const;
+
+// Функции выбора и нахождения записи клиента
+private:
+ ClientState* chooseStatic(DhcpPacket packet);
+ ClientState* chooseDynamic(DhcpPacket packet);
+ ClientState* findClient( int xid ) const;
+ ClientState* findClient(IpAddress ip) const;
+
+private:
+ QList<ClientState*> clients;
+ Interface *myInterface;
+ QString myInterfaceName;
+ DhcpServerModel *myDhcpModel;
+ IpAddress myBeginIp;
+ IpAddress myEndIp;
+ IpAddress myMask;
+ IpAddress myGateway;
+ int myTime;
+ int myWaitingTime;
+ bool myDynamic;
+ bool myTurnOn;
+};
+
+#endif // DHCPDEMON_H
Deleted: trunk/src/programs/dhcpdemon.cpp
===================================================================
--- trunk/src/programs/dhcpdemon.cpp 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/programs/dhcpdemon.cpp 2011-02-12 21:06:36 UTC (rev 244)
@@ -1,207 +0,0 @@
-#include "dhcpdemon.h"
-#include "interface.h"
-#include "udppacket.h"
-#include "dhcppacket.h"
-#include "dhcpservermodel.h"
-
-DhcpDemon::DhcpDemon(QObject *parent) : QObject(parent)
-{
- initialize();
-}
-
-DhcpDemon::DhcpDemon(Interface *inter) {
- myInterface = inter->name();
- initialize();
-}
-
-DhcpDemon::~DhcpDemon() {
- delete myDhcpModel;
- //delete receiver;
- clients.clear();
-}
-
-void DhcpDemon::executeDiscover(DhcpPacket packet)
-{
- ClientState *client = findClient( packet.xid() );
- if ( client && client->state == ClientState::IN_USE ) return;
- client = chooseStatic(packet);
- if ( client ) {
- makeAnswer(client, DhcpPacket::DHCPOFFER);
- return;
- }
- if ( !myDynamic ) return;
- client = chooseDynamic(packet);
- if ( client ) makeAnswer(client,DhcpPacket::DHCPOFFER);
-}
-
-void DhcpDemon::executeRequest(DhcpPacket packet)
-{
- ClientState *client = findClient( packet.xid() );
- if ( !client ) return;
-// if ( packet.siaddr() != myDevice->adapter(myInterface)->ip() ) {
-// clients.removeOne(client);
-// delete client;
-// return;
-// }
- makeAnswer( client, DhcpPacket::DHCPACK );
-}
-
-void DhcpDemon::executeDecline(DhcpPacket packet)
-{
- ClientState *client = findClient(packet.yiaddr());
- if ( !client ) return;
- client->state = ClientState::DECLINE;
-}
-
-void DhcpDemon::initialize()
-{
- myDhcpModel = new DhcpServerModel;
- myDynamic = false;
- myTime = 300;
- myWaitingTime = 60;
-}
-
-ClientState* DhcpDemon::chooseStatic(DhcpPacket packet)
-{
- StaticDhcpRecord *rec = myDhcpModel->recordWithMac(packet.chaddr());
- if ( !rec ) return 0;
- ClientState *client = new ClientState(rec);
- if ( findClient(client->ip) ) return 0;
- client->requestTimer = 0;
- client->xid = packet.xid();
- clients << client;
- return client;
-}
-
-/*!
- Выбираем адрес из динамического диапазона.
- @return указатель на созданную запись.
- */
-ClientState* DhcpDemon::chooseDynamic(DhcpPacket packet)
-{
- ClientState *cl = new ClientState;
- cl->requestTimer = 0;
- ClientState *c = findClient(packet.yiaddr());
- if ( !packet.yiaddr().isEmpty() && !c ) cl->ip = packet.yiaddr();
- else cl->ip = giveDynamicIp();
- if ( cl->ip.isEmpty() ) return NULL;
- cl->mac = packet.chaddr();
- cl->xid = packet.xid();
- cl->time = myTime;
- cl->mask = myMask;
- cl->gateway = myGateway;
- clients << cl;
- return cl;
-}
-
-/*!
- Создаем dhcp пакет.
- @param client - запись клиента на основе которой будем создавать пакет.
- @param state - тип отправляемого сообщения.
- @return созданный пакет.
- */
-DhcpPacket DhcpDemon::createDhcpPacket( ClientState *client, int state ) const
-{
- if ( state == DhcpPacket::DHCPOFFER ) client->state = ClientState::WAIT_REQUEST;
- else client->state = ClientState::IN_USE;
- DhcpPacket p;
- p.setType( state );
- p.setXid( client->xid );
- p.setChaddr( client->mac );
- p.setYiaddr( client->ip );
- p.setMask( client->mask );
- p.setGateway( client->gateway );
- //p.setSiaddr( myDevice->adapter(myInterface)->ip() );
- p.setTime( client->time );
- return p;
-}
-//------------------------------------------------------------
-
-void DhcpDemon::sendDhcp(DhcpPacket packet) const
-{
- UdpPacket udp;
- udp.setSender( SERVER_SOCKET );
- udp.setReceiver( CLIENT_SOCKET );
- udp.pack( packet.toData() );
- //ipPacket p( myDevice->adapter(myInterface)->ip(), ipAddress::full() );
- //p.pack( udp.toData() );
- //p.setUpProtocol( ipPacket::udp );
- //myDevice->adapter(myInterface)->sendPacket(p);
-}
-
-void DhcpDemon::makeAnswer(ClientState *client, int type)
-{
- DhcpPacket dhcp = createDhcpPacket(client,type);
- sendDhcp(dhcp);
-}
-
-/*! Ищет в списке клиента с данным идентификатрором и проверкой состояния записи.
- @param xid - идентификатрор.
- @return указатель на запись из списка, если xid совпали, или 0 в противном случае.
- */
-ClientState* DhcpDemon::findClient(int xid) const
-{
- foreach ( ClientState *i, clients )
- if ( i->xid == xid && i->state != ClientState::DECLINE ) return i;
- return 0;
-}
-//------------------------------------------------------------
-/*! Ищет в списке клиента с данным ip-адресом.
- @param ip - адрес.
- @return указатель на запись из списка, если ip совпали, или 0 в противном случае.
- */
-ClientState* DhcpDemon::findClient(IpAddress ip) const
-{
- foreach ( ClientState *i, clients )
- if ( i->ip == ip ) return i;
- return 0;
-}
-//--------------------------------------------------------------
-/*!
- Выбирает ip-адрес из динамического диапазона
- @return выбранный адрес, или "0.0.0.0", если нет свободных адресов.
- */
-IpAddress DhcpDemon::giveDynamicIp() const
-{
- bool isContains = false;
- quint32 i = myBeginIp.toInt();
- while ( i <= myEndIp.toInt() ) {
-// isContains = myDhcpModel->containRecord( ipAddress(i) ) || findClient(ipAddress(i))
-// || myDevice->adapter(myInterface)->ip().toInt() == i;
- if ( isContains ) {
- i++;
- isContains = false;
- }
- else {
- return IpAddress(i);
- }
- }
- return IpAddress("0.0.0.0");
-}
-//-------------------------------------------------------------
-void DhcpDemon::incTime() {
- bool canDelete = false;
- foreach ( ClientState *i, clients ) {
- if ( i->state == ClientState::WAIT_REQUEST ) {
- if ( ++i->requestTimer == myWaitingTime ) canDelete = true;
- }
- else if ( i->state == ClientState::IN_USE && --i->time == 0 ) canDelete = true;
- if ( canDelete ) {
- canDelete = false;
- clients.removeOne(i);
- delete i;
- }
- }
-}
-
-void DhcpDemon::read(QDataStream &stream)
-{
- stream >> myInterface;
- stream >> myBeginIp;
- stream >> myEndIp;
- stream >> myMask;
- stream >> myGateway;
- stream >> myTime;
- stream >> myDynamic;
- stream >> myWaitingTime;
-}
Deleted: trunk/src/programs/dhcpdemon.h
===================================================================
--- trunk/src/programs/dhcpdemon.h 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/programs/dhcpdemon.h 2011-02-12 21:06:36 UTC (rev 244)
@@ -1,105 +0,0 @@
-#ifndef DHCPDEMON_H
-#define DHCPDEMON_H
-
-#include "ipaddress.h"
-#include "macaddress.h"
-
-class UdpSocket;
-class DhcpPacket;
-class Interface;
-class StaticDhcpRecord;
-class DhcpServerModel;
-
-struct ClientState {
- int xid;
- int state;
- MacAddress mac;
- IpAddress ip;
- IpAddress mask;
- IpAddress gateway;
- int time;
- int requestTimer;
- enum { WAIT_REQUEST = 0, IN_USE = 1, DECLINE = 2 };
- ClientState(StaticDhcpRecord *rec) {
-
- }
-
- ClientState() { }
-};
-
-class DhcpDemon : public QObject
-{
- Q_OBJECT
- Q_PROPERTY( QString interfaceName READ interfaceName WRITE setInterfaceName )
- Q_PROPERTY( QString beginIp READ beginIp WRITE setBeginIp )
- Q_PROPERTY( QString endIp READ endIp WRITE setEndIp )
- Q_PROPERTY( QString mask READ mask WRITE setMask )
- Q_PROPERTY( QString gateway READ gateway WRITE setGateway )
- Q_PROPERTY( int time READ time WRITE setTime )
- Q_PROPERTY( int waitingTime READ waitingTime WRITE setWaitingTime )
- Q_PROPERTY( bool dynamic READ dynamic WRITE setDynamic )
-public:
- enum { CLIENT_SOCKET = 67 , SERVER_SOCKET = 68 };
-
- DhcpDemon(QObject* parent = 0);
- DhcpDemon(Interface *inter);
- ~DhcpDemon();
- void setInterfaceName( QString inter ) { myInterface = inter; }
- void setBeginIp(QString ip) { myBeginIp.setIp(ip); }
- void setEndIp(QString ip) { myEndIp.setIp(ip); }
- void setMask(QString m) { myMask.setIp(m); }
- void setGateway(QString g) { myGateway.setIp(g); }
- void setTime(int t) { myTime = t; }
- void setWaitingTime(int t) { myWaitingTime = t; }
- void setDynamic(bool b) { myDynamic = b; }
- QString interfaceName() const { return myInterface; }
- QString beginIp() const { return myBeginIp.toString(); }
- QString endIp() const { return myEndIp.toString(); }
- QString mask() const { return myMask.toString(); }
- QString gateway() const { return myGateway.toString(); }
- int time() const { return myTime; }
- int waitingTime() const { return myWaitingTime; }
- bool dynamic() const { return myDynamic; }
- DhcpServerModel* dhcpModel() { return myDhcpModel; }
- void incTime();
- IpAddress giveDynamicIp() const;
-
- void read(QDataStream &stream);
-
-// Обработка пакетов
-public:
- void executeDiscover(DhcpPacket packet);
- void executeRequest(DhcpPacket packet);
- void executeDecline(DhcpPacket packet);
-
-// Функция инициализации для конструкторов
-private:
- void initialize();
-
-// Функции создания и отправки ответа
-private:
- void makeAnswer(ClientState* client, int type);
- void sendDhcp(DhcpPacket packet) const;
- DhcpPacket createDhcpPacket(ClientState *client, int state) const;
-
-// Функции выбора и нахождения записи клиента
-private:
- ClientState* chooseStatic(DhcpPacket packet);
- ClientState* chooseDynamic(DhcpPacket packet);
- ClientState* findClient( int xid ) const;
- ClientState* findClient(IpAddress ip) const;
-
-private:
- QList<ClientState*> clients;
- QString myInterface;
- DhcpServerModel *myDhcpModel;
- IpAddress myBeginIp;
- IpAddress myEndIp;
- IpAddress myMask;
- IpAddress myGateway;
- int myTime;
- int myWaitingTime;
- bool myDynamic;
-};
-
-#endif // DHCPDEMON_H
Modified: trunk/src/programs/dhcpserverprogram.cpp
===================================================================
--- trunk/src/programs/dhcpserverprogram.cpp 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/programs/dhcpserverprogram.cpp 2011-02-12 21:06:36 UTC (rev 244)
@@ -34,83 +34,77 @@
myName = tr("DHCP server");
myServerCount++;
myServerName = QString("Server%1").arg(myServerCount);
- myDemons.clear();
- qDeleteAll(myDemons);
+ myDaemons.clear();
+ qDeleteAll(myDaemons);
}
DhcpServerProgram::~DhcpServerProgram()
{
- myDevice->disposeSocket(receiver);
- myDemons.clear();
- qDeleteAll(myDemons);
+ myDaemons.clear();
+ qDeleteAll(myDaemons);
}
void DhcpServerProgram::setDevice(SmartDevice *s)
{
if ( s == 0 ) return;
Program::setDevice(s);
- receiver = myDevice->openSocket(DhcpDemon::SERVER_SOCKET, SocketFactory::UDP);
- //receiver = new udpSocket(myDevice, SERVER_SOCKET);
foreach ( Interface *i, myDevice->interfaces() ) {
if ( i->isConnect() ) {
- DhcpDemon *demon = new DhcpDemon(i);
- myDemons << demon;
+ DhcpDaemon *daemon = new DhcpDaemon(i, this);
+ myDaemons.insert(i, daemon);
}
}
- receiver->setBind("0.0.0.0");
- connect( receiver , SIGNAL(readyRead(QByteArray)), SLOT(execute(QByteArray)));
- connect( myDevice, SIGNAL(interfaceConnected(QString)), SLOT(checkInterface(QString)) );
+ connect( myDevice, SIGNAL(interfaceConnected(QString)), SLOT(checkInterfaceOnConnect(QString)) );
+ connect( myDevice, SIGNAL(interfaceDeleted(QString)), SLOT(checkInterfaceOnDelete(QString)) );
}
-//void dhcpServerProgramm::checkInterface(QString port)
-//{
-// if ( myInterface.isEmpty() ) setInterfaceName(port);
-//}
-
-void DhcpServerProgram::execute(QByteArray data)
+void DhcpServerProgram::checkInterfaceOnConnect(QString port)
{
- DhcpPacket packet(data);
- foreach ( DhcpDemon *demon, myDemons ) {
- IpAddress deviceIp = myDevice->adapter(demon->interfaceName())->ip();
- if ( deviceIp.isEmpty() ) {
- QMessageBox::warning(0,tr("Warning"),
- tr("Your DHCP server <i>%1</i> isn't configured.").arg(myServerName),
- QMessageBox::Ok, QMessageBox::Ok);
- return;
- }
+ Interface *i = myDevice->adapter(port);
+ if ( !myDaemons.contains(i) ) {
+ DhcpDaemon *daem = new DhcpDaemon(i, this);
+ myDaemons.insert(i, daem);
+ }
+}
- if ( deviceIp == packet.siaddr() ) {
- switch ( packet.type() ) {
- case DhcpPacket::DHCPDISCOVER :
- demon->executeDiscover(packet);
- break;
- case DhcpPacket::DHCPREQUEST :
- demon->executeRequest(packet);
- break;
- case DhcpPacket::DHCPDECLINE :
- demon->executeDecline(packet);
- break;
- }
- }
+void DhcpServerProgram::checkInterfaceOnDelete(QString port)
+{
+ Interface *i = myDevice->adapter(port);
+ if ( !myDaemons.contains(i) ) {
+ DhcpDaemon *daem = myDaemons.take(i);
+ delete daem;
}
}
-
-
void DhcpServerProgram::incTime()
{
- foreach ( DhcpDemon *demon, myDemons ) {
+ foreach ( DhcpDaemon *demon, myDaemons.values() ) {
demon->incTime();
}
}
void DhcpServerProgram::showProperty()
{
- DhcpServerProperty *d = new DhcpServerProperty(myDevice);
- d->setProgramm(this);
+ DhcpServerSetting *setting = new DhcpServerSetting(this);
+ DhcpServerProperty *d = new DhcpServerProperty(setting);
d->exec();
}
+DhcpDaemon* DhcpServerProgram::daemonOf(Interface *inter)
+{
+ return myDaemons.value(inter);
+}
+
+void DhcpServerProgram::addDhcpDaemon(DhcpDaemon *daemon)
+{
+ Interface *i = daemon->interface();
+ if ( !i ) {
+ i = myDevice->adapter(daemon->interfaceName());
+ daemon->setInterface(i);
+ }
+ myDaemons.insert(i, daemon);
+}
+
/*!
Записывает отличительные черты в поток.
@param stream - поток для записи.
@@ -119,7 +113,7 @@
{
stream << DHCPServer;
Program::write(stream);
- DhcpDemon *d = myDemons.at(0);
+ DhcpDaemon *d = myDaemons.values().at(0);
d->dhcpModel()->write(stream);
stream << d->interfaceName();
stream << d->beginIp();
@@ -139,21 +133,9 @@
void DhcpServerProgram::read(QDataStream &stream)
{
Program::read(stream);
- DhcpDemon *d = new DhcpDemon(device()->interfaces().at(0));
+ DhcpDaemon *d = new DhcpDaemon(device()->interfaces().at(0));
d->dhcpModel()->read(stream);
d->read(stream);
}
//---------------------------------------------------
-
-
-//---------------------------------------------------
-//СlientState::СlientState(StaticDhcpRecord *rec)
-//{
-// ip = rec->yiaddr;
-// mac = rec->chaddr;
-// mask = rec->mask;
-// gateway = rec->gateway;
-// time = rec->time;
-//}
-
Modified: trunk/src/programs/dhcpserverprogram.h
===================================================================
--- trunk/src/programs/dhcpserverprogram.h 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/programs/dhcpserverprogram.h 2011-02-12 21:06:36 UTC (rev 244)
@@ -21,7 +21,7 @@
#define DHCPSERVERPROGRAMM_H
#include "program.h"
-#include "dhcpdemon.h"
+#include "dhcpdaemon.h"
class AbstractSocket;
@@ -47,17 +47,31 @@
void write(QDataStream &stream) const;
void read(QDataStream &stream);
-// Слоты
+ DhcpDaemon* daemonOf(Interface *inter);
+
+ Q_INVOKABLE void addDhcpDaemon(DhcpDaemon *daemon);
+
+ // Слоты
public slots:
- void execute(QByteArray data);
-// void checkInterface(QString port);
+ void checkInterfaceOnConnect(QString port);
+ void checkInterfaceOnDelete(QString port);
// Переменные
private:
static int myServerCount;
QString myServerName;
- QList<DhcpDemon*> myDemons;
- AbstractSocket *receiver;
+ QMap<Interface*, DhcpDaemon*> myDaemons;
};
+class DhcpServerSetting
+{
+public:
+ DhcpServerSetting(DhcpServerProgram *prog) { myProgram = prog; }
+ DhcpServerProgram* program() { return myProgram; }
+ DhcpDaemon* daemonOf(Interface *inter) { return myProgram->daemonOf(inter); }
+
+private:
+ DhcpServerProgram *myProgram;
+};
+
#endif // DHCPSERVERPROGRAMM_H
Modified: trunk/src/programs/programs.pri
===================================================================
--- trunk/src/programs/programs.pri 2011-02-11 23:05:12 UTC (rev 243)
+++ trunk/src/programs/programs.pri 2011-02-12 21:06:36 UTC (rev 244)
@@ -3,10 +3,10 @@
src/programs/dhcpserverprogram.h \
src/programs/dhcpclientprogram.h \
src/programs/spoofingprogram.h \
- src/programs/dhcpdemon.h
+ src/programs/dhcpdaemon.h
SOURCES += src/programs/ripprogram.cpp \
src/programs/program.cpp \
src/programs/dhcpserverprogram.cpp \
src/programs/dhcpclientprogram.cpp \
src/programs/spoofingprogram.cpp \
- src/programs/dhcpdemon.cpp
+ src/programs/dhcpdaemon.cpp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-11 23:05:21
|
Revision: 243
http://netemul.svn.sourceforge.net/netemul/?rev=243&view=rev
Author: f-r-o-s-t
Date: 2011-02-11 23:05:12 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
I'm sorry =(
Modified Paths:
--------------
trunk/src/devices/smartdevice.h
trunk/src/programs/dhcpdemon.h
Added Paths:
-----------
trunk/src/programs/
trunk/src/programs/dhcpclientprogram.cpp
trunk/src/programs/dhcpclientprogram.h
trunk/src/programs/dhcpserverprogram.cpp
trunk/src/programs/dhcpserverprogram.h
trunk/src/programs/program.cpp
trunk/src/programs/program.h
trunk/src/programs/programs.pri
trunk/src/programs/ripprogram.cpp
trunk/src/programs/ripprogram.h
trunk/src/programs/spoofingprogram.cpp
trunk/src/programs/spoofingprogram.h
Removed Paths:
-------------
trunk/src/programs/dhcpclientprogramm.cpp
trunk/src/programs/dhcpclientprogramm.h
trunk/src/programs/dhcpserverprogramm.cpp
trunk/src/programs/dhcpserverprogramm.h
trunk/src/programs/programmrep.cpp
trunk/src/programs/programmrep.h
trunk/src/programs/programms.pri
trunk/src/programs/ripprogramm.cpp
trunk/src/programs/ripprogramm.h
trunk/src/programs/spoofingprogramm.cpp
trunk/src/programs/spoofingprogramm.h
Modified: trunk/src/devices/smartdevice.h
===================================================================
--- trunk/src/devices/smartdevice.h 2011-02-11 21:56:14 UTC (rev 242)
+++ trunk/src/devices/smartdevice.h 2011-02-11 23:05:12 UTC (rev 243)
@@ -24,7 +24,7 @@
#include <QtGui/QIcon>
#include "deviceimpl.h"
#include "interface.h"
-#include "programrep.h"
+#include "program.h"
class RouteModel;
class ArpModel;
Copied: trunk/src/programs/dhcpclientprogram.cpp (from rev 240, trunk/src/programms/dhcpclientprogramm.cpp)
===================================================================
--- trunk/src/programs/dhcpclientprogram.cpp (rev 0)
+++ trunk/src/programs/dhcpclientprogram.cpp 2011-02-11 23:05:12 UTC (rev 243)
@@ -0,0 +1,376 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#include "dhcpclientprogram.h"
+#include "smartdevice.h"
+#include "udpsocket.h"
+#include "dhcpclientproperty.h"
+#include "udppacket.h"
+
+DhcpClientProgram::DhcpClientProgram(QObject *parent) : Program(parent)
+{
+ myName = tr("DHCP client");
+ myOfferTime = 60;
+}
+
+DhcpClientProgram::~DhcpClientProgram()
+{
+ qDeleteAll(myStates);
+ // Make it
+ //delete listener;
+ myDevice->disposeSocket(listener);
+}
+
+void DhcpClientProgram::incTime()
+{
+ foreach ( InterfaceState *i , myStates ) {
+ --i->time;
+ if ( i->time <= 0 ) {
+ switch ( i->state ) {
+ case InterfaceState::CS_ALL_RIGHT: restartSession(i); break;
+ case InterfaceState::CS_WAIT_VARIANT: sendDiscover( i->name ); break;
+ case InterfaceState::CS_WAIT_RESPONSE: sendRequest(i->name ); break;
+ }
+ }
+ }
+}
+/*!
+ * Переопределяем функцию установки устройства чтобы соединиться со слотом.
+ * @param s - указатель на устройство на которое установлена программа.
+ */
+void DhcpClientProgram::setDevice(SmartDevice *s)
+{
+ if ( s == 0 ) {
+ foreach ( InterfaceState *i , myStates ) resetClient(i);
+ return;
+ }
+ Program::setDevice(s);
+ listener = s->openSocket( CLIENT_SOCKET , SmartDevice::UDP );
+ listener->setBind("0.0.0.0");
+ connect( listener , SIGNAL(readyRead(QByteArray)) , SLOT(processData(QByteArray)) );
+ connect( s , SIGNAL(interfaceDeleted(QString)), SLOT(deleteInterface(QString)) );
+ foreach ( InterfaceState *i , myStates ) {
+ resetClient( i );
+ }
+}
+//------------------------------------------------------
+
+void DhcpClientProgram::resetClient(InterfaceState *session)
+{
+ myDevice->adapter(session->name)->setIp(IpAddress("0.0.0.0"));
+ myDevice->adapter(session->name)->setMask(IpAddress("0.0.0.0"));
+ myDevice->connectedNet( myDevice->adapter( session->name ) );
+ myDevice->setGateway("0.0.0.0");
+}
+
+bool DhcpClientProgram::isUnderDhcpControl(const QString name) const
+{
+ foreach ( InterfaceState *i , myStates )
+ if ( i->name == name ) {
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Посылает Request серверу
+ @param name - имя интерфейса
+ */
+void DhcpClientProgram::sendRequest(const QString &name)
+{
+ InterfaceState *t = stateAt(name);
+ if ( !t ) return;
+ if ( REPEAT_COUNT < ++t->count ) {
+ restartSession(t);
+ return;
+ }
+ t->time = myOfferTime;
+ DhcpPacket message;
+ message.setType( DhcpPacket::DHCPREQUEST );
+ message.setXid( t->xid );
+ message.setChaddr( myDevice->adapter(t->name)->mac() );
+ message.setSiaddr( t->serverAddress );
+ sendDhcpMessage(message,t);
+}
+//------------------------------------------------------
+/*!
+ * Посылает запрос на получение настроек.
+ * @param name - имя интерфейса.
+ */
+void DhcpClientProgram::sendDiscover(const QString &name)
+{
+ InterfaceState *t = stateAt(name);
+ if ( !t ) return;
+ t->state = InterfaceState::CS_WAIT_VARIANT;
+ t->time = myOfferTime;
+ t->count = 0;
+ DhcpPacket message;
+ message.setType( DhcpPacket::DHCPDISCOVER );
+ message.setXid(t->xid);
+ message.setChaddr( myDevice->adapter(t->name)->mac() );
+ if ( !t->lastIp.isEmpty() ) message.setYiaddr( t->lastIp );
+ sendDhcpMessage(message,t);
+}
+//--------------------------------------------------------------
+void DhcpClientProgram::sendDecLine(const QString &name)
+{
+ InterfaceState *t = stateAt(name);
+ if ( !t ) return;
+ DhcpPacket message;
+ message.setType( DhcpPacket::DHCPDECLINE );
+ message.setXid( t->xid );
+ if ( !t->lastIp.isEmpty() ) message.setYiaddr( t->lastIp );
+ message.setChaddr( myDevice->adapter( t->name )->mac() );
+ sendDhcpMessage( message , t );
+}
+/*!
+ Обрабатывает входящие данные.
+ @param data - пришедщие данные.
+ */
+void DhcpClientProgram::processData(QByteArray data)
+{
+ DhcpPacket packet(data);
+ switch ( packet.type() ) {
+ case DhcpPacket::DHCPOFFER: receiveOffer(packet); break;
+ case DhcpPacket::DHCPACK: receiveAck(packet); break;
+ }
+}
+//---------------------------------------------------------------
+/*!
+ Начинает заново сессию
+ @param session - указатель на сессию
+ */
+void DhcpClientProgram::restartSession(InterfaceState *session)
+{
+ resetClient(session);
+ sendDiscover( session->name );
+}
+//---------------------------------------------------------------
+/*!
+ Обрабатывает входящее предложение настроек.
+ @param packet - пакет с настройками.
+ */
+void DhcpClientProgram::receiveOffer(DhcpPacket packet)
+{
+ foreach ( InterfaceState *i , myStates )
+ if ( i->xid == packet.xid() && i->state == InterfaceState::CS_WAIT_VARIANT ) {
+ i->state = InterfaceState::CS_WAIT_RESPONSE;
+ i->serverAddress = packet.siaddr();
+ sendRequest( i->name );
+ return;
+ }
+}
+//---------------------------------------------------------------
+/*!
+ Обрабатывает вхоодящий АСК.
+ @param packet - ack пакет
+ */
+void DhcpClientProgram::receiveAck(DhcpPacket packet)
+{
+ foreach ( InterfaceState *i , myStates )
+ if ( i->xid == packet.xid() && i->state == InterfaceState::CS_WAIT_RESPONSE ) {
+ i->state = InterfaceState::CS_ALL_RIGHT;
+ myDevice->adapter(i->name)->setIp( packet.yiaddr() );
+ myDevice->adapter(i->name)->setMask( packet.mask() );
+ myDevice->connectedNet(myDevice->adapter(i->name));
+ myDevice->setGateway( packet.gateway().toString() );
+ myDevice->updateView();
+ i->time = packet.time();
+ i->lastIp = packet.yiaddr();
+ myDevice->adapter(i->name)->sendArpRequest( packet.yiaddr() );
+ return;
+ }
+}
+//---------------------------------------------------------------
+/*!
+ Отправляет пакет с нужного интерфейса.
+ @param message - пакет.
+ @param state - поток-отправитель.
+ */
+void DhcpClientProgram::sendDhcpMessage(DhcpPacket message, InterfaceState *state)
+{
+ if (!myDevice->adapter(state->name)->isConnect() ) return;
+ UdpPacket udp;
+ udp.setSender(CLIENT_SOCKET);
+ udp.setReceiver(SERVER_SOCKET);
+ udp.pack( message.toData() );
+ IpPacket packet( myDevice->adapter(state->name)->ip() , IpAddress::full() );
+ packet.pack( udp.toData() );
+ packet.setUpProtocol( IpPacket::udp );
+ myDevice->adapter(state->name)->sendPacket( packet);
+}
+//---------------------------------------------------------------
+/*!
+ * Показывает диалог программы.
+ */
+void DhcpClientProgram::showProperty()
+{
+ dhcpClientProperty *d = new dhcpClientProperty;
+ d->setProgramm(this);
+ d->exec();
+}
+//---------------------------------------------------------------
+/*!
+ * Ищет указанный сеанс связи для интерфейса.
+ * @param name - имя интерфейса.
+ * @return указатель на сеанс, если такого нет то 0
+ */
+InterfaceState* DhcpClientProgram::stateAt(const QString name)
+{
+ foreach ( InterfaceState *i , myStates )
+ if ( i->name == name ) return i;
+ return 0;
+}
+//--------------------------------------------------------------
+QStringList DhcpClientProgram::interfacesList() const
+{
+ return myDevice->sockets();
+}
+/*!
+ * Возвращаем иконку подключения, для указанного интерфейса.
+ * @param имя интерефейса
+ * @return иконка соединения
+ */
+QIcon DhcpClientProgram::isConnectSocketIcon(const QString &name) const
+{
+ return myDevice->isConnectSocketIcon(name);
+}
+//-----------------------------------------------------------------------
+/*!
+ * Вызывается когда у устройства удаляется интерфейс, если мы за
+ * ним следим, то мы прекращаем это делать и удаляем его из списка.
+ */
+void DhcpClientProgram::deleteInterface(const QString name)
+{
+ InterfaceState *t = stateAt(name);
+ if ( !t ) return;
+ myStates.removeOne(t);
+ delete t;
+}
+//--------------------------------------------------------------------
+/*!
+ * Если интерфейс еще не добавлен под наблюдение, то добавляем его.
+ * @param name - имя интерфейса.
+ * @param b - включить или выключить наблюдение.
+ */
+void DhcpClientProgram::observeInterface(const QString &name, bool b)
+{
+ if ( !myEnable ) return;
+ InterfaceState *temp = stateAt(name);
+ if ( temp ) {
+ if ( b ) return;
+ resetClient( temp );
+ myStates.removeOne(temp);
+ delete temp;
+ return;
+ }
+ if ( !b ) return;
+ InterfaceState *session = new InterfaceState;
+ session->name = name;
+ session->xid = qrand()%5000;
+ session->time = 0;
+ connect( myDevice->adapter(session->name) , SIGNAL(equalIpDetected()) , SLOT(onDetectEqualIp()) );
+ myStates << session;
+ sendDiscover(session->name);
+}
+//--------------------------------------------------------------------
+
+void DhcpClientProgram::onDetectEqualIp()
+{
+ Interface *t = qobject_cast<Interface*>(sender());
+ InterfaceState *client = 0;
+ foreach ( InterfaceState *i , myStates )
+ if ( myDevice->adapter( i->name ) == t ) client = i;
+ if ( !client ) return;
+ sendDecLine(client->name);
+ client->xid = qrand()%5000;
+ client->lastIp.setIp("0.0.0.0");
+ restartSession( client);
+}
+
+Qt::CheckState DhcpClientProgram::checkedState(const QString &name) const
+{
+ foreach ( InterfaceState *i , myStates )
+ if ( i->name == name ) return Qt::Checked;
+ return Qt::Unchecked;
+}
+/*!
+ Записывает отличительные черты в поток.
+ @param stream - поток для записи.
+*/
+void DhcpClientProgram::write(QDataStream &stream) const
+{
+ stream << DHCPClient;
+ Program::write(stream);
+ stream << myOfferTime;
+ stream << myStates.size();
+ foreach ( InterfaceState *i , myStates ) i->write(stream);
+}
+//---------------------------------------------------
+/*!
+ Считывает отличительные черты из потока.
+ @param stream - поток для чтения.
+*/
+void DhcpClientProgram::read(QDataStream &stream)
+{
+ Program::read(stream);
+ stream >> myOfferTime;
+ int n;
+ stream >> n;
+ for ( int i = 0 ; i < n ; i++ ) {
+ InterfaceState *temp = new InterfaceState;
+ temp->read(stream);
+ temp->time = 0;
+ temp->state = InterfaceState::CS_WAIT_VARIANT;
+ myStates << temp;
+ }
+}
+//---------------------------------------------------
+QVariantList DhcpClientProgram::statesObjectList() const
+{
+ QVariantList list;
+ foreach ( InterfaceState *i , myStates ) {
+ QObject *o = new InterfaceStateObject(i);
+ list << qVariantFromValue(o);
+ }
+ return list;
+}
+
+void DhcpClientProgram::addInterfaceStateObject(InterfaceStateObject *obj)
+{
+ InterfaceState *s = obj->object();
+ s->state = InterfaceState::CS_WAIT_VARIANT;
+ myStates << s;
+ obj->deleteLater();
+}
+
+//---------------------------------------------------
+//---------------------------------------------------
+void InterfaceState::write(QDataStream &stream) const
+{
+ stream << xid << time << serverAddress << lastIp << name;
+}
+
+void InterfaceState::read(QDataStream &stream)
+{
+ stream >> xid >> time >> serverAddress >> lastIp >> name;
+}
+
+
+
Copied: trunk/src/programs/dhcpclientprogram.h (from rev 240, trunk/src/programms/dhcpclientprogramm.h)
===================================================================
--- trunk/src/programs/dhcpclientprogram.h (rev 0)
+++ trunk/src/programs/dhcpclientprogram.h 2011-02-11 23:05:12 UTC (rev 243)
@@ -0,0 +1,130 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#ifndef DHCPCLIENTPROGRAMM_H
+#define DHCPCLIENTPROGRAMM_H
+
+#include <QMetaType>
+#include <QIcon>
+#include "program.h"
+#include "dhcppacket.h"
+
+static const int MINUTE = 60;
+static const int REPEAT_COUNT = 3;
+
+class Interface;
+class AbstractSocket;
+
+struct InterfaceState {
+ enum { CS_NONE , CS_WAIT_VARIANT , CS_WAIT_RESPONSE , CS_ALL_RIGHT };
+ int state;
+ int xid;
+ int time;
+ qint8 count;
+ IpAddress serverAddress;
+ IpAddress lastIp;
+ QString name;
+ void write(QDataStream &stream) const;
+ void read(QDataStream &stream);
+};
+typedef QList<InterfaceState*> InterfaceStateList;
+
+//xid << time << serverAddress << lastIp << name;
+
+class InterfaceStateObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY( int xid READ xid WRITE setXid )
+ Q_PROPERTY( QString serverAddress READ serverAddress WRITE setServerAddress )
+ Q_PROPERTY( QString lastIp READ lastIp WRITE setLastIp )
+ Q_PROPERTY( QString name READ name WRITE setName )
+public:
+ InterfaceStateObject(InterfaceState *s) { st = s; }
+ InterfaceStateObject(QObject *parent = 0) : QObject(parent) { st = new InterfaceState(); }
+
+ InterfaceState* object() { return st; }
+
+ int xid() const { return st->xid; }
+ QString serverAddress() const { return st->serverAddress.toString(); }
+ QString lastIp() const { return st->lastIp.toString(); }
+ QString name() const { return st->name; }
+
+ void setXid( int x ) { st->xid = x; }
+ void setServerAddress( const QString &x ) { st->serverAddress.setIp(x); }
+ void setLastIp( const QString &x ) { st->lastIp.setIp(x); }
+ void setName( const QString &x ) { st->name = x; }
+
+private:
+ InterfaceState *st;
+};
+
+
+class DhcpClientProgram : public Program
+{
+ Q_OBJECT
+ Q_PROPERTY( int offerTime READ offerTime WRITE setOfferTime )
+ Q_PROPERTY( QVariantList states READ statesObjectList )
+public:
+ enum { DHCPClient = 1 ,CLIENT_SOCKET = 67, SERVER_SOCKET = 68 };
+ DhcpClientProgram(QObject *parent = 0);
+ ~DhcpClientProgram();
+ int id() const { return DHCPClient; }
+ bool interrupt(int) { return false; }
+ void setDevice(SmartDevice *s);
+ void showProperty();
+ void incTime();
+ bool isUnderDhcpControl(const QString name) const;
+ void write(QDataStream &stream) const;
+ void read(QDataStream &stream);
+ void observeInterface(const QString &name, bool b);
+ QStringList interfacesList() const;
+ QIcon isConnectSocketIcon(const QString &name) const;
+ Qt::CheckState checkedState(const QString &name) const;
+ virtual QString featureName() const { return "dc"; }
+public slots:
+ void deleteInterface(const QString name);
+private slots:
+ void processData(QByteArray data);
+ void onDetectEqualIp();
+//Property
+public:
+ Q_INVOKABLE void addInterfaceStateObject(InterfaceStateObject *obj);
+ void setOfferTime(int time) { myOfferTime = time; }
+ int offerTime() const { return myOfferTime; }
+ InterfaceStateList states() { return myStates; }
+ QVariantList statesObjectList() const;
+
+private:
+ InterfaceStateList myStates;
+ int myOfferTime;
+
+private:
+ void sendDhcpMessage(DhcpPacket message, InterfaceState *state);
+ void sendRequest(const QString &name);
+ void sendDiscover(const QString &name);
+ void sendDecLine(const QString &name);
+ void receiveOffer(DhcpPacket packet);
+ void receiveAck(DhcpPacket packet);
+ void restartSession( InterfaceState *session);
+ InterfaceState* stateAt(const QString name);
+ void resetClient( InterfaceState *session);
+ AbstractSocket *listener;
+};
+
+#endif // DHCPCLIENTPROGRAMM_H
Deleted: trunk/src/programs/dhcpclientprogramm.cpp
===================================================================
--- trunk/src/programms/dhcpclientprogramm.cpp 2011-02-11 21:27:21 UTC (rev 240)
+++ trunk/src/programs/dhcpclientprogramm.cpp 2011-02-11 23:05:12 UTC (rev 243)
@@ -1,376 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#include "dhcpclientprogramm.h"
-#include "smartdevice.h"
-#include "udpsocket.h"
-#include "dhcpclientproperty.h"
-#include "udppacket.h"
-
-DhcpClientProgram::DhcpClientProgram(QObject *parent) : Program(parent)
-{
- myName = tr("DHCP client");
- myOfferTime = 60;
-}
-
-DhcpClientProgram::~DhcpClientProgram()
-{
- qDeleteAll(myStates);
- // Make it
- //delete listener;
- myDevice->disposeSocket(listener);
-}
-
-void DhcpClientProgram::incTime()
-{
- foreach ( InterfaceState *i , myStates ) {
- --i->time;
- if ( i->time <= 0 ) {
- switch ( i->state ) {
- case InterfaceState::CS_ALL_RIGHT: restartSession(i); break;
- case InterfaceState::CS_WAIT_VARIANT: sendDiscover( i->name ); break;
- case InterfaceState::CS_WAIT_RESPONSE: sendRequest(i->name ); break;
- }
- }
- }
-}
-/*!
- * Переопределяем функцию установки устройства чтобы соединиться со слотом.
- * @param s - указатель на устройство на которое установлена программа.
- */
-void DhcpClientProgram::setDevice(SmartDevice *s)
-{
- if ( s == 0 ) {
- foreach ( InterfaceState *i , myStates ) resetClient(i);
- return;
- }
- Program::setDevice(s);
- listener = s->openSocket( CLIENT_SOCKET , SmartDevice::UDP );
- listener->setBind("0.0.0.0");
- connect( listener , SIGNAL(readyRead(QByteArray)) , SLOT(processData(QByteArray)) );
- connect( s , SIGNAL(interfaceDeleted(QString)), SLOT(deleteInterface(QString)) );
- foreach ( InterfaceState *i , myStates ) {
- resetClient( i );
- }
-}
-//------------------------------------------------------
-
-void DhcpClientProgram::resetClient(InterfaceState *session)
-{
- myDevice->adapter(session->name)->setIp(IpAddress("0.0.0.0"));
- myDevice->adapter(session->name)->setMask(IpAddress("0.0.0.0"));
- myDevice->connectedNet( myDevice->adapter( session->name ) );
- myDevice->setGateway("0.0.0.0");
-}
-
-bool DhcpClientProgram::isUnderDhcpControl(const QString name) const
-{
- foreach ( InterfaceState *i , myStates )
- if ( i->name == name ) {
- return true;
- }
- return false;
-}
-
-/*!
- Посылает Request серверу
- @param name - имя интерфейса
- */
-void DhcpClientProgram::sendRequest(const QString &name)
-{
- InterfaceState *t = stateAt(name);
- if ( !t ) return;
- if ( REPEAT_COUNT < ++t->count ) {
- restartSession(t);
- return;
- }
- t->time = myOfferTime;
- DhcpPacket message;
- message.setType( DhcpPacket::DHCPREQUEST );
- message.setXid( t->xid );
- message.setChaddr( myDevice->adapter(t->name)->mac() );
- message.setSiaddr( t->serverAddress );
- sendDhcpMessage(message,t);
-}
-//------------------------------------------------------
-/*!
- * Посылает запрос на получение настроек.
- * @param name - имя интерфейса.
- */
-void DhcpClientProgram::sendDiscover(const QString &name)
-{
- InterfaceState *t = stateAt(name);
- if ( !t ) return;
- t->state = InterfaceState::CS_WAIT_VARIANT;
- t->time = myOfferTime;
- t->count = 0;
- DhcpPacket message;
- message.setType( DhcpPacket::DHCPDISCOVER );
- message.setXid(t->xid);
- message.setChaddr( myDevice->adapter(t->name)->mac() );
- if ( !t->lastIp.isEmpty() ) message.setYiaddr( t->lastIp );
- sendDhcpMessage(message,t);
-}
-//--------------------------------------------------------------
-void DhcpClientProgram::sendDecLine(const QString &name)
-{
- InterfaceState *t = stateAt(name);
- if ( !t ) return;
- DhcpPacket message;
- message.setType( DhcpPacket::DHCPDECLINE );
- message.setXid( t->xid );
- if ( !t->lastIp.isEmpty() ) message.setYiaddr( t->lastIp );
- message.setChaddr( myDevice->adapter( t->name )->mac() );
- sendDhcpMessage( message , t );
-}
-/*!
- Обрабатывает входящие данные.
- @param data - пришедщие данные.
- */
-void DhcpClientProgram::processData(QByteArray data)
-{
- DhcpPacket packet(data);
- switch ( packet.type() ) {
- case DhcpPacket::DHCPOFFER: receiveOffer(packet); break;
- case DhcpPacket::DHCPACK: receiveAck(packet); break;
- }
-}
-//---------------------------------------------------------------
-/*!
- Начинает заново сессию
- @param session - указатель на сессию
- */
-void DhcpClientProgram::restartSession(InterfaceState *session)
-{
- resetClient(session);
- sendDiscover( session->name );
-}
-//---------------------------------------------------------------
-/*!
- Обрабатывает входящее предложение настроек.
- @param packet - пакет с настройками.
- */
-void DhcpClientProgram::receiveOffer(DhcpPacket packet)
-{
- foreach ( InterfaceState *i , myStates )
- if ( i->xid == packet.xid() && i->state == InterfaceState::CS_WAIT_VARIANT ) {
- i->state = InterfaceState::CS_WAIT_RESPONSE;
- i->serverAddress = packet.siaddr();
- sendRequest( i->name );
- return;
- }
-}
-//---------------------------------------------------------------
-/*!
- Обрабатывает вхоодящий АСК.
- @param packet - ack пакет
- */
-void DhcpClientProgram::receiveAck(DhcpPacket packet)
-{
- foreach ( InterfaceState *i , myStates )
- if ( i->xid == packet.xid() && i->state == InterfaceState::CS_WAIT_RESPONSE ) {
- i->state = InterfaceState::CS_ALL_RIGHT;
- myDevice->adapter(i->name)->setIp( packet.yiaddr() );
- myDevice->adapter(i->name)->setMask( packet.mask() );
- myDevice->connectedNet(myDevice->adapter(i->name));
- myDevice->setGateway( packet.gateway().toString() );
- myDevice->updateView();
- i->time = packet.time();
- i->lastIp = packet.yiaddr();
- myDevice->adapter(i->name)->sendArpRequest( packet.yiaddr() );
- return;
- }
-}
-//---------------------------------------------------------------
-/*!
- Отправляет пакет с нужного интерфейса.
- @param message - пакет.
- @param state - поток-отправитель.
- */
-void DhcpClientProgram::sendDhcpMessage(DhcpPacket message, InterfaceState *state)
-{
- if (!myDevice->adapter(state->name)->isConnect() ) return;
- UdpPacket udp;
- udp.setSender(CLIENT_SOCKET);
- udp.setReceiver(SERVER_SOCKET);
- udp.pack( message.toData() );
- IpPacket packet( myDevice->adapter(state->name)->ip() , IpAddress::full() );
- packet.pack( udp.toData() );
- packet.setUpProtocol( IpPacket::udp );
- myDevice->adapter(state->name)->sendPacket( packet);
-}
-//---------------------------------------------------------------
-/*!
- * Показывает диалог программы.
- */
-void DhcpClientProgram::showProperty()
-{
- dhcpClientProperty *d = new dhcpClientProperty;
- d->setProgramm(this);
- d->exec();
-}
-//---------------------------------------------------------------
-/*!
- * Ищет указанный сеанс связи для интерфейса.
- * @param name - имя интерфейса.
- * @return указатель на сеанс, если такого нет то 0
- */
-InterfaceState* DhcpClientProgram::stateAt(const QString name)
-{
- foreach ( InterfaceState *i , myStates )
- if ( i->name == name ) return i;
- return 0;
-}
-//--------------------------------------------------------------
-QStringList DhcpClientProgram::interfacesList() const
-{
- return myDevice->sockets();
-}
-/*!
- * Возвращаем иконку подключения, для указанного интерфейса.
- * @param имя интерефейса
- * @return иконка соединения
- */
-QIcon DhcpClientProgram::isConnectSocketIcon(const QString &name) const
-{
- return myDevice->isConnectSocketIcon(name);
-}
-//-----------------------------------------------------------------------
-/*!
- * Вызывается когда у устройства удаляется интерфейс, если мы за
- * ним следим, то мы прекращаем это делать и удаляем его из списка.
- */
-void DhcpClientProgram::deleteInterface(const QString name)
-{
- InterfaceState *t = stateAt(name);
- if ( !t ) return;
- myStates.removeOne(t);
- delete t;
-}
-//--------------------------------------------------------------------
-/*!
- * Если интерфейс еще не добавлен под наблюдение, то добавляем его.
- * @param name - имя интерфейса.
- * @param b - включить или выключить наблюдение.
- */
-void DhcpClientProgram::observeInterface(const QString &name, bool b)
-{
- if ( !myEnable ) return;
- InterfaceState *temp = stateAt(name);
- if ( temp ) {
- if ( b ) return;
- resetClient( temp );
- myStates.removeOne(temp);
- delete temp;
- return;
- }
- if ( !b ) return;
- InterfaceState *session = new InterfaceState;
- session->name = name;
- session->xid = qrand()%5000;
- session->time = 0;
- connect( myDevice->adapter(session->name) , SIGNAL(equalIpDetected()) , SLOT(onDetectEqualIp()) );
- myStates << session;
- sendDiscover(session->name);
-}
-//--------------------------------------------------------------------
-
-void DhcpClientProgram::onDetectEqualIp()
-{
- Interface *t = qobject_cast<Interface*>(sender());
- InterfaceState *client = 0;
- foreach ( InterfaceState *i , myStates )
- if ( myDevice->adapter( i->name ) == t ) client = i;
- if ( !client ) return;
- sendDecLine(client->name);
- client->xid = qrand()%5000;
- client->lastIp.setIp("0.0.0.0");
- restartSession( client);
-}
-
-Qt::CheckState DhcpClientProgram::checkedState(const QString &name) const
-{
- foreach ( InterfaceState *i , myStates )
- if ( i->name == name ) return Qt::Checked;
- return Qt::Unchecked;
-}
-/*!
- Записывает отличительные черты в поток.
- @param stream - поток для записи.
-*/
-void DhcpClientProgram::write(QDataStream &stream) const
-{
- stream << DHCPClient;
- Program::write(stream);
- stream << myOfferTime;
- stream << myStates.size();
- foreach ( InterfaceState *i , myStates ) i->write(stream);
-}
-//---------------------------------------------------
-/*!
- Считывает отличительные черты из потока.
- @param stream - поток для чтения.
-*/
-void DhcpClientProgram::read(QDataStream &stream)
-{
- Program::read(stream);
- stream >> myOfferTime;
- int n;
- stream >> n;
- for ( int i = 0 ; i < n ; i++ ) {
- InterfaceState *temp = new InterfaceState;
- temp->read(stream);
- temp->time = 0;
- temp->state = InterfaceState::CS_WAIT_VARIANT;
- myStates << temp;
- }
-}
-//---------------------------------------------------
-QVariantList DhcpClientProgram::statesObjectList() const
-{
- QVariantList list;
- foreach ( InterfaceState *i , myStates ) {
- QObject *o = new InterfaceStateObject(i);
- list << qVariantFromValue(o);
- }
- return list;
-}
-
-void DhcpClientProgram::addInterfaceStateObject(InterfaceStateObject *obj)
-{
- InterfaceState *s = obj->object();
- s->state = InterfaceState::CS_WAIT_VARIANT;
- myStates << s;
- obj->deleteLater();
-}
-
-//---------------------------------------------------
-//---------------------------------------------------
-void InterfaceState::write(QDataStream &stream) const
-{
- stream << xid << time << serverAddress << lastIp << name;
-}
-
-void InterfaceState::read(QDataStream &stream)
-{
- stream >> xid >> time >> serverAddress >> lastIp >> name;
-}
-
-
-
Deleted: trunk/src/programs/dhcpclientprogramm.h
===================================================================
--- trunk/src/programms/dhcpclientprogramm.h 2011-02-11 21:27:21 UTC (rev 240)
+++ trunk/src/programs/dhcpclientprogramm.h 2011-02-11 23:05:12 UTC (rev 243)
@@ -1,130 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#ifndef DHCPCLIENTPROGRAMM_H
-#define DHCPCLIENTPROGRAMM_H
-
-#include <QMetaType>
-#include <QIcon>
-#include "programmrep.h"
-#include "dhcppacket.h"
-
-static const int MINUTE = 60;
-static const int REPEAT_COUNT = 3;
-
-class Interface;
-class AbstractSocket;
-
-struct InterfaceState {
- enum { CS_NONE , CS_WAIT_VARIANT , CS_WAIT_RESPONSE , CS_ALL_RIGHT };
- int state;
- int xid;
- int time;
- qint8 count;
- IpAddress serverAddress;
- IpAddress lastIp;
- QString name;
- void write(QDataStream &stream) const;
- void read(QDataStream &stream);
-};
-typedef QList<InterfaceState*> InterfaceStateList;
-
-//xid << time << serverAddress << lastIp << name;
-
-class InterfaceStateObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY( int xid READ xid WRITE setXid )
- Q_PROPERTY( QString serverAddress READ serverAddress WRITE setServerAddress )
- Q_PROPERTY( QString lastIp READ lastIp WRITE setLastIp )
- Q_PROPERTY( QString name READ name WRITE setName )
-public:
- InterfaceStateObject(InterfaceState *s) { st = s; }
- InterfaceStateObject(QObject *parent = 0) : QObject(parent) { st = new InterfaceState(); }
-
- InterfaceState* object() { return st; }
-
- int xid() const { return st->xid; }
- QString serverAddress() const { return st->serverAddress.toString(); }
- QString lastIp() const { return st->lastIp.toString(); }
- QString name() const { return st->name; }
-
- void setXid( int x ) { st->xid = x; }
- void setServerAddress( const QString &x ) { st->serverAddress.setIp(x); }
- void setLastIp( const QString &x ) { st->lastIp.setIp(x); }
- void setName( const QString &x ) { st->name = x; }
-
-private:
- InterfaceState *st;
-};
-
-
-class DhcpClientProgram : public Program
-{
- Q_OBJECT
- Q_PROPERTY( int offerTime READ offerTime WRITE setOfferTime )
- Q_PROPERTY( QVariantList states READ statesObjectList )
-public:
- enum { DHCPClient = 1 ,CLIENT_SOCKET = 67, SERVER_SOCKET = 68 };
- DhcpClientProgram(QObject *parent = 0);
- ~DhcpClientProgram();
- int id() const { return DHCPClient; }
- bool interrupt(int) { return false; }
- void setDevice(SmartDevice *s);
- void showProperty();
- void incTime();
- bool isUnderDhcpControl(const QString name) const;
- void write(QDataStream &stream) const;
- void read(QDataStream &stream);
- void observeInterface(const QString &name, bool b);
- QStringList interfacesList() const;
- QIcon isConnectSocketIcon(const QString &name) const;
- Qt::CheckState checkedState(const QString &name) const;
- virtual QString featureName() const { return "dc"; }
-public slots:
- void deleteInterface(const QString name);
-private slots:
- void processData(QByteArray data);
- void onDetectEqualIp();
-//Property
-public:
- Q_INVOKABLE void addInterfaceStateObject(InterfaceStateObject *obj);
- void setOfferTime(int time) { myOfferTime = time; }
- int offerTime() const { return myOfferTime; }
- InterfaceStateList states() { return myStates; }
- QVariantList statesObjectList() const;
-
-private:
- InterfaceStateList myStates;
- int myOfferTime;
-
-private:
- void sendDhcpMessage(DhcpPacket message, InterfaceState *state);
- void sendRequest(const QString &name);
- void sendDiscover(const QString &name);
- void sendDecLine(const QString &name);
- void receiveOffer(DhcpPacket packet);
- void receiveAck(DhcpPacket packet);
- void restartSession( InterfaceState *session);
- InterfaceState* stateAt(const QString name);
- void resetClient( InterfaceState *session);
- AbstractSocket *listener;
-};
-
-#endif // DHCPCLIENTPROGRAMM_H
Modified: trunk/src/programs/dhcpdemon.h
===================================================================
--- trunk/src/programms/dhcpdemon.h 2011-02-11 21:27:21 UTC (rev 240)
+++ trunk/src/programs/dhcpdemon.h 2011-02-11 23:05:12 UTC (rev 243)
@@ -30,7 +30,6 @@
class DhcpDemon : public QObject
{
Q_OBJECT
-
Q_PROPERTY( QString interfaceName READ interfaceName WRITE setInterfaceName )
Q_PROPERTY( QString beginIp READ beginIp WRITE setBeginIp )
Q_PROPERTY( QString endIp READ endIp WRITE setEndIp )
@@ -39,7 +38,6 @@
Q_PROPERTY( int time READ time WRITE setTime )
Q_PROPERTY( int waitingTime READ waitingTime WRITE setWaitingTime )
Q_PROPERTY( bool dynamic READ dynamic WRITE setDynamic )
-
public:
enum { CLIENT_SOCKET = 67 , SERVER_SOCKET = 68 };
Copied: trunk/src/programs/dhcpserverprogram.cpp (from rev 240, trunk/src/programms/dhcpserverprogramm.cpp)
===================================================================
--- trunk/src/programs/dhcpserverprogram.cpp (rev 0)
+++ trunk/src/programs/dhcpserverprogram.cpp 2011-02-11 23:05:12 UTC (rev 243)
@@ -0,0 +1,159 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#include "dhcpserverprogram.h"
+#include "dhcpserverproperty.h"
+#include "dhcppacket.h"
+#include "smartdevice.h"
+#include "udpsocket.h"
+#include "socketfactory.h"
+#include <QMessageBox>
+
+#include "dhcpservermodel.h"
+
+int DhcpServerProgram::myServerCount = 0;
+
+DhcpServerProgram::DhcpServerProgram(QObject *parent) : Program(parent)
+{
+ myName = tr("DHCP server");
+ myServerCount++;
+ myServerName = QString("Server%1").arg(myServerCount);
+ myDemons.clear();
+ qDeleteAll(myDemons);
+}
+
+DhcpServerProgram::~DhcpServerProgram()
+{
+ myDevice->disposeSocket(receiver);
+ myDemons.clear();
+ qDeleteAll(myDemons);
+}
+
+void DhcpServerProgram::setDevice(SmartDevice *s)
+{
+ if ( s == 0 ) return;
+ Program::setDevice(s);
+ receiver = myDevice->openSocket(DhcpDemon::SERVER_SOCKET, SocketFactory::UDP);
+ //receiver = new udpSocket(myDevice, SERVER_SOCKET);
+ foreach ( Interface *i, myDevice->interfaces() ) {
+ if ( i->isConnect() ) {
+ DhcpDemon *demon = new DhcpDemon(i);
+ myDemons << demon;
+ }
+ }
+ receiver->setBind("0.0.0.0");
+ connect( receiver , SIGNAL(readyRead(QByteArray)), SLOT(execute(QByteArray)));
+ connect( myDevice, SIGNAL(interfaceConnected(QString)), SLOT(checkInterface(QString)) );
+}
+
+//void dhcpServerProgramm::checkInterface(QString port)
+//{
+// if ( myInterface.isEmpty() ) setInterfaceName(port);
+//}
+
+void DhcpServerProgram::execute(QByteArray data)
+{
+ DhcpPacket packet(data);
+ foreach ( DhcpDemon *demon, myDemons ) {
+ IpAddress deviceIp = myDevice->adapter(demon->interfaceName())->ip();
+ if ( deviceIp.isEmpty() ) {
+ QMessageBox::warning(0,tr("Warning"),
+ tr("Your DHCP server <i>%1</i> isn't configured.").arg(myServerName),
+ QMessageBox::Ok, QMessageBox::Ok);
+ return;
+ }
+
+ if ( deviceIp == packet.siaddr() ) {
+ switch ( packet.type() ) {
+ case DhcpPacket::DHCPDISCOVER :
+ demon->executeDiscover(packet);
+ break;
+ case DhcpPacket::DHCPREQUEST :
+ demon->executeRequest(packet);
+ break;
+ case DhcpPacket::DHCPDECLINE :
+ demon->executeDecline(packet);
+ break;
+ }
+ }
+ }
+}
+
+
+
+void DhcpServerProgram::incTime()
+{
+ foreach ( DhcpDemon *demon, myDemons ) {
+ demon->incTime();
+ }
+}
+
+void DhcpServerProgram::showProperty()
+{
+ DhcpServerProperty *d = new DhcpServerProperty(myDevice);
+ d->setProgramm(this);
+ d->exec();
+}
+
+/*!
+ Записывает отличительные черты в поток.
+ @param stream - поток для записи.
+*/
+void DhcpServerProgram::write(QDataStream &stream) const
+{
+ stream << DHCPServer;
+ Program::write(stream);
+ DhcpDemon *d = myDemons.at(0);
+ d->dhcpModel()->write(stream);
+ stream << d->interfaceName();
+ stream << d->beginIp();
+ stream << d->endIp();
+ stream << d->mask();
+ stream << d->gateway();
+ stream << d->time();
+ stream << d->dynamic();
+ stream << d->waitingTime();
+}
+//---------------------------------------------------
+
+/*!
+ Считывает отличительные черты из потока.
+ @param stream - поток для чтения.
+*/
+void DhcpServerProgram::read(QDataStream &stream)
+{
+ Program::read(stream);
+ DhcpDemon *d = new DhcpDemon(device()->interfaces().at(0));
+ d->dhcpModel()->read(stream);
+ d->read(stream);
+}
+//---------------------------------------------------
+
+
+
+//---------------------------------------------------
+//СlientState::СlientState(StaticDhcpRecord *rec)
+//{
+// ip = rec->yiaddr;
+// mac = rec->chaddr;
+// mask = rec->mask;
+// gateway = rec->gateway;
+// time = rec->time;
+//}
+
Copied: trunk/src/programs/dhcpserverprogram.h (from rev 240, trunk/src/programms/dhcpserverprogramm.h)
===================================================================
--- trunk/src/programs/dhcpserverprogram.h (rev 0)
+++ trunk/src/programs/dhcpserverprogram.h 2011-02-11 23:05:12 UTC (rev 243)
@@ -0,0 +1,63 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#ifndef DHCPSERVERPROGRAMM_H
+#define DHCPSERVERPROGRAMM_H
+
+#include "program.h"
+#include "dhcpdemon.h"
+
+class AbstractSocket;
+
+class DhcpServerProgram : public Program
+{
+ Q_OBJECT
+public:
+ enum { DHCPServer = 2 };
+ DhcpServerProgram(QObject *parent = 0);
+ ~DhcpServerProgram();
+
+// Атрибуты
+public:
+ int id() const { return DHCPServer; }
+ void setDevice(SmartDevice *s);
+ void setServerName(QString n) { myServerName = n; }
+ QString serverName() const { return myServerName; }
+ virtual QString featureName() const { return "ds"; }
+public:
+ void showProperty();
+ void incTime();
+ bool interrupt(int) { return false; }
+ void write(QDataStream &stream) const;
+ void read(QDataStream &stream);
+
+// Слоты
+public slots:
+ void execute(QByteArray data);
+// void checkInterface(QString port);
+
+// Переменные
+private:
+ static int myServerCount;
+ QString myServerName;
+ QList<DhcpDemon*> myDemons;
+ AbstractSocket *receiver;
+};
+
+#endif // DHCPSERVERPROGRAMM_H
Deleted: trunk/src/programs/dhcpserverprogramm.cpp
===================================================================
--- trunk/src/programms/dhcpserverprogramm.cpp 2011-02-11 21:27:21 UTC (rev 240)
+++ trunk/src/programs/dhcpserverprogramm.cpp 2011-02-11 23:05:12 UTC (rev 243)
@@ -1,159 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#include "dhcpserverprogramm.h"
-#include "dhcpserverproperty.h"
-#include "dhcppacket.h"
-#include "smartdevice.h"
-#include "udpsocket.h"
-#include "socketfactory.h"
-#include <QMessageBox>
-
-#include "dhcpservermodel.h"
-
-int DhcpServerProgram::myServerCount = 0;
-
-DhcpServerProgram::DhcpServerProgram(QObject *parent) : Program(parent)
-{
- myName = tr("DHCP server");
- myServerCount++;
- myServerName = QString("Server%1").arg(myServerCount);
- myDemons.clear();
- qDeleteAll(myDemons);
-}
-
-DhcpServerProgram::~DhcpServerProgram()
-{
- myDevice->disposeSocket(receiver);
- myDemons.clear();
- qDeleteAll(myDemons);
-}
-
-void DhcpServerProgram::setDevice(SmartDevice *s)
-{
- if ( s == 0 ) return;
- Program::setDevice(s);
- receiver = myDevice->openSocket(DhcpDemon::SERVER_SOCKET, SocketFactory::UDP);
- //receiver = new udpSocket(myDevice, SERVER_SOCKET);
- foreach ( Interface *i, myDevice->interfaces() ) {
- if ( i->isConnect() ) {
- DhcpDemon *demon = new DhcpDemon(i);
- myDemons << demon;
- }
- }
- receiver->setBind("0.0.0.0");
- connect( receiver , SIGNAL(readyRead(QByteArray)), SLOT(execute(QByteArray)));
- connect( myDevice, SIGNAL(interfaceConnected(QString)), SLOT(checkInterface(QString)) );
-}
-
-//void dhcpServerProgramm::checkInterface(QString port)
-//{
-// if ( myInterface.isEmpty() ) setInterfaceName(port);
-//}
-
-void DhcpServerProgram::execute(QByteArray data)
-{
- DhcpPacket packet(data);
- foreach ( DhcpDemon *demon, myDemons ) {
- IpAddress deviceIp = myDevice->adapter(demon->interfaceName())->ip();
- if ( deviceIp.isEmpty() ) {
- QMessageBox::warning(0,tr("Warning"),
- tr("Your DHCP server <i>%1</i> isn't configured.").arg(myServerName),
- QMessageBox::Ok, QMessageBox::Ok);
- return;
- }
-
- if ( deviceIp == packet.siaddr() ) {
- switch ( packet.type() ) {
- case DhcpPacket::DHCPDISCOVER :
- demon->executeDiscover(packet);
- break;
- case DhcpPacket::DHCPREQUEST :
- demon->executeRequest(packet);
- break;
- case DhcpPacket::DHCPDECLINE :
- demon->executeDecline(packet);
- break;
- }
- }
- }
-}
-
-
-
-void DhcpServerProgram::incTime()
-{
- foreach ( DhcpDemon *demon, myDemons ) {
- demon->incTime();
- }
-}
-
-void DhcpServerProgram::showProperty()
-{
- DhcpServerProperty *d = new DhcpServerProperty(myDevice);
- d->setProgramm(this);
- d->exec();
-}
-
-/*!
- Записывает отличительные черты в поток.
- @param stream - поток для записи.
-*/
-void DhcpServerProgram::write(QDataStream &stream) const
-{
- stream << DHCPServer;
- Program::write(stream);
- DhcpDemon *d = myDemons.at(0);
- d->dhcpModel()->write(stream);
- stream << d->interfaceName();
- stream << d->beginIp();
- stream << d->endIp();
- stream << d->mask();
- stream << d->gateway();
- stream << d->time();
- stream << d->dynamic();
- stream << d->waitingTime();
-}
-//---------------------------------------------------
-
-/*!
- Считывает отличительные черты из потока.
- @param stream - поток для чтения.
-*/
-void DhcpServerProgram::read(QDataStream &stream)
-{
- Program::read(stream);
- DhcpDemon *d = new DhcpDemon(device()->interfaces().at(0));
- d->dhcpModel()->read(stream);
- d->read(stream);
-}
-//---------------------------------------------------
-
-
-
-//---------------------------------------------------
-//СlientState::СlientState(StaticDhcpRecord *rec)
-//{
-// ip = rec->yiaddr;
-// mac = rec->chaddr;
-// mask = rec->mask;
-// gateway = rec->gateway;
-// time = rec->time;
-//}
-
Deleted: trunk/src/programs/dhcpserverprogramm.h
===================================================================
--- trunk/src/programms/dhcpserverprogramm.h 2011-02-11 21:27:21 UTC (rev 240)
+++ trunk/src/programs/dhcpserverprogramm.h 2011-02-11 23:05:12 UTC (rev 243)
@@ -1,63 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#ifndef DHCPSERVERPROGRAMM_H
-#define DHCPSERVERPROGRAMM_H
-
-#include "programmrep.h"
-#include "dhcpdemon.h"
-
-class AbstractSocket;
-
-class DhcpServerProgram : public Program
-{
- Q_OBJECT
-public:
- enum { DHCPServer = 2 };
- DhcpServerProgram(QObject *parent = 0);
- ~DhcpServerProgram();
-
-// Атрибуты
-public:
- int id() const { return DHCPServer; }
- void setDevice(SmartDevice *s);
- void setServerName(QString n) { myServerName = n; }
- QString serverName() const { return myServerName; }
- virtual QString featureName() const { return "ds"; }
-public:
- void showProperty();
- void incTime();
- bool interrupt(int) { return false; }
- void write(QDataStream &stream) const;
- void read(QDataStream &stream);
-
-// Слоты
-public slots:
- void execute(QByteArray data);
-// void checkInterface(QString port);
-
-// Переменные
-private:
- static int myServerCount;
- QString myServerName;
- QList<DhcpDemon*> myDemons;
- AbstractSocket *receiver;
-};
-
-#endif // DHCPSERVERPROGRAMM_H
Copied: trunk/src/programs/program.cpp (from rev 240, trunk/src/programms/programmrep.cpp)
===================================================================
--- trunk/src/programs/program.cpp (rev 0)
+++ trunk/src/programs/program.cpp 2011-02-11 23:05:12 UTC (rev 243)
@@ -0,0 +1,87 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#include "program.h"
+#include "smartdevice.h"
+#include "ripprogram.h"
+#include "dhcpserverprogram.h"
+#include "dhcpclientprogram.h"
+#include "spoofingprogram.h"
+
+static const int MAGIC_PROGRAMM_NUMBER = 50;
+
+Program::Program(QObject *parent) : QObject(parent)
+{
+}
+
+Program::~Program()
+{
+}
+
+void Program::setEnable(bool b)
+{
+ if ( b != myEnable ) {
+ myEnable = b;
+ }
+}
+
+void Program::updateView()
+{
+ myDevice->updateView();
+}
+
+Program* Program::createFromStream(QObject *parent, QDataStream &stream)
+{
+ int n;
+ stream >> n;
+ Program *p = createImpl(parent,n);
+ p->read(stream);
+ return p;
+}
+
+Program* Program::createImpl(QObject *parent, int n)
+{
+ switch (n%MAGIC_PROGRAMM_NUMBER) {
+ case RIP: return new RipProgram(parent);
+ case DHCPClient : return new DhcpClientProgram(parent);
+ case DHCPServer : return new DhcpServerProgram(parent);
+ case SPOOFING : return new SpoofingProgram(parent);
+ default: break;
+ }
+ return 0;
+}
+
+/*!
+ Записывает программу в поток.
+ @param stream - поток для записи.
+*/
+void Program::write(QDataStream &stream) const
+{
+ stream << myEnable;
+}
+//--------------------------------------------
+/*!
+ Считывает программу из потока.
+ @param stream - поток для чтения.
+*/
+void Program::read(QDataStream &stream)
+{
+ stream >> myEnable;
+}
+//-------------------------------------------
Copied: trunk/src/programs/program.h (from rev 240, trunk/src/programms/programmrep.h)
===================================================================
--- trunk/src/programs/program.h (rev 0)
+++ trunk/src/programs/program.h 2011-02-11 23:05:12 UTC (rev 243)
@@ -0,0 +1,64 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#ifndef PROGRAMMREP_H
+#define PROGRAMMREP_H
+
+#include <QDataStream>
+
+class Device;
+class SmartDevice;
+class Program;
+
+typedef QList<Program*> ProgramList;
+
+class Program : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY( bool enable READ isEnable WRITE setEnable )
+public:
+ Program(QObject *parent = 0);
+ virtual ~Program();
+
+ static Program* createFromStream(QObject *parent , QDataStream &stream);
+ static Program* createImpl(QObject *parent , int n);
+
+public:
+ enum { RIP = 0 , DHCPClient = 1 , DHCPServer = 2, SPOOFING = 3 };
+
+ void setEnable(bool b);
+ bool isEnable() const { return myEnable; }
+ QString name() const { return myName; }
+ virtual void setDevice(SmartDevice *s) { myDevice = s; }
+ void updateView();
+ SmartDevice* device() const { return myDevice; }
+ virtual bool interrupt(int u) = 0;
+ virtual void showProperty() = 0;
+ virtual QString featureName() const = 0;
+ virtual void incTime() { }
+ virtual void write(QDataStream &stream) const;
+ virtual void read(QDataStream &stream);
+ virtual int id() const = 0;
+protected:
+ SmartDevice *myDevice;
+ bool myEnable;
+ QString myName; //!< Имя программы.
+};
+
+#endif // PROGRAMMREP_H
Deleted: trunk/src/programs/programmrep.cpp
===================================================================
--- trunk/src/programms/programmrep.cpp 2011-02-11 21:27:21 UTC (rev 240)
+++ trunk/src/programs/programmrep.cpp 2011-02-11 23:05:12 UTC (rev 243)
@@ -1,87 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#include "programmrep.h"
-#include "smartdevice.h"
-#include "ripprogramm.h"
-#include "dhcpserverprogramm.h"
-#include "dhcpclientprogramm.h"
-#include "spoofingprogramm.h"
-
-static const int MAGIC_PROGRAMM_NUMBER = 50;
-
-Program::Program(QObject *parent) : QObject(parent)
-{
-}
-
-Program::~Program()
-{
-}
-
-void Program::setEnable(bool b)
-{
- if ( b != myEnable ) {
- myEnable = b;
- }
-}
-
-void Program::updateView()
-{
- myDevice->updateView();
-}
-
-Program* Program::createFromStream(QObject *parent, QDataStream &stream)
-{
- int n;
- str...
[truncated message content] |
|
From: <f-r...@us...> - 2011-02-11 21:56:20
|
Revision: 242
http://netemul.svn.sourceforge.net/netemul/?rev=242&view=rev
Author: f-r-o-s-t
Date: 2011-02-11 21:56:14 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
sorry, i'm stupid
Removed Paths:
-------------
trunk/src/programms/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-11 21:52:17
|
Revision: 241
http://netemul.svn.sourceforge.net/netemul/?rev=241&view=rev
Author: f-r-o-s-t
Date: 2011-02-11 21:52:11 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
delete deprectated test
Removed Paths:
-------------
trunk/test/mycanvas/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-11 21:27:28
|
Revision: 240
http://netemul.svn.sourceforge.net/netemul/?rev=240&view=rev
Author: f-r-o-s-t
Date: 2011-02-11 21:27:21 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
Henceforth DHCP works on all configured ports! Cheers!!!
Modified Paths:
--------------
trunk/src/dialogs/dhcpserverproperty.cpp
trunk/src/dialogs/dhcpserverproperty.h
trunk/src/factories/classfactory.cpp
trunk/src/forms/dhcpserverproperty.ui
trunk/src/models/arpmodel.h
trunk/src/models/dhcpservermodel.cpp
trunk/src/models/dhcpservermodel.h
Modified: trunk/src/dialogs/dhcpserverproperty.cpp
===================================================================
--- trunk/src/dialogs/dhcpserverproperty.cpp 2011-02-11 19:25:30 UTC (rev 239)
+++ trunk/src/dialogs/dhcpserverproperty.cpp 2011-02-11 21:27:21 UTC (rev 240)
@@ -18,6 +18,8 @@
** 02111-1307 USA.
****************************************************************************************/
#include <QMessageBox>
+//#include <QApplication>
+//#include <QStyle>
#include "dhcpserverproperty.h"
#include "dhcpservermodel.h"
#include "smartdevice.h"
@@ -31,6 +33,7 @@
mySetting = setting;
SmartDevice *dev = mySetting->program()->device();
setAttribute(Qt::WA_DeleteOnClose);
+ btn_apply->setIcon(QIcon(qApp->style()->standardIcon( QStyle::SP_DialogApplyButton)));
port_tb = new QTabBar;
tab_lay->addWidget(port_tb);
foreach ( Interface *i, dev->interfaces() ) {
@@ -139,8 +142,14 @@
myDaemon->setMask(ie_mask->ipAddress());
myDaemon->setTime(sb_time->value());
myDaemon->setWaitingTime(sb_waitingTime->value());
+}
+
+void DhcpServerProperty::onOkButtonClicked()
+{
+ apply();
accept();
}
+
//-----------------------------------------
void DhcpServerProperty::changeEvent(QEvent *e)
Modified: trunk/src/dialogs/dhcpserverproperty.h
===================================================================
--- trunk/src/dialogs/dhcpserverproperty.h 2011-02-11 19:25:30 UTC (rev 239)
+++ trunk/src/dialogs/dhcpserverproperty.h 2011-02-11 21:27:21 UTC (rev 240)
@@ -46,6 +46,7 @@
void deleteRecord();
void changeState(bool);
void apply();
+ void onOkButtonClicked();
private: // Functions
void clearForm();
Modified: trunk/src/factories/classfactory.cpp
===================================================================
--- trunk/src/factories/classfactory.cpp 2011-02-11 19:25:30 UTC (rev 239)
+++ trunk/src/factories/classfactory.cpp 2011-02-11 21:27:21 UTC (rev 240)
@@ -13,6 +13,7 @@
#include "dhcpdaemon.h"
#include "dhcpclientprogram.h"
#include "dhcpserverprogram.h"
+#include "dhcpservermodel.h"
#include "spoofingprogram.h"
#include "statistics.h"
#include "textitem.h"
@@ -69,6 +70,10 @@
return new ArpRecordObject(parent);
} else if ( str == "DhcpDaemon" ) {
return new DhcpDaemon(parent);
+ } else if ( str == "DhcpServerModel" ) {
+ return new DhcpServerModel(parent);
+ } else if ( str == "StaticDhcpRecordObject" ) {
+ return new StaticDhcpRecordObject(parent);
} else {
return 0;
}
Modified: trunk/src/forms/dhcpserverproperty.ui
===================================================================
--- trunk/src/forms/dhcpserverproperty.ui 2011-02-11 19:25:30 UTC (rev 239)
+++ trunk/src/forms/dhcpserverproperty.ui 2011-02-11 21:27:21 UTC (rev 240)
@@ -285,6 +285,13 @@
</spacer>
</item>
<item>
+ <widget class="QPushButton" name="btn_apply">
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QPushButton" name="btn_ok">
<property name="text">
<string>Ok</string>
@@ -386,34 +393,50 @@
</hints>
</connection>
<connection>
+ <sender>cb_turnOn</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>dhspServerProperty</receiver>
+ <slot>onTurnedOnOff(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>153</x>
+ <y>32</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>248</x>
+ <y>3</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
<sender>btn_ok</sender>
<signal>clicked()</signal>
<receiver>dhspServerProperty</receiver>
- <slot>apply()</slot>
+ <slot>onOkButtonClicked()</slot>
<hints>
<hint type="sourcelabel">
- <x>693</x>
- <y>451</y>
+ <x>644</x>
+ <y>436</y>
</hint>
<hint type="destinationlabel">
- <x>540</x>
- <y>364</y>
+ <x>448</x>
+ <y>440</y>
</hint>
</hints>
</connection>
<connection>
- <sender>cb_turnOn</sender>
- <signal>toggled(bool)</signal>
+ <sender>btn_apply</sender>
+ <signal>clicked()</signal>
<receiver>dhspServerProperty</receiver>
- <slot>onTurnedOnOff(bool)</slot>
+ <slot>apply()</slot>
<hints>
<hint type="sourcelabel">
- <x>144</x>
- <y>15</y>
+ <x>564</x>
+ <y>448</y>
</hint>
<hint type="destinationlabel">
- <x>248</x>
- <y>3</y>
+ <x>524</x>
+ <y>446</y>
</hint>
</hints>
</connection>
@@ -424,5 +447,6 @@
<slot>changeState(bool)</slot>
<slot>apply()</slot>
<slot>onTurnedOnOff(bool)</slot>
+ <slot>onOkButtonClicked()</slot>
</slots>
</ui>
Modified: trunk/src/models/arpmodel.h
===================================================================
--- trunk/src/models/arpmodel.h 2011-02-11 19:25:30 UTC (rev 239)
+++ trunk/src/models/arpmodel.h 2011-02-11 21:27:21 UTC (rev 240)
@@ -69,7 +69,8 @@
}
};
-class ArpRecordObject : public QObject {
+class ArpRecordObject : public QObject
+{
Q_OBJECT
Q_PROPERTY( QString mac READ mac WRITE setMac )
Q_PROPERTY( QString ip READ ip WRITE setIp )
Modified: trunk/src/models/dhcpservermodel.cpp
===================================================================
--- trunk/src/models/dhcpservermodel.cpp 2011-02-11 19:25:30 UTC (rev 239)
+++ trunk/src/models/dhcpservermodel.cpp 2011-02-11 21:27:21 UTC (rev 240)
@@ -19,16 +19,18 @@
****************************************************************************************/
#include "dhcpservermodel.h"
+DhcpServerModel::DhcpServerModel(QObject *parent /*= 0*/) : QAbstractTableModel(parent) {}
+
DhcpServerModel::~DhcpServerModel()
{
- qDeleteAll(table);
- table.clear();
+ qDeleteAll(myTable);
+ myTable.clear();
}
int DhcpServerModel::rowCount( const QModelIndex &r/* = QModelIndex() */) const
{
- if ( r.isValid() || table.isEmpty() ) return 0;
- return table.size();
+ if ( r.isValid() || myTable.isEmpty() ) return 0;
+ return myTable.size();
}
int DhcpServerModel::columnCount( const QModelIndex &r/* = QModelIndex() */) const
@@ -60,8 +62,8 @@
QVariant DhcpServerModel::data(const QModelIndex &r, int role/* = Qt::DisplayRole */) const
{
- if ( !r.isValid() || table.isEmpty() ) return QVariant();
- StaticDhcpRecord *rec = table.at( r.row() );
+ if ( !r.isValid() || myTable.isEmpty() ) return QVariant();
+ StaticDhcpRecord *rec = myTable.at( r.row() );
if ( role == Qt::DisplayRole || role == Qt::EditRole )
switch( r.column() ) {
case 0: return rec->chaddr.toString();
@@ -76,7 +78,7 @@
bool DhcpServerModel::setData(const QModelIndex &index, const QVariant &value, int role/* = Qt::EditRole*/)
{
if ( index.isValid() && role == Qt::EditRole ) {
- StaticDhcpRecord *rec = table.at(index.row());
+ StaticDhcpRecord *rec = myTable.at(index.row());
if ( value.toString().isEmpty() ) return false;
switch ( index.column() ) {
case 0: rec->chaddr.setMac(value.toString()); break;
@@ -85,7 +87,7 @@
case 3: rec->gateway.setIp(value.toString()); break;
case 4: rec->time = value.toInt(); break;
}
- table.replace( index.row(), rec);
+ myTable.replace( index.row(), rec);
emit dataChanged(index, index);
return true;
}
@@ -97,7 +99,7 @@
Q_UNUSED(parent);
StaticDhcpRecord *newRecord = new StaticDhcpRecord;
newRecord->time = 0;
- table << newRecord;
+ myTable << newRecord;
reset();
return true;
}
@@ -105,7 +107,7 @@
bool DhcpServerModel::removeRow(int row, const QModelIndex &parent)
{
Q_UNUSED(parent);
- StaticDhcpRecord *record = table.takeAt(row);
+ StaticDhcpRecord *record = myTable.takeAt(row);
if ( record ) delete record;
reset();
return true;
@@ -113,37 +115,55 @@
bool DhcpServerModel::containRecord(StaticDhcpRecord *rec) const
{
- if ( table.isEmpty() ) return false;
- foreach ( StaticDhcpRecord *i, table )
+ if ( myTable.isEmpty() ) return false;
+ foreach ( StaticDhcpRecord *i, myTable )
if ( i == rec ) return true;
return false;
}
bool DhcpServerModel::containRecord(IpAddress ip) const
{
- if ( table.isEmpty() ) return false;
- foreach ( StaticDhcpRecord *i, table )
+ if ( myTable.isEmpty() ) return false;
+ foreach ( StaticDhcpRecord *i, myTable )
if ( i->yiaddr == ip ) return true;
return false;
}
StaticDhcpRecord* DhcpServerModel::recordWithMac(MacAddress cha) const
{
- if ( table.isEmpty() ) return 0;
- foreach ( StaticDhcpRecord *i, table )
+ if ( myTable.isEmpty() ) return 0;
+ foreach ( StaticDhcpRecord *i, myTable )
if ( i->chaddr == cha ) return i;
return 0;
}
void DhcpServerModel::addStaticRecord(StaticDhcpRecord *rec)
{
- table << rec;
+ myTable << rec;
}
+QVariantList DhcpServerModel::staticDhcpRecordObjectsList() const
+{
+ QVariantList list;
+ foreach ( StaticDhcpRecord *i , myTable ) {
+ QObject *o = new StaticDhcpRecordObject(i);
+ list << qVariantFromValue(o);
+ }
+ return list;
+}
+
+void DhcpServerModel::addStaticDhcpRecordObject(StaticDhcpRecordObject *r)
+{
+ addStaticRecord( r->record() );
+ r->deleteLater();
+}
+
+//-----------------------------------------------------------------------------
+
void DhcpServerModel::write(QDataStream &stream) const
{
- stream << table.size();
- foreach ( StaticDhcpRecord *i, table )
+ stream << myTable.size();
+ foreach ( StaticDhcpRecord *i, myTable )
i->write(stream);
}
@@ -157,7 +177,6 @@
addStaticRecord(rec);
}
}
-
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -170,4 +189,5 @@
{
stream >> chaddr >> yiaddr >> mask >> gateway >> time;
}
-
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
Modified: trunk/src/models/dhcpservermodel.h
===================================================================
--- trunk/src/models/dhcpservermodel.h 2011-02-11 19:25:30 UTC (rev 239)
+++ trunk/src/models/dhcpservermodel.h 2011-02-11 21:27:21 UTC (rev 240)
@@ -24,6 +24,8 @@
#include "macaddress.h"
#include "ipaddress.h"
+class StaticDhcpRecordObject;
+
struct StaticDhcpRecord {
MacAddress chaddr;
IpAddress yiaddr;
@@ -38,8 +40,10 @@
class DhcpServerModel : public QAbstractTableModel
{
+ Q_OBJECT
+ Q_PROPERTY( QVariantList staticDhcpRecordObject READ staticDhcpRecordObjectsList )
public:
- DhcpServerModel(QObject *parent = 0) : QAbstractTableModel(parent) { }
+ DhcpServerModel(QObject *parent = 0);
~DhcpServerModel();
int rowCount( const QModelIndex &r = QModelIndex() ) const;
int columnCount( const QModelIndex &r = QModelIndex() ) const;
@@ -50,14 +54,52 @@
bool removeRow(int row, const QModelIndex &parent = QModelIndex() );
bool setData(const QModelIndex &index,const QVariant &value, int role = Qt::EditRole);
+ Q_INVOKABLE void addStaticDhcpRecordObject(StaticDhcpRecordObject *r);
+ QVariantList staticDhcpRecordObjectsList() const;
+
bool containRecord( StaticDhcpRecord *rec) const;
bool containRecord(IpAddress ip) const;
StaticDhcpRecord* recordWithMac(MacAddress cha) const;
void addStaticRecord(StaticDhcpRecord *rec);
+
void write(QDataStream &stream) const;
void read(QDataStream &stream);
private:
- QList<StaticDhcpRecord*> table;
+ QList<StaticDhcpRecord*> myTable;
};
+class StaticDhcpRecordObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY( QString chaddr READ chaddr WRITE setChaddr )
+ Q_PROPERTY( QString yiaddr READ yiaddr WRITE setYiaddr )
+ Q_PROPERTY( QString mask READ mask WRITE setMask )
+ Q_PROPERTY( QString gateway READ gateway WRITE setGateway )
+ Q_PROPERTY( int time READ time WRITE setTime )
+public:
+ StaticDhcpRecordObject(StaticDhcpRecord *record) {
+ myRecord = record;
+ }
+
+ StaticDhcpRecordObject(QObject *parent = 0) : QObject(parent) {
+ myRecord = new StaticDhcpRecord();
+ }
+
+ StaticDhcpRecord* record() const { return myRecord; }
+
+ void setChaddr(const QString &str) { myRecord->chaddr.setMac(str); }
+ void setYiaddr(const QString &str) { myRecord->yiaddr.setIp(str); }
+ void setMask(const QString &str) { myRecord->mask.setIp(str); }
+ void setGateway(const QString &str) { myRecord->gateway.setIp(str); }
+ void setTime(int t) { myRecord->time = t; }
+ QString chaddr() const { return myRecord->chaddr.toString(); }
+ QString yiaddr() const { return myRecord->yiaddr.toString(); }
+ QString mask() const { return myRecord->mask.toString(); }
+ QString gateway() const { return myRecord->gateway.toString(); }
+ int time() const { return myRecord->time; }
+private:
+ StaticDhcpRecord *myRecord;
+
+};
+
#endif // DHCPSERVERMODEL_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-11 19:25:37
|
Revision: 239
http://netemul.svn.sourceforge.net/netemul/?rev=239&view=rev
Author: f-r-o-s-t
Date: 2011-02-11 19:25:30 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
rename program files
Added Paths:
-----------
trunk/src/dialogs/programdialog.cpp
trunk/src/dialogs/programdialog.h
trunk/src/forms/programdialog.ui
Removed Paths:
-------------
trunk/src/dialogs/programmdialog.cpp
trunk/src/dialogs/programmdialog.h
trunk/src/forms/programmdialog.ui
Copied: trunk/src/dialogs/programdialog.cpp (from rev 238, trunk/src/dialogs/programmdialog.cpp)
===================================================================
--- trunk/src/dialogs/programdialog.cpp (rev 0)
+++ trunk/src/dialogs/programdialog.cpp 2011-02-11 19:25:30 UTC (rev 239)
@@ -0,0 +1,119 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#include "programmdialog.h"
+#include "smartdevice.h"
+#include "installdialog.h"
+#include <QCheckBox>
+
+programmDialog::programmDialog(QWidget *parent) : QDialog(parent)
+{
+ setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+}
+
+/*!
+ Обновляет список программ.
+*/
+void programmDialog::updateList()
+{
+ list->clear();
+ foreach ( Program *i, s->programs() ){
+ QListWidgetItem *item = new QListWidgetItem(i->name());
+ item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
+ item->setData( Qt::UserRole , i->id() );
+ if ( i->isEnable() ) item->setCheckState(Qt::Checked);
+ else item->setCheckState(Qt::Unchecked);
+ list->addItem(item);
+ }
+}
+//-------------------------------------------------
+void programmDialog::programmChanged()
+{
+ btn_remove->setEnabled( list->currentItem() );
+ btn_settings->setEnabled( list->currentItem() );
+}
+
+void programmDialog::stateChanged(QListWidgetItem *item)
+{
+ if ( !item ) return;
+ Program *p = s->programAt( item->data( Qt::UserRole).toInt() );
+ p->setEnable( item->checkState() == Qt::Checked );
+ p->updateView();
+}
+
+void programmDialog::setDevice( SmartDevice *d )
+{
+ s = d;
+ updateList();
+}
+/*!
+ Слот, вызываемый при нажатии на кнопку Ok,
+ выполняет все принятые изменения, закрывает диалог.
+*/
+void programmDialog::apply()
+{
+ for ( int i = 0; i < list->count(); i++) {
+ QListWidgetItem *n = list->item(i);
+ if (n->checkState() == Qt::Checked ) s->programAt( n->data(Qt::UserRole).toInt() )->setEnable(true);
+ else s->programAt( n->data(Qt::UserRole).toInt() )->setEnable(false);
+ }
+ accept();
+}
+//----------------------------------------------------
+/*!
+ Слот вызывает диалог установки программ,
+ обновляет список установленных программ.
+*/
+void programmDialog::add()
+{
+ installDialog *d = new installDialog;
+ d->setDevice( s );
+ d->exec();
+ btn_ok->setFocus();
+ updateList();
+}
+//-----------------------------------------------------
+/*!
+ Слот удаляет выделенную программу.
+*/
+void programmDialog::remove()
+{
+ QListWidgetItem *w = list->currentItem();
+ s->removeProgram( s->programAt(w->data(Qt::UserRole).toInt() ) );
+ updateList();
+}
+
+void programmDialog::settings()
+{
+ s->programAt( list->currentItem()->data(Qt::UserRole).toInt() )->showProperty();
+}
+
+//-----------------------------------------------------
+void programmDialog::changeEvent(QEvent *e)
+{
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
Copied: trunk/src/dialogs/programdialog.h (from rev 238, trunk/src/dialogs/programmdialog.h)
===================================================================
--- trunk/src/dialogs/programdialog.h (rev 0)
+++ trunk/src/dialogs/programdialog.h 2011-02-11 19:25:30 UTC (rev 239)
@@ -0,0 +1,51 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#ifndef PROGRAMMDIALOG_H
+#define PROGRAMMDIALOG_H
+
+#include "ui_programmdialog.h"
+
+class SmartDevice;
+
+/*!
+ Реализует диалог установленных пограмм устройства.
+*/
+class programmDialog : public QDialog, private Ui::programmDialog {
+ Q_OBJECT
+ Q_DISABLE_COPY(programmDialog)
+public:
+ programmDialog(QWidget *parent = 0);
+ void setDevice( SmartDevice *d );
+protected:
+ void updateList();
+ void changeEvent(QEvent *e);
+private:
+ SmartDevice *s; //!< Указатель на устройство.
+public slots:
+ void apply();
+private slots:
+ void stateChanged(QListWidgetItem *item);
+ void programmChanged();
+ void settings();
+ void add();
+ void remove();
+};
+
+#endif // PROGRAMMDIALOG_H
Deleted: trunk/src/dialogs/programmdialog.cpp
===================================================================
--- trunk/src/dialogs/programmdialog.cpp 2011-02-11 18:54:11 UTC (rev 238)
+++ trunk/src/dialogs/programmdialog.cpp 2011-02-11 19:25:30 UTC (rev 239)
@@ -1,119 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#include "programmdialog.h"
-#include "smartdevice.h"
-#include "installdialog.h"
-#include <QCheckBox>
-
-programmDialog::programmDialog(QWidget *parent) : QDialog(parent)
-{
- setupUi(this);
- setAttribute(Qt::WA_DeleteOnClose);
-}
-
-/*!
- Обновляет список программ.
-*/
-void programmDialog::updateList()
-{
- list->clear();
- foreach ( Program *i, s->programs() ){
- QListWidgetItem *item = new QListWidgetItem(i->name());
- item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
- item->setData( Qt::UserRole , i->id() );
- if ( i->isEnable() ) item->setCheckState(Qt::Checked);
- else item->setCheckState(Qt::Unchecked);
- list->addItem(item);
- }
-}
-//-------------------------------------------------
-void programmDialog::programmChanged()
-{
- btn_remove->setEnabled( list->currentItem() );
- btn_settings->setEnabled( list->currentItem() );
-}
-
-void programmDialog::stateChanged(QListWidgetItem *item)
-{
- if ( !item ) return;
- Program *p = s->programAt( item->data( Qt::UserRole).toInt() );
- p->setEnable( item->checkState() == Qt::Checked );
- p->updateView();
-}
-
-void programmDialog::setDevice( SmartDevice *d )
-{
- s = d;
- updateList();
-}
-/*!
- Слот, вызываемый при нажатии на кнопку Ok,
- выполняет все принятые изменения, закрывает диалог.
-*/
-void programmDialog::apply()
-{
- for ( int i = 0; i < list->count(); i++) {
- QListWidgetItem *n = list->item(i);
- if (n->checkState() == Qt::Checked ) s->programAt( n->data(Qt::UserRole).toInt() )->setEnable(true);
- else s->programAt( n->data(Qt::UserRole).toInt() )->setEnable(false);
- }
- accept();
-}
-//----------------------------------------------------
-/*!
- Слот вызывает диалог установки программ,
- обновляет список установленных программ.
-*/
-void programmDialog::add()
-{
- installDialog *d = new installDialog;
- d->setDevice( s );
- d->exec();
- btn_ok->setFocus();
- updateList();
-}
-//-----------------------------------------------------
-/*!
- Слот удаляет выделенную программу.
-*/
-void programmDialog::remove()
-{
- QListWidgetItem *w = list->currentItem();
- s->removeProgram( s->programAt(w->data(Qt::UserRole).toInt() ) );
- updateList();
-}
-
-void programmDialog::settings()
-{
- s->programAt( list->currentItem()->data(Qt::UserRole).toInt() )->showProperty();
-}
-
-//-----------------------------------------------------
-void programmDialog::changeEvent(QEvent *e)
-{
- QDialog::changeEvent(e);
- switch (e->type()) {
- case QEvent::LanguageChange:
- retranslateUi(this);
- break;
- default:
- break;
- }
-}
Deleted: trunk/src/dialogs/programmdialog.h
===================================================================
--- trunk/src/dialogs/programmdialog.h 2011-02-11 18:54:11 UTC (rev 238)
+++ trunk/src/dialogs/programmdialog.h 2011-02-11 19:25:30 UTC (rev 239)
@@ -1,51 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#ifndef PROGRAMMDIALOG_H
-#define PROGRAMMDIALOG_H
-
-#include "ui_programmdialog.h"
-
-class SmartDevice;
-
-/*!
- Реализует диалог установленных пограмм устройства.
-*/
-class programmDialog : public QDialog, private Ui::programmDialog {
- Q_OBJECT
- Q_DISABLE_COPY(programmDialog)
-public:
- programmDialog(QWidget *parent = 0);
- void setDevice( SmartDevice *d );
-protected:
- void updateList();
- void changeEvent(QEvent *e);
-private:
- SmartDevice *s; //!< Указатель на устройство.
-public slots:
- void apply();
-private slots:
- void stateChanged(QListWidgetItem *item);
- void programmChanged();
- void settings();
- void add();
- void remove();
-};
-
-#endif // PROGRAMMDIALOG_H
Copied: trunk/src/forms/programdialog.ui (from rev 238, trunk/src/forms/programmdialog.ui)
===================================================================
--- trunk/src/forms/programdialog.ui (rev 0)
+++ trunk/src/forms/programdialog.ui 2011-02-11 19:25:30 UTC (rev 239)
@@ -0,0 +1,260 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>programmDialog</class>
+ <widget class="QDialog" name="programmDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>250</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>400</width>
+ <height>250</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Programs</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="lb_prog">
+ <property name="text">
+ <string>Installed programs</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="list"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_add">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/im/images/edit_add.png</normaloff>:/im/images/edit_add.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_settings">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Settings</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/im/images/setting.png</normaloff>:/im/images/setting.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_remove">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/im/images/edit_remove.png</normaloff>:/im/images/edit_remove.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_ok">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/im/images/ok.png</normaloff>:/im/images/ok.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_cancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/im/images/not.png</normaloff>:/im/images/not.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>btn_cancel</sender>
+ <signal>clicked()</signal>
+ <receiver>programmDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>393</x>
+ <y>243</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>188</x>
+ <y>245</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btn_ok</sender>
+ <signal>clicked()</signal>
+ <receiver>programmDialog</receiver>
+ <slot>apply()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>393</x>
+ <y>214</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>180</x>
+ <y>277</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btn_add</sender>
+ <signal>clicked()</signal>
+ <receiver>programmDialog</receiver>
+ <slot>add()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>343</x>
+ <y>63</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>313</x>
+ <y>18</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btn_remove</sender>
+ <signal>clicked()</signal>
+ <receiver>programmDialog</receiver>
+ <slot>remove()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>393</x>
+ <y>132</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>315</x>
+ <y>135</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btn_settings</sender>
+ <signal>clicked()</signal>
+ <receiver>programmDialog</receiver>
+ <slot>settings()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>360</x>
+ <y>89</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>386</x>
+ <y>23</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>list</sender>
+ <signal>currentRowChanged(int)</signal>
+ <receiver>programmDialog</receiver>
+ <slot>programmChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>140</x>
+ <y>120</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>351</x>
+ <y>13</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>list</sender>
+ <signal>itemClicked(QListWidgetItem*)</signal>
+ <receiver>programmDialog</receiver>
+ <slot>stateChanged(QListWidgetItem*)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>232</x>
+ <y>109</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>335</x>
+ <y>30</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>apply()</slot>
+ <slot>add()</slot>
+ <slot>remove()</slot>
+ <slot>settings()</slot>
+ <slot>programmChanged()</slot>
+ <slot>stateChanged(QListWidgetItem*)</slot>
+ </slots>
+</ui>
Deleted: trunk/src/forms/programmdialog.ui
===================================================================
--- trunk/src/forms/programmdialog.ui 2011-02-11 18:54:11 UTC (rev 238)
+++ trunk/src/forms/programmdialog.ui 2011-02-11 19:25:30 UTC (rev 239)
@@ -1,260 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>programmDialog</class>
- <widget class="QDialog" name="programmDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>250</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>400</width>
- <height>250</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Programs</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel" name="lb_prog">
- <property name="text">
- <string>Installed programs</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QListWidget" name="list"/>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="btn_add">
- <property name="text">
- <string>Add</string>
- </property>
- <property name="icon">
- <iconset>
- <normaloff>:/im/images/edit_add.png</normaloff>:/im/images/edit_add.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btn_settings">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Settings</string>
- </property>
- <property name="icon">
- <iconset>
- <normaloff>:/im/images/setting.png</normaloff>:/im/images/setting.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btn_remove">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Delete</string>
- </property>
- <property name="icon">
- <iconset>
- <normaloff>:/im/images/edit_remove.png</normaloff>:/im/images/edit_remove.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="btn_ok">
- <property name="text">
- <string>Ok</string>
- </property>
- <property name="icon">
- <iconset>
- <normaloff>:/im/images/ok.png</normaloff>:/im/images/ok.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btn_cancel">
- <property name="text">
- <string>Cancel</string>
- </property>
- <property name="icon">
- <iconset>
- <normaloff>:/im/images/not.png</normaloff>:/im/images/not.png</iconset>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>btn_cancel</sender>
- <signal>clicked()</signal>
- <receiver>programmDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>393</x>
- <y>243</y>
- </hint>
- <hint type="destinationlabel">
- <x>188</x>
- <y>245</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>btn_ok</sender>
- <signal>clicked()</signal>
- <receiver>programmDialog</receiver>
- <slot>apply()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>393</x>
- <y>214</y>
- </hint>
- <hint type="destinationlabel">
- <x>180</x>
- <y>277</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>btn_add</sender>
- <signal>clicked()</signal>
- <receiver>programmDialog</receiver>
- <slot>add()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>343</x>
- <y>63</y>
- </hint>
- <hint type="destinationlabel">
- <x>313</x>
- <y>18</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>btn_remove</sender>
- <signal>clicked()</signal>
- <receiver>programmDialog</receiver>
- <slot>remove()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>393</x>
- <y>132</y>
- </hint>
- <hint type="destinationlabel">
- <x>315</x>
- <y>135</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>btn_settings</sender>
- <signal>clicked()</signal>
- <receiver>programmDialog</receiver>
- <slot>settings()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>360</x>
- <y>89</y>
- </hint>
- <hint type="destinationlabel">
- <x>386</x>
- <y>23</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>list</sender>
- <signal>currentRowChanged(int)</signal>
- <receiver>programmDialog</receiver>
- <slot>programmChanged()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>140</x>
- <y>120</y>
- </hint>
- <hint type="destinationlabel">
- <x>351</x>
- <y>13</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>list</sender>
- <signal>itemClicked(QListWidgetItem*)</signal>
- <receiver>programmDialog</receiver>
- <slot>stateChanged(QListWidgetItem*)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>232</x>
- <y>109</y>
- </hint>
- <hint type="destinationlabel">
- <x>335</x>
- <y>30</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>apply()</slot>
- <slot>add()</slot>
- <slot>remove()</slot>
- <slot>settings()</slot>
- <slot>programmChanged()</slot>
- <slot>stateChanged(QListWidgetItem*)</slot>
- </slots>
-</ui>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-11 18:54:19
|
Revision: 238
http://netemul.svn.sourceforge.net/netemul/?rev=238&view=rev
Author: f-r-o-s-t
Date: 2011-02-11 18:54:11 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
Modified Paths:
--------------
trunk/basicnetlib/basicnetlib.pro
trunk/basicnetlib/packets/dhcppacket.h
trunk/netemul.pro
trunk/src/devices/deviceimpl.h
trunk/src/devices/smartdevice.cpp
trunk/src/devices/smartdevice.h
trunk/src/dialogs/adapterproperty.cpp
trunk/src/dialogs/computerproperty.cpp
trunk/src/dialogs/designerdialog.cpp
trunk/src/dialogs/dhcpclientproperty.cpp
trunk/src/dialogs/dhcpserverproperty.cpp
trunk/src/dialogs/dhcpserverproperty.h
trunk/src/dialogs/dialogs.pri
trunk/src/dialogs/installdialog.cpp
trunk/src/dialogs/ripproperty.cpp
trunk/src/dialogs/routeeditor.cpp
trunk/src/dialogs/spoofingproperty.cpp
trunk/src/dialogs/tablearp.cpp
trunk/src/factories/classfactory.cpp
trunk/src/forms/dhcpserverproperty.ui
trunk/src/forms/forms.pri
trunk/src/graphics/device.h
trunk/src/ipedit.cpp
trunk/src/ipedit.h
trunk/test/frame/frame.pro
trunk/test/frame/main.cpp
trunk/test/ipaddress/ipaddress.pro
trunk/test/ipaddress/main.cpp
trunk/test/ippacket/ippacket.pro
trunk/test/ippacket/main.cpp
trunk/test/mac/main.cpp
trunk/test/test.pro
Modified: trunk/basicnetlib/basicnetlib.pro
===================================================================
--- trunk/basicnetlib/basicnetlib.pro 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/basicnetlib/basicnetlib.pro 2011-02-11 18:54:11 UTC (rev 238)
@@ -28,3 +28,8 @@
frame.h \
basicnetlib_global.h
+ # install
+ #target.path =
+ #sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS basictools.pro
+ #sources.path = $$[QT_INSTALL_EXAMPLES]/tools/plugandpaintplugins/basictools
+ #INSTALLS += target sources
Modified: trunk/basicnetlib/packets/dhcppacket.h
===================================================================
--- trunk/basicnetlib/packets/dhcppacket.h 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/basicnetlib/packets/dhcppacket.h 2011-02-11 18:54:11 UTC (rev 238)
@@ -39,9 +39,9 @@
int time;
IpAddress mask;
IpAddress gateway;
- IpAddress yiaddr;
- IpAddress siaddr;
- MacAddress chaddr;
+ IpAddress yiaddr; // proposed ip
+ IpAddress siaddr; // server's ip
+ MacAddress chaddr; // sender's mac-address
};
class BASICNETLIBSHARED_EXPORT DhcpPacket
Modified: trunk/netemul.pro
===================================================================
--- trunk/netemul.pro 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/netemul.pro 2011-02-11 18:54:11 UTC (rev 238)
@@ -1,5 +1,5 @@
include(src/chips/chips.pri)
-include(src/programms/programms.pri)
+include(src/programs/programs.pri)
include(src/controls/controls.pri)
include(src/devices/devices.pri)
include(src/models/models.pri)
@@ -23,7 +23,7 @@
src \
src/chips \
src/controls \
- src/programms \
+ src/programs \
src/devices \
src/models \
src/dialogs \
Modified: trunk/src/devices/deviceimpl.h
===================================================================
--- trunk/src/devices/deviceimpl.h 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/devices/deviceimpl.h 2011-02-11 18:54:11 UTC (rev 238)
@@ -66,7 +66,7 @@
virtual void showLogDialog(logDialog*) const = 0;
virtual void tableDialog() { qFatal("error not compatibility Table!"); }
virtual void adapterDialog() { qFatal("error not compatibility adapter!"); }
- virtual void programmsDialog() { qFatal("error not compatibility"); }
+ virtual void programsDialog() { qFatal("error not compatibility"); }
virtual void arpDialog() { qFatal("error not compatibility"); }
virtual void showDesignerDialog() { qFatal("Error designer!"); }
virtual void showVirtualNetworkDialog() { qFatal("Error virtual network"); }
Modified: trunk/src/devices/smartdevice.cpp
===================================================================
--- trunk/src/devices/smartdevice.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/devices/smartdevice.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -23,12 +23,12 @@
#include "routeeditor.h"
#include "adapterproperty.h"
#include "tablearp.h"
-#include "programmdialog.h"
+#include "programdialog.h"
#include "logdialog.h"
#include "routemodel.h"
#include "abstractsocket.h"
#include "socketfactory.h"
-#include "dhcpclientprogramm.h"
+#include "dhcpclientprogram.h"
SmartDevice::SmartDevice(QObject *parent) : DeviceImpl(parent) , myRouter(false) ,
@@ -205,7 +205,7 @@
/*!
Отправляет сообщение посланное из интерфейса программы.
@param a - Адрес назначения.
- @param size - \xD0 азмер сообщения в кб(на деле сколько пакетов).
+ @param size - азмер сообщения в кб(на деле сколько пакетов).
@param type - Протокол с помощью которого происходит отправка.
*/
void SmartDevice::sendMessage( const QString &a , int size ,int type)
@@ -301,9 +301,9 @@
d->show();
}
-void SmartDevice::programmsDialog()
+void SmartDevice::programsDialog()
{
- programmDialog *d = new programmDialog;
+ ProgramDialog *d = new ProgramDialog;
d->setDevice(this);
d->show();
}
@@ -501,7 +501,7 @@
return s;
}
-bool SmartDevice::hasProgramm(int id)
+bool SmartDevice::hasProgram(int id)
{
foreach ( Program *i , myPrograms )
if ( i->id() == id ) return true;
Modified: trunk/src/devices/smartdevice.h
===================================================================
--- trunk/src/devices/smartdevice.h 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/devices/smartdevice.h 2011-02-11 18:54:11 UTC (rev 238)
@@ -24,7 +24,7 @@
#include <QtGui/QIcon>
#include "deviceimpl.h"
#include "interface.h"
-#include "programmrep.h"
+#include "programrep.h"
class RouteModel;
class ArpModel;
@@ -49,7 +49,7 @@
QString tableName() const { return tr("Routing Table"); }
virtual void tableDialog();
virtual void adapterDialog();
- virtual void programmsDialog();
+ virtual void programsDialog();
virtual void arpDialog();
virtual void showLogDialog(logDialog *log) const;
@@ -101,7 +101,7 @@
void setRouter(bool n) { myRouter = n; }
bool isRouter() const { return myRouter; }
bool hasTable() const { return true; }
- bool hasProgramm(int id);
+ bool hasProgram(int id);
IpAddress gateway() const;
QString gatewayString() const { return gateway().toString(); }
AbstractSocket* openSocket(quint16 port , int type);
@@ -165,7 +165,7 @@
void setCheckedSocket(const QString &str) { sd->setCheckedSocket(str); }
QString statics() const { return sd->myInterfaces.at(cur)->statisticsString(); }
void sendArpRequest(IpAddress a) { sd->myInterfaces.at(cur)->sendArpRequest(a); }
- bool hasDhcpClient() const { return sd->hasProgramm( Program::DHCPClient ); }
+ bool hasDhcpClient() const { return sd->hasProgram( Program::DHCPClient ); }
bool isUnderDhcpControl() const;
void setUnderDhcpControl(bool isUnder);
bool canManageInterface() const { return sd->canManageInterface(); }
Modified: trunk/src/dialogs/adapterproperty.cpp
===================================================================
--- trunk/src/dialogs/adapterproperty.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/adapterproperty.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -147,14 +147,14 @@
void adapterProperty::apply()
{
sd->setMac( le_mac->text() );
- sd->setIp( le_ip->text() );
- sd->setMask( le_mask->text() );
+ sd->setIp( le_ip->ipText() );
+ sd->setMask( le_mask->ipText() );
sd->connectedNet();
sd->setCurrent( tab_interfaces->currentIndex() );
if ( sd->hasDhcpClient() ) {
sd->setUnderDhcpControl( cb_auto->isChecked() );
}
- if ( sd->isConnect() ) sd->sendArpRequest(le_ip->text());
+ if ( sd->isConnect() ) sd->sendArpRequest(le_ip->ipText());
if ( sender() == btn_ok ) accept();
}
//------------------------------------------------------------
Modified: trunk/src/dialogs/computerproperty.cpp
===================================================================
--- trunk/src/dialogs/computerproperty.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/computerproperty.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -59,7 +59,7 @@
void computerProperty::apply()
{
- comp->setGateway(gateway->text());
+ comp->setGateway(gateway->ipText());
comp->setRouter( cb_route->isChecked() );
if ( sender() == btn_ok ) accept();
}
Modified: trunk/src/dialogs/designerdialog.cpp
===================================================================
--- trunk/src/dialogs/designerdialog.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/designerdialog.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -262,7 +262,7 @@
Frame.setReceiver( le_receiverMac->text() );
if ( rb_ip->isChecked() ) {
Frame.setType( Frame::ip );
- IpPacket Packet( senderIp->ipText() , receiverIp->ipText() );
+ IpPacket Packet( senderIp->ipAddress() , receiverIp->ipAddress() );
if ( rb_tcp->isChecked() ) {
TcpPacket tcp;
tcp.setSender( sb_tcpSenderPort->value() );
@@ -289,8 +289,8 @@
Frame.setType( Frame::arp );
ArpPacket arp;
arp.setType( ( rb_request->isChecked() ) ? ArpPacket::request : ArpPacket::response );
- arp.setReceiverIp( arpReceiverIp->ipText() );
- arp.setSenderIp( arpSenderIp->ipText() );
+ arp.setReceiverIp( arpReceiverIp->ipAddress() );
+ arp.setSenderIp( arpSenderIp->ipAddress() );
arp.setReceiverMac( le_arpReceiverMac->text() );
arp.setSenderMac( le_arpSenderMac->text() );
Frame.pack(arp.toData());
Modified: trunk/src/dialogs/dhcpclientproperty.cpp
===================================================================
--- trunk/src/dialogs/dhcpclientproperty.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/dhcpclientproperty.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -18,7 +18,7 @@
** 02111-1307 USA.
****************************************************************************************/
#include "dhcpclientproperty.h"
-#include "dhcpclientprogramm.h"
+#include "dhcpclientprogram.h"
dhcpClientProperty::dhcpClientProperty(QWidget *parent) : QDialog(parent)
{
Modified: trunk/src/dialogs/dhcpserverproperty.cpp
===================================================================
--- trunk/src/dialogs/dhcpserverproperty.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/dhcpserverproperty.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -19,19 +19,29 @@
****************************************************************************************/
#include <QMessageBox>
#include "dhcpserverproperty.h"
-#include "dhcpserverprogramm.h"
#include "dhcpservermodel.h"
#include "smartdevice.h"
#include "macaddressdelegate.h"
#include "ipaddressdelegate.h"
-DhcpServerProperty::DhcpServerProperty(SmartDevice *dev,QWidget *parent /* = 0 */) : QDialog(parent)
+DhcpServerProperty::DhcpServerProperty(DhcpServerSetting *setting, QWidget *parent) : QDialog(parent)
{
setupUi(this);
- device = dev;
+ myPortMap = new QMap<int, Interface*>;
+ mySetting = setting;
+ SmartDevice *dev = mySetting->program()->device();
setAttribute(Qt::WA_DeleteOnClose);
- foreach ( Interface *i, device->interfaces() )
- if ( i->isConnect() ) cb_interface->addItem( QIcon(":im/images/ok.png"), i->name() );
+ port_tb = new QTabBar;
+ tab_lay->addWidget(port_tb);
+ foreach ( Interface *i, dev->interfaces() ) {
+ if ( i->isConnect() ) {
+ int index = port_tb->addTab(QIcon(":im/images/ok.png"), i->name() );
+ myPortMap->insert(index, i);
+ }
+ }
+ connect(port_tb, SIGNAL(currentChanged(int)), SLOT(onCurrentChanged(int)));
+ port_tb->setCurrentIndex(0);
+ onCurrentChanged(0);
macDelegate = new MacAddressDelegate(this);
ipDelegate = new IpAddressDelegate(this);
tv_static->setItemDelegateForColumn(0, macDelegate );
@@ -42,34 +52,66 @@
DhcpServerProperty::~DhcpServerProperty()
{
+ myPortMap->clear();
+ delete mySetting;
delete macDelegate;
+ delete ipDelegate;
}
-void DhcpServerProperty::setProgramm(DhcpServerProgram *prog)
+//----------Private functions--------------
+void DhcpServerProperty::clearForm()
{
-// myProgramm = prog;
-// myModel = myProgramm->dhcpModel();
-// tv_static->setModel( myModel );
-// QHeaderView *h = tv_static->horizontalHeader();
-// h->setResizeMode( QHeaderView::Stretch );
-// cb_dynamic->setChecked(myProgramm->dynamic());
-// sb_time->setValue(myProgramm->time());
-// ie_begin->setText(myProgramm->beginIp());
-// ie_end->setText(myProgramm->endIp());
-// ie_mask->setText(myProgramm->mask());
-// ie_gatew->setText(myProgramm->gateway());
-// cb_interface->setCurrentIndex( cb_interface->findText(myProgramm->interfaceName() ));
-// sb_waitingTime->setValue( myProgramm->waitingTime() );
-// le_name->setText(myProgramm->serverName());
+ tv_static->clearSpans();
+ cb_turnOn->setChecked(false);
+ cb_dynamic->setChecked(false);
+ sb_time->cleanText();
+ ie_begin->clear();
+ ie_end->clear();
+ ie_gatew->clear();
+ ie_mask->clear();
+ sb_waitingTime->cleanText();
}
+//----------Private slots--------------
+void DhcpServerProperty::onCurrentChanged(int index)
+{
+ myDaemon = mySetting->daemonOf(myPortMap->value(index));
+ if ( myDaemon == NULL ) clearForm();
+ myModel = myDaemon->dhcpModel();
+ cb_turnOn->setChecked(myDaemon->isTurnOn());
+ onTurnedOnOff(cb_turnOn->isChecked());
+ tv_static->setModel(myModel);
+ QHeaderView *h = tv_static->horizontalHeader();
+ h->setResizeMode( QHeaderView::Stretch );
+ cb_dynamic->setChecked(myDaemon->dynamic());
+ sb_time->setValue(myDaemon->time());
+ ie_begin->setText(myDaemon->beginIp());
+ ie_end->setText(myDaemon->endIp());
+ ie_gatew->setText(myDaemon->gateway());
+ ie_mask->setText(myDaemon->mask());
+ sb_waitingTime->setValue(myDaemon->waitingTime());
+}
+
+void DhcpServerProperty::onTurnedOnOff(bool b)
+{
+ static_lb->setEnabled(b);
+ tv_static->setEnabled(b);
+ btn_add->setEnabled(b);
+ btn_del->setEnabled(b);
+ waiting_lb->setEnabled(b);
+ sb_waitingTime->setEnabled(b);
+ cb_dynamic->setEnabled(b);
+}
+
void DhcpServerProperty::addRecord()
{
+ if ( myModel == NULL ) return;
myModel->insertRow( myModel->rowCount() );
}
void DhcpServerProperty::deleteRecord()
{
+ if ( myModel == NULL ) return;
myModel->removeRow( tv_static->currentIndex().row() );
}
@@ -85,21 +127,21 @@
void DhcpServerProperty::apply()
{
- if ( ie_begin->ipText() > ie_end->ipText() ) {
+ if ( ie_begin->ipAddress() > ie_end->ipAddress() ) {
QMessageBox::warning(0,tr("Wrong range"),tr("You have entered a wrong IP range."), QMessageBox::Ok, QMessageBox::Ok);
return;
}
-// myProgramm->setInterfaceName(cb_interface->currentText());
-// myProgramm->setBeginIp(ie_begin->ipText().toString());
-// myProgramm->setEndIp(ie_end->ipText().toString());
-// myProgramm->setMask(ie_mask->ipText().toString());
-// myProgramm->setGateway(ie_gatew->ipText().toString());
-// myProgramm->setTime(sb_time->value());
-// myProgramm->setDynamic(cb_dynamic->isChecked());
-// myProgramm->setWaitingTime(sb_waitingTime->value());
-// myProgramm->setServerName(le_name->text());
+ myDaemon->setTurnOn(cb_turnOn->isChecked());
+ myDaemon->setBeginIp(ie_begin->ipAddress());
+ myDaemon->setEndIp(ie_end->ipAddress());
+ myDaemon->setDynamic(cb_dynamic->isChecked());
+ myDaemon->setGateway(ie_gatew->ipAddress());
+ myDaemon->setMask(ie_mask->ipAddress());
+ myDaemon->setTime(sb_time->value());
+ myDaemon->setWaitingTime(sb_waitingTime->value());
accept();
}
+//-----------------------------------------
void DhcpServerProperty::changeEvent(QEvent *e)
{
Modified: trunk/src/dialogs/dhcpserverproperty.h
===================================================================
--- trunk/src/dialogs/dhcpserverproperty.h 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/dhcpserverproperty.h 2011-02-11 18:54:11 UTC (rev 238)
@@ -22,10 +22,9 @@
#include <ui_dhcpserverproperty.h>
#include "ipedit.h"
+#include "dhcpserverprogram.h"
-class DhcpServerProgram;
class DhcpServerModel;
-class SmartDevice;
class MacAddressDelegate;
class IpAddressDelegate;
@@ -33,22 +32,34 @@
{
Q_OBJECT
public:
- DhcpServerProperty(SmartDevice *dev, QWidget *parent = 0);
+ DhcpServerProperty(DhcpServerSetting *setting, QWidget *parent = 0);
~DhcpServerProperty();
- void setProgramm( DhcpServerProgram *prog );
-public slots:
+ void setProgram( DhcpServerProgram *prog );
+
+protected:
+ void changeEvent(QEvent *e);
+
+private slots:
+ void onCurrentChanged(int index);
+ void onTurnedOnOff(bool b);
void addRecord();
void deleteRecord();
void changeState(bool);
void apply();
-protected:
- void changeEvent(QEvent *e);
+
+private: // Functions
+ void clearForm();
+
+
private:
MacAddressDelegate *macDelegate;
IpAddressDelegate *ipDelegate;
- DhcpServerProgram *myProgramm;
DhcpServerModel *myModel;
- SmartDevice *device;
+ DhcpServerSetting* mySetting;
+ DhcpDaemon* myDaemon;
+ QMap<int, Interface*> *myPortMap;
+
+ QTabBar *port_tb;
};
#endif // DHCPSERVERPROPERTY_H
Modified: trunk/src/dialogs/dialogs.pri
===================================================================
--- trunk/src/dialogs/dialogs.pri 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/dialogs.pri 2011-02-11 18:54:11 UTC (rev 238)
@@ -4,7 +4,7 @@
src/dialogs/dialogtemplate.h \
src/dialogs/hubproperty.h \
src/dialogs/installdialog.h \
- src/dialogs/programmdialog.h \
+ src/dialogs/programdialog.h \
src/dialogs/routeeditor.h \
src/dialogs/routerproperty.h \
src/dialogs/senddialog.h \
@@ -29,7 +29,7 @@
src/dialogs/dialogtemplate.cpp \
src/dialogs/hubproperty.cpp \
src/dialogs/installdialog.cpp \
- src/dialogs/programmdialog.cpp \
+ src/dialogs/programdialog.cpp \
src/dialogs/routeeditor.cpp \
src/dialogs/routerproperty.cpp \
src/dialogs/senddialog.cpp \
Modified: trunk/src/dialogs/installdialog.cpp
===================================================================
--- trunk/src/dialogs/installdialog.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/installdialog.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -19,7 +19,7 @@
****************************************************************************************/
#include <QtGui/QMessageBox>
#include "installdialog.h"
-#include "ripprogramm.h"
+#include "ripprogram.h"
#include "smartdevice.h"
installDialog::installDialog(QWidget *parent) : QDialog(parent)
@@ -38,7 +38,7 @@
*/
void installDialog::install()
{
- if ( smart->hasProgramm( list->currentRow() ) ) {
+ if ( smart->hasProgram( list->currentRow() ) ) {
QMessageBox::warning(0,tr("Error") , tr("Program already installed.") ,
QMessageBox::Ok , QMessageBox::Ok );
return;
Modified: trunk/src/dialogs/ripproperty.cpp
===================================================================
--- trunk/src/dialogs/ripproperty.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/ripproperty.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -18,7 +18,7 @@
** 02111-1307 USA.
****************************************************************************************/
#include "ripproperty.h"
-#include "ripprogramm.h"
+#include "ripprogram.h"
ripProperty::ripProperty(QWidget *parent) : QDialog(parent)
{
Modified: trunk/src/dialogs/routeeditor.cpp
===================================================================
--- trunk/src/dialogs/routeeditor.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/routeeditor.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -108,7 +108,7 @@
void routeEditor::addRecord()
{
- model->addToTable( ip_dest->ipText() , ip_mask->ipText() , ip_gateway->ipText() , ipList.at( cb_out->currentIndex() )
+ model->addToTable( ip_dest->ipAddress() , ip_mask->ipAddress() , ip_gateway->ipAddress() , ipList.at( cb_out->currentIndex() )
, sp_metr->value(), RouteModel::staticMode );
ip_dest->clear();
ip_mask->clear();
Modified: trunk/src/dialogs/spoofingproperty.cpp
===================================================================
--- trunk/src/dialogs/spoofingproperty.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/spoofingproperty.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -1,5 +1,5 @@
#include "spoofingproperty.h"
-#include "spoofingprogramm.h"
+#include "spoofingprogram.h"
#include "ui_spoofingproperty.h"
spoofingProperty::spoofingProperty(QWidget *parent) :
@@ -25,8 +25,8 @@
void spoofingProperty::apply()
{
- pr->setClientIp( ui->clientEdit->ipText() );
- pr->setServerIp( ui->serverEdit->ipText() );
+ pr->setClientIp( ui->clientEdit->ipAddress() );
+ pr->setServerIp( ui->serverEdit->ipAddress() );
accept();
}
Modified: trunk/src/dialogs/tablearp.cpp
===================================================================
--- trunk/src/dialogs/tablearp.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/dialogs/tablearp.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -123,8 +123,8 @@
*/
void tableArp::addRecord()
{
- if ( le_mac->text() == "00:00:00:00:00:00" || ip->text() == "0.0.0.0" ) return;
- list.at(s.indexOf(cb_port->currentText()))->addToTable( ip->text(), le_mac->text(), ArpModel::staticMode );
+ if ( le_mac->text() == "00:00:00:00:00:00" || ip->ipText() == "0.0.0.0" ) return;
+ list.at(s.indexOf(cb_port->currentText()))->addToTable( ip->ipText(), le_mac->text(), ArpModel::staticMode );
updateTable();
ip->setText("0.0.0.0");
le_mac->setText("00:00:00:00:00:00");
Modified: trunk/src/factories/classfactory.cpp
===================================================================
--- trunk/src/factories/classfactory.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/factories/classfactory.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -8,11 +8,12 @@
#include "switchchip.h"
#include "routemodel.h"
#include "switchmodel.h"
-#include "ripprogramm.h"
+#include "ripprogram.h"
#include "arpmodel.h"
-#include "dhcpclientprogramm.h"
-#include "dhcpserverprogramm.h"
-#include "spoofingprogramm.h"
+#include "dhcpdaemon.h"
+#include "dhcpclientprogram.h"
+#include "dhcpserverprogram.h"
+#include "spoofingprogram.h"
#include "statistics.h"
#include "textitem.h"
@@ -66,7 +67,9 @@
return new ArpModel(parent);
} else if ( str == "ArpRecordObject" ) {
return new ArpRecordObject(parent);
- } else {
+ } else if ( str == "DhcpDaemon" ) {
+ return new DhcpDaemon(parent);
+ } else {
return 0;
}
}
Modified: trunk/src/forms/dhcpserverproperty.ui
===================================================================
--- trunk/src/forms/dhcpserverproperty.ui 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/forms/dhcpserverproperty.ui 2011-02-11 18:54:11 UTC (rev 238)
@@ -1,465 +1,428 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>dhspServerProperty</class>
- <widget class="QDialog" name="dhspServerProperty">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>800</width>
- <height>462</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>800</width>
- <height>0</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>DHCP server's properties</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="cb_turnOn">
- <property name="text">
- <string>Turn on/off dhcp-server on this interface.</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Static:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTableView" name="tv_static">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::SingleSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="btn_add">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Add</string>
- </property>
- <property name="icon">
- <iconset resource="../../netemul.qrc">
- <normaloff>:/im/images/edit_add.png</normaloff>:/im/images/edit_add.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btn_del">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Delete</string>
- </property>
- <property name="icon">
- <iconset resource="../../netemul.qrc">
- <normaloff>:/im/images/edit_remove.png</normaloff>:/im/images/edit_remove.png</iconset>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="cb_dynamic">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Dynamic:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="lb_term">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Lease term:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="sb_time">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>70</width>
- <height>0</height>
- </size>
- </property>
- <property name="suffix">
- <string> s</string>
- </property>
- <property name="minimum">
- <number>300</number>
- </property>
- <property name="maximum">
- <number>3600</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="IpEdit" name="ie_begin" native="true">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Ip address</string>
- </property>
- <property name="whatsThis">
- <string>The field for ip-address.</string>
- </property>
- <property name="labelText" stdset="0">
- <string>From:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="IpEdit" name="ie_end" native="true">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Ip address</string>
- </property>
- <property name="whatsThis">
- <string>The field for ip-address.</string>
- </property>
- <property name="labelText" stdset="0">
- <string>to:</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="IpEdit" name="ie_mask" native="true">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Ip address</string>
- </property>
- <property name="whatsThis">
- <string>The field for ip-address.</string>
- </property>
- <property name="labelText" stdset="0">
- <string>Mask:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="IpEdit" name="ie_gatew" native="true">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Ip address</string>
- </property>
- <property name="whatsThis">
- <string>The field for ip-address.</string>
- </property>
- <property name="labelText" stdset="0">
- <string>Gateway:</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Wating time for request from dhcp-client:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="sb_waitingTime">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>70</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="minimum">
- <number>60</number>
- </property>
- <property name="maximum">
- <number>300</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>13</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="btn_ok">
- <property name="text">
- <string>Ok</string>
- </property>
- <property name="icon">
- <iconset resource="../../netemul.qrc">
- <normaloff>:/im/images/ok.png</normaloff>:/im/images/ok.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btn_cancel">
- <property name="text">
- <string>Cancel</string>
- </property>
- <property name="icon">
- <iconset resource="../../netemul.qrc">
- <normaloff>:/im/images/not.png</normaloff>:/im/images/not.png</iconset>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Choose interface:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="cb_interface">
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Give server's name:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="le_name"/>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>IpEdit</class>
- <extends>QWidget</extends>
- <header>ipedit.h</header>
- </customwidget>
- </customwidgets>
- <resources>
- <include location="../../netemul.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>btn_cancel</sender>
- <signal>clicked()</signal>
- <receiver>dhspServerProperty</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>789</x>
- <y>451</y>
- </hint>
- <hint type="destinationlabel">
- <x>49</x>
- <y>284</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>btn_add</sender>
- <signal>clicked()</signal>
- <receiver>dhspServerProperty</receiver>
- <slot>addRecord()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>694</x>
- <y>214</y>
- </hint>
- <hint type="destinationlabel">
- <x>234</x>
- <y>228</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>btn_del</sender>
- <signal>clicked()</signal>
- <receiver>dhspServerProperty</receiver>
- <slot>deleteRecord()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>789</x>
- <y>214</y>
- </hint>
- <hint type="destinationlabel">
- <x>260</x>
- <y>234</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>cb_dynamic</sender>
- <signal>toggled(bool)</signal>
- <receiver>dhspServerProperty</receiver>
- <slot>changeState(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>42</x>
- <y>244</y>
- </hint>
- <hint type="destinationlabel">
- <x>114</x>
- <y>326</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>btn_ok</sender>
- <signal>clicked()</signal>
- <receiver>dhspServerProperty</receiver>
- <slot>apply()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>693</x>
- <y>451</y>
- </hint>
- <hint type="destinationlabel">
- <x>540</x>
- <y>364</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>addRecord()</slot>
- <slot>deleteRecord()</slot>
- <slot>changeState(bool)</slot>
- <slot>apply()</slot>
- </slots>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>dhspServerProperty</class>
+ <widget class="QDialog" name="dhspServerProperty">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>462</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>800</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>DHCP server's properties</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="tab_lay"/>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cb_turnOn">
+ <property name="text">
+ <string>Turn on/off dhcp-server on this interface.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="static_lb">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Static:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTableView" name="tv_static">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_add">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../../netemul.qrc">
+ <normaloff>:/im/images/edit_add.png</normaloff>:/im/images/edit_add.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_del">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../../netemul.qrc">
+ <normaloff>:/im/images/edit_remove.png</normaloff>:/im/images/edit_remove.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cb_dynamic">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Dynamic:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lb_term">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Lease term:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="sb_time">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>70</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="suffix">
+ <string> s</string>
+ </property>
+ <property name="minimum">
+ <number>300</number>
+ </property>
+ <property name="maximum">
+ <number>3600</number>
+ </property>
+ <property name="singleStep">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="IpEdit" name="ie_begin" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Ip address</string>
+ </property>
+ <property name="whatsThis">
+ <string>The field for ip-address.</string>
+ </property>
+ <property name="labelText" stdset="0">
+ <string>From:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="IpEdit" name="ie_end" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Ip address</string>
+ </property>
+ <property name="whatsThis">
+ <string>The field for ip-address.</string>
+ </property>
+ <property name="labelText" stdset="0">
+ <string>to:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="IpEdit" name="ie_mask" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Ip address</string>
+ </property>
+ <property name="whatsThis">
+ <string>The field for ip-address.</string>
+ </property>
+ <property name="labelText" stdset="0">
+ <string>Mask:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="IpEdit" name="ie_gatew" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Ip address</string>
+ </property>
+ <property name="whatsThis">
+ <string>The field for ip-address.</string>
+ </property>
+ <property name="labelText" stdset="0">
+ <string>Gateway:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="waiting_lb">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Wating time for request from dhcp-client:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="sb_waitingTime">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>70</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>60</number>
+ </property>
+ <property name="maximum">
+ <number>300</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>13</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_ok">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../../netemul.qrc">
+ <normaloff>:/im/images/ok.png</normaloff>:/im/images/ok.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_cancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../../netemul.qrc">
+ <normaloff>:/im/images/not.png</normaloff>:/im/images/not.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>IpEdit</class>
+ <extends>QWidget</extends>
+ <header>ipedit.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources>
+ <include location="../../netemul.qrc"/>
+ </resources>
+ <connections>
+ <connection>
+ <sender>btn_cancel</sender>
+ <signal>clicked()</signal>
+ <receiver>dhspServerProperty</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>789</x>
+ <y>451</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>49</x>
+ <y>284</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btn_add</sender>
+ <signal>clicked()</signal>
+ <receiver>dhspServerProperty</receiver>
+ <slot>addRecord()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>704</x>
+ <y>263</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>234</x>
+ <y>228</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btn_del</sender>
+ <signal>clicked()</signal>
+ <receiver>dhspServerProperty</receiver>
+ <slot>deleteRecord()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>789</x>
+ <y>263</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>260</x>
+ <y>234</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cb_dynamic</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>dhspServerProperty</receiver>
+ <slot>changeState(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>51</x>
+ <y>292</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>114</x>
+ <y>326</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btn_ok</sender>
+ <signal>clicked()</signal>
+ <receiver>dhspServerProperty</receiver>
+ <slot>apply()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>693</x>
+ <y>451</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>540</x>
+ <y>364</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cb_turnOn</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>dhspServerProperty</receiver>
+ <slot>onTurnedOnOff(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>144</x>
+ <y>15</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>248</x>
+ <y>3</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>addRecord()</slot>
+ <slot>deleteRecord()</slot>
+ <slot>changeState(bool)</slot>
+ <slot>apply()</slot>
+ <slot>onTurnedOnOff(bool)</slot>
+ </slots>
+</ui>
Modified: trunk/src/forms/forms.pri
===================================================================
--- trunk/src/forms/forms.pri 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/forms/forms.pri 2011-02-11 18:54:11 UTC (rev 238)
@@ -1,4 +1,4 @@
-FORMS += src/forms/programmdialog.ui \
+FORMS += src/forms/programdialog.ui \
src/forms/testdialog.ui \
src/forms/connectdialog.ui \
src/forms/tableswitch.ui \
Modified: trunk/src/graphics/device.h
===================================================================
--- trunk/src/graphics/device.h 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/graphics/device.h 2011-02-11 18:54:11 UTC (rev 238)
@@ -66,7 +66,7 @@
void dialog() { impl->dialog(); }
void tableDialog() const { impl->tableDialog(); }
void adapterDialog() const { impl->adapterDialog(); }
- void programmsDialog() const { impl->programmsDialog(); }
+ void programmsDialog() const { impl->programsDialog(); }
void arpDialog() const { impl->arpDialog(); }
void showLogDialog(logDialog *log) const { impl->showLogDialog(log); }
void showDesignerDialog() const { impl->showDesignerDialog(); }
Modified: trunk/src/ipedit.cpp
===================================================================
--- trunk/src/ipedit.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/ipedit.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -77,7 +77,7 @@
return QSize(label->width() + part[0]->width() * 4 + 50, part[0]->height() +10 );
}
-QString IpEdit::text() const
+QString IpEdit::ipText() const
{
QString s;
s = part[0]->text();
Modified: trunk/src/ipedit.h
===================================================================
--- trunk/src/ipedit.h 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/src/ipedit.h 2011-02-11 18:54:11 UTC (rev 238)
@@ -35,8 +35,8 @@
public:
IpEdit(QWidget *parent = 0, QString str = "");
void setText(QString str);
- IpAddress ipText() const { return IpAddress(text()); }
- QString text() const;
+ IpAddress ipAddress() const { return IpAddress(ipText()); }
+ QString ipText() const;
void setLabelText(const QString text);
QString labelText() const;
void clear();
Modified: trunk/test/frame/frame.pro
===================================================================
--- trunk/test/frame/frame.pro 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/test/frame/frame.pro 2011-02-11 18:54:11 UTC (rev 238)
@@ -1,20 +1,9 @@
-INCLUDEPATH += ../../src/packets \
- ../../src
-SOURCES += main.cpp \
- ../../src/frame.cpp \
- ../../src/macaddress.cpp \
- ../../src/packets/ippacket.cpp \
- ../../src/ipaddress.cpp \
- ../../src/packets/arppacket.cpp \
- ../../src/packets/udppacket.cpp \
- ../../src/packets/tcppacket.cpp
-HEADERS += ../../src/frame.h \
- ../../src/macaddress.h \
- ../../src/packets/ippacket.h \
- ../../src/ipaddress.h \
- ../../src/packets/arppacket.h \
- ../../src/packets/udppacket.h \
- ../../src/packets/tcppacket.h
+INCLUDEPATH += ../../basicnetlib/packets \
+ ../../basicnetlib
+SOURCES += main.cpp
+
+LIBS += -L../.. -lbasicnetlib
+
TARGET = frame
TEMPLATE = app
QT += testlib
Modified: trunk/test/frame/main.cpp
===================================================================
--- trunk/test/frame/main.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/test/frame/main.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -11,20 +11,20 @@
void saveLoadIp();
void creatingCopy();
private:
- frame arpFrame;
- frame ipFrame;
+ Frame arpFrame;
+ Frame ipFrame;
};
void TestFrame::saveLoadArp()
{
- arpPacket p;
- p.setType(arpPacket::response);
+ ArpPacket p;
+ p.setType(ArpPacket::response);
p.setReceiverIp(IpAddress("1.2.3.4"));
- p.setReceiverMac(macAddress("10:01:10:01:10:01"));
+ p.setReceiverMac(MacAddress("10:01:10:01:10:01"));
p.setSenderIp(IpAddress("4.3.2.1"));
- p.setSenderMac(macAddress("00:11:22:33:44:55"));
+ p.setSenderMac(MacAddress("00:11:22:33:44:55"));
arpFrame.pack(p.toData());
- arpPacket a(arpFrame.unpack() );
+ ArpPacket a(arpFrame.unpack() );
QCOMPARE( p.type() , a.type() );
QCOMPARE( p.receiverIp() , a.receiverIp() );
QCOMPARE( p.receiverMac() ,a.receiverMac() );
@@ -34,12 +34,12 @@
void TestFrame::saveLoadIp()
{
- ipPacket p;
+ IpPacket p;
p.setSender(IpAddress("1.2.3.4"));
p.setReceiver(IpAddress("4.3.2.1"));
- p.setUpProtocol(ipPacket::tcp);
+ p.setUpProtocol(IpPacket::tcp);
ipFrame.pack( p.toData() );
- ipPacket a( ipFrame.unpack() );
+ IpPacket a( ipFrame.unpack() );
QCOMPARE( p.sender() , a.sender() );
QCOMPARE( p.receiver() , a.receiver() );
QCOMPARE( p.upProtocol() , a.upProtocol() );
@@ -49,8 +49,8 @@
{
arpFrame.setSender(tr("09:09:09:09:09:09"));
ipFrame.setSender( arpFrame.sender() );
- frame a = arpFrame;
- frame b = ipFrame;
+ Frame a = arpFrame;
+ Frame b = ipFrame;
QCOMPARE( a.sender() , b.sender() );
}
Modified: trunk/test/ipaddress/ipaddress.pro
===================================================================
--- trunk/test/ipaddress/ipaddress.pro 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/test/ipaddress/ipaddress.pro 2011-02-11 18:54:11 UTC (rev 238)
@@ -10,6 +10,9 @@
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
-SOURCES += main.cpp \
- ../../src/ipaddress.cpp
-HEADERS += ../../src/ipaddress.h
+
+INCLUDEPATH += ../../basicnetlib
+
+LIBS += -L../.. -lbasicnetlib
+
+SOURCES += main.cpp
Modified: trunk/test/ipaddress/main.cpp
===================================================================
--- trunk/test/ipaddress/main.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/test/ipaddress/main.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -1,5 +1,5 @@
#include <QtTest>
-#include "../../src/ipaddress.h"
+#include "ipaddress.h"
class TestIpAddress : public QObject
{
Modified: trunk/test/ippacket/ippacket.pro
===================================================================
--- trunk/test/ippacket/ippacket.pro 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/test/ippacket/ippacket.pro 2011-02-11 18:54:11 UTC (rev 238)
@@ -5,15 +5,11 @@
TARGET = ippacket
CONFIG += console
TEMPLATE = app
-INCLUDEPATH += ../../src/packets \
- ../../src
-SOURCES += main.cpp \
- ../../src/packets/ippacket.cpp \
- ../../src/ipaddress.cpp \
- ../../src/packets/udppacket.cpp \
- ../../src/packets/tcppacket.cpp
-HEADERS += ../../src/packets/ippacket.h \
- ../../src/ipaddress.h \
- ../../src/packets/udppacket.h \
- ../../src/packets/tcppacket.h
+LIBS += -L../.. -lbasicnetlib
+
+INCLUDEPATH += ../../basicnetlib/packets \
+ ../../basicnetlib
+SOURCES += main.cpp
+
+
Modified: trunk/test/ippacket/main.cpp
===================================================================
--- trunk/test/ippacket/main.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/test/ippacket/main.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -15,8 +15,8 @@
void saveLoadTcp();
void saveLoadUdp();
private:
- ipPacket tcpIp;
- ipPacket udpIp;
+ IpPacket tcpIp;
+ IpPacket udpIp;
};
//---------------------------------------
/*!
@@ -24,7 +24,7 @@
*/
void TestIpPacket::setBroadcast()
{
- ipPacket p;
+ IpPacket p;
p.setReceiver(IpAddress("192.168.1.13"));
QCOMPARE(p.isBroadcast("255.255.0.0") , false );
p.setSender(IpAddress("192.168.1.2"));
@@ -33,20 +33,20 @@
p.setSender(IpAddress("192.168.1.255"));
p.setBroadcast("255.255.255.0");
QCOMPARE( p.isBroadcast("255.255.255.0") , true);
- ipPacket a = p;
- ipPacket b = p;
+ IpPacket a = p;
+ IpPacket b = p;
QCOMPARE( a.sender() , b.sender() );
}
//------------------------------------------
void TestIpPacket::saveLoadTcp()
{
- tcpPacket *p = new tcpPacket;
+ TcpPacket *p = new TcpPacket;
p->setSender(1024);
p->setReceiver(512);
tcpIp.pack(p->toData());
delete p;
- p = new tcpPacket( tcpIp.unpack() );
+ p = new TcpPacket( tcpIp.unpack() );
QCOMPARE( p->sender() , quint16(1024) );
QCOMPARE( p->receiver() ,quint16( 512 ));
delete p;
@@ -54,12 +54,12 @@
void TestIpPacket::saveLoadUdp()
{
- udpPacket *p = new udpPacket;
+ UdpPacket *p = new UdpPacket;
p->setSender(1024);
p->setReceiver(512);
udpIp.pack( p->toData() );
delete p;
- p = new udpPacket( udpIp.unpack() );
+ p = new UdpPacket( udpIp.unpack() );
QCOMPARE( p->sender() , quint16(1024) );
QCOMPARE( p->receiver() , quint16(512) );
delete p;
Modified: trunk/test/mac/main.cpp
===================================================================
--- trunk/test/mac/main.cpp 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/test/mac/main.cpp 2011-02-11 18:54:11 UTC (rev 238)
@@ -13,14 +13,14 @@
void TestmacAddress::toString()
{
- macAddress m;
+ MacAddress m;
m.setMac("01:03:00:00:00:00");
QCOMPARE(m.toString(), tr("01:03:00:00:00:00"));
}
void TestmacAddress::setBroadcast()
{
- macAddress m;
+ MacAddress m;
m.setBroadcast();
QCOMPARE( m.toString() , tr("FF:FF:FF:FF:FF:FF"));
QCOMPARE( m.isBroadcast() , true );
@@ -28,8 +28,8 @@
void TestmacAddress::saveAndLoad()
{
- macAddress m("01:02:03:04:05:06");
- macAddress t = m;
+ MacAddress m("01:02:03:04:05:06");
+ MacAddress t = m;
QFile f("test3");
if ( f.open(QIODevice::WriteOnly) ) {
QDataStream s(&f);
@@ -49,8 +49,8 @@
void TestmacAddress::operators()
{
- macAddress a("01:02:03:04:05:06");
- macAddress b("01:02:03:04:05:07");
+ MacAddress a("01:02:03:04:05:06");
+ MacAddress b("01:02:03:04:05:07");
QCOMPARE( a < b , true );
QCOMPARE( a >= b , false );
QCOMPARE( a++ == b++ , false );
Modified: trunk/test/test.pro
===================================================================
--- trunk/test/test.pro 2011-02-09 12:47:59 UTC (rev 237)
+++ trunk/test/test.pro 2011-02-11 18:54:11 UTC (rev 238)
@@ -2,12 +2,10 @@
# Automatically generated by qmake (2.01a) Sun Jun 28 01:51:25 2009
######################################################################
-DEFINES += __TESTING__
TEMPLATE = subdirs
SUBDIRS = mac \
ippacket \
ipaddress \
- frame \
- scenexmlreader \
- cable
+ frame
+# cable
# Input
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-09 12:48:06
|
Revision: 237
http://netemul.svn.sourceforge.net/netemul/?rev=237&view=rev
Author: f-r-o-s-t
Date: 2011-02-09 12:47:59 +0000 (Wed, 09 Feb 2011)
Log Message:
-----------
Fix some problems =)
Modified Paths:
--------------
trunk/basicnetlib/basicnetlib.pro.user
trunk/ipedit/ipedit.pro
trunk/ipedit/ipeditdesignerplugin.cpp
trunk/src/deviceport.cpp
trunk/src/deviceport.h
trunk/src/devices/smartdevice.cpp
trunk/src/dialogs/logdialog.cpp
trunk/src/dialogs/logdialog.h
trunk/src/programms/dhcpdemon.h
trunk/src/programms/spoofingprogramm.h
Added Paths:
-----------
trunk/test/rect_cache_test/
trunk/test/rect_cache_test/rect_cache_test.pro
trunk/test/rect_cache_test/tst_rect_cache_testtest.cpp
Modified: trunk/basicnetlib/basicnetlib.pro.user
===================================================================
--- trunk/basicnetlib/basicnetlib.pro.user 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/basicnetlib/basicnetlib.pro.user 2011-02-09 12:47:59 UTC (rev 237)
@@ -43,12 +43,12 @@
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Отладка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt в PATH Отладка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/netemul/trunk/basicnetlib-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
@@ -77,15 +77,151 @@
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Релиз</value>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt в PATH Релиз</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/netemul/trunk/basicnetlib-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
- <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.2" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">4.5.0 Отладка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">6</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.3" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">4.5.0 Релиз</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">6</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.4" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.7.0 OpenSource Отладка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">12</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.5" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.7.0 OpenSource Релиз</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">12</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">6</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments" type="QVariantList"/>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase" type="int">2</value>
Modified: trunk/ipedit/ipedit.pro
===================================================================
--- trunk/ipedit/ipedit.pro 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/ipedit/ipedit.pro 2011-02-09 12:47:59 UTC (rev 237)
@@ -8,7 +8,8 @@
TARGET = $$qtLibraryTarget($$TARGET)
TEMPLATE = lib
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
-INCLUDEPATH += "../src"
+INCLUDEPATH += "../src" \
+ ../basicnetlib
HEADERS = ../src/ipedit.h \
ipeditdesignerplugin.h
SOURCES = ../src/ipedit.cpp \
Modified: trunk/ipedit/ipeditdesignerplugin.cpp
===================================================================
--- trunk/ipedit/ipeditdesignerplugin.cpp 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/ipedit/ipeditdesignerplugin.cpp 2011-02-09 12:47:59 UTC (rev 237)
@@ -33,7 +33,7 @@
QWidget* ipEditDesignerPlugin::createWidget(QWidget *parent)
{
- return new ipEdit(parent,tr("Enter text: "));
+ return new IpEdit(parent,tr("Enter text: "));
}
Q_EXPORT_PLUGIN2(ipeditdesignerplugin , ipEditDesignerPlugin )
Modified: trunk/src/deviceport.cpp
===================================================================
--- trunk/src/deviceport.cpp 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/src/deviceport.cpp 2011-02-09 12:47:59 UTC (rev 237)
@@ -19,7 +19,7 @@
****************************************************************************************/
#include "deviceport.h"
#include "cabledev.h"
-#include "Frame.h"
+#include "frame.h"
DevicePort::DevicePort(QObject *parent)
{
Modified: trunk/src/deviceport.h
===================================================================
--- trunk/src/deviceport.h 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/src/deviceport.h 2011-02-09 12:47:59 UTC (rev 237)
@@ -21,7 +21,7 @@
#define DEVICEPORT_H
#include <QQueue>
-#include "Frame.h"
+#include "frame.h"
class MacAddress;
class Cable;
Modified: trunk/src/devices/smartdevice.cpp
===================================================================
--- trunk/src/devices/smartdevice.cpp 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/src/devices/smartdevice.cpp 2011-02-09 12:47:59 UTC (rev 237)
@@ -20,13 +20,11 @@
#include <QtCore/QtDebug>
#include <QMessageBox>
#include "smartdevice.h"
-#ifndef __TESTING__
#include "routeeditor.h"
#include "adapterproperty.h"
#include "tablearp.h"
#include "programmdialog.h"
#include "logdialog.h"
-#endif
#include "routemodel.h"
#include "abstractsocket.h"
#include "socketfactory.h"
@@ -284,10 +282,8 @@
//-------------------------------------------------------
void SmartDevice::tableDialog()
{
-#ifndef __TESTING__
routeEditor *d = new routeEditor(this);
d->show();
-#endif
}
void SmartDevice::showLogDialog(logDialog *log) const
Modified: trunk/src/dialogs/logdialog.cpp
===================================================================
--- trunk/src/dialogs/logdialog.cpp 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/src/dialogs/logdialog.cpp 2011-02-09 12:47:59 UTC (rev 237)
@@ -19,7 +19,7 @@
****************************************************************************************/
#include <QtCore/QTime>
#include "logdialog.h"
-#include "Frame.h"
+#include "frame.h"
#include "ippacket.h"
#include "arppacket.h"
#include "appsetting.h"
Modified: trunk/src/dialogs/logdialog.h
===================================================================
--- trunk/src/dialogs/logdialog.h 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/src/dialogs/logdialog.h 2011-02-09 12:47:59 UTC (rev 237)
@@ -21,7 +21,7 @@
#define LOGDIALOG_H
#include "ui_logdialog.h"
-#include "Frame.h"
+#include "frame.h"
static const QColor cl_frame = "#fbec5d";
static const QColor cl_ipInternal = "#efaf8c";
Modified: trunk/src/programms/dhcpdemon.h
===================================================================
--- trunk/src/programms/dhcpdemon.h 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/src/programms/dhcpdemon.h 2011-02-09 12:47:59 UTC (rev 237)
@@ -20,7 +20,10 @@
int time;
int requestTimer;
enum { WAIT_REQUEST = 0, IN_USE = 1, DECLINE = 2 };
- ClientState(StaticDhcpRecord *rec);
+ ClientState(StaticDhcpRecord *rec) {
+
+ }
+
ClientState() { }
};
Modified: trunk/src/programms/spoofingprogramm.h
===================================================================
--- trunk/src/programms/spoofingprogramm.h 2011-02-09 12:26:11 UTC (rev 236)
+++ trunk/src/programms/spoofingprogramm.h 2011-02-09 12:47:59 UTC (rev 237)
@@ -4,7 +4,7 @@
#include "programmrep.h"
#include "ipaddress.h"
#include "macaddress.h"
-#include "Frame.h"
+#include "frame.h"
class ArpRecord;
Added: trunk/test/rect_cache_test/rect_cache_test.pro
===================================================================
--- trunk/test/rect_cache_test/rect_cache_test.pro (rev 0)
+++ trunk/test/rect_cache_test/rect_cache_test.pro 2011-02-09 12:47:59 UTC (rev 237)
@@ -0,0 +1,19 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2011-02-09T14:45:12
+#
+#-------------------------------------------------
+
+QT += testlib
+
+QT -= gui
+
+TARGET = tst_rect_cache_testtest
+CONFIG += console
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+
+SOURCES += tst_rect_cache_testtest.cpp
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
Added: trunk/test/rect_cache_test/tst_rect_cache_testtest.cpp
===================================================================
--- trunk/test/rect_cache_test/tst_rect_cache_testtest.cpp (rev 0)
+++ trunk/test/rect_cache_test/tst_rect_cache_testtest.cpp 2011-02-09 12:47:59 UTC (rev 237)
@@ -0,0 +1,47 @@
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+#include <QRectF>
+
+class Rect_cache_testTest : public QObject
+{
+ Q_OBJECT
+
+public:
+ Rect_cache_testTest();
+
+private Q_SLOTS:
+ void cacheTest();
+ void calculateTest();
+};
+
+Rect_cache_testTest::Rect_cache_testTest()
+{
+}
+
+QRectF getCalculateRect()
+{
+ return QRectF(10,10,100,100).normalized().adjusted(-3,-3,3,3);
+}
+
+QRectF getCachedRect() {
+ static QRectF cachedRect(10,10,100,100);
+ return cachedRect;
+}
+
+void Rect_cache_testTest::calculateTest()
+{
+ QBENCHMARK {
+ QRectF r = getCalculateRect();
+ }
+}
+
+void Rect_cache_testTest::cacheTest()
+{
+ QBENCHMARK {
+ QRectF r = getCachedRect();
+ }
+}
+
+QTEST_APPLESS_MAIN(Rect_cache_testTest);
+
+#include "tst_rect_cache_testtest.moc"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sla...@us...> - 2011-02-09 12:26:24
|
Revision: 236
http://netemul.svn.sourceforge.net/netemul/?rev=236&view=rev
Author: slaste-nochka
Date: 2011-02-09 12:26:11 +0000 (Wed, 09 Feb 2011)
Log Message:
-----------
unworkable version
Modified Paths:
--------------
trunk/basicnetlib/basicnetlib.pro
trunk/basicnetlib/basicnetlib.pro.user
trunk/basicnetlib/basicnetlib_global.h
trunk/basicnetlib/frame.cpp
trunk/basicnetlib/frame.h
trunk/basicnetlib/macaddress.cpp
trunk/basicnetlib/macaddress.h
trunk/basicnetlib/packets/arppacket.cpp
trunk/basicnetlib/packets/arppacket.h
trunk/basicnetlib/packets/dhcppacket.cpp
trunk/basicnetlib/packets/dhcppacket.h
trunk/basicnetlib/packets/ippacket.cpp
trunk/basicnetlib/packets/ippacket.h
trunk/basicnetlib/packets/packets.pri
trunk/basicnetlib/packets/tcppacket.cpp
trunk/basicnetlib/packets/tcppacket.h
trunk/basicnetlib/packets/udppacket.cpp
trunk/basicnetlib/packets/udppacket.h
trunk/netemul.pro
trunk/src/chips/abstractchip.cpp
trunk/src/chips/abstractchip.h
trunk/src/chips/boxchip.cpp
trunk/src/chips/hubchip.cpp
trunk/src/chips/hubchip.h
trunk/src/chips/interface.cpp
trunk/src/chips/interface.h
trunk/src/chips/switchchip.cpp
trunk/src/chips/switchchip.h
trunk/src/deviceport.cpp
trunk/src/deviceport.h
trunk/src/devices/boxdevice.cpp
trunk/src/devices/computer.cpp
trunk/src/devices/computer.h
trunk/src/devices/hubdevice.h
trunk/src/devices/smartdevice.cpp
trunk/src/devices/smartdevice.h
trunk/src/devices/switchdevice.h
trunk/src/dialogs/adapterproperty.cpp
trunk/src/dialogs/adapterproperty.h
trunk/src/dialogs/computerproperty.cpp
trunk/src/dialogs/computerproperty.h
trunk/src/dialogs/designerdialog.cpp
trunk/src/dialogs/designerdialog.h
trunk/src/dialogs/dhcpserverproperty.cpp
trunk/src/dialogs/dhcpserverproperty.h
trunk/src/dialogs/hubproperty.h
trunk/src/dialogs/logdialog.cpp
trunk/src/dialogs/logdialog.h
trunk/src/dialogs/routeeditor.cpp
trunk/src/dialogs/routeeditor.h
trunk/src/dialogs/switchproperty.h
trunk/src/dialogs/tablearp.cpp
trunk/src/dialogs/tablearp.h
trunk/src/dialogs/tableswitch.cpp
trunk/src/forms/dhcpserverproperty.ui
trunk/src/forms/spoofingproperty.ui
trunk/src/ipedit.cpp
trunk/src/ipedit.h
trunk/src/models/arpmodel.cpp
trunk/src/models/arpmodel.h
trunk/src/models/dhcpservermodel.cpp
trunk/src/models/dhcpservermodel.h
trunk/src/models/switchmodel.cpp
trunk/src/models/switchmodel.h
trunk/src/programms/dhcpclientprogramm.cpp
trunk/src/programms/dhcpclientprogramm.h
trunk/src/programms/dhcpdemon.cpp
trunk/src/programms/dhcpdemon.h
trunk/src/programms/dhcpserverprogramm.cpp
trunk/src/programms/dhcpserverprogramm.h
trunk/src/programms/spoofingprogramm.cpp
trunk/src/programms/spoofingprogramm.h
trunk/src/tools/abstractsocket.h
trunk/src/tools/tcpsocket.cpp
trunk/src/tools/tcpsocket.h
trunk/src/tools/udpsocket.cpp
trunk/src/tools/udpsocket.h
Modified: trunk/basicnetlib/basicnetlib.pro
===================================================================
--- trunk/basicnetlib/basicnetlib.pro 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/basicnetlib.pro 2011-02-09 12:26:11 UTC (rev 236)
@@ -7,7 +7,8 @@
include(packets/packets.pri)
QT -= gui
-INCLUDEPATH += packets
+INCLUDEPATH += . \
+ packets
TARGET = basicnetlib
TEMPLATE = lib
@@ -21,9 +22,9 @@
frame.cpp
-HEADERS += basicnetlib.h\
- basicnetlib_global.h \
+HEADERS += basicnetlib.h \
macaddress.h \
ipaddress.h \
- frame.h
+ frame.h \
+ basicnetlib_global.h
Modified: trunk/basicnetlib/basicnetlib.pro.user
===================================================================
--- trunk/basicnetlib/basicnetlib.pro.user 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/basicnetlib.pro.user 2011-02-09 12:26:11 UTC (rev 236)
@@ -43,12 +43,12 @@
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt в PATH Отладка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Отладка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
@@ -77,151 +77,15 @@
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt в PATH Релиз</value>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Релиз</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
- <valuemap key="ProjectExplorer.Target.BuildConfiguration.2" type="QVariantMap">
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
- <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
- </valuemap>
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
- <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
- <value type="QString">clean</value>
- </valuelist>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
- <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
- <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">4.5.0 Отладка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">6</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
- </valuemap>
- <valuemap key="ProjectExplorer.Target.BuildConfiguration.3" type="QVariantMap">
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
- <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
- </valuemap>
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
- <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
- <value type="QString">clean</value>
- </valuelist>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
- <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
- <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">4.5.0 Релиз</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">6</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
- </valuemap>
- <valuemap key="ProjectExplorer.Target.BuildConfiguration.4" type="QVariantMap">
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
- <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
- </valuemap>
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
- <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
- <value type="QString">clean</value>
- </valuelist>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
- <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
- <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.7.0 OpenSource Отладка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">12</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
- </valuemap>
- <valuemap key="ProjectExplorer.Target.BuildConfiguration.5" type="QVariantMap">
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
- <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
- </valuemap>
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
- <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
- <value type="QString">clean</value>
- </valuelist>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
- <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
- <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.7.0 OpenSource Релиз</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">12</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
- </valuemap>
- <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">6</value>
+ <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments" type="QVariantList"/>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase" type="int">2</value>
Modified: trunk/basicnetlib/basicnetlib_global.h
===================================================================
--- trunk/basicnetlib/basicnetlib_global.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/basicnetlib_global.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -1,7 +1,7 @@
#ifndef BASICNETLIB_GLOBAL_H
#define BASICNETLIB_GLOBAL_H
-#include <QtCore/qglobal.h>
+#include <QtCore/QtGlobal>
#if defined(BASICNETLIB_LIBRARY)
# define BASICNETLIBSHARED_EXPORT Q_DECL_EXPORT
Modified: trunk/basicnetlib/frame.cpp
===================================================================
--- trunk/basicnetlib/frame.cpp 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/frame.cpp 2011-02-09 12:26:11 UTC (rev 236)
@@ -19,19 +19,19 @@
****************************************************************************************/
#include "frame.h"
-frame::frame(const QByteArray &b)
+Frame::Frame(const QByteArray &b)
{
d = new frameData;
QDataStream s(b);
s >> d->different >> d->sender >> d->receiver >> d->type >> d->data;
}
-QByteArray frame::toData() const
+QByteArray Frame::toData() const
{
return d->toArray();
}
-QString frame::toString() const
+QString Frame::toString() const
{
QString temp;
temp.append(QObject::tr("Ethernet, sender: %1 receiver: %2").arg(d->sender.toString()).arg(d->receiver.toString()));
@@ -43,7 +43,7 @@
frameData::frameData()
{
- different = frame::NORMAL;
+ different = Frame::NORMAL;
}
QByteArray frameData::toArray() const
Modified: trunk/basicnetlib/frame.h
===================================================================
--- trunk/basicnetlib/frame.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/frame.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -35,31 +35,31 @@
different(other.different) , data(other.data) { }
~frameData() { }
QByteArray toArray() const;
- friend class frame;
+ friend class Frame;
private:
- macAddress sender; //!< Mac-адрес отправителя
- macAddress receiver; //!< Mac-адрес получателя
+ MacAddress sender; //!< Mac-адрес отправителя
+ MacAddress receiver; //!< Mac-адрес получателя
qint8 type; //!< Показывает несет ли в себе кадр ip-пакет или arp сообщение.
qint8 different; //!< Разновидность фрэйма, влияет на его цвет и отображение
QByteArray data; //!< Данные протокола более высокого уровня.
};
/*!
- Реализует кадр, также как и в реальной сети содержит адрес отправителя, получателя и
+ Реализует кадр, также как и в реальной сети содержит адрес отправителя, получателя и
поле данных где содержиться информация протокола более высокого уровня.
*/
-class BASICNETLIBSHARED_EXPORT frame
+class BASICNETLIBSHARED_EXPORT Frame
{
public:
enum { arp = 100 , ip = 101 };
enum { NORMAL = 3 , BROADCAST = 4 };
- frame() { d = new frameData; }
- frame(const frame &other) : d(other.d) { }
- frame(const QByteArray &b);
- macAddress sender() const { return d->sender; }
- void setSender(macAddress temp) { d->sender = temp; }
- macAddress receiver() const { return d->receiver; }
- void setReceiver(macAddress temp) { d->receiver = temp; }
+ Frame() { d = new frameData; }
+ Frame(const Frame &other) : d(other.d) { }
+ Frame(const QByteArray &b);
+ MacAddress sender() const { return d->sender; }
+ void setSender(MacAddress temp) { d->sender = temp; }
+ MacAddress receiver() const { return d->receiver; }
+ void setReceiver(MacAddress temp) { d->receiver = temp; }
void setDifferent(qint8 t) { d->different = t; }
int type() const { return d->type; }
void setType(int t) { d->type = t; }
@@ -70,7 +70,7 @@
private:
QSharedDataPointer<frameData> d;
protected:
- friend QDataStream& operator<<(QDataStream &stream, const frame &f);
+ friend QDataStream& operator<<(QDataStream &stream, const Frame &f);
};
/*!
@@ -79,7 +79,7 @@
@param f - ссылка на кадр.
@return результирующий поток.
*/
-inline QDataStream& operator<<(QDataStream &stream, const frame &f)
+inline QDataStream& operator<<(QDataStream &stream, const Frame &f)
{
stream << f.toData();
return stream;
Modified: trunk/basicnetlib/macaddress.cpp
===================================================================
--- trunk/basicnetlib/macaddress.cpp 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/macaddress.cpp 2011-02-09 12:26:11 UTC (rev 236)
@@ -1,119 +1,119 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#include "macaddress.h"
-#include <QStringList>
-
-macAddress::macAddress()
-{
- for ( int i = 0 ; i < 6 ; i++ )
- myMac[i] = 0;
-}
-
-macAddress::macAddress(QString str)
-{
- setMac(str);
-}
-
-macAddress::macAddress(const macAddress &other)
-{
- for (int i = 0 ; i < 6 ; i ++)
- myMac[i] = other.myMac[i];
-}
-
-QString macAddress::toString() const
-{
- QString temp = QString("%1").arg( QString().setNum(myMac[0],16), 2 , QChar('0'));
- int i;
- for ( i = 1 ; i <= 5 ; i++ ) {
- temp.append(QChar(':'));
- temp = temp + QString("%1").arg(myMac[i],2,16,QChar('0'));
- }
- return temp.toUpper();
-}
-
-macAddress& macAddress::operator=(const macAddress &other)
-{
- for (int i = 0 ; i < 6 ; i ++)
- myMac[i] = other.myMac[i];
- return (*this);
-}
-
-macAddress macAddress::operator++()
-{
- int i = 5;
- while ( i >= 0 && myMac[i] == 255) {
- myMac[i] = 0;
- i--;
- }
- myMac[i]++;
- return *this;
-}
-
-macAddress macAddress::operator++(int notused)
-{
- Q_UNUSED(notused);
- macAddress temp = *this;
- int i = 5;
- while ( i >= 0 && myMac[i] == 255) {
- myMac[i] = 0;
- i--;
- }
- myMac[i]++;
- return temp;
-}
-
-void macAddress::setBroadcast()
-{
- int i;
- for (i = 0 ; i < 6 ; i++)
- myMac[i] = 0xFF;
-}
-
-bool macAddress::isBroadcast()
-{
- int i;
- for (i = 0; i < 6 ; i++)
- if ( myMac[i] != 0xFF ) return false;
- return true;
-}
-
-void macAddress::setRandom()
-{
- int i;
- myMac[0] = 0x01;
- for ( i = 1 ; i < 6 ; i++ )
- myMac[i] = qrand()%256;
-}
-
-void macAddress::setMac(QString str)
-{
- QStringList s = str.split(":");
- for (int i = 0 ; i < 6 ; i++)
- myMac[i] = s.at(i).toInt(0,16);
-}
-
-bool macAddress::isEmpty() const
-{
- for ( int i = 0 ; i < 6 ; i++ )
- if ( myMac[i] ) return false;
- return true;
-}
-
-
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#include "macaddress.h"
+#include <QStringList>
+
+MacAddress::MacAddress()
+{
+ for ( int i = 0 ; i < 6 ; i++ )
+ myMac[i] = 0;
+}
+
+MacAddress::MacAddress(QString str)
+{
+ setMac(str);
+}
+
+MacAddress::MacAddress(const MacAddress &other)
+{
+ for (int i = 0 ; i < 6 ; i ++)
+ myMac[i] = other.myMac[i];
+}
+
+QString MacAddress::toString() const
+{
+ QString temp = QString("%1").arg( QString().setNum(myMac[0],16), 2 , QChar('0'));
+ int i;
+ for ( i = 1 ; i <= 5 ; i++ ) {
+ temp.append(QChar(':'));
+ temp = temp + QString("%1").arg(myMac[i],2,16,QChar('0'));
+ }
+ return temp.toUpper();
+}
+
+MacAddress& MacAddress::operator=(const MacAddress &other)
+{
+ for (int i = 0 ; i < 6 ; i ++)
+ myMac[i] = other.myMac[i];
+ return (*this);
+}
+
+MacAddress MacAddress::operator++()
+{
+ int i = 5;
+ while ( i >= 0 && myMac[i] == 255) {
+ myMac[i] = 0;
+ i--;
+ }
+ myMac[i]++;
+ return *this;
+}
+
+MacAddress MacAddress::operator++(int notused)
+{
+ Q_UNUSED(notused);
+ MacAddress temp = *this;
+ int i = 5;
+ while ( i >= 0 && myMac[i] == 255) {
+ myMac[i] = 0;
+ i--;
+ }
+ myMac[i]++;
+ return temp;
+}
+
+void MacAddress::setBroadcast()
+{
+ int i;
+ for (i = 0 ; i < 6 ; i++)
+ myMac[i] = 0xFF;
+}
+
+bool MacAddress::isBroadcast()
+{
+ int i;
+ for (i = 0; i < 6 ; i++)
+ if ( myMac[i] != 0xFF ) return false;
+ return true;
+}
+
+void MacAddress::setRandom()
+{
+ int i;
+ myMac[0] = 0x01;
+ for ( i = 1 ; i < 6 ; i++ )
+ myMac[i] = qrand()%256;
+}
+
+void MacAddress::setMac(QString str)
+{
+ QStringList s = str.split(":");
+ for (int i = 0 ; i < 6 ; i++)
+ myMac[i] = s.at(i).toInt(0,16);
+}
+
+bool MacAddress::isEmpty() const
+{
+ for ( int i = 0 ; i < 6 ; i++ )
+ if ( myMac[i] ) return false;
+ return true;
+}
+
+
Modified: trunk/basicnetlib/macaddress.h
===================================================================
--- trunk/basicnetlib/macaddress.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/macaddress.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -1,74 +1,75 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#ifndef MACADDRESS_H
-#define MACADDRESS_H
-
-#include <QDataStream>
-#include "basicnetlib_global.h"
-
-class BASICNETLIBSHARED_EXPORT macAddress
-{
-public:
- macAddress();
- macAddress(QString str);
- macAddress(const macAddress &other);
- void setMac(QString str);
- void setRandom();
- QString toString() const ;
- macAddress operator++();
- macAddress operator++(int notused);
- macAddress& operator=(const macAddress &other);
- void setBroadcast();
- bool isBroadcast();
- bool isEmpty() const;
- qulonglong toInt() const;
-private:
- quint8 myMac[6];
-protected:
- friend QDataStream& operator<<(QDataStream &stream, const macAddress &address);
- friend QDataStream& operator>>(QDataStream &stream, macAddress &address);
-};
-
-inline qulonglong macAddress::toInt() const
-{
- return ((qulonglong)myMac[0]<<40)+((qulonglong)myMac[1]<<32)+((qulonglong)myMac[2]<<24)+
- ((qulonglong)myMac[3]<<16)+((qulonglong)myMac[4]<<8)+(qulonglong)myMac[5];
-}
-inline bool operator<(const macAddress &e1 , const macAddress &e2) { return e1.toInt() < e2.toInt(); }
-inline bool operator>(const macAddress &e1 , const macAddress &e2) { return e1.toInt() > e2.toInt(); }
-inline bool operator==(const macAddress &e1 , const macAddress &e2) { return e1.toInt() == e2.toInt(); }
-inline bool operator!=(const macAddress &e1, const macAddress &e2) { return !(e1 == e2); }
-inline bool operator>=(const macAddress &e1 , const macAddress &e2) { return !(e1 < e2); }
-inline bool operator<=(const macAddress &e1 , const macAddress &e2) { return !(e1 > e2); }
-
-
-inline QDataStream& operator<<(QDataStream &stream, const macAddress &address)
-{
- for (int i = 0 ; i < 6 ; i++ ) stream << address.myMac[i];
- return stream;
-}
-
-inline QDataStream& operator>>(QDataStream &stream, macAddress &address)
-{
- for (int i = 0 ; i < 6 ; i++ ) stream >> address.myMac[i];
- return stream;
-}
-
-#endif // MACADDRESS_H
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#ifndef MACADDRESS_H
+#define MACADDRESS_H
+
+#include <QDataStream>
+#include "basicnetlib_global.h"
+
+class BASICNETLIBSHARED_EXPORT MacAddress
+{
+public:
+ MacAddress();
+ MacAddress(QString str);
+ MacAddress(const MacAddress &other);
+ void setMac(QString str);
+ void setRandom();
+ QString toString() const ;
+ MacAddress operator++();
+ MacAddress operator++(int notused);
+ MacAddress& operator=(const MacAddress &other);
+ void setBroadcast();
+ bool isBroadcast();
+ bool isEmpty() const;
+ qulonglong toInt() const;
+private:
+ quint8 myMac[6];
+protected:
+ friend QDataStream& operator<<(QDataStream &stream, const MacAddress &address);
+ friend QDataStream& operator>>(QDataStream &stream, MacAddress &address);
+};
+
+inline qulonglong MacAddress::toInt() const
+{
+ return ((qulonglong)myMac[0]<<40)+((qulonglong)myMac[1]<<32)+((qulonglong)myMac[2]<<24)+
+ ((qulonglong)myMac[3]<<16)+((qulonglong)myMac[4]<<8)+(qulonglong)myMac[5];
+}
+inline bool operator<(const MacAddress &e1 , const MacAddress &e2) { return e1.toInt() < e2.toInt(); }
+inline bool operator>(const MacAddress &e1 , const MacAddress &e2) { return e1.toInt() > e2.toInt(); }
+inline bool operator==(const MacAddress &e1 , const MacAddress &e2) { return e1.toInt() == e2.toInt(); }
+inline bool operator!=(const MacAddress &e1, const MacAddress &e2) { return !(e1 == e2); }
+inline bool operator>=(const MacAddress &e1 , const MacAddress &e2) { return !(e1 < e2); }
+inline bool operator<=(const MacAddress &e1 , const MacAddress &e2) { return !(e1 > e2); }
+
+
+inline QDataStream& operator<<(QDataStream &stream, const MacAddress &address)
+{
+ for (int i = 0 ; i < 6 ; i++ ) stream << address.myMac[i];
+ return stream;
+}
+
+inline QDataStream& operator>>(QDataStream &stream, MacAddress &address)
+{
+ for (int i = 0 ; i < 6 ; i++ ) stream >> address.myMac[i];
+ return stream;
+}
+
+#endif // MACADDRESS_H
+
Modified: trunk/basicnetlib/packets/arppacket.cpp
===================================================================
--- trunk/basicnetlib/packets/arppacket.cpp 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/arppacket.cpp 2011-02-09 12:26:11 UTC (rev 236)
@@ -19,9 +19,9 @@
****************************************************************************************/
#include "arppacket.h"
-arpPacket::arpPacket(macAddress rm , macAddress sm , IpAddress ri , IpAddress si , quint8 t)
+ArpPacket::ArpPacket(MacAddress rm , MacAddress sm , IpAddress ri , IpAddress si , quint8 t)
{
- d = new arpPacketData;
+ d = new ArpPacketData;
d->receiverMac = rm;
d->senderMac = sm;
d->receiverIp = ri;
@@ -29,14 +29,14 @@
d->type = t;
}
-arpPacket::arpPacket(const QByteArray &b)
+ArpPacket::ArpPacket(const QByteArray &b)
{
- d = new arpPacketData;
+ d = new ArpPacketData;
QDataStream s(b);
s >> d->type >> d->senderMac >> d->receiverMac >> d->senderIp >> d->receiverIp;
}
-QByteArray arpPacket::toData() const
+QByteArray ArpPacket::toData() const
{
return d->toData();
}
@@ -44,7 +44,7 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
-QByteArray arpPacketData::toData() const
+QByteArray ArpPacketData::toData() const
{
QByteArray t;
QDataStream s(&t,QIODevice::WriteOnly);
@@ -52,7 +52,7 @@
return t;
}
-arpPacketData::arpPacketData(const arpPacketData &other) : QSharedData(other)
+ArpPacketData::ArpPacketData(const ArpPacketData &other) : QSharedData(other)
{
receiverMac = other.receiverMac;
senderMac = other.senderMac;
Modified: trunk/basicnetlib/packets/arppacket.h
===================================================================
--- trunk/basicnetlib/packets/arppacket.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/arppacket.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -26,45 +26,45 @@
#include "ipaddress.h"
-class arpPacketData : public QSharedData
+class ArpPacketData : public QSharedData
{
public:
- arpPacketData() { }
- arpPacketData(const arpPacketData &other);
- ~arpPacketData() { }
+ ArpPacketData() { }
+ ArpPacketData(const ArpPacketData &other);
+ ~ArpPacketData() { }
QByteArray toData() const;
- friend class arpPacket;
+ friend class ArpPacket;
private:
quint8 type;
- macAddress senderMac;
- macAddress receiverMac;
+ MacAddress senderMac;
+ MacAddress receiverMac;
IpAddress senderIp;
IpAddress receiverIp;
};
-class BASICNETLIBSHARED_EXPORT arpPacket
+class BASICNETLIBSHARED_EXPORT ArpPacket
{
public:
- arpPacket(macAddress rm , macAddress sm , IpAddress ri , IpAddress si , quint8 t);
- arpPacket(const arpPacket &other) : d(other.d) { }
- arpPacket() { d = new arpPacketData; }
- arpPacket(const QByteArray &b);
+ ArpPacket(MacAddress rm , MacAddress sm , IpAddress ri , IpAddress si , quint8 t);
+ ArpPacket(const ArpPacket &other) : d(other.d) { }
+ ArpPacket() { d = new ArpPacketData; }
+ ArpPacket(const QByteArray &b);
QByteArray toData() const;
enum { request = 0 , response = 1 };
void setType(int i) { d->type = i; }
int type() const { return d->type; }
- void setSenderMac(macAddress m) { d->senderMac = m; }
+ void setSenderMac(MacAddress m) { d->senderMac = m; }
void setSenderIp(IpAddress a) { d->senderIp = a; }
- void setReceiverMac(macAddress m) { d->receiverMac = m; }
+ void setReceiverMac(MacAddress m) { d->receiverMac = m; }
void setReceiverIp(IpAddress a) { d->receiverIp = a; }
- macAddress senderMac() const { return d->senderMac; }
+ MacAddress senderMac() const { return d->senderMac; }
IpAddress senderIp() const { return d->senderIp; }
- macAddress receiverMac() const { return d->receiverMac; }
+ MacAddress receiverMac() const { return d->receiverMac; }
IpAddress receiverIp() const { return d->receiverIp; }
private:
- QSharedDataPointer<arpPacketData> d;
+ QSharedDataPointer<ArpPacketData> d;
protected:
- friend QDataStream& operator<<(QDataStream &stream,const arpPacket &p);
+ friend QDataStream& operator<<(QDataStream &stream,const ArpPacket &p);
};
//-------------------------------------------------------------------
/*!
@@ -73,7 +73,7 @@
@param p - пакет для записи.
@return обновленный поток.
*/
-inline QDataStream& operator<<(QDataStream &stream,const arpPacket &p)
+inline QDataStream& operator<<(QDataStream &stream,const ArpPacket &p)
{
stream << p.toData();
return stream;
Modified: trunk/basicnetlib/packets/dhcppacket.cpp
===================================================================
--- trunk/basicnetlib/packets/dhcppacket.cpp 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/dhcppacket.cpp 2011-02-09 12:26:11 UTC (rev 236)
@@ -21,21 +21,21 @@
static const QString TYPES_DHCP_MESSAGES[] = { "DHCPDISCOVER" , "DHCPOFFER" , "DHCPREQUEST" , "DHCPACK" , "DHCPDECLINE" };
-dhcpPacket::dhcpPacket()
+DhcpPacket::DhcpPacket()
{
- d = new dhcpPacketData;
+ d = new DhcpPacketData;
}
-dhcpPacket::dhcpPacket(const QByteArray &data)
+DhcpPacket::DhcpPacket(const QByteArray &data)
{
- d = new dhcpPacketData;
+ d = new DhcpPacketData;
QDataStream s(data);
s >> d->xid >> d->type >> d->yiaddr >> d->siaddr >> d->chaddr >> d->mask >> d->gateway >> d->time;
}
/*!
* Выполняет сериализацию.
*/
-QByteArray dhcpPacket::toData() const
+QByteArray DhcpPacket::toData() const
{
return d->toData();
}
@@ -43,13 +43,13 @@
/*!
* Преобразует тип пакета в строковое представление.
*/
-QString dhcpPacket::typeString() const
+QString DhcpPacket::typeString() const
{
return TYPES_DHCP_MESSAGES[ d->type ];
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
-dhcpPacketData::dhcpPacketData(const dhcpPacketData &other) : QSharedData(other)
+DhcpPacketData::DhcpPacketData(const DhcpPacketData &other) : QSharedData(other)
{
xid = other.xid;
type = other.type;
@@ -63,7 +63,7 @@
/*!
* Преобразует содержимое в последовательность байт.
*/
-QByteArray dhcpPacketData::toData() const
+QByteArray DhcpPacketData::toData() const
{
QByteArray d;
QDataStream s(&d, QIODevice::WriteOnly);
Modified: trunk/basicnetlib/packets/dhcppacket.h
===================================================================
--- trunk/basicnetlib/packets/dhcppacket.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/dhcppacket.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -25,14 +25,14 @@
#include "ipaddress.h"
#include "macaddress.h"
-class dhcpPacketData : public QSharedData
+class DhcpPacketData : public QSharedData
{
public:
- dhcpPacketData() { time = 0; }
- dhcpPacketData(const dhcpPacketData &other);
- ~dhcpPacketData() { }
+ DhcpPacketData() { time = 0; }
+ DhcpPacketData(const DhcpPacketData &other);
+ ~DhcpPacketData() { }
QByteArray toData() const;
- friend class dhcpPacket;
+ friend class DhcpPacket;
private:
int xid;
int type;
@@ -41,23 +41,23 @@
IpAddress gateway;
IpAddress yiaddr;
IpAddress siaddr;
- macAddress chaddr;
+ MacAddress chaddr;
};
-class BASICNETLIBSHARED_EXPORT dhcpPacket
+class BASICNETLIBSHARED_EXPORT DhcpPacket
{
public:
- dhcpPacket();
- dhcpPacket(const QByteArray &data);
- dhcpPacket(const dhcpPacket &other) : d(other.d) { }
- ~dhcpPacket() { }
+ DhcpPacket();
+ DhcpPacket(const QByteArray &data);
+ DhcpPacket(const DhcpPacket &other) : d(other.d) { }
+ ~DhcpPacket() { }
QByteArray toData() const;
enum { DHCPDISCOVER , DHCPOFFER , DHCPREQUEST , DHCPACK , DHCPDECLINE };
void setYiaddr(IpAddress a) { d->yiaddr = a; }
void setSiaddr(IpAddress a) { d->siaddr = a; }
void setMask(IpAddress a) { d->mask = a; }
void setGateway(IpAddress a) { d->gateway = a; }
- void setChaddr(macAddress a) { d->chaddr = a; }
+ void setChaddr(MacAddress a) { d->chaddr = a; }
void setXid(int x) { d->xid = x; }
void setType(int t) { d->type = t; }
void setTime(int t) { d->time = t; }
@@ -68,10 +68,10 @@
IpAddress siaddr() const { return d->siaddr; }
IpAddress mask() const { return d->mask; }
IpAddress gateway() const { return d->gateway; }
- macAddress chaddr() const { return d->chaddr; }
+ MacAddress chaddr() const { return d->chaddr; }
QString typeString() const;
private:
- QSharedDataPointer<dhcpPacketData> d;
+ QSharedDataPointer<DhcpPacketData> d;
};
#endif // DHCPPACKET_H
Modified: trunk/basicnetlib/packets/ippacket.cpp
===================================================================
--- trunk/basicnetlib/packets/ippacket.cpp 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/ippacket.cpp 2011-02-09 12:26:11 UTC (rev 236)
@@ -19,16 +19,16 @@
****************************************************************************************/
#include "ippacket.h"
-ipPacket::ipPacket(const QByteArray &b)
+IpPacket::IpPacket(const QByteArray &b)
{
- d = new ipPacketData;
+ d = new IpPacketData;
QDataStream s(b);
s >> d->sender >> d->receiver >> d->upProtocol >> d->data >> d->ttl;
}
-ipPacket::ipPacket(IpAddress s,IpAddress r)
+IpPacket::IpPacket(IpAddress s,IpAddress r)
{
- d = new ipPacketData;
+ d = new IpPacketData;
d->sender = s ;
d->receiver = r;
d->ttl = 64;
@@ -38,26 +38,26 @@
@param mask - маска сети, по которой идет проверка.
@return - true - широковещательный, false - в противном случае.
*/
-bool ipPacket::isBroadcast(const IpAddress mask) const
+bool IpPacket::isBroadcast(const IpAddress mask) const
{
IpAddress a = ~mask;
if ( ( d->receiver & a ) == a) return true;
return false;
}
//----------------------------------------------------
-QByteArray ipPacket::toData() const
+QByteArray IpPacket::toData() const
{
return d->toData();
}
-QString ipPacket::toString() const
+QString IpPacket::toString() const
{
QString temp;
temp.append(QObject::tr("IP packet, sender: %1, receiver: %2 TTL: %3").arg(d->sender.toString()).arg(d->receiver.toString()).arg(d->ttl));
return temp;
}
-quint16 ipPacket::receiverSocket() const
+quint16 IpPacket::receiverSocket() const
{
QDataStream stream(d->data);
quint16 t;
@@ -65,7 +65,7 @@
return t;
}
-quint8 ipPacket::decTtl()
+quint8 IpPacket::decTtl()
{
d->ttl--;
return d->ttl;
@@ -76,7 +76,7 @@
/*!
* Переводит пакет в массив байт.
*/
-QByteArray ipPacketData::toData() const
+QByteArray IpPacketData::toData() const
{
QByteArray t;
QDataStream s(&t,QIODevice::WriteOnly);
@@ -87,7 +87,7 @@
/*!
* Копирующий конструктор данных.
*/
-ipPacketData::ipPacketData(const ipPacketData &other) : QSharedData(other)
+IpPacketData::IpPacketData(const IpPacketData &other) : QSharedData(other)
{
sender = other.sender;
receiver = other.receiver;
Modified: trunk/basicnetlib/packets/ippacket.h
===================================================================
--- trunk/basicnetlib/packets/ippacket.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/ippacket.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -27,13 +27,13 @@
/*!
* Содержит в себе разделяемые между ip пакетами данные.
*/
-class ipPacketData : public QSharedData
+class IpPacketData : public QSharedData
{
public:
- ipPacketData() { }
- ipPacketData(const ipPacketData &other);
- ~ipPacketData() { }
- friend class ipPacket;
+ IpPacketData() { }
+ IpPacketData(const IpPacketData &other);
+ ~IpPacketData() { }
+ friend class IpPacket;
private:
IpAddress sender; //!< Адрес отправителя.
IpAddress receiver; //!< Адрес получателя.
@@ -49,16 +49,16 @@
тип протокола верхнего уровня и поле данных. Остальные папраметры реального пакета пока
не используются.
*/
-class BASICNETLIBSHARED_EXPORT ipPacket
+class BASICNETLIBSHARED_EXPORT IpPacket
{
public:
/*! Используется для обозначения протокола верхнего уровня. */
enum { udp = 0 , tcp = 1 };
- ipPacket() { d = new ipPacketData; d->ttl = 64; }
- ipPacket(const QByteArray &b);
- ipPacket(IpAddress s,IpAddress r);
- ~ipPacket() { }
- ipPacket(const ipPacket &other) : d(other.d) { }
+ IpPacket() { d = new IpPacketData; d->ttl = 64; }
+ IpPacket(const QByteArray &b);
+ IpPacket(IpAddress s,IpAddress r);
+ ~IpPacket() { }
+ IpPacket(const IpPacket &other) : d(other.d) { }
QByteArray toData() const;
QString toString() const;
@@ -78,10 +78,10 @@
int size() { return d->data.size(); }
QByteArray unpack() const { return d->data; }
private:
- QSharedDataPointer<ipPacketData> d; //!< Данные пакета.
+ QSharedDataPointer<IpPacketData> d; //!< Данные пакета.
protected:
- friend bool operator==(const ipPacket &p1,const ipPacket &p2);
- friend QDataStream& operator<<(QDataStream &stream,const ipPacket &p);
+ friend bool operator==(const IpPacket &p1,const IpPacket &p2);
+ friend QDataStream& operator<<(QDataStream &stream,const IpPacket &p);
};
//---------------------------------------------------------------------------
/*!
@@ -90,7 +90,7 @@
@param p - записываемый пакет.
@return ссылку на результирующий поток.
*/
-inline QDataStream& operator<<(QDataStream &stream,const ipPacket &p)
+inline QDataStream& operator<<(QDataStream &stream,const IpPacket &p)
{
stream << p.toData();
return stream;
@@ -100,12 +100,12 @@
Назначает пакету широковещательный адрес исходя из маски.
@param mask - Маска.
*/
-inline void ipPacket::setBroadcast(const IpAddress mask)
+inline void IpPacket::setBroadcast(const IpAddress mask)
{
d->receiver = d->sender | ~mask;
}
//---------------------------------------------------
-inline bool operator==(const ipPacket &p1,const ipPacket &p2)
+inline bool operator==(const IpPacket &p1,const IpPacket &p2)
{
return ( p1.sender() == p2.sender() && p1.receiver() == p2.receiver() );
}
Modified: trunk/basicnetlib/packets/packets.pri
===================================================================
--- trunk/basicnetlib/packets/packets.pri 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/packets.pri 2011-02-09 12:26:11 UTC (rev 236)
@@ -1,10 +1,10 @@
-SOURCES += packets/dhcppacket.cpp\
- packets/arppacket.cpp\
- packets/ippacket.cpp\
- packets/tcppacket.cpp\
+SOURCES += packets/dhcppacket.cpp \
+ packets/arppacket.cpp \
+ packets/ippacket.cpp \
+ packets/tcppacket.cpp \
packets/udppacket.cpp
-HEADERS += packets/dhcppacket.h\
- packets/arppacket.h\
- packets/ippacket.h\
- packets/tcppacket.h\
+HEADERS += packets/dhcppacket.h \
+ packets/arppacket.h \
+ packets/ippacket.h \
+ packets/tcppacket.h \
packets/udppacket.h
Modified: trunk/basicnetlib/packets/tcppacket.cpp
===================================================================
--- trunk/basicnetlib/packets/tcppacket.cpp 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/tcppacket.cpp 2011-02-09 12:26:11 UTC (rev 236)
@@ -19,9 +19,9 @@
****************************************************************************************/
#include "tcppacket.h"
-tcpPacket::tcpPacket(const QByteArray &b)
+TcpPacket::TcpPacket(const QByteArray &b)
{
- d = new tcpPacketData;
+ d = new TcpPacketData;
QDataStream s(b);
s >> d->receiver >> d->sender >> d->sequence >> d->ack >> d->flag >> d->window >> d->data;
}
@@ -32,21 +32,21 @@
@param p - записываемый пакет.
@return ссылку на результирующий поток.
*/
-QDataStream& operator<<( QDataStream &stream, const tcpPacket &p )
+QDataStream& operator<<( QDataStream &stream, const TcpPacket &p )
{
stream << p.toData();
return stream;
}
//-------------------------------------------------------
-QString tcpPacket::toString() const
+QString TcpPacket::toString() const
{
QString temp;
temp.append("TCP, "+QObject::tr("sender port: %1, receiver port: %2").arg(d->sender).arg(d->receiver) );
return temp;
}
-tcpPacketData::tcpPacketData(const tcpPacketData &u) : QSharedData(u)
+TcpPacketData::TcpPacketData(const TcpPacketData &u) : QSharedData(u)
{
sender = u.sender;
receiver = u.receiver;
@@ -57,7 +57,7 @@
data = u.data;
}
-QByteArray tcpPacketData::toData() const
+QByteArray TcpPacketData::toData() const
{
QByteArray t;
QDataStream s(&t,QIODevice::WriteOnly);
Modified: trunk/basicnetlib/packets/tcppacket.h
===================================================================
--- trunk/basicnetlib/packets/tcppacket.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/tcppacket.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -24,14 +24,14 @@
#include <QSharedData>
#include "basicnetlib_global.h"
-class tcpPacketData : public QSharedData
+class TcpPacketData : public QSharedData
{
public:
- tcpPacketData() { }
- tcpPacketData(const tcpPacketData &other);
- ~tcpPacketData() { }
+ TcpPacketData() { }
+ TcpPacketData(const TcpPacketData &other);
+ ~TcpPacketData() { }
QByteArray toData() const;
- friend class tcpPacket;
+ friend class TcpPacket;
private:
quint16 sender; //!< Порт отправителя
quint16 receiver; //!< Порт получателя
@@ -45,15 +45,15 @@
/*!
Реализует tcp-сегмент
*/
-class BASICNETLIBSHARED_EXPORT tcpPacket
+class BASICNETLIBSHARED_EXPORT TcpPacket
{
public:
enum { User = 7777 , Window = 10240 };
enum { NO_FLAGS = 0, SYN = 1, ACK = 2, FIN = 4, RST = 8 };
- tcpPacket() { d = new tcpPacketData; }
- tcpPacket(const QByteArray &b);
- tcpPacket(const tcpPacket &other) : d(other.d) { }
- ~tcpPacket() { }
+ TcpPacket() { d = new TcpPacketData; }
+ TcpPacket(const QByteArray &b);
+ TcpPacket(const TcpPacket &other) : d(other.d) { }
+ ~TcpPacket() { }
QByteArray toData() const { return d->toData(); }
int size() const { return d->data.size(); }
void setSender(quint16 s) { d->sender = s; }
@@ -72,9 +72,9 @@
void pack(const QByteArray &b) { d->data = b; }
QString toString() const;
private:
- QSharedDataPointer<tcpPacketData> d;
+ QSharedDataPointer<TcpPacketData> d;
protected:
- friend QDataStream& operator<<( QDataStream &stream, const tcpPacket &p );
+ friend QDataStream& operator<<( QDataStream &stream, const TcpPacket &p );
};
#endif // TCPPACKET_H
Modified: trunk/basicnetlib/packets/udppacket.cpp
===================================================================
--- trunk/basicnetlib/packets/udppacket.cpp 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/udppacket.cpp 2011-02-09 12:26:11 UTC (rev 236)
@@ -19,19 +19,19 @@
****************************************************************************************/
#include "udppacket.h"
-QByteArray udpPacket::toData() const
+QByteArray UdpPacket::toData() const
{
return d->toData();
}
-udpPacket::udpPacket(const QByteArray &b)
+UdpPacket::UdpPacket(const QByteArray &b)
{
- d = new udpPacketData;
+ d = new UdpPacketData;
QDataStream s(b);
s >> d->receiver >> d->sender >> d->data;
}
-QString udpPacket::typeToString() const
+QString UdpPacket::typeToString() const
{
switch ( d->receiver ) {
case User: return QObject::tr("UDP Message user");
@@ -41,7 +41,7 @@
}
}
-QString udpPacket::toString() const
+QString UdpPacket::toString() const
{
QString temp;
temp.append("UDP, "+QObject::tr("sender port: %1, receiver port: %2").arg(d->sender).arg(d->receiver) );
@@ -51,14 +51,14 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-udpPacketData::udpPacketData(const udpPacketData &u) : QSharedData(u)
+UdpPacketData::UdpPacketData(const UdpPacketData &u) : QSharedData(u)
{
sender = u.sender;
receiver = u.receiver;
data = u.data;
}
-QByteArray udpPacketData::toData() const
+QByteArray UdpPacketData::toData() const
{
QByteArray t;
QDataStream s(&t,QIODevice::WriteOnly);
Modified: trunk/basicnetlib/packets/udppacket.h
===================================================================
--- trunk/basicnetlib/packets/udppacket.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/basicnetlib/packets/udppacket.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -24,14 +24,14 @@
#include <QDataStream>
#include <QSharedData>
-class udpPacketData : public QSharedData
+class UdpPacketData : public QSharedData
{
public:
- udpPacketData() { }
- udpPacketData(const udpPacketData &other);
- ~udpPacketData() { }
+ UdpPacketData() { }
+ UdpPacketData(const UdpPacketData &other);
+ ~UdpPacketData() { }
QByteArray toData() const;
- friend class udpPacket;
+ friend class UdpPacket;
private:
quint16 sender; //!< Порт отправителя
quint16 receiver; //!< Порт получателя
@@ -40,14 +40,14 @@
/*!
Реализует udp-дейтаграмму
*/
-class BASICNETLIBSHARED_EXPORT udpPacket
+class BASICNETLIBSHARED_EXPORT UdpPacket
{
public:
enum { User = 7777 , RIP = 520 , DHCPClient = 67, DHCPServer = 68 } ;
- udpPacket() { d = new udpPacketData; }
- udpPacket(const QByteArray &b);
- udpPacket(const udpPacket &u) : d(u.d) { }
- ~udpPacket() { }
+ UdpPacket() { d = new UdpPacketData; }
+ UdpPacket(const QByteArray &b);
+ UdpPacket(const UdpPacket &u) : d(u.d) { }
+ ~UdpPacket() { }
QByteArray toData() const;
int size() const { return d->data.size(); }
void setSender( quint16 i ) { d->sender = i;}
@@ -59,9 +59,9 @@
QString typeToString() const;
QString toString() const;
private:
- QSharedDataPointer<udpPacketData> d;
+ QSharedDataPointer<UdpPacketData> d;
protected:
- friend QDataStream& operator<<( QDataStream &stream, const udpPacket &p );
+ friend QDataStream& operator<<( QDataStream &stream, const UdpPacket &p );
};
//-----------------------------------------------------
/*!
@@ -70,7 +70,7 @@
@param p - записываемый пакет.
@return ссылку на результирующий поток.
*/
-inline QDataStream& operator<<( QDataStream &stream, const udpPacket &p )
+inline QDataStream& operator<<( QDataStream &stream, const UdpPacket &p )
{
stream << p.toData();
return stream;
Modified: trunk/netemul.pro
===================================================================
--- trunk/netemul.pro 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/netemul.pro 2011-02-09 12:26:11 UTC (rev 236)
@@ -49,7 +49,7 @@
SCRIPT_PATH = "scripts"
win32 {
DESTDIR = ../trunk
- message("Static link ...")
+# message("Static link ...")
# DEFINES += QT_NO_DEBUG_OUTPUT
# CONFIG += static
}
Modified: trunk/src/chips/abstractchip.cpp
===================================================================
--- trunk/src/chips/abstractchip.cpp 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/src/chips/abstractchip.cpp 2011-02-09 12:26:11 UTC (rev 236)
@@ -64,16 +64,16 @@
obj->deleteLater();
}
-void AbstractChip::checkReceive(frame &f)
+void AbstractChip::checkReceive(Frame &f)
{
myStatistics.receiveFrames++;
- if ( f.type() == frame::ip ) myStatistics.receivePackets++;
+ if ( f.type() == Frame::ip ) myStatistics.receivePackets++;
}
-void AbstractChip::checkSend(frame &f)
+void AbstractChip::checkSend(Frame &f)
{
myStatistics.sendFrames++;
- if ( f.type() == frame::ip ) myStatistics.sendPackets++;
+ if ( f.type() == Frame::ip ) myStatistics.sendPackets++;
}
Modified: trunk/src/chips/abstractchip.h
===================================================================
--- trunk/src/chips/abstractchip.h 2011-02-09 01:36:43 UTC (rev 235)
+++ trunk/src/chips/abstractchip.h 2011-02-09 12:26:11 UTC (rev 236)
@@ -27,7 +27,7 @@
#include "frame.h"
class DevicePort;
-class ipPacket;
+class IpPacket;
/*!
Класс являеться абстрактным устройством приема и обработки кадров.
@@ -44,21 +44,21 @@
public:
AbstractChip(QObject *parent = 0);
virtual ~AbstractChip() { }
- virtual void receiveEvent(frame &fr,DevicePort *sender) = 0;
+ virtual void receiveEvent(Frame &fr,DevicePort *sender) = 0;
virtual int trafficDigit() const = 0;
QString statisticsString() const { return myStatistics.toString(); }
QVariant statisticsObject() const;
Q_INVOKABLE void setStatisticsObject(StatisticsObject *obj);
- void checkReceive(frame &f);
- void checkSend(frame &f);
- macAddress mac() const { return myMac; }
+ void checkReceive(Frame &f);
+ void checkSend(Frame &f);
+ MacAddress mac() const { return myMac; }
IpAddress ip() const { return myIp; }
IpAddress mask() const { return myMask; }
QString ipString() c...
[truncated message content] |
|
From: <f-r...@us...> - 2011-02-09 01:36:49
|
Revision: 235
http://netemul.svn.sourceforge.net/netemul/?rev=235&view=rev
Author: f-r-o-s-t
Date: 2011-02-09 01:36:43 +0000 (Wed, 09 Feb 2011)
Log Message:
-----------
Little clear
Modified Paths:
--------------
trunk/test/mac/mac.pro
trunk/test/mac/main.cpp
Removed Paths:
-------------
trunk/test/scenexmlreader/
Modified: trunk/test/mac/mac.pro
===================================================================
--- trunk/test/mac/mac.pro 2011-02-09 01:09:50 UTC (rev 234)
+++ trunk/test/mac/mac.pro 2011-02-09 01:36:43 UTC (rev 235)
@@ -1,7 +1,6 @@
# -------------------------------------------------
# Project created by QtCreator 2009-06-28T00:44:43
# -------------------------------------------------
-include(../testing.pri)
QT += testlib
QT -= gui
TARGET = mac
@@ -9,7 +8,8 @@
CONFIG -= app_bundle
TEMPLATE = app
-# HEADERS += ../../src/macaddress.h
-SOURCES += main.cpp \
- ../../src/macaddress.cpp
-HEADERS += ../../src/macaddress.h
+LIBS += -L../.. -lbasicnetlib
+
+INCLUDEPATH += ../../basicnetlib
+
+SOURCES += main.cpp
Modified: trunk/test/mac/main.cpp
===================================================================
--- trunk/test/mac/main.cpp 2011-02-09 01:09:50 UTC (rev 234)
+++ trunk/test/mac/main.cpp 2011-02-09 01:36:43 UTC (rev 235)
@@ -1,7 +1,7 @@
#include <QtTest>
-#include "../../src/macaddress.h"
+#include "macaddress.h"
-class TestMacAddress : public QObject
+class TestmacAddress : public QObject
{
Q_OBJECT
private slots:
@@ -11,14 +11,14 @@
void operators();
};
-void TestMacAddress::toString()
+void TestmacAddress::toString()
{
macAddress m;
m.setMac("01:03:00:00:00:00");
QCOMPARE(m.toString(), tr("01:03:00:00:00:00"));
}
-void TestMacAddress::setBroadcast()
+void TestmacAddress::setBroadcast()
{
macAddress m;
m.setBroadcast();
@@ -26,7 +26,7 @@
QCOMPARE( m.isBroadcast() , true );
}
-void TestMacAddress::saveAndLoad()
+void TestmacAddress::saveAndLoad()
{
macAddress m("01:02:03:04:05:06");
macAddress t = m;
@@ -47,7 +47,7 @@
QCOMPARE( t , m);
}
-void TestMacAddress::operators()
+void TestmacAddress::operators()
{
macAddress a("01:02:03:04:05:06");
macAddress b("01:02:03:04:05:07");
@@ -57,5 +57,5 @@
QCOMPARE( ++a == b , true );
}
-QTEST_MAIN(TestMacAddress)
+QTEST_MAIN(TestmacAddress)
#include "main.moc"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-09 01:10:00
|
Revision: 234
http://netemul.svn.sourceforge.net/netemul/?rev=234&view=rev
Author: f-r-o-s-t
Date: 2011-02-09 01:09:50 +0000 (Wed, 09 Feb 2011)
Log Message:
-----------
Apply names notation.
Modified Paths:
--------------
trunk/src/chips/abstractchip.cpp
trunk/src/chips/interface.cpp
trunk/src/commands/addcablecommand.cpp
trunk/src/commands/addcablecommand.h
trunk/src/commands/addcommand.cpp
trunk/src/commands/addcommand.h
trunk/src/commands/addtextcommand.cpp
trunk/src/commands/addtextcommand.h
trunk/src/commands/deletecommand.cpp
trunk/src/commands/deletecommand.h
trunk/src/commands/movecommand.cpp
trunk/src/commands/movecommand.h
trunk/src/controls/scenecontrol.cpp
trunk/src/controls/scenecontrol.h
trunk/src/delegats/ipaddressdelegate.cpp
trunk/src/delegats/ipaddressdelegate.h
trunk/src/delegats/macaddressdelegate.cpp
trunk/src/delegats/macaddressdelegate.h
trunk/src/devices/boxdevice.h
trunk/src/devices/computer.cpp
trunk/src/devices/computer.h
trunk/src/devices/deviceimpl.cpp
trunk/src/devices/deviceimpl.h
trunk/src/devices/hubdevice.cpp
trunk/src/devices/hubdevice.h
trunk/src/devices/routerdevice.cpp
trunk/src/devices/routerdevice.h
trunk/src/devices/sharebus.cpp
trunk/src/devices/sharebus.h
trunk/src/devices/smartdevice.cpp
trunk/src/devices/smartdevice.h
trunk/src/devices/switchdevice.cpp
trunk/src/devices/switchdevice.h
trunk/src/dialogs/adapterproperty.cpp
trunk/src/dialogs/adapterproperty.h
trunk/src/dialogs/computerproperty.cpp
trunk/src/dialogs/computerproperty.h
trunk/src/dialogs/devicenotedialog.cpp
trunk/src/dialogs/devicenotedialog.h
trunk/src/dialogs/dhcpserverproperty.cpp
trunk/src/dialogs/dhcpserverproperty.h
trunk/src/dialogs/hubproperty.cpp
trunk/src/dialogs/hubproperty.h
trunk/src/dialogs/routerproperty.cpp
trunk/src/dialogs/routerproperty.h
trunk/src/dialogs/settingdialog.cpp
trunk/src/dialogs/staticsdialog.cpp
trunk/src/dialogs/staticsdialog.h
trunk/src/dialogs/switchproperty.cpp
trunk/src/dialogs/switchproperty.h
trunk/src/dialogs/tableswitch.cpp
trunk/src/dialogs/tableswitch.h
trunk/src/dialogs/testdialog.cpp
trunk/src/dialogs/virtualnetworkdialog.cpp
trunk/src/dialogs/virtualnetworkdialog.h
trunk/src/graphics/cabledev.cpp
trunk/src/graphics/cabledev.h
trunk/src/graphics/device.cpp
trunk/src/graphics/device.h
trunk/src/graphics/sendellipse.cpp
trunk/src/interfaces/visualizable.h
trunk/src/mainwindow.cpp
trunk/src/mainwindow.h
trunk/src/models/arpmodel.cpp
trunk/src/models/dhcpservermodel.cpp
trunk/src/models/dhcpservermodel.h
trunk/src/models/switchmodel.cpp
trunk/src/mycanvas.cpp
trunk/src/mycanvas.h
trunk/src/other/appsetting.cpp
trunk/src/other/appsetting.h
trunk/src/programms/dhcpdemon.cpp
trunk/src/programms/dhcpdemon.h
trunk/src/programms/dhcpserverprogramm.cpp
trunk/src/programms/programms.pri
trunk/src/states/abstractstate.cpp
trunk/src/states/cablestate.cpp
trunk/src/states/cablestate.h
trunk/src/states/emptystate.h
trunk/src/states/insertstate.cpp
trunk/src/states/insertstate.h
trunk/src/states/movestate.cpp
trunk/src/states/movestate.h
trunk/src/states/sendstate.cpp
trunk/src/states/sendstate.h
trunk/src/states/textstate.cpp
trunk/src/states/textstate.h
trunk/src/tools/scenexmlwriter.cpp
trunk/src/tools/scenexmlwriter.h
trunk/src/tools/statistics.h
trunk/src/tools/statisticsscene.cpp
trunk/src/tools/statisticsscene.h
trunk/src/tools/tcpsocket.cpp
Removed Paths:
-------------
trunk/src/programms/programm.cpp
trunk/src/programms/programm.h
Modified: trunk/src/chips/abstractchip.cpp
===================================================================
--- trunk/src/chips/abstractchip.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/chips/abstractchip.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -24,10 +24,8 @@
*/
AbstractChip::AbstractChip(QObject *parent) : QObject(parent)
{
-#ifndef __TESTING__
myMac.setRandom();
resetStatics();
-#endif
}
//--------------------------------------------------------------
/*!
Modified: trunk/src/chips/interface.cpp
===================================================================
--- trunk/src/chips/interface.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/chips/interface.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -167,7 +167,7 @@
if ( --i->time ) continue;
if ( i->count <= COUNT_AGAINST_SEND ) {
i->count++;
- i->time = qrand()%(appSetting::arpResponceTime()*i->count)+appSetting::arpResponceTime();
+ i->time = qrand()%(AppSetting::arpResponceTime()*i->count)+AppSetting::arpResponceTime();
sendArpRequest( i->dest );
} else {
myWaits.removeOne(i);
@@ -226,7 +226,7 @@
waitPacket *t = new waitPacket;
t->dest = a;
t->packets << p;
- t->time = appSetting::arpResponceTime();
+ t->time = AppSetting::arpResponceTime();
t->count = 0;
return t;
}
Modified: trunk/src/commands/addcablecommand.cpp
===================================================================
--- trunk/src/commands/addcablecommand.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/addcablecommand.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -21,26 +21,26 @@
#include "mycanvas.h"
#include "cabledev.h"
-addCableCommand::addCableCommand(MyCanvas *s, Cable *c)
+AddCableCommand::AddCableCommand(MyCanvas *s, Cable *c)
{
scene = s;
cable = c;
setText(QObject::tr("Add cable"));
}
-addCableCommand::~addCableCommand()
+AddCableCommand::~AddCableCommand()
{
if ( !isOnScene) delete cable;
}
-void addCableCommand::undo()
+void AddCableCommand::undo()
{
// cable->unregisterCable();
scene->unregisterCable(cable);
isOnScene = false;
}
-void addCableCommand::redo()
+void AddCableCommand::redo()
{
// cable->registerCable();
scene->registerCable(cable);
Modified: trunk/src/commands/addcablecommand.h
===================================================================
--- trunk/src/commands/addcablecommand.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/addcablecommand.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -25,11 +25,11 @@
class MyCanvas;
class Cable;
-class addCableCommand : public QUndoCommand
+class AddCableCommand : public QUndoCommand
{
public:
- addCableCommand(MyCanvas *s, Cable *c);
- ~addCableCommand();
+ AddCableCommand(MyCanvas *s, Cable *c);
+ ~AddCableCommand();
void redo();
void undo();
private:
Modified: trunk/src/commands/addcommand.cpp
===================================================================
--- trunk/src/commands/addcommand.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/addcommand.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -21,7 +21,7 @@
#include "addcommand.h"
#include "mycanvas.h"
-addCommand::addCommand(MyCanvas *s, QPointF point , int type)
+AddCommand::AddCommand(MyCanvas *s, QPointF point , int type)
{
scene = s;
myDevice = 0;
@@ -29,18 +29,18 @@
myType = type;
}
-addCommand::~addCommand()
+AddCommand::~AddCommand()
{
if ( !isOnScene ) delete myDevice;
}
-void addCommand::undo()
+void AddCommand::undo()
{
scene->unregisterDevice(myDevice);
isOnScene = false;
}
-void addCommand::redo()
+void AddCommand::redo()
{
if ( myDevice ) scene->registerDevice(myDevice);
else {
Modified: trunk/src/commands/addcommand.h
===================================================================
--- trunk/src/commands/addcommand.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/addcommand.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -25,11 +25,11 @@
class MyCanvas;
class Device;
-class addCommand : public QUndoCommand
+class AddCommand : public QUndoCommand
{
public:
- addCommand(MyCanvas *s , QPointF point , int type);
- ~addCommand();
+ AddCommand(MyCanvas *s , QPointF point , int type);
+ ~AddCommand();
void undo();
void redo();
private:
Modified: trunk/src/commands/addtextcommand.cpp
===================================================================
--- trunk/src/commands/addtextcommand.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/addtextcommand.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -20,7 +20,7 @@
#include "addtextcommand.h"
#include "mycanvas.h"
-addTextCommand::addTextCommand(MyCanvas *s, QPointF p)
+AddTextCommand::AddTextCommand(MyCanvas *s, QPointF p)
{
scene = s;
point = p;
@@ -28,18 +28,18 @@
setText(QObject::tr("Add note"));
}
-addTextCommand::~addTextCommand()
+AddTextCommand::~AddTextCommand()
{
if ( !isOnScene ) delete text;
}
-void addTextCommand::undo()
+void AddTextCommand::undo()
{
scene->unregisterText(text);
isOnScene = false;
}
-void addTextCommand::redo()
+void AddTextCommand::redo()
{
if ( isFirst ) {
text = scene->createTextItem(point);
Modified: trunk/src/commands/addtextcommand.h
===================================================================
--- trunk/src/commands/addtextcommand.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/addtextcommand.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -26,11 +26,11 @@
class MyCanvas;
class TextItem;
-class addTextCommand : public QUndoCommand
+class AddTextCommand : public QUndoCommand
{
public:
- addTextCommand(MyCanvas *s, QPointF p);
- ~addTextCommand();
+ AddTextCommand(MyCanvas *s, QPointF p);
+ ~AddTextCommand();
void undo();
void redo();
private:
Modified: trunk/src/commands/deletecommand.cpp
===================================================================
--- trunk/src/commands/deletecommand.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/deletecommand.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -23,7 +23,7 @@
#include "device.h"
#include "textitem.h"
-deleteCommand::deleteCommand(MyCanvas *s, QList<QGraphicsItem*> list)
+DeleteCommand::DeleteCommand(MyCanvas *s, QList<QGraphicsItem*> list)
{
scene = s;
foreach ( QGraphicsItem *i, list) {
@@ -38,7 +38,7 @@
setText(QObject::tr("Delete"));
}
-deleteCommand::~deleteCommand()
+DeleteCommand::~DeleteCommand()
{
if ( isOnScene ) return;
qDeleteAll(extractDevices);
@@ -46,7 +46,7 @@
qDeleteAll(extractText);
}
-void deleteCommand::undo()
+void DeleteCommand::undo()
{
foreach ( Device *i, extractDevices ) scene->registerDevice(i);
foreach ( Cable *i, extractCables ) createConnection(i);
@@ -54,7 +54,7 @@
isOnScene = true;
}
-void deleteCommand::redo()
+void DeleteCommand::redo()
{
foreach ( Device *i, extractDevices ) scene->unregisterDevice(i);
foreach ( Cable *i, extractCables ) deleteConnection(i);
@@ -62,13 +62,13 @@
isOnScene = false;
}
-void deleteCommand::deleteConnection(Cable *cable)
+void DeleteCommand::deleteConnection(Cable *cable)
{
// cable->unregisterCable();
scene->unregisterCable(cable);
}
-void deleteCommand::createConnection(Cable *cable)
+void DeleteCommand::createConnection(Cable *cable)
{
// cable->registerCable();
scene->registerCable(cable);
Modified: trunk/src/commands/deletecommand.h
===================================================================
--- trunk/src/commands/deletecommand.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/deletecommand.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -29,11 +29,11 @@
class Device;
class TextItem;
-class deleteCommand : public QUndoCommand
+class DeleteCommand : public QUndoCommand
{
public:
- deleteCommand(MyCanvas *s, QList<QGraphicsItem*> list);
- ~deleteCommand();
+ DeleteCommand(MyCanvas *s, QList<QGraphicsItem*> list);
+ ~DeleteCommand();
void undo();
void redo();
void deleteConnection(Cable *cable);
Modified: trunk/src/commands/movecommand.cpp
===================================================================
--- trunk/src/commands/movecommand.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/movecommand.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -19,7 +19,7 @@
****************************************************************************************/
#include "movecommand.h"
-moveCommand::moveCommand(MyCanvas *s,mapWithCoords o,mapWithCoords r)
+MoveCommand::MoveCommand(MyCanvas *s,mapWithCoords o,mapWithCoords r)
{
scene = s;
old = o;
@@ -27,12 +27,12 @@
setText(QObject::tr("Move"));
}
-void moveCommand::undo()
+void MoveCommand::undo()
{
scene->putItems(old);
}
-void moveCommand::redo()
+void MoveCommand::redo()
{
scene->putItems(recent);
}
Modified: trunk/src/commands/movecommand.h
===================================================================
--- trunk/src/commands/movecommand.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/commands/movecommand.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -25,10 +25,10 @@
typedef QMap<QGraphicsItem*,QPointF> mapWithCoords;
-class moveCommand : public QUndoCommand
+class MoveCommand : public QUndoCommand
{
public:
- moveCommand(MyCanvas *s,mapWithCoords o, mapWithCoords r);
+ MoveCommand(MyCanvas *s,mapWithCoords o, mapWithCoords r);
void undo();
void redo();
private:
Modified: trunk/src/controls/scenecontrol.cpp
===================================================================
--- trunk/src/controls/scenecontrol.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/controls/scenecontrol.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -21,12 +21,12 @@
#include "device.h"
#include "mycanvas.h"
-sceneControl::sceneControl(QObject *parent , MyCanvas *s ) : QObject(parent) , scene(s)
+SceneControl::SceneControl(QObject *parent , MyCanvas *s ) : QObject(parent) , scene(s)
{
connect( scene , SIGNAL(selectionChanged()) , SLOT(observeSelection()) );
}
-void sceneControl::observeSelection()
+void SceneControl::observeSelection()
{
if ( Device *t = scene->oneSelectedDevice() ) {
emit selectTableDevice( t->hasTable() );
@@ -44,77 +44,77 @@
}
}
-QString sceneControl::tableName() const
+QString SceneControl::tableName() const
{
return scene->oneSelectedDevice()->tableName();
}
-void sceneControl::propertyDialog() const
+void SceneControl::propertyDialog() const
{
Device *t = scene->oneSelectedDevice();
t->dialog();
}
-void sceneControl::tableDialog() const
+void SceneControl::tableDialog() const
{
Device *t = scene->oneSelectedDevice();
t->tableDialog();
}
-void sceneControl::adapterDialog() const
+void SceneControl::adapterDialog() const
{
Device *t = scene->oneSelectedDevice();
t->adapterDialog();
}
-void sceneControl::programmsDialog() const
+void SceneControl::programmsDialog() const
{
Device *t = scene->oneSelectedDevice();
t->programmsDialog();
}
-void sceneControl::arpDialog() const
+void SceneControl::arpDialog() const
{
Device *t = scene->oneSelectedDevice();
t->arpDialog();
}
-void sceneControl::showLogDialog(logDialog *log) const
+void SceneControl::showLogDialog(logDialog *log) const
{
Device *t = scene->oneSelectedDevice();
t->showLogDialog(log);
}
-void sceneControl::showDesignerDialog() const
+void SceneControl::showDesignerDialog() const
{
Device *t = scene->oneSelectedDevice();
t->showDesignerDialog();
}
-void sceneControl::showDeviceNoteDialog() const
+void SceneControl::showDeviceNoteDialog() const
{
Device *t = scene->oneSelectedDevice();
t->showDeviceNoteDialog();
}
-void sceneControl::showVirtualNetworkDialog() const
+void SceneControl::showVirtualNetworkDialog() const
{
scene->oneSelectedDevice()->showVirtualNetworkDialog();
}
-bool sceneControl::isSelect() const
+bool SceneControl::isSelect() const
{
if ( scene->oneSelectedDevice() ) return true;
return false;
}
-QString sceneControl::note() const
+QString SceneControl::note() const
{
Device *t = scene->oneSelectedDevice();
return t->toolTip();
}
-QIcon sceneControl::tableIcon() const
+QIcon SceneControl::tableIcon() const
{
Device *t = scene->oneSelectedDevice();
if ( !t->hasTable() ) return QIcon();
@@ -122,13 +122,13 @@
else return QIcon(":/im/images/table_arp.png");
}
-QString sceneControl::deviceName() const
+QString SceneControl::deviceName() const
{
Device *t = scene->oneSelectedDevice();
return t->deviceName();
}
-QStringList sceneControl::sockets() const
+QStringList SceneControl::sockets() const
{
Device *t = scene->oneSelectedDevice();
return t->sockets();
Modified: trunk/src/controls/scenecontrol.h
===================================================================
--- trunk/src/controls/scenecontrol.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/controls/scenecontrol.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -26,11 +26,11 @@
class MyCanvas;
class logDialog;
-class sceneControl : public QObject
+class SceneControl : public QObject
{
Q_OBJECT
public:
- sceneControl(QObject *parent,MyCanvas *s);
+ SceneControl(QObject *parent,MyCanvas *s);
bool isSelect() const;
QString tableName() const;
QString note() const;
Modified: trunk/src/delegats/ipaddressdelegate.cpp
===================================================================
--- trunk/src/delegats/ipaddressdelegate.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/delegats/ipaddressdelegate.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -21,24 +21,24 @@
#include <QLineEdit>
#include <QStringList>
-ipAddressDelegate::ipAddressDelegate(QObject *parent /* = 0 */) : QItemDelegate(parent)
+IpAddressDelegate::IpAddressDelegate(QObject *parent /* = 0 */) : QItemDelegate(parent)
{
}
-QWidget* ipAddressDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex&) const
+QWidget* IpAddressDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex&) const
{
QLineEdit *line = new QLineEdit(parent);
return line;
}
-void ipAddressDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
+void IpAddressDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
QString data = index.model()->data(index,Qt::EditRole ).toString();
QLineEdit *line = static_cast<QLineEdit*>(editor);
line->setText(data);
}
-void ipAddressDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,const QModelIndex &index) const
+void IpAddressDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,const QModelIndex &index) const
{
QLineEdit *line = static_cast<QLineEdit*>(editor);
QString data = line->text();
@@ -47,7 +47,7 @@
model->setData(index,data,Qt::EditRole);
}
-void ipAddressDelegate::updateEditorGeometry(QWidget *editor,const QStyleOptionViewItem &option,const QModelIndex&) const
+void IpAddressDelegate::updateEditorGeometry(QWidget *editor,const QStyleOptionViewItem &option,const QModelIndex&) const
{
editor->setGeometry( option.rect );
}
Modified: trunk/src/delegats/ipaddressdelegate.h
===================================================================
--- trunk/src/delegats/ipaddressdelegate.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/delegats/ipaddressdelegate.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -22,10 +22,10 @@
#include <QItemDelegate>
-class ipAddressDelegate : public QItemDelegate
+class IpAddressDelegate : public QItemDelegate
{
public:
- ipAddressDelegate(QObject *parent = 0);
+ IpAddressDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem&,
const QModelIndex&) const;
Modified: trunk/src/delegats/macaddressdelegate.cpp
===================================================================
--- trunk/src/delegats/macaddressdelegate.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/delegats/macaddressdelegate.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -20,33 +20,33 @@
#include "macaddressdelegate.h"
#include <QLineEdit>
-macAddressDelegate::macAddressDelegate(QObject *parent /* = 0 */) : QItemDelegate(parent)
+MacAddressDelegate::MacAddressDelegate(QObject *parent /* = 0 */) : QItemDelegate(parent)
{
}
-QWidget* macAddressDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex&) const
+QWidget* MacAddressDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex&) const
{
QLineEdit *line = new QLineEdit(parent);
line->setInputMask("HH:HH:HH:HH:HH:HH;_");
return line;
}
-void macAddressDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
+void MacAddressDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
QString data = index.model()->data(index,Qt::EditRole ).toString();
QLineEdit *line = static_cast<QLineEdit*>(editor);
line->setText(data);
}
-void macAddressDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,const QModelIndex &index) const
+void MacAddressDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,const QModelIndex &index) const
{
QLineEdit *line = static_cast<QLineEdit*>(editor);
QString data = line->text();
model->setData(index,data,Qt::EditRole);
}
-void macAddressDelegate::updateEditorGeometry(QWidget *editor,const QStyleOptionViewItem &option,const QModelIndex&) const
+void MacAddressDelegate::updateEditorGeometry(QWidget *editor,const QStyleOptionViewItem &option,const QModelIndex&) const
{
editor->setGeometry( option.rect );
}
Modified: trunk/src/delegats/macaddressdelegate.h
===================================================================
--- trunk/src/delegats/macaddressdelegate.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/delegats/macaddressdelegate.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -22,11 +22,11 @@
#include <QItemDelegate>
-class macAddressDelegate : public QItemDelegate
+class MacAddressDelegate : public QItemDelegate
{
Q_OBJECT
public:
- macAddressDelegate(QObject *parent = 0);
+ MacAddressDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem&,
const QModelIndex&) const;
Modified: trunk/src/devices/boxdevice.h
===================================================================
--- trunk/src/devices/boxdevice.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/boxdevice.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -29,8 +29,7 @@
Q_OBJECT
Q_PROPERTY( bool isManual READ isManual WRITE setManual )
public:
- friend class boxSetting;
- BoxDevice(QObject *parent = 0);
+ BoxDevice(QObject *parent = 0);
virtual ~BoxDevice();
bool isConnectSocket(const QString &socket) const { return myChip->isConnectSocket(socket); }
QIcon isConnectSocketIcon(const QString &socket) const;
@@ -66,12 +65,15 @@
bool myManual;
BoxChip *myChip;
virtual void write(QDataStream &stream) const;
- virtual void read(QDataStream &stream);
+ virtual void read(QDataStream &stream);
+
+public:
+ friend class BoxSetting;
};
-class boxSetting : public deviceSetting {
+class BoxSetting : public DeviceSetting {
public:
- boxSetting(BoxDevice *h) : deviceSetting(h) , box(h) { }
+ BoxSetting(BoxDevice *h) : DeviceSetting(h) , box(h) { }
int socketsCount() const { return box->myChip->socketsCount(); }
QString snmpMac() const { return box->myChip->mac().toString(); }
QString snmpIp() const { return box->myChip->ip().toString(); }
Modified: trunk/src/devices/computer.cpp
===================================================================
--- trunk/src/devices/computer.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/computer.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -35,7 +35,7 @@
Computer* Computer::create(QObject *parent)
{
Computer *c = new Computer(parent);
- c->setSocketsCount(appSetting::defaultComputerCount());
+ c->setSocketsCount(AppSetting::defaultComputerCount());
c->setRouteModel( new RouteModel(c) );
c->routeModel()->addToTable("127.0.0.0","255.0.0.0","127.0.0.1","127.0.0.1",0,RouteModel::connectMode);
c->setNote(tr("<b>Computer</b><!--You can use HTML.-->"));
@@ -50,11 +50,9 @@
void Computer::dialog()
{
-#ifndef __TESTING__
computerProperty *d = new computerProperty;
- d->setDevice( new computerSetting(this) );
+ d->setDevice( new ComputerSetting(this) );
d->exec();
-#endif
}
void Computer::setSocketsCount(int n)
Modified: trunk/src/devices/computer.h
===================================================================
--- trunk/src/devices/computer.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/computer.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -55,9 +55,9 @@
};
//---------------------------------------------
-class computerSetting : public smartSetting {
+class ComputerSetting : public SmartSetting {
public:
- computerSetting( Computer *c ) : smartSetting(c) , cp(c) { }
+ ComputerSetting( Computer *c ) : SmartSetting(c) , cp(c) { }
QString gateway() const { return cp->gateway().toString(); }
void setGateway(const QString &str) { cp->setGateway(str); }
private:
Modified: trunk/src/devices/deviceimpl.cpp
===================================================================
--- trunk/src/devices/deviceimpl.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/deviceimpl.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -28,7 +28,7 @@
void DeviceImpl::showDeviceNoteDialog()
{
deviceNoteDialog *d = new deviceNoteDialog;
- d->setDevice( new deviceSetting(this) );
+ d->setDevice( new DeviceSetting(this) );
d->exec();
}
Modified: trunk/src/devices/deviceimpl.h
===================================================================
--- trunk/src/devices/deviceimpl.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/deviceimpl.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -31,7 +31,7 @@
class logDialog;
class DevicePort;
-typedef QMap<QString,bool> featuresMap;
+typedef QMap<QString,bool> FeaturesMap;
class DeviceImpl : public QObject
{
@@ -46,7 +46,7 @@
virtual int type() const = 0;
virtual QStringList sockets() const = 0;
- virtual featuresMap featuresList() const { return featuresMap(); }
+ virtual FeaturesMap featuresList() const { return FeaturesMap(); }
virtual bool isConnectSocket(const QString &socket) const = 0;
virtual QIcon isConnectSocketIcon( const QString &socket) const = 0;
virtual QString socketName(const Cable *c) const = 0;
@@ -90,7 +90,7 @@
virtual bool isCanSend() const { return false; }
- void setVisualizator( visualizable *view ) { myView = view; }
+ void setVisualizator( Visualizable *view ) { myView = view; }
void updateView() const { myView->onImplChange(); }
public:
@@ -113,14 +113,14 @@
virtual quint64 sendFrameCount(const QString&) { return 0; }
virtual quint64 receiveFrameCount(const QString&) { return 0; }
protected:
- visualizable *myView;
+ Visualizable *myView;
private:
QString myNote;
};
-class deviceSetting {
+class DeviceSetting {
public:
- deviceSetting(DeviceImpl *d) : dev(d) { }
+ DeviceSetting(DeviceImpl *d) : dev(d) { }
QString note() const { return dev->note(); }
void setNote(const QString &str) { dev->setNote(str); }
private:
Modified: trunk/src/devices/hubdevice.cpp
===================================================================
--- trunk/src/devices/hubdevice.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/hubdevice.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -32,8 +32,8 @@
{
HubDevice *h = new HubDevice(parent);
h->setBoxChip(new HubChip(h));
- h->setSocketsCount( appSetting::defaultHubCount() );
- h->setManual( appSetting::defaultHubManual() );
+ h->setSocketsCount( AppSetting::defaultHubCount() );
+ h->setManual( AppSetting::defaultHubManual() );
h->setNote(tr( "<b>Hub</b><!--You can use HTML.-->" ) );
return h;
}
@@ -66,7 +66,7 @@
void HubDevice::dialog()
{
hubProperty *d = new hubProperty;
- hubSetting *set = new hubSetting(this);
+ HubSetting *set = new HubSetting(this);
d->setHub(set);
d->exec();
delete set;
Modified: trunk/src/devices/hubdevice.h
===================================================================
--- trunk/src/devices/hubdevice.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/hubdevice.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -44,7 +44,7 @@
QString deviceName() const { return "hub"; }
QString deviceCommandName() const { return tr("Hub"); }
QString pixmapName() const { return ":/im/images/hub.png"; }
- friend class hubSetting;
+ friend class HubSetting;
protected:
void write(QDataStream &stream) const;
void read(QDataStream &stream);
@@ -52,12 +52,12 @@
quint32 m_collision;
};
-class hubSetting : public boxSetting
+class HubSetting : public BoxSetting
{
public:
- hubSetting(HubDevice *d) : boxSetting(d) , hd(d) { }
+ HubSetting(HubDevice *d) : BoxSetting(d) , hd(d) { }
quint32 collisions() const { return hd->m_collision; }
- void reset() { boxSetting::reset(); hd->m_collision = 0; }
+ void reset() { BoxSetting::reset(); hd->m_collision = 0; }
private:
HubDevice *hd;
};
Modified: trunk/src/devices/routerdevice.cpp
===================================================================
--- trunk/src/devices/routerdevice.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/routerdevice.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -31,7 +31,7 @@
RouterDevice* RouterDevice::create(QObject *parent)
{
RouterDevice *r = new RouterDevice(parent);
- r->setSocketsCount( appSetting::defaultRouterCount() );
+ r->setSocketsCount( AppSetting::defaultRouterCount() );
r->setRouteModel( new RouteModel() );
r->setNote(tr("<b>Router</b><!--You can use HTML.-->"));
return r;
@@ -40,7 +40,7 @@
void RouterDevice::dialog()
{
routerProperty *d = new routerProperty;
- routerSetting *set = new routerSetting(this);
+ RouterSetting *set = new RouterSetting(this);
d->setRouter(set);
d->exec();
delete d;
Modified: trunk/src/devices/routerdevice.h
===================================================================
--- trunk/src/devices/routerdevice.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/routerdevice.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -42,10 +42,10 @@
void setSocketsCount(int n);
};
-class routerSetting : public smartSetting
+class RouterSetting : public SmartSetting
{
public:
- routerSetting(RouterDevice *r) : smartSetting(r) , rd(r) { }
+ RouterSetting(RouterDevice *r) : SmartSetting(r) , rd(r) { }
void setSocketsCount(int n) { rd->setSocketsCount(n); }
private:
RouterDevice *rd;
Modified: trunk/src/devices/sharebus.cpp
===================================================================
--- trunk/src/devices/sharebus.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/sharebus.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -19,13 +19,13 @@
****************************************************************************************/
#include "sharebus.h"
-shareBus::shareBus(int c)
+ShareBus::ShareBus(int c)
{
Q_UNUSED(c);
widthDev = defaultWidth;
}
-DevicePort* shareBus::addInterface(QString str, int t)
+DevicePort* ShareBus::addInterface(QString str, int t)
{
Q_UNUSED(str);
Q_UNUSED(t);
Modified: trunk/src/devices/sharebus.h
===================================================================
--- trunk/src/devices/sharebus.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/sharebus.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -28,11 +28,11 @@
// который унаследован от device , так как у общей шины будет отличаться
// реализация и отображение от остальных устройств
//
-class shareBus : public DeviceImpl
+class ShareBus : public DeviceImpl
{
public:
enum { defaultWidth = 200 };
- shareBus(int c);
+ ShareBus(int c);
DevicePort* addInterface(QString str,int t);
void dialog() { }
bool hasTable() const { return false; }
Modified: trunk/src/devices/smartdevice.cpp
===================================================================
--- trunk/src/devices/smartdevice.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/smartdevice.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -41,7 +41,9 @@
SmartDevice::~SmartDevice()
{
qDeleteAll(mySockets);
+ mySockets.clear();
qDeleteAll(myInterfaces);
+ myInterfaces.clear();
}
const Interface* SmartDevice::adapter(const QString &s) const
@@ -290,44 +292,36 @@
void SmartDevice::showLogDialog(logDialog *log) const
{
-#ifndef __TESTING__
connect( log ,SIGNAL(changeInterface(QString)) , this ,SLOT(setCheckedSocket(QString)) );
foreach ( Interface *i , myInterfaces ) {
connect( i , SIGNAL(receiveData(frame,QString)) , log , SLOT(receiveData(frame,QString)) );
connect( i , SIGNAL(sendData(frame,QString)) , log , SLOT(sendData(frame,QString)) );
}
-#endif
}
void SmartDevice::adapterDialog()
{
-#ifndef __TESTING__
- adapterProperty *d = new adapterProperty( new adapterSetting(this) );
+ adapterProperty *d = new adapterProperty( new AdapterSetting(this) );
d->show();
-#endif
}
void SmartDevice::programmsDialog()
{
-#ifndef __TESTING__
programmDialog *d = new programmDialog;
d->setDevice(this);
d->show();
-#endif
}
void SmartDevice::arpDialog()
{
-#ifndef __TESTING__
tableArp *d = new tableArp;
d->setDevice(this);
d->exec();
-#endif
}
-featuresMap SmartDevice::featuresList() const
+FeaturesMap SmartDevice::featuresList() const
{
- featuresMap t;
+ FeaturesMap t;
foreach ( Program *i , myPrograms )
t.insert(i->featureName(),i->isEnable());
return t;
@@ -552,15 +546,15 @@
}
connect( s , SIGNAL(imFinished(AbstractSocket*)) , this , SLOT(disposeSocket(AbstractSocket*)) );
mySockets << s;
- qDebug("Socket %d created",type);
return s;
}
void SmartDevice::disposeSocket(AbstractSocket *socket)
{
- qDebug("Socket removed");
- mySockets.removeOne(socket);
- delete socket;
+ if ( mySockets.contains(socket) ) {
+ mySockets.removeOne(socket);
+ delete socket;
+ }
}
//------------------------------------------------------------------------------
@@ -569,7 +563,7 @@
/*!
* Функция устанавливает текущий выбранный интерфейс в настройках адаптеров.
*/
-void adapterSetting::setCurrent(int n)
+void AdapterSetting::setCurrent(int n)
{
cur = n;
oldMask = sd->myInterfaces[cur]->mask();
@@ -579,7 +573,7 @@
/*!
* Изменяет таблицу маршрутизации в соответсвии с новыми настройками интрефейсов.
*/
-void adapterSetting::connectedNet()
+void AdapterSetting::connectedNet()
{
RouteRecord *t = sd->routeModel()->recordAt( oldMask & oldIp );
if ( t ) { // Удаляем запись со старыми натсройками
@@ -589,13 +583,13 @@
}
//--------------------------------------------------------------------------
-bool adapterSetting::isUnderDhcpControl() const
+bool AdapterSetting::isUnderDhcpControl() const
{
DhcpClientProgram *t = qobject_cast<DhcpClientProgram*>( sd->programAt(Program::DHCPClient) );
return t->isUnderDhcpControl( sd->myInterfaces.at(cur)->name() );
}
-void adapterSetting::setUnderDhcpControl(bool isUnder)
+void AdapterSetting::setUnderDhcpControl(bool isUnder)
{
DhcpClientProgram *t = qobject_cast<DhcpClientProgram*>( sd->programAt( Program::DHCPClient) );
t->observeInterface( sd->myInterfaces.at(cur)->name() , isUnder );
Modified: trunk/src/devices/smartdevice.h
===================================================================
--- trunk/src/devices/smartdevice.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/smartdevice.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -67,7 +67,7 @@
QStringList interfacesIp() const;
QList<Cable*> cableList() const;
DevicePort* findPortByName(const QString &name) const;
- featuresMap featuresList() const;
+ FeaturesMap featuresList() const;
void addInterface();
bool isConnectSocket(const QString &socket) const { return adapter(socket)->isConnect(); }
bool hasConnentSockets() const;
@@ -139,15 +139,15 @@
virtual void read(QDataStream &stream);
// FRIENDS:
public:
- friend class adapterSetting;
+ friend class AdapterSetting;
};
//-------------------------------------------------------------------
/*!
Модель данных для настроек адаптеров.
*/
-class adapterSetting {
+class AdapterSetting {
public:
- adapterSetting(SmartDevice *s) : sd(s) { }
+ AdapterSetting(SmartDevice *s) : sd(s) { }
void setCurrent(int n);
int current() const { return cur; }
void resetStatics() { sd->myInterfaces.at(cur)->resetStatics(); }
@@ -179,9 +179,9 @@
};
//-------------------------------------------------------------
-class smartSetting : public deviceSetting {
+class SmartSetting : public DeviceSetting {
public:
- smartSetting(SmartDevice *d) : deviceSetting(d) , sd(d) { }
+ SmartSetting(SmartDevice *d) : DeviceSetting(d) , sd(d) { }
int socketsCount() const { return sd->socketsCount(); }
bool isRouter() const { return sd->isRouter(); }
void setRouter(bool b) { sd->setRouter(b); }
Modified: trunk/src/devices/switchdevice.cpp
===================================================================
--- trunk/src/devices/switchdevice.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/switchdevice.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -33,8 +33,8 @@
{
SwitchDevice *s = new SwitchDevice(parent);
s->setBoxChip( SwitchChip::create(s) );
- s->setSocketsCount( appSetting::defaultSwitchCount() );
- s->setManual( appSetting::defaultSwitchManual() );
+ s->setSocketsCount( AppSetting::defaultSwitchCount() );
+ s->setManual( AppSetting::defaultSwitchManual() );
s->setNote(tr("<b>Switch</b><!--You can use HTML.-->"));
return s;
}
@@ -58,13 +58,13 @@
void SwitchDevice::dialog()
{
switchProperty *d = new switchProperty;
- d->setSwitch( new boxSetting(this) );
+ d->setSwitch( new BoxSetting(this) );
d->show();
}
void SwitchDevice::tableDialog()
{
- switchTableSetting *set = new switchTableSetting(this);
+ SwitchTableSetting *set = new SwitchTableSetting(this);
TableSwitch *t = new TableSwitch(set);
t->exec();
delete t;
@@ -74,7 +74,7 @@
void SwitchDevice::showVirtualNetworkDialog()
{
virtualNetworkDialog *d = new virtualNetworkDialog;
- d->setDevice( new virtualNetworkSetting(this) );
+ d->setDevice( new VirtualNetworkSetting(this) );
d->show();
}
@@ -90,7 +90,7 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
-SwitchModel* switchTableSetting::switchTable()
+SwitchModel* SwitchTableSetting::switchTable()
{
return sw->concreteChip()->modelAt( sw->concreteChip()->vlanAt(0) );
}
Modified: trunk/src/devices/switchdevice.h
===================================================================
--- trunk/src/devices/switchdevice.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/devices/switchdevice.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -25,7 +25,7 @@
class frame;
class SwitchModel;
-class switchTableSetting;
+class SwitchTableSetting;
class SwitchChip;
// Пока такое коротенькое объявление для свитча
@@ -34,7 +34,6 @@
{
Q_OBJECT
public:
- friend class switchTableSetting;
enum { switchDev = 5 };
int type() const { return switchDev; }
SwitchDevice(QObject *parent = 0); //Пока конструктор и прорисовка
@@ -55,11 +54,14 @@
protected:
void write(QDataStream &stream) const;
void read(QDataStream &stream);
+
+public:
+ friend class SwitchTableSetting;
};
-class switchTableSetting {
+class SwitchTableSetting {
public:
- switchTableSetting(SwitchDevice *s) : sw(s) { }
+ SwitchTableSetting(SwitchDevice *s) : sw(s) { }
SwitchModel* switchTable();
int socketsCount() const { return sw->myChip->socketsCount(); }
void removeFromTable(int row);
@@ -68,9 +70,9 @@
SwitchDevice *sw;
};
-class virtualNetworkSetting {
+class VirtualNetworkSetting {
public:
- virtualNetworkSetting( SwitchDevice *device ) : myDevice(device) { }
+ VirtualNetworkSetting( SwitchDevice *device ) : myDevice(device) { }
private:
SwitchDevice *myDevice;
};
Modified: trunk/src/dialogs/adapterproperty.cpp
===================================================================
--- trunk/src/dialogs/adapterproperty.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/adapterproperty.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -29,7 +29,7 @@
/*!
Конструктор создает основной интерфейс диалога.
*/
-adapterProperty::adapterProperty(adapterSetting *s)
+adapterProperty::adapterProperty(AdapterSetting *s)
{
setWindowTitle(tr("Netcard"));
sd = s;
Modified: trunk/src/dialogs/adapterproperty.h
===================================================================
--- trunk/src/dialogs/adapterproperty.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/adapterproperty.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -30,7 +30,7 @@
class DevicePort;
class ipEdit;
-class adapterSetting;
+class AdapterSetting;
/**
Класс диалога настройки адаптеров.
@@ -40,7 +40,7 @@
Q_OBJECT
Q_DISABLE_COPY(adapterProperty)
public:
- adapterProperty(adapterSetting *s);
+ adapterProperty(AdapterSetting *s);
~adapterProperty();
private slots:
void updateTab(int n);
@@ -51,7 +51,7 @@
void onAutoClicked(bool isAuto);
void apply();
private:
- adapterSetting *sd;
+ AdapterSetting *sd;
QLabel *lb_statics;
QTabBar *tab_interfaces;
QLineEdit *le_name;
Modified: trunk/src/dialogs/computerproperty.cpp
===================================================================
--- trunk/src/dialogs/computerproperty.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/computerproperty.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -49,7 +49,7 @@
delete comp;
}
-void computerProperty::setDevice(computerSetting *c)
+void computerProperty::setDevice(ComputerSetting *c)
{
comp = c;
gateway->setText( c->gateway() );
Modified: trunk/src/dialogs/computerproperty.h
===================================================================
--- trunk/src/dialogs/computerproperty.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/computerproperty.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -24,7 +24,7 @@
class QCheckBox;
-class computerSetting;
+class ComputerSetting;
class ipEdit;
class computerProperty : public dialogTemplate
@@ -34,9 +34,9 @@
public:
computerProperty();
~computerProperty();
- void setDevice(computerSetting *c);
+ void setDevice(ComputerSetting *c);
private:
- computerSetting *comp;
+ ComputerSetting *comp;
QCheckBox *cb_route;
ipEdit *gateway;
public slots:
Modified: trunk/src/dialogs/devicenotedialog.cpp
===================================================================
--- trunk/src/dialogs/devicenotedialog.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/devicenotedialog.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -7,7 +7,7 @@
setAttribute(Qt::WA_DeleteOnClose);
}
-void deviceNoteDialog::setDevice(deviceSetting *device)
+void deviceNoteDialog::setDevice(DeviceSetting *device)
{
myDevice = device;
te_text->setPlainText( device->note() );
Modified: trunk/src/dialogs/devicenotedialog.h
===================================================================
--- trunk/src/dialogs/devicenotedialog.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/devicenotedialog.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -3,20 +3,20 @@
#include "ui_devicenotedialog.h"
-class deviceSetting;
+class DeviceSetting;
class deviceNoteDialog : public QDialog, private Ui::deviceNoteDialog {
Q_OBJECT
public:
deviceNoteDialog(QWidget *parent = 0);
- void setDevice(deviceSetting *device);
+ void setDevice(DeviceSetting *device);
~deviceNoteDialog();
public slots:
void apply();
protected:
void changeEvent(QEvent *e);
private:
- deviceSetting *myDevice;
+ DeviceSetting *myDevice;
};
#endif // DEVICENOTEDIALOG_H
Modified: trunk/src/dialogs/dhcpserverproperty.cpp
===================================================================
--- trunk/src/dialogs/dhcpserverproperty.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/dhcpserverproperty.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -32,8 +32,8 @@
setAttribute(Qt::WA_DeleteOnClose);
foreach ( Interface *i, device->interfaces() )
if ( i->isConnect() ) cb_interface->addItem( QIcon(":im/images/ok.png"), i->name() );
- macDelegate = new macAddressDelegate(this);
- ipDelegate = new ipAddressDelegate(this);
+ macDelegate = new MacAddressDelegate(this);
+ ipDelegate = new IpAddressDelegate(this);
tv_static->setItemDelegateForColumn(0, macDelegate );
for ( int i = 1 ; i <= 3 ; i++ )
tv_static->setItemDelegateForColumn(i,ipDelegate);
Modified: trunk/src/dialogs/dhcpserverproperty.h
===================================================================
--- trunk/src/dialogs/dhcpserverproperty.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/dhcpserverproperty.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -24,10 +24,10 @@
#include "ipedit.h"
class DhcpServerProgram;
-class dhcpServerModel;
+class DhcpServerModel;
class SmartDevice;
-class macAddressDelegate;
-class ipAddressDelegate;
+class MacAddressDelegate;
+class IpAddressDelegate;
class dhcpServerProperty : public QDialog, private Ui::dhspServerProperty
{
@@ -44,10 +44,10 @@
protected:
void changeEvent(QEvent *e);
private:
- macAddressDelegate *macDelegate;
- ipAddressDelegate *ipDelegate;
+ MacAddressDelegate *macDelegate;
+ IpAddressDelegate *ipDelegate;
DhcpServerProgram *myProgramm;
- dhcpServerModel *myModel;
+ DhcpServerModel *myModel;
SmartDevice *device;
};
Modified: trunk/src/dialogs/hubproperty.cpp
===================================================================
--- trunk/src/dialogs/hubproperty.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/hubproperty.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -69,7 +69,7 @@
{
}
-void hubProperty::setHub(hubSetting *s)
+void hubProperty::setHub(HubSetting *s)
{
st = s;
cb_count->setCurrentIndex( cb_count->findText( QString::number(st->socketsCount() ) ));
Modified: trunk/src/dialogs/hubproperty.h
===================================================================
--- trunk/src/dialogs/hubproperty.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/hubproperty.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -28,7 +28,7 @@
class QPushButton;
class ipEdit;
-class hubSetting;
+class HubSetting;
class hubProperty : public dialogTemplate
{
@@ -36,9 +36,9 @@
public:
hubProperty();
~hubProperty();
- void setHub(hubSetting *s);
+ void setHub(HubSetting *s);
private:
- hubSetting *st;
+ HubSetting *st;
QComboBox *cb_count;
QLabel *lb_statics;
QLabel *lb_mac;
Modified: trunk/src/dialogs/routerproperty.cpp
===================================================================
--- trunk/src/dialogs/routerproperty.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/routerproperty.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -52,7 +52,7 @@
Задает диалогу устройство для работы.
@param r - указатель на роутер.
*/
-void routerProperty::setRouter(routerSetting *r)
+void routerProperty::setRouter(RouterSetting *r)
{
rt = r;
cb_route->setChecked(r->isRouter());
Modified: trunk/src/dialogs/routerproperty.h
===================================================================
--- trunk/src/dialogs/routerproperty.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/routerproperty.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -22,7 +22,7 @@
#include "dialogtemplate.h"
-class routerSetting;
+class RouterSetting;
class QCheckBox;
class QGroupBox;
class QComboBox;
@@ -33,9 +33,9 @@
Q_DISABLE_COPY(routerProperty)
public:
routerProperty();
- void setRouter(routerSetting *r);
+ void setRouter(RouterSetting *r);
private:
- routerSetting *rt;
+ RouterSetting *rt;
QCheckBox *cb_route;
QComboBox *cb_count;
public slots:
Modified: trunk/src/dialogs/settingdialog.cpp
===================================================================
--- trunk/src/dialogs/settingdialog.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/settingdialog.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -29,38 +29,38 @@
void settingDialog::currentValues()
{
- sp_arpResponce->setValue( appSetting::arpResponceTime() );
+ sp_arpResponce->setValue( AppSetting::arpResponceTime() );
- sp_ttlArp->setValue( appSetting::ttlArp() );
+ sp_ttlArp->setValue( AppSetting::ttlArp() );
computerComboBox->setCurrentIndex( computerComboBox->findText(QString::number(
- appSetting::defaultComputerCount() ) ) );
+ AppSetting::defaultComputerCount() ) ) );
hubComboBox->setCurrentIndex( hubComboBox->findText(
- QString::number( appSetting::defaultHubCount() ) ) );
+ QString::number( AppSetting::defaultHubCount() ) ) );
switchComboBox->setCurrentIndex( switchComboBox->findText(
- QString::number( appSetting::defaultSwitchCount() ) ) );
+ QString::number( AppSetting::defaultSwitchCount() ) ) );
- sp_ttlMac->setValue( appSetting::ttlMac() );
+ sp_ttlMac->setValue( AppSetting::ttlMac() );
routerComboBox->setCurrentIndex( routerComboBox->findText(QString::number(
- appSetting::defaultRouterCount() ) ) );
+ AppSetting::defaultRouterCount() ) ) );
- int s = appSetting::animateSpeed();
+ int s = AppSetting::animateSpeed();
sl_speed->setValue(s);
- languageBox->setCurrentIndex( appSetting::language() );
+ languageBox->setCurrentIndex( AppSetting::language() );
- sb_send->setValue(appSetting::sendingNum());
+ sb_send->setValue(AppSetting::sendingNum());
- sb_waitingTime->setValue(appSetting::waitingTime());
+ sb_waitingTime->setValue(AppSetting::waitingTime());
- cb_opengl->setChecked( appSetting::hasOpengl() );
+ cb_opengl->setChecked( AppSetting::hasOpengl() );
- cb_autosave->setChecked( appSetting::isAutosave() );
+ cb_autosave->setChecked( AppSetting::isAutosave() );
- sb_autosave->setValue( appSetting::autosaveInterval() );
+ sb_autosave->setValue( AppSetting::autosaveInterval() );
btn_apply->setEnabled(false);
}
@@ -72,20 +72,20 @@
void settingDialog::apply()
{
- appSetting::setDefaultComputerCount( computerComboBox->currentText().toInt() );
- appSetting::setDefaultHubCount( hubComboBox->currentText().toInt() );
- appSetting::setDefaultSwitchCount( switchComboBox->currentText().toInt() );
- appSetting::setDefaultRouterCount( routerComboBox->currentText().toInt() );
- appSetting::setTtlArp( sp_ttlArp->value() );
- appSetting::setArpResponceTime( sp_arpResponce->value() );
- appSetting::setTtlMac( sp_ttlMac->value() );
- appSetting::setAnimateSpeed(sl_speed->value());
- appSetting::setLanguage( languageBox->currentIndex() );
- appSetting::setSendingNum(sb_send->value());
- appSetting::setWaitingTime(sb_waitingTime->value());
- appSetting::setHasOpengl( cb_opengl->isChecked() );
- appSetting::setAutosaveInterval( sb_autosave->value() );
- appSetting::setAutosave( cb_autosave->isChecked() );
+ AppSetting::setDefaultComputerCount( computerComboBox->currentText().toInt() );
+ AppSetting::setDefaultHubCount( hubComboBox->currentText().toInt() );
+ AppSetting::setDefaultSwitchCount( switchComboBox->currentText().toInt() );
+ AppSetting::setDefaultRouterCount( routerComboBox->currentText().toInt() );
+ AppSetting::setTtlArp( sp_ttlArp->value() );
+ AppSetting::setArpResponceTime( sp_arpResponce->value() );
+ AppSetting::setTtlMac( sp_ttlMac->value() );
+ AppSetting::setAnimateSpeed(sl_speed->value());
+ AppSetting::setLanguage( languageBox->currentIndex() );
+ AppSetting::setSendingNum(sb_send->value());
+ AppSetting::setWaitingTime(sb_waitingTime->value());
+ AppSetting::setHasOpengl( cb_opengl->isChecked() );
+ AppSetting::setAutosaveInterval( sb_autosave->value() );
+ AppSetting::setAutosave( cb_autosave->isChecked() );
btn_apply->setEnabled(false);
if ( sender() == btn_ok ) accept();
}
@@ -97,7 +97,7 @@
void settingDialog::defaultSettings()
{
- appSetting::defaultNums();
+ AppSetting::defaultNums();
currentValues();
}
@@ -106,7 +106,7 @@
switch (e->type()) {
case QEvent::LanguageChange:
retranslateUi(this);
- languageBox->setCurrentIndex( appSetting::language() );
+ languageBox->setCurrentIndex( AppSetting::language() );
listWidget->setSpacing( listWidget->spacing() );
break;
default:
Modified: trunk/src/dialogs/staticsdialog.cpp
===================================================================
--- trunk/src/dialogs/staticsdialog.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/staticsdialog.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -21,7 +21,7 @@
#include "mycanvas.h"
#include "statisticsscene.h"
-staticsDialog::staticsDialog(statisticsScene *statistics, QWidget *parent) :QDialog(parent)
+staticsDialog::staticsDialog(StatisticsScene *statistics, QWidget *parent) :QDialog(parent)
{
setupUi(this);
deviceLabel->setText( statistics->devicesString() );
Modified: trunk/src/dialogs/staticsdialog.h
===================================================================
--- trunk/src/dialogs/staticsdialog.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/staticsdialog.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -23,13 +23,13 @@
#include "ui_staticsdialog.h"
class MyCanvas;
-class statisticsScene;
+class StatisticsScene;
class staticsDialog : public QDialog, private Ui::staticsDialog {
Q_OBJECT
Q_DISABLE_COPY(staticsDialog)
public:
- staticsDialog(statisticsScene *statistics, QWidget *parent = 0);
+ staticsDialog(StatisticsScene *statistics, QWidget *parent = 0);
protected:
void changeEvent(QEvent *e);
};
Modified: trunk/src/dialogs/switchproperty.cpp
===================================================================
--- trunk/src/dialogs/switchproperty.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/switchproperty.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -72,7 +72,7 @@
delete sw;
}
-void switchProperty::setSwitch(boxSetting *d)
+void switchProperty::setSwitch(BoxSetting *d)
{
sw = d;
cb_count->setCurrentIndex( cb_count->findText( QString::number( d->socketsCount() ) ) );
Modified: trunk/src/dialogs/switchproperty.h
===================================================================
--- trunk/src/dialogs/switchproperty.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/switchproperty.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -27,7 +27,7 @@
class QLabel;
class QCheckBox;
-class boxSetting;
+class BoxSetting;
class ipEdit;
class switchProperty : public dialogTemplate
@@ -37,9 +37,9 @@
public:
switchProperty();
~switchProperty();
- void setSwitch(boxSetting *d);
+ void setSwitch(BoxSetting *d);
private:
- boxSetting *sw;
+ BoxSetting *sw;
QComboBox *cb_count;
QCheckBox *chb_manual;
QLabel *lb_statics;
Modified: trunk/src/dialogs/tableswitch.cpp
===================================================================
--- trunk/src/dialogs/tableswitch.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/tableswitch.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -21,7 +21,7 @@
#include "switchdevice.h"
#include "switchmodel.h"
-TableSwitch::TableSwitch(switchTableSetting *s)
+TableSwitch::TableSwitch(SwitchTableSetting *s)
{
sw = s;
t_sw = s->switchTable();
Modified: trunk/src/dialogs/tableswitch.h
===================================================================
--- trunk/src/dialogs/tableswitch.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/tableswitch.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -22,16 +22,16 @@
#include "ui_tableswitch.h"
-class switchTableSetting;
+class SwitchTableSetting;
class SwitchModel;
class TableSwitch : public QDialog , private Ui::tableSwitch
{
Q_OBJECT
public:
- explicit TableSwitch(switchTableSetting *s);
+ explicit TableSwitch(SwitchTableSetting *s);
private:
- switchTableSetting *sw;
+ SwitchTableSetting *sw;
SwitchModel *t_sw;
private slots:
void addRecord();
Modified: trunk/src/dialogs/testdialog.cpp
===================================================================
--- trunk/src/dialogs/testdialog.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/testdialog.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -71,7 +71,7 @@
void testDialog::updateList()
{
listWidget->clear();
- QDir t(appSetting::scriptPath());
+ QDir t(AppSetting::scriptPath());
QStringList h;
h << "*.js";
QStringList s = t.entryList(h);
@@ -114,7 +114,7 @@
bool testDialog::test(QString s)
{
qDebug() << s << " started";
- QString g = appSetting::scriptPath()+s+".js";
+ QString g = AppSetting::scriptPath()+s+".js";
QFile file(g);
file.open(QIODevice::ReadOnly);
QString temporary = file.readAll();
@@ -144,10 +144,10 @@
void testDialog::setScriptPath()
{
QString name = QFileDialog::getExistingDirectory( this,
- tr("Choose a directory with scripts"), appSetting::scriptPath() );
+ tr("Choose a directory with scripts"), AppSetting::scriptPath() );
if ( name.isEmpty() ) return;
if ( name.at( name.length() - 1 ) != '/' ) name.push_back('/');
- appSetting::setScriptPath(name);
+ AppSetting::setScriptPath(name);
updateList();
}
Modified: trunk/src/dialogs/virtualnetworkdialog.cpp
===================================================================
--- trunk/src/dialogs/virtualnetworkdialog.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/virtualnetworkdialog.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -6,7 +6,7 @@
setAttribute(Qt::WA_DeleteOnClose);
}
-void virtualNetworkDialog::setDevice( virtualNetworkSetting *device)
+void virtualNetworkDialog::setDevice( VirtualNetworkSetting *device)
{
myDevice = device;
}
Modified: trunk/src/dialogs/virtualnetworkdialog.h
===================================================================
--- trunk/src/dialogs/virtualnetworkdialog.h 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/dialogs/virtualnetworkdialog.h 2011-02-09 01:09:50 UTC (rev 234)
@@ -3,17 +3,17 @@
#include "ui_virtualnetworkdialog.h"
-class virtualNetworkSetting;
+class VirtualNetworkSetting;
class virtualNetworkDialog : public QDialog, private Ui::virtualNetworkDialog {
Q_OBJECT
public:
virtualNetworkDialog(QWidget *parent = 0);
- void setDevice( virtualNetworkSetting *device);
+ void setDevice( VirtualNetworkSetting *device);
protected:
void changeEvent(QEvent *e);
private:
- virtualNetworkSetting *myDevice;
+ VirtualNetworkSetting *myDevice;
};
#endif // VIRTUALNETWORKDIALOG_H
Modified: trunk/src/graphics/cabledev.cpp
===================================================================
--- trunk/src/graphics/cabledev.cpp 2011-02-08 23:18:03 UTC (rev 233)
+++ trunk/src/graphics/cabledev.cpp 2011-02-09 01:09:50 UTC (rev 234)
@@ -20,13 +20,15 @@
#include "cabledev.h"
#include "deviceport.h"
-Cable::Cable(QGraphicsObject *parent) : QGraphicsObject(parent) , myStartPort(0) ,
- myEndPort(0) ,
- isCollision(false), myChecked(false) ,
- myShared(false) , mySpeed(5)
+Cable::Cable(QGraphicsObject *parent) : QGraphicsObject(parent) , startItem(0),
+endItem(0) , myStartPort(0) ,
+myEndPort(0) ,
+isCollision(false), myChecked(false) ,
+myShared(false) , mySpeed(5)
{...
[truncated message content] |
|
From: <f-r...@us...> - 2011-02-08 23:18:10
|
Revision: 233
http://netemul.svn.sourceforge.net/netemul/?rev=233&view=rev
Author: f-r-o-s-t
Date: 2011-02-08 23:18:03 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
update lib
Modified Paths:
--------------
trunk/basicnetlib/basicnetlib.pro
trunk/basicnetlib/packets/arppacket.h
trunk/basicnetlib/packets/dhcppacket.h
trunk/basicnetlib/packets/ippacket.h
trunk/basicnetlib/packets/packets.pri
trunk/basicnetlib/packets/tcppacket.h
trunk/basicnetlib/packets/udppacket.h
trunk/netemul.pro
Added Paths:
-----------
trunk/basicnetlib/frame.cpp
trunk/basicnetlib/frame.h
trunk/basicnetlib/packets/
Removed Paths:
-------------
trunk/src/frame.cpp
trunk/src/frame.h
trunk/src/packets/
Modified: trunk/basicnetlib/basicnetlib.pro
===================================================================
--- trunk/basicnetlib/basicnetlib.pro 2011-02-08 21:41:11 UTC (rev 232)
+++ trunk/basicnetlib/basicnetlib.pro 2011-02-08 23:18:03 UTC (rev 233)
@@ -4,8 +4,11 @@
#
#-------------------------------------------------
+include(packets/packets.pri)
QT -= gui
+INCLUDEPATH += packets
+
TARGET = basicnetlib
TEMPLATE = lib
DESTDIR = ..
@@ -14,10 +17,13 @@
SOURCES += basicnetlib.cpp \
macaddress.cpp \
- ipaddress.cpp
+ ipaddress.cpp \
+ frame.cpp
HEADERS += basicnetlib.h\
basicnetlib_global.h \
macaddress.h \
- ipaddress.h
+ ipaddress.h \
+ frame.h
+
Copied: trunk/basicnetlib/frame.cpp (from rev 228, trunk/src/frame.cpp)
===================================================================
--- trunk/basicnetlib/frame.cpp (rev 0)
+++ trunk/basicnetlib/frame.cpp 2011-02-08 23:18:03 UTC (rev 233)
@@ -0,0 +1,58 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#include "frame.h"
+
+frame::frame(const QByteArray &b)
+{
+ d = new frameData;
+ QDataStream s(b);
+ s >> d->different >> d->sender >> d->receiver >> d->type >> d->data;
+}
+
+QByteArray frame::toData() const
+{
+ return d->toArray();
+}
+
+QString frame::toString() const
+{
+ QString temp;
+ temp.append(QObject::tr("Ethernet, sender: %1 receiver: %2").arg(d->sender.toString()).arg(d->receiver.toString()));
+ return temp;
+}
+
+//-------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------
+
+frameData::frameData()
+{
+ different = frame::NORMAL;
+}
+
+QByteArray frameData::toArray() const
+{
+ QByteArray t;
+ QDataStream s(&t,QIODevice::WriteOnly);
+ s << different << sender << receiver << type << data;
+ return t;
+}
+
+
+
Copied: trunk/basicnetlib/frame.h (from rev 228, trunk/src/frame.h)
===================================================================
--- trunk/basicnetlib/frame.h (rev 0)
+++ trunk/basicnetlib/frame.h 2011-02-08 23:18:03 UTC (rev 233)
@@ -0,0 +1,90 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#ifndef FRAME_H
+#define FRAME_H
+
+#include "basicnetlib_global.h"
+#include "macaddress.h"
+#include <QSharedData>
+
+/*!
+ * Класс данные общего пользования, для фреймов.
+*/
+class frameData : public QSharedData {
+public:
+ frameData();
+ frameData(const frameData &other) : QSharedData(other) , sender(other.sender) ,
+ receiver(other.receiver) , type(other.type) ,
+ different(other.different) , data(other.data) { }
+ ~frameData() { }
+ QByteArray toArray() const;
+ friend class frame;
+private:
+ macAddress sender; //!< Mac-адрес отправителя
+ macAddress receiver; //!< Mac-адрес получателя
+ qint8 type; //!< Показывает несет ли в себе кадр ip-пакет или arp сообщение.
+ qint8 different; //!< Разновидность фрэйма, влияет на его цвет и отображение
+ QByteArray data; //!< Данные протокола более высокого уровня.
+};
+
+/*!
+ Реализует кадр, также как и в реальной сети содержит адрес отправителя, получателя и
+ поле данных где содержиться информация протокола более высокого уровня.
+*/
+class BASICNETLIBSHARED_EXPORT frame
+{
+public:
+ enum { arp = 100 , ip = 101 };
+ enum { NORMAL = 3 , BROADCAST = 4 };
+ frame() { d = new frameData; }
+ frame(const frame &other) : d(other.d) { }
+ frame(const QByteArray &b);
+ macAddress sender() const { return d->sender; }
+ void setSender(macAddress temp) { d->sender = temp; }
+ macAddress receiver() const { return d->receiver; }
+ void setReceiver(macAddress temp) { d->receiver = temp; }
+ void setDifferent(qint8 t) { d->different = t; }
+ int type() const { return d->type; }
+ void setType(int t) { d->type = t; }
+ QByteArray toData() const;
+ QString toString() const;
+ void pack(const QByteArray &b) { d->data = b; }
+ QByteArray unpack() const { return d->data; }
+private:
+ QSharedDataPointer<frameData> d;
+protected:
+ friend QDataStream& operator<<(QDataStream &stream, const frame &f);
+};
+
+/*!
+ Записывает кадр в поток.
+ @param stream - ссылка на поток.
+ @param f - ссылка на кадр.
+ @return результирующий поток.
+*/
+inline QDataStream& operator<<(QDataStream &stream, const frame &f)
+{
+ stream << f.toData();
+ return stream;
+}
+//----------------------------------------------------
+
+
+#endif // FRAME_H
Modified: trunk/basicnetlib/packets/arppacket.h
===================================================================
--- trunk/src/packets/arppacket.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/basicnetlib/packets/arppacket.h 2011-02-08 23:18:03 UTC (rev 233)
@@ -20,6 +20,7 @@
#ifndef ARPPACKET_H
#define ARPPACKET_H
+#include "basicnetlib_global.h"
#include <QSharedData>
#include "macaddress.h"
#include "ipaddress.h"
@@ -41,7 +42,7 @@
IpAddress receiverIp;
};
-class arpPacket
+class BASICNETLIBSHARED_EXPORT arpPacket
{
public:
arpPacket(macAddress rm , macAddress sm , IpAddress ri , IpAddress si , quint8 t);
Modified: trunk/basicnetlib/packets/dhcppacket.h
===================================================================
--- trunk/src/packets/dhcppacket.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/basicnetlib/packets/dhcppacket.h 2011-02-08 23:18:03 UTC (rev 233)
@@ -20,6 +20,7 @@
#ifndef DHCPPACKET_H
#define DHCPPACKET_H
+#include "basicnetlib_global.h"
#include <QSharedData>
#include "ipaddress.h"
#include "macaddress.h"
@@ -43,7 +44,7 @@
macAddress chaddr;
};
-class dhcpPacket
+class BASICNETLIBSHARED_EXPORT dhcpPacket
{
public:
dhcpPacket();
Modified: trunk/basicnetlib/packets/ippacket.h
===================================================================
--- trunk/src/packets/ippacket.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/basicnetlib/packets/ippacket.h 2011-02-08 23:18:03 UTC (rev 233)
@@ -20,6 +20,7 @@
#ifndef IPPACKET_H
#define IPPACKET_H
+#include "basicnetlib_global.h"
#include <QSharedData>
#include "ipaddress.h"
@@ -48,7 +49,7 @@
тип протокола верхнего уровня и поле данных. Остальные папраметры реального пакета пока
не используются.
*/
-class ipPacket
+class BASICNETLIBSHARED_EXPORT ipPacket
{
public:
/*! Используется для обозначения протокола верхнего уровня. */
Modified: trunk/basicnetlib/packets/packets.pri
===================================================================
--- trunk/src/packets/packets.pri 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/basicnetlib/packets/packets.pri 2011-02-08 23:18:03 UTC (rev 233)
@@ -1,10 +1,10 @@
-SOURCES += src/packets/dhcppacket.cpp\
- src/packets/arppacket.cpp\
- src/packets/ippacket.cpp\
- src/packets/tcppacket.cpp\
- src/packets/udppacket.cpp
-HEADERS += src/packets/dhcppacket.h\
- src/packets/arppacket.h\
- src/packets/ippacket.h\
- src/packets/tcppacket.h\
- src/packets/udppacket.h
+SOURCES += packets/dhcppacket.cpp\
+ packets/arppacket.cpp\
+ packets/ippacket.cpp\
+ packets/tcppacket.cpp\
+ packets/udppacket.cpp
+HEADERS += packets/dhcppacket.h\
+ packets/arppacket.h\
+ packets/ippacket.h\
+ packets/tcppacket.h\
+ packets/udppacket.h
Modified: trunk/basicnetlib/packets/tcppacket.h
===================================================================
--- trunk/src/packets/tcppacket.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/basicnetlib/packets/tcppacket.h 2011-02-08 23:18:03 UTC (rev 233)
@@ -22,6 +22,7 @@
#include <QDataStream>
#include <QSharedData>
+#include "basicnetlib_global.h"
class tcpPacketData : public QSharedData
{
@@ -44,7 +45,7 @@
/*!
Реализует tcp-сегмент
*/
-class tcpPacket
+class BASICNETLIBSHARED_EXPORT tcpPacket
{
public:
enum { User = 7777 , Window = 10240 };
Modified: trunk/basicnetlib/packets/udppacket.h
===================================================================
--- trunk/src/packets/udppacket.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/basicnetlib/packets/udppacket.h 2011-02-08 23:18:03 UTC (rev 233)
@@ -20,6 +20,7 @@
#ifndef UDPPACKET_H
#define UDPPACKET_H
+#include "basicnetlib_global.h"
#include <QDataStream>
#include <QSharedData>
@@ -39,7 +40,7 @@
/*!
Реализует udp-дейтаграмму
*/
-class udpPacket
+class BASICNETLIBSHARED_EXPORT udpPacket
{
public:
enum { User = 7777 , RIP = 520 , DHCPClient = 67, DHCPServer = 68 } ;
Modified: trunk/netemul.pro
===================================================================
--- trunk/netemul.pro 2011-02-08 21:41:11 UTC (rev 232)
+++ trunk/netemul.pro 2011-02-08 23:18:03 UTC (rev 233)
@@ -8,7 +8,6 @@
include(src/graphics/graphics.pri)
include(src/forms/forms.pri)
include(src/tools/tools.pri)
-include(src/packets/packets.pri)
include(src/states/states.pri)
include(src/commands/commands.pri)
include(src/delegats/delegats.pri)
@@ -31,7 +30,6 @@
src/other \
src/graphics \
src/tools \
- src/packets \
src/states \
src/commands \
src/delegats \
@@ -69,17 +67,16 @@
MOC_DIR = build
UI_DIR = src
-INCLUDEPATH += basicnetlib
-LIBS += -lbasicnetlib
+INCLUDEPATH += basicnetlib \
+ basicnetlib/packets
+LIBS += -L. -lbasicnetlib
# Input
HEADERS += src/deviceport.h \
- src/frame.h \
src/ipedit.h \
src/mainwindow.h \
src/mycanvas.h
SOURCES += src/deviceport.cpp \
- src/frame.cpp \
src/ipedit.cpp \
src/main.cpp \
src/mainwindow.cpp \
Deleted: trunk/src/frame.cpp
===================================================================
--- trunk/src/frame.cpp 2011-02-08 21:41:11 UTC (rev 232)
+++ trunk/src/frame.cpp 2011-02-08 23:18:03 UTC (rev 233)
@@ -1,58 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#include "frame.h"
-
-frame::frame(const QByteArray &b)
-{
- d = new frameData;
- QDataStream s(b);
- s >> d->different >> d->sender >> d->receiver >> d->type >> d->data;
-}
-
-QByteArray frame::toData() const
-{
- return d->toArray();
-}
-
-QString frame::toString() const
-{
- QString temp;
- temp.append(QObject::tr("Ethernet, sender: %1 receiver: %2").arg(d->sender.toString()).arg(d->receiver.toString()));
- return temp;
-}
-
-//-------------------------------------------------------------------------------
-//-------------------------------------------------------------------------------
-
-frameData::frameData()
-{
- different = frame::NORMAL;
-}
-
-QByteArray frameData::toArray() const
-{
- QByteArray t;
- QDataStream s(&t,QIODevice::WriteOnly);
- s << different << sender << receiver << type << data;
- return t;
-}
-
-
-
Deleted: trunk/src/frame.h
===================================================================
--- trunk/src/frame.h 2011-02-08 21:41:11 UTC (rev 232)
+++ trunk/src/frame.h 2011-02-08 23:18:03 UTC (rev 233)
@@ -1,89 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#ifndef FRAME_H
-#define FRAME_H
-
-#include "macaddress.h"
-#include <QSharedData>
-
-/*!
- * Класс данные общего пользования, для фреймов.
-*/
-class frameData : public QSharedData {
-public:
- frameData();
- frameData(const frameData &other) : QSharedData(other) , sender(other.sender) ,
- receiver(other.receiver) , type(other.type) ,
- different(other.different) , data(other.data) { }
- ~frameData() { }
- QByteArray toArray() const;
- friend class frame;
-private:
- macAddress sender; //!< Mac-адрес отправителя
- macAddress receiver; //!< Mac-адрес получателя
- qint8 type; //!< Показывает несет ли в себе кадр ip-пакет или arp сообщение.
- qint8 different; //!< Разновидность фрэйма, влияет на его цвет и отображение
- QByteArray data; //!< Данные протокола более высокого уровня.
-};
-
-/*!
- Реализует кадр, также как и в реальной сети содержит адрес отправителя, получателя и
- поле данных где содержиться информация протокола более высокого уровня.
-*/
-class frame
-{
-public:
- enum { arp = 100 , ip = 101 };
- enum { NORMAL = 3 , BROADCAST = 4 };
- frame() { d = new frameData; }
- frame(const frame &other) : d(other.d) { }
- frame(const QByteArray &b);
- macAddress sender() const { return d->sender; }
- void setSender(macAddress temp) { d->sender = temp; }
- macAddress receiver() const { return d->receiver; }
- void setReceiver(macAddress temp) { d->receiver = temp; }
- void setDifferent(qint8 t) { d->different = t; }
- int type() const { return d->type; }
- void setType(int t) { d->type = t; }
- QByteArray toData() const;
- QString toString() const;
- void pack(const QByteArray &b) { d->data = b; }
- QByteArray unpack() const { return d->data; }
-private:
- QSharedDataPointer<frameData> d;
-protected:
- friend QDataStream& operator<<(QDataStream &stream, const frame &f);
-};
-
-/*!
- Записывает кадр в поток.
- @param stream - ссылка на поток.
- @param f - ссылка на кадр.
- @return результирующий поток.
-*/
-inline QDataStream& operator<<(QDataStream &stream, const frame &f)
-{
- stream << f.toData();
- return stream;
-}
-//----------------------------------------------------
-
-
-#endif // FRAME_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-08 21:41:18
|
Revision: 232
http://netemul.svn.sourceforge.net/netemul/?rev=232&view=rev
Author: f-r-o-s-t
Date: 2011-02-08 21:41:11 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
create tools library
Modified Paths:
--------------
trunk/netemul.pro
Added Paths:
-----------
trunk/basicnetlib/
trunk/basicnetlib/basicnetlib.cpp
trunk/basicnetlib/basicnetlib.h
trunk/basicnetlib/basicnetlib.pro
trunk/basicnetlib/basicnetlib.pro.user
trunk/basicnetlib/basicnetlib_global.h
trunk/basicnetlib/ipaddress.cpp
trunk/basicnetlib/ipaddress.h
trunk/basicnetlib/macaddress.cpp
trunk/basicnetlib/macaddress.h
Removed Paths:
-------------
trunk/src/ipaddress.cpp
trunk/src/ipaddress.h
trunk/src/macaddress.cpp
trunk/src/macaddress.h
Added: trunk/basicnetlib/basicnetlib.cpp
===================================================================
--- trunk/basicnetlib/basicnetlib.cpp (rev 0)
+++ trunk/basicnetlib/basicnetlib.cpp 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,6 @@
+#include "basicnetlib.h"
+
+
+Basicnetlib::Basicnetlib()
+{
+}
Added: trunk/basicnetlib/basicnetlib.h
===================================================================
--- trunk/basicnetlib/basicnetlib.h (rev 0)
+++ trunk/basicnetlib/basicnetlib.h 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,11 @@
+#ifndef BASICNETLIB_H
+#define BASICNETLIB_H
+
+#include "basicnetlib_global.h"
+
+class BASICNETLIBSHARED_EXPORT Basicnetlib {
+public:
+ Basicnetlib();
+};
+
+#endif // BASICNETLIB_H
Added: trunk/basicnetlib/basicnetlib.pro
===================================================================
--- trunk/basicnetlib/basicnetlib.pro (rev 0)
+++ trunk/basicnetlib/basicnetlib.pro 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,23 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2011-02-08T00:44:43
+#
+#-------------------------------------------------
+
+QT -= gui
+
+TARGET = basicnetlib
+TEMPLATE = lib
+DESTDIR = ..
+
+DEFINES += BASICNETLIB_LIBRARY
+
+SOURCES += basicnetlib.cpp \
+ macaddress.cpp \
+ ipaddress.cpp
+
+
+HEADERS += basicnetlib.h\
+ basicnetlib_global.h \
+ macaddress.h \
+ ipaddress.h
Added: trunk/basicnetlib/basicnetlib.pro.user
===================================================================
--- trunk/basicnetlib/basicnetlib.pro.user (rev 0)
+++ trunk/basicnetlib/basicnetlib.pro.user 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,248 @@
+<!DOCTYPE QtCreatorProject>
+<qtcreator>
+ <data>
+ <variable>ProjectExplorer.Project.ActiveTarget</variable>
+ <value type="int">0</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.EditorSettings</variable>
+ <valuemap type="QVariantMap">
+ <value key="EditorConfiguration.Codec" type="QByteArray">UTF-8</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Target.0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Настольный компьютер</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
+ <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
+ <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt в PATH Отладка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
+ </valuemap>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt в PATH Релиз</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.2" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">4.5.0 Отладка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">6</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.3" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">4.5.0 Релиз</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">6</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.4" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.7.0 OpenSource Отладка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">12</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.5" type="QVariantMap">
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+ <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+ </valuemap>
+ <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+ <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+ <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+ <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+ </valuemap>
+ <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+ <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+ <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.7.0 OpenSource Релиз</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/frost/netemul/trunk/basicnetlib-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">12</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+ </valuemap>
+ <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">6</value>
+ <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
+ <valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments" type="QVariantList"/>
+ <value key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase" type="int">2</value>
+ <value key="ProjectExplorer.CustomExecutableRunConfiguration.Executable" type="QString"></value>
+ <value key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal" type="bool">false</value>
+ <valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+ <value key="ProjectExplorer.CustomExecutableRunConfiguration.UserName" type="QString"></value>
+ <value key="ProjectExplorer.CustomExecutableRunConfiguration.UserSetName" type="bool">false</value>
+ <value key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory" type="QString">$BUILDDIR</value>
+ <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Особая программа</value>
+ <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.CustomExecutableRunConfiguration</value>
+ </valuemap>
+ <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.TargetCount</variable>
+ <value type="int">1</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+ <value type="int">4</value>
+ </data>
+</qtcreator>
Added: trunk/basicnetlib/basicnetlib_global.h
===================================================================
--- trunk/basicnetlib/basicnetlib_global.h (rev 0)
+++ trunk/basicnetlib/basicnetlib_global.h 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,12 @@
+#ifndef BASICNETLIB_GLOBAL_H
+#define BASICNETLIB_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#if defined(BASICNETLIB_LIBRARY)
+# define BASICNETLIBSHARED_EXPORT Q_DECL_EXPORT
+#else
+# define BASICNETLIBSHARED_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // BASICNETLIB_GLOBAL_H
Copied: trunk/basicnetlib/ipaddress.cpp (from rev 228, trunk/src/ipaddress.cpp)
===================================================================
--- trunk/basicnetlib/ipaddress.cpp (rev 0)
+++ trunk/basicnetlib/ipaddress.cpp 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,130 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#include "ipaddress.h"
+#include <QStringList>
+
+IpAddress::IpAddress()
+{
+ for ( int i = 0 ; i < 4 ; i++ ) myIp[i] = 0;
+}
+
+IpAddress::IpAddress(const quint8 *cur)
+{
+ for ( int i = 0; i < 4 ; i++)
+ myIp[i] = cur[i];
+}
+
+IpAddress::IpAddress(const QString str)
+{
+ QStringList s = str.split(".");
+ for (int i = 0 ; i < 4 ; i++)
+ myIp[i] = s.at(i).toInt();
+}
+
+IpAddress::IpAddress(const char *str)
+{
+ QString t(str);
+ QStringList l = t.split(".");
+ for ( int i = 0 ; i < 4 ; i++ )
+ myIp[i] = l.at(i).toInt();
+}
+
+IpAddress::IpAddress(const IpAddress &other)
+{
+ for ( int i = 0; i < 4 ; i++)
+ myIp[i] = other.myIp[i];
+}
+
+IpAddress::IpAddress(const quint32 intIp)
+{
+ myIp[0] = intIp >> 24;
+ myIp[1] = intIp >> 16;
+ myIp[2] = intIp >> 8;
+ myIp[3] = intIp;
+}
+
+QString IpAddress::toString() const
+{
+ QString temp = QString().setNum(myIp[0]);
+ for ( int i = 1 ; i <= 3 ; i++ )
+ temp += QChar('.') + QString().setNum(myIp[i]);
+ return temp;
+}
+
+void IpAddress::setIp(const quint8 *cur)
+{
+ for ( int i = 0; i < 4 ; i++)
+ myIp[i] = cur[i];
+}
+
+IpAddress& IpAddress::operator=(const IpAddress &other)
+{
+ for ( int i = 0; i < 4 ; i++)
+ myIp[i] = other.myIp[i];
+ return (*this);
+}
+
+void IpAddress::setIp(const QString str)
+{
+ QStringList s = str.split(".");
+ for (int i = 0 ; i < 4 ; i++)
+ myIp[i] = s.at(i).toInt();
+}
+
+IpAddress IpAddress::operator&(const IpAddress &e1) const
+{
+ int i;
+ IpAddress e3;
+ for (i=0; i < 4; i++)
+ e3.myIp[i] = this->myIp[i] & e1.myIp[i];
+ return e3;
+}
+
+IpAddress IpAddress::operator |(const IpAddress &e1) const
+{
+ int i;
+ IpAddress e3;
+ for (i=0; i < 4; i++)
+ e3.myIp[i] = this->myIp[i] | e1.myIp[i];
+ return e3;
+}
+
+bool IpAddress::isEmpty() const
+{
+ int d = 0;
+ for ( int i = 0 ; i < 4 ; i++ ) d += myIp[i];
+ return !d;
+}
+
+bool IpAddress::isFull() const
+{
+ for ( int i = 0 ; i < 4 ; i++ )
+ if ( myIp[i] != 255 ) return false;
+ return true;
+}
+
+IpAddress IpAddress::operator ~() const
+{
+ IpAddress ip;
+ for ( int i = 0; i < 4 ; i++)
+ ip.myIp[i] = ~myIp[i];
+ return ip;
+}
+
Copied: trunk/basicnetlib/ipaddress.h (from rev 228, trunk/src/ipaddress.h)
===================================================================
--- trunk/basicnetlib/ipaddress.h (rev 0)
+++ trunk/basicnetlib/ipaddress.h 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,79 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#ifndef IPADDRESS_H
+#define IPADDRESS_H
+
+#include <QDataStream>
+#include <QVariant>
+#include "basicnetlib_global.h"
+
+class BASICNETLIBSHARED_EXPORT IpAddress
+{
+public:
+ IpAddress();
+ IpAddress(const quint8 *cur);
+ IpAddress(const QString str);
+ IpAddress(const char *str);
+ IpAddress(const IpAddress &other);
+ IpAddress(const quint32 intIp);
+ void setIp(const quint8 *cur);
+ void setIp(const QString str);
+ QString toString() const;
+ bool isEmpty() const;
+ bool isLoopBack() const { return myIp[0] == 127; }
+ bool isFull() const;
+ quint32 toInt() const;
+ quint8 at(int i) const { return myIp[i]; }
+ IpAddress& operator=(const IpAddress &other);
+ IpAddress operator&(const IpAddress &e1) const;
+ IpAddress operator~() const;
+ IpAddress operator|(const IpAddress &e1) const;
+ static IpAddress full() { return IpAddress("255.255.255.255"); }
+ void writeXml() const { }
+private:
+ quint8 myIp[4];
+protected:
+ friend QDataStream& operator>>(QDataStream &stream, IpAddress &address);
+ friend QDataStream& operator<<(QDataStream &stream, const IpAddress &address);
+};
+
+inline quint32 IpAddress::toInt() const
+{
+ return ( (myIp[0] << 24) + (myIp[1] << 16) + (myIp[2] << 8) +myIp[3]);
+}
+
+inline bool operator<(const IpAddress &e1 , const IpAddress &e2) { return e1.toInt() < e2.toInt(); }
+inline bool operator>(const IpAddress &e1 , const IpAddress &e2) { return e1.toInt() > e2.toInt(); }
+inline bool operator<=(const IpAddress &e1 , const IpAddress &e2) { return !(e1.toInt() > e2.toInt()); }
+inline bool operator>=(const IpAddress &e1 , const IpAddress &e2) { return !(e1.toInt() < e2.toInt()); }
+inline bool operator==(const IpAddress &e1 , const IpAddress &e2) { return e1.toInt() == e2.toInt(); }
+inline bool operator!=(const IpAddress &e1, const IpAddress &e2) { return !(e1 == e2) ; }
+inline QDataStream& operator<<(QDataStream &stream, const IpAddress &address)
+{
+ for (int i = 0 ; i < 4 ; i++ ) stream << address.myIp[i];
+ return stream;
+}
+inline QDataStream& operator>>(QDataStream &stream, IpAddress &address)
+{
+ for (int i = 0 ; i < 4 ; i++ ) stream >> address.myIp[i];
+ return stream;
+}
+
+#endif // IPADDRESS_H
Copied: trunk/basicnetlib/macaddress.cpp (from rev 228, trunk/src/macaddress.cpp)
===================================================================
--- trunk/basicnetlib/macaddress.cpp (rev 0)
+++ trunk/basicnetlib/macaddress.cpp 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,119 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#include "macaddress.h"
+#include <QStringList>
+
+macAddress::macAddress()
+{
+ for ( int i = 0 ; i < 6 ; i++ )
+ myMac[i] = 0;
+}
+
+macAddress::macAddress(QString str)
+{
+ setMac(str);
+}
+
+macAddress::macAddress(const macAddress &other)
+{
+ for (int i = 0 ; i < 6 ; i ++)
+ myMac[i] = other.myMac[i];
+}
+
+QString macAddress::toString() const
+{
+ QString temp = QString("%1").arg( QString().setNum(myMac[0],16), 2 , QChar('0'));
+ int i;
+ for ( i = 1 ; i <= 5 ; i++ ) {
+ temp.append(QChar(':'));
+ temp = temp + QString("%1").arg(myMac[i],2,16,QChar('0'));
+ }
+ return temp.toUpper();
+}
+
+macAddress& macAddress::operator=(const macAddress &other)
+{
+ for (int i = 0 ; i < 6 ; i ++)
+ myMac[i] = other.myMac[i];
+ return (*this);
+}
+
+macAddress macAddress::operator++()
+{
+ int i = 5;
+ while ( i >= 0 && myMac[i] == 255) {
+ myMac[i] = 0;
+ i--;
+ }
+ myMac[i]++;
+ return *this;
+}
+
+macAddress macAddress::operator++(int notused)
+{
+ Q_UNUSED(notused);
+ macAddress temp = *this;
+ int i = 5;
+ while ( i >= 0 && myMac[i] == 255) {
+ myMac[i] = 0;
+ i--;
+ }
+ myMac[i]++;
+ return temp;
+}
+
+void macAddress::setBroadcast()
+{
+ int i;
+ for (i = 0 ; i < 6 ; i++)
+ myMac[i] = 0xFF;
+}
+
+bool macAddress::isBroadcast()
+{
+ int i;
+ for (i = 0; i < 6 ; i++)
+ if ( myMac[i] != 0xFF ) return false;
+ return true;
+}
+
+void macAddress::setRandom()
+{
+ int i;
+ myMac[0] = 0x01;
+ for ( i = 1 ; i < 6 ; i++ )
+ myMac[i] = qrand()%256;
+}
+
+void macAddress::setMac(QString str)
+{
+ QStringList s = str.split(":");
+ for (int i = 0 ; i < 6 ; i++)
+ myMac[i] = s.at(i).toInt(0,16);
+}
+
+bool macAddress::isEmpty() const
+{
+ for ( int i = 0 ; i < 6 ; i++ )
+ if ( myMac[i] ) return false;
+ return true;
+}
+
+
Copied: trunk/basicnetlib/macaddress.h (from rev 228, trunk/src/macaddress.h)
===================================================================
--- trunk/basicnetlib/macaddress.h (rev 0)
+++ trunk/basicnetlib/macaddress.h 2011-02-08 21:41:11 UTC (rev 232)
@@ -0,0 +1,74 @@
+/****************************************************************************************
+** NetEmul - program for simulating computer networks.
+** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
+**
+** NetEmul is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** NetEmul 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
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with the NetEmul; if not, write to the Free
+** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+** 02111-1307 USA.
+****************************************************************************************/
+#ifndef MACADDRESS_H
+#define MACADDRESS_H
+
+#include <QDataStream>
+#include "basicnetlib_global.h"
+
+class BASICNETLIBSHARED_EXPORT macAddress
+{
+public:
+ macAddress();
+ macAddress(QString str);
+ macAddress(const macAddress &other);
+ void setMac(QString str);
+ void setRandom();
+ QString toString() const ;
+ macAddress operator++();
+ macAddress operator++(int notused);
+ macAddress& operator=(const macAddress &other);
+ void setBroadcast();
+ bool isBroadcast();
+ bool isEmpty() const;
+ qulonglong toInt() const;
+private:
+ quint8 myMac[6];
+protected:
+ friend QDataStream& operator<<(QDataStream &stream, const macAddress &address);
+ friend QDataStream& operator>>(QDataStream &stream, macAddress &address);
+};
+
+inline qulonglong macAddress::toInt() const
+{
+ return ((qulonglong)myMac[0]<<40)+((qulonglong)myMac[1]<<32)+((qulonglong)myMac[2]<<24)+
+ ((qulonglong)myMac[3]<<16)+((qulonglong)myMac[4]<<8)+(qulonglong)myMac[5];
+}
+inline bool operator<(const macAddress &e1 , const macAddress &e2) { return e1.toInt() < e2.toInt(); }
+inline bool operator>(const macAddress &e1 , const macAddress &e2) { return e1.toInt() > e2.toInt(); }
+inline bool operator==(const macAddress &e1 , const macAddress &e2) { return e1.toInt() == e2.toInt(); }
+inline bool operator!=(const macAddress &e1, const macAddress &e2) { return !(e1 == e2); }
+inline bool operator>=(const macAddress &e1 , const macAddress &e2) { return !(e1 < e2); }
+inline bool operator<=(const macAddress &e1 , const macAddress &e2) { return !(e1 > e2); }
+
+
+inline QDataStream& operator<<(QDataStream &stream, const macAddress &address)
+{
+ for (int i = 0 ; i < 6 ; i++ ) stream << address.myMac[i];
+ return stream;
+}
+
+inline QDataStream& operator>>(QDataStream &stream, macAddress &address)
+{
+ for (int i = 0 ; i < 6 ; i++ ) stream >> address.myMac[i];
+ return stream;
+}
+
+#endif // MACADDRESS_H
Modified: trunk/netemul.pro
===================================================================
--- trunk/netemul.pro 2011-02-08 21:40:10 UTC (rev 231)
+++ trunk/netemul.pro 2011-02-08 21:41:11 UTC (rev 232)
@@ -39,6 +39,8 @@
src/factories
QT += script xml
+WARNING += -Wall
+
unix {
QMAKE_POST_LINK += cd ipedit && qmake && make && cd ..
}
@@ -67,19 +69,18 @@
MOC_DIR = build
UI_DIR = src
+INCLUDEPATH += basicnetlib
+LIBS += -lbasicnetlib
+
# Input
HEADERS += src/deviceport.h \
src/frame.h \
- src/ipaddress.h \
src/ipedit.h \
- src/macaddress.h \
src/mainwindow.h \
src/mycanvas.h
SOURCES += src/deviceport.cpp \
src/frame.cpp \
- src/ipaddress.cpp \
src/ipedit.cpp \
- src/macaddress.cpp \
src/main.cpp \
src/mainwindow.cpp \
src/mycanvas.cpp
Deleted: trunk/src/ipaddress.cpp
===================================================================
--- trunk/src/ipaddress.cpp 2011-02-08 21:40:10 UTC (rev 231)
+++ trunk/src/ipaddress.cpp 2011-02-08 21:41:11 UTC (rev 232)
@@ -1,130 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#include "ipaddress.h"
-#include <QStringList>
-
-IpAddress::IpAddress()
-{
- for ( int i = 0 ; i < 4 ; i++ ) myIp[i] = 0;
-}
-
-IpAddress::IpAddress(const quint8 *cur)
-{
- for ( int i = 0; i < 4 ; i++)
- myIp[i] = cur[i];
-}
-
-IpAddress::IpAddress(const QString str)
-{
- QStringList s = str.split(".");
- for (int i = 0 ; i < 4 ; i++)
- myIp[i] = s.at(i).toInt();
-}
-
-IpAddress::IpAddress(const char *str)
-{
- QString t(str);
- QStringList l = t.split(".");
- for ( int i = 0 ; i < 4 ; i++ )
- myIp[i] = l.at(i).toInt();
-}
-
-IpAddress::IpAddress(const IpAddress &other)
-{
- for ( int i = 0; i < 4 ; i++)
- myIp[i] = other.myIp[i];
-}
-
-IpAddress::IpAddress(const quint32 intIp)
-{
- myIp[0] = intIp >> 24;
- myIp[1] = intIp >> 16;
- myIp[2] = intIp >> 8;
- myIp[3] = intIp;
-}
-
-QString IpAddress::toString() const
-{
- QString temp = QString().setNum(myIp[0]);
- for ( int i = 1 ; i <= 3 ; i++ )
- temp += QChar('.') + QString().setNum(myIp[i]);
- return temp;
-}
-
-void IpAddress::setIp(const quint8 *cur)
-{
- for ( int i = 0; i < 4 ; i++)
- myIp[i] = cur[i];
-}
-
-IpAddress& IpAddress::operator=(const IpAddress &other)
-{
- for ( int i = 0; i < 4 ; i++)
- myIp[i] = other.myIp[i];
- return (*this);
-}
-
-void IpAddress::setIp(const QString str)
-{
- QStringList s = str.split(".");
- for (int i = 0 ; i < 4 ; i++)
- myIp[i] = s.at(i).toInt();
-}
-
-IpAddress IpAddress::operator&(const IpAddress &e1) const
-{
- int i;
- IpAddress e3;
- for (i=0; i < 4; i++)
- e3.myIp[i] = this->myIp[i] & e1.myIp[i];
- return e3;
-}
-
-IpAddress IpAddress::operator |(const IpAddress &e1) const
-{
- int i;
- IpAddress e3;
- for (i=0; i < 4; i++)
- e3.myIp[i] = this->myIp[i] | e1.myIp[i];
- return e3;
-}
-
-bool IpAddress::isEmpty() const
-{
- int d = 0;
- for ( int i = 0 ; i < 4 ; i++ ) d += myIp[i];
- return !d;
-}
-
-bool IpAddress::isFull() const
-{
- for ( int i = 0 ; i < 4 ; i++ )
- if ( myIp[i] != 255 ) return false;
- return true;
-}
-
-IpAddress IpAddress::operator ~() const
-{
- IpAddress ip;
- for ( int i = 0; i < 4 ; i++)
- ip.myIp[i] = ~myIp[i];
- return ip;
-}
-
Deleted: trunk/src/ipaddress.h
===================================================================
--- trunk/src/ipaddress.h 2011-02-08 21:40:10 UTC (rev 231)
+++ trunk/src/ipaddress.h 2011-02-08 21:41:11 UTC (rev 232)
@@ -1,78 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#ifndef IPADDRESS_H
-#define IPADDRESS_H
-
-#include <QDataStream>
-#include <QVariant>
-
-class IpAddress
-{
-public:
- IpAddress();
- IpAddress(const quint8 *cur);
- IpAddress(const QString str);
- IpAddress(const char *str);
- IpAddress(const IpAddress &other);
- IpAddress(const quint32 intIp);
- void setIp(const quint8 *cur);
- void setIp(const QString str);
- QString toString() const;
- bool isEmpty() const;
- bool isLoopBack() const { return myIp[0] == 127; }
- bool isFull() const;
- quint32 toInt() const;
- quint8 at(int i) const { return myIp[i]; }
- IpAddress& operator=(const IpAddress &other);
- IpAddress operator&(const IpAddress &e1) const;
- IpAddress operator~() const;
- IpAddress operator|(const IpAddress &e1) const;
- static IpAddress full() { return IpAddress("255.255.255.255"); }
- void writeXml() const { }
-private:
- quint8 myIp[4];
-protected:
- friend QDataStream& operator>>(QDataStream &stream, IpAddress &address);
- friend QDataStream& operator<<(QDataStream &stream, const IpAddress &address);
-};
-
-inline quint32 IpAddress::toInt() const
-{
- return ( (myIp[0] << 24) + (myIp[1] << 16) + (myIp[2] << 8) +myIp[3]);
-}
-
-inline bool operator<(const IpAddress &e1 , const IpAddress &e2) { return e1.toInt() < e2.toInt(); }
-inline bool operator>(const IpAddress &e1 , const IpAddress &e2) { return e1.toInt() > e2.toInt(); }
-inline bool operator<=(const IpAddress &e1 , const IpAddress &e2) { return !(e1.toInt() > e2.toInt()); }
-inline bool operator>=(const IpAddress &e1 , const IpAddress &e2) { return !(e1.toInt() < e2.toInt()); }
-inline bool operator==(const IpAddress &e1 , const IpAddress &e2) { return e1.toInt() == e2.toInt(); }
-inline bool operator!=(const IpAddress &e1, const IpAddress &e2) { return !(e1 == e2) ; }
-inline QDataStream& operator<<(QDataStream &stream, const IpAddress &address)
-{
- for (int i = 0 ; i < 4 ; i++ ) stream << address.myIp[i];
- return stream;
-}
-inline QDataStream& operator>>(QDataStream &stream, IpAddress &address)
-{
- for (int i = 0 ; i < 4 ; i++ ) stream >> address.myIp[i];
- return stream;
-}
-
-#endif // IPADDRESS_H
Deleted: trunk/src/macaddress.cpp
===================================================================
--- trunk/src/macaddress.cpp 2011-02-08 21:40:10 UTC (rev 231)
+++ trunk/src/macaddress.cpp 2011-02-08 21:41:11 UTC (rev 232)
@@ -1,119 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#include "macaddress.h"
-#include <QStringList>
-
-macAddress::macAddress()
-{
- for ( int i = 0 ; i < 6 ; i++ )
- myMac[i] = 0;
-}
-
-macAddress::macAddress(QString str)
-{
- setMac(str);
-}
-
-macAddress::macAddress(const macAddress &other)
-{
- for (int i = 0 ; i < 6 ; i ++)
- myMac[i] = other.myMac[i];
-}
-
-QString macAddress::toString() const
-{
- QString temp = QString("%1").arg( QString().setNum(myMac[0],16), 2 , QChar('0'));
- int i;
- for ( i = 1 ; i <= 5 ; i++ ) {
- temp.append(QChar(':'));
- temp = temp + QString("%1").arg(myMac[i],2,16,QChar('0'));
- }
- return temp.toUpper();
-}
-
-macAddress& macAddress::operator=(const macAddress &other)
-{
- for (int i = 0 ; i < 6 ; i ++)
- myMac[i] = other.myMac[i];
- return (*this);
-}
-
-macAddress macAddress::operator++()
-{
- int i = 5;
- while ( i >= 0 && myMac[i] == 255) {
- myMac[i] = 0;
- i--;
- }
- myMac[i]++;
- return *this;
-}
-
-macAddress macAddress::operator++(int notused)
-{
- Q_UNUSED(notused);
- macAddress temp = *this;
- int i = 5;
- while ( i >= 0 && myMac[i] == 255) {
- myMac[i] = 0;
- i--;
- }
- myMac[i]++;
- return temp;
-}
-
-void macAddress::setBroadcast()
-{
- int i;
- for (i = 0 ; i < 6 ; i++)
- myMac[i] = 0xFF;
-}
-
-bool macAddress::isBroadcast()
-{
- int i;
- for (i = 0; i < 6 ; i++)
- if ( myMac[i] != 0xFF ) return false;
- return true;
-}
-
-void macAddress::setRandom()
-{
- int i;
- myMac[0] = 0x01;
- for ( i = 1 ; i < 6 ; i++ )
- myMac[i] = qrand()%256;
-}
-
-void macAddress::setMac(QString str)
-{
- QStringList s = str.split(":");
- for (int i = 0 ; i < 6 ; i++)
- myMac[i] = s.at(i).toInt(0,16);
-}
-
-bool macAddress::isEmpty() const
-{
- for ( int i = 0 ; i < 6 ; i++ )
- if ( myMac[i] ) return false;
- return true;
-}
-
-
Deleted: trunk/src/macaddress.h
===================================================================
--- trunk/src/macaddress.h 2011-02-08 21:40:10 UTC (rev 231)
+++ trunk/src/macaddress.h 2011-02-08 21:41:11 UTC (rev 232)
@@ -1,73 +0,0 @@
-/****************************************************************************************
-** NetEmul - program for simulating computer networks.
-** Copyright © 2009 Semenov Pavel and Omilaeva Anastasia
-**
-** NetEmul is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** NetEmul 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
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with the NetEmul; if not, write to the Free
-** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-** 02111-1307 USA.
-****************************************************************************************/
-#ifndef MACADDRESS_H
-#define MACADDRESS_H
-
-#include <QDataStream>
-
-class macAddress
-{
-public:
- macAddress();
- macAddress(QString str);
- macAddress(const macAddress &other);
- void setMac(QString str);
- void setRandom();
- QString toString() const ;
- macAddress operator++();
- macAddress operator++(int notused);
- macAddress& operator=(const macAddress &other);
- void setBroadcast();
- bool isBroadcast();
- bool isEmpty() const;
- qulonglong toInt() const;
-private:
- quint8 myMac[6];
-protected:
- friend QDataStream& operator<<(QDataStream &stream, const macAddress &address);
- friend QDataStream& operator>>(QDataStream &stream, macAddress &address);
-};
-
-inline qulonglong macAddress::toInt() const
-{
- return ((qulonglong)myMac[0]<<40)+((qulonglong)myMac[1]<<32)+((qulonglong)myMac[2]<<24)+
- ((qulonglong)myMac[3]<<16)+((qulonglong)myMac[4]<<8)+(qulonglong)myMac[5];
-}
-inline bool operator<(const macAddress &e1 , const macAddress &e2) { return e1.toInt() < e2.toInt(); }
-inline bool operator>(const macAddress &e1 , const macAddress &e2) { return e1.toInt() > e2.toInt(); }
-inline bool operator==(const macAddress &e1 , const macAddress &e2) { return e1.toInt() == e2.toInt(); }
-inline bool operator!=(const macAddress &e1, const macAddress &e2) { return !(e1 == e2); }
-inline bool operator>=(const macAddress &e1 , const macAddress &e2) { return !(e1 < e2); }
-inline bool operator<=(const macAddress &e1 , const macAddress &e2) { return !(e1 > e2); }
-
-
-inline QDataStream& operator<<(QDataStream &stream, const macAddress &address)
-{
- for (int i = 0 ; i < 6 ; i++ ) stream << address.myMac[i];
- return stream;
-}
-
-inline QDataStream& operator>>(QDataStream &stream, macAddress &address)
-{
- for (int i = 0 ; i < 6 ; i++ ) stream >> address.myMac[i];
- return stream;
-}
-
-#endif // MACADDRESS_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-08 21:40:17
|
Revision: 231
http://netemul.svn.sourceforge.net/netemul/?rev=231&view=rev
Author: f-r-o-s-t
Date: 2011-02-08 21:40:10 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
create basic tools lib
Modified Paths:
--------------
trunk/test/cable/cable.pro
trunk/test/cable/tst_cabletest.cpp
Modified: trunk/test/cable/cable.pro
===================================================================
--- trunk/test/cable/cable.pro 2011-02-07 20:58:19 UTC (rev 230)
+++ trunk/test/cable/cable.pro 2011-02-08 21:40:10 UTC (rev 231)
@@ -6,7 +6,7 @@
QT += testlib
-TARGET = tst_cabletest
+TARGET = cable
CONFIG += console
CONFIG -= app_bundle
Modified: trunk/test/cable/tst_cabletest.cpp
===================================================================
--- trunk/test/cable/tst_cabletest.cpp 2011-02-07 20:58:19 UTC (rev 230)
+++ trunk/test/cable/tst_cabletest.cpp 2011-02-08 21:40:10 UTC (rev 231)
@@ -12,10 +12,10 @@
public:
private Q_SLOTS:
- void testCase1();
+ // void testCase1();
};
-
+/*
void CableTest::testCase1()
{
Cable *cable = new Cable();
@@ -29,6 +29,7 @@
QCOMPARE( cable->endPort() , dev2->findPortByName("LAN2") );
}
+*/
QTEST_MAIN(CableTest);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-07 20:58:26
|
Revision: 230
http://netemul.svn.sourceforge.net/netemul/?rev=230&view=rev
Author: f-r-o-s-t
Date: 2011-02-07 20:58:19 +0000 (Mon, 07 Feb 2011)
Log Message:
-----------
Delete boxchip broken test
Modified Paths:
--------------
trunk/test/test.pro
Removed Paths:
-------------
trunk/test/boxchip/
Modified: trunk/test/test.pro
===================================================================
--- trunk/test/test.pro 2011-02-07 20:34:22 UTC (rev 229)
+++ trunk/test/test.pro 2011-02-07 20:58:19 UTC (rev 230)
@@ -2,15 +2,12 @@
# Automatically generated by qmake (2.01a) Sun Jun 28 01:51:25 2009
######################################################################
-SOURCES += ../src/macaddress.cpp
-HEADERS += ../src/macaddress.h
DEFINES += __TESTING__
TEMPLATE = subdirs
SUBDIRS = mac \
ippacket \
ipaddress \
frame \
- boxchip \
scenexmlreader \
cable
# Input
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-r...@us...> - 2011-02-07 20:34:29
|
Revision: 229
http://netemul.svn.sourceforge.net/netemul/?rev=229&view=rev
Author: f-r-o-s-t
Date: 2011-02-07 20:34:22 +0000 (Mon, 07 Feb 2011)
Log Message:
-----------
WARNING!!! Don't download this version.
We change VCS to Mercurial soon, and change development process.
Thank you for your understanding.
Modified Paths:
--------------
trunk/src/mainwindow.cpp
trunk/src/mycanvas.cpp
trunk/src/mycanvas.h
trunk/src/states/abstractstate.cpp
trunk/src/states/abstractstate.h
trunk/src/states/cablestate.cpp
trunk/src/states/cablestate.h
trunk/src/states/emptystate.h
trunk/src/states/insertstate.cpp
trunk/src/states/insertstate.h
trunk/src/states/movestate.cpp
trunk/src/states/movestate.h
trunk/src/states/sendstate.cpp
trunk/src/states/sendstate.h
trunk/src/states/textstate.h
Added Paths:
-----------
trunk/test/mycanvas/
trunk/test/mycanvas/abstractstate.cpp
trunk/test/mycanvas/abstractstate.h
trunk/test/mycanvas/addcablecommand.cpp
trunk/test/mycanvas/addcablecommand.h
trunk/test/mycanvas/appsetting.cpp
trunk/test/mycanvas/appsetting.h
trunk/test/mycanvas/cabledev.cpp
trunk/test/mycanvas/cabledev.h
trunk/test/mycanvas/deletecommand.cpp
trunk/test/mycanvas/deletecommand.h
trunk/test/mycanvas/device.cpp
trunk/test/mycanvas/device.h
trunk/test/mycanvas/mycanvas.pro
trunk/test/mycanvas/textitem.cpp
trunk/test/mycanvas/textitem.h
trunk/test/mycanvas/tst_mycanvastest.cpp
Modified: trunk/src/mainwindow.cpp
===================================================================
--- trunk/src/mainwindow.cpp 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/mainwindow.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -536,18 +536,25 @@
//Слот сохранить
bool MainWindow::saveFile()
{
+ int code = MyCanvas::OPEN_OK;
if ( myFile.isEmpty() ) {
- saveAsFile();
- return true;
+ saveAsFile();
+ return true;
}
setWindowTitle( myFile );
if ( myFile.endsWith("net") ) {
- canva->saveScene(myFile);
+ code = canva->saveScene(myFile);
}
else {
- canva->saveSceneXml(myFile);
+ code = canva->saveSceneXml(myFile);
}
- return true;
+ if ( code == MyCanvas::OPEN_OK ) {
+ return true;
+ } else {
+ QMessageBox::critical(this,tr("Save error"),MyCanvas::IOErrorString(code),
+ QMessageBox::Ok , QMessageBox::Ok );
+ return false;
+ }
}
void MainWindow::openFile(QString name)
@@ -555,12 +562,17 @@
setWindowTitle(name);
setEnabledFileItems(true);
showGridAct->setChecked(true);
+ int code = MyCanvas::OPEN_OK;
if ( name.endsWith("net") ) {
- canva->openScene(name);
+ code = canva->openScene(name);
}
else {
- canva->openSceneXml(name);
+ code = canva->openSceneXml(name);
}
+ if ( code != MyCanvas::OPEN_OK ) {
+ QMessageBox::critical(this,tr("Open error"),MyCanvas::IOErrorString(code),
+ QMessageBox::Ok , QMessageBox::Ok );
+ }
}
void MainWindow::openFile()
Modified: trunk/src/mycanvas.cpp
===================================================================
--- trunk/src/mycanvas.cpp 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/mycanvas.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -26,7 +26,6 @@
#include <QtDebug>
#include <QtCore/QFile>
#include <QtCore/QDataStream>
-#include <QtGui/QMessageBox>
#include <QtGui/QTextCursor>
#include <QtGui/QApplication>
#include <QtXml/QXmlSimpleReader>
@@ -52,7 +51,7 @@
myTimer = 0;
myOpen = false;
myModified = false;
- myState = abstractState::initialize(this);
+ myState = AbstractState::initialize(this);
commandStack.setUndoLimit(UNDO_LIMIT);
// WHAT THE FUCK???
@@ -207,13 +206,13 @@
Загружает сцену из файла.
@param fileName - имя файла из которого осуществляется загрузка.
*/
-void MyCanvas::openScene(QString fileName)
+int MyCanvas::openScene(const QString &fileName)
{
+ int code = OPEN_OK;
newFile();
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
- qDebug() << tr("Opening file for reading is impossible");
- return;
+ return READING_FAIL;
}
QDataStream s(&file);
s.setVersion(QDataStream::Qt_4_3);
@@ -221,56 +220,62 @@
QString str;
s >> str;
if ( str != QCoreApplication::applicationVersion() ) {
- QMessageBox::critical(0,tr("Error"),tr("Outdated version of the file, file can't be opened"),
- QMessageBox::Ok , QMessageBox::Ok );
emit fileClosed();
- return;
+ code = OUTDATED_VERSION;
+ } else {
+ QApplication::changeOverrideCursor(Qt::WaitCursor);
+ Device *item;
+ int n,i;
+ s >> n;
+ for ( i = 0 ; i < n ; i++ ) {
+ item = new Device(s);
+ item->setMenu(myItemMenu);
+ addItem(item);
+ myDevices << item;
+ }
+ s >> n;
+ for ( i = 0 ; i < n ; i++ ) {
+ s >> p;
+ Device *start = deviceInPoint(p);
+ s >> p;
+ Device *end = deviceInPoint(p);
+ s >> str;
+ QString startP = str;
+ s >> str;
+ QString endP = str;
+ createConnection( start , end , startP , endP );
+ }
+ s >> n;
+ for ( i = 0 ; i < n ; i++ ) {
+ s >> p; s >> str;
+ createTextItem(p,str);
+ }
+ if ( s.status() != QDataStream::Ok ) {
+ qDebug() << "PPC";
+ code = STREAM_ERROR;
+ emit fileClosed();
+ } else {
+ qDebug() << tr("Scene opened from %1").arg(fileName) ;
+ emit fileOpened();
+ }
+ file.close();
+ QApplication::restoreOverrideCursor();
+ myModified = false;
}
- QApplication::changeOverrideCursor(Qt::WaitCursor);
- Device *item;
- int n,i;
- s >> n;
- for ( i = 0 ; i < n ; i++ ) {
- item = new Device(s);
- item->setMenu(myItemMenu);
- addItem(item);
- myDevices << item;
- }
- s >> n;
- for ( i = 0 ; i < n ; i++ ) {
- s >> p;
- Device *start = deviceInPoint(p);
- s >> p;
- Device *end = deviceInPoint(p);
- s >> str;
- QString startP = str;
- s >> str;
- QString endP = str;
- createConnection( start , end , startP , endP );
- }
- s >> n;
- for ( i = 0 ; i < n ; i++ ) {
- s >> p; s >> str;
- createTextItem(p,str);
- }
- if ( s.status() != QDataStream::Ok ) qDebug() << "PPC";
- file.close();
- QApplication::restoreOverrideCursor();
- emit fileOpened();
- qDebug() << tr("Scene opened from %1").arg(fileName) ;
- myModified = false;
+ return code;
}
//-----------------------------------------------------------------------
-void MyCanvas::openSceneXml(QString fileName)
+int MyCanvas::openSceneXml(const QString &fileName)
{
newFile();
stop();
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
- qDebug() << tr("Opening file for reading is impossible");
- return;
+ //qDebug() << tr("Opening file for reading is impossible");
+ return READING_FAIL;
}
+ int code = OPEN_OK;
QApplication::changeOverrideCursor(Qt::WaitCursor);
SceneXmlReader handler(this);
@@ -280,27 +285,27 @@
if ( reader.parse(&source) ) {
emit fileOpened();
+ play();
qDebug() << tr("Scene opened from %1").arg(fileName) ;
} else {
- qDebug("CДелай Ну ХОТЬ ЧТО_НИБУДЬ!!!!!!!!!");
+ code = STREAM_ERROR;
+ emit fileClosed();
}
-
- file.close();
- play();
+ file.close();
QApplication::restoreOverrideCursor();
myModified = false;
+ return code;
}
/*!
Сохраняет сцену в файл.
@param fileName - имя файла в который осуществляется сохранение.
*/
-void MyCanvas::saveScene(QString fileName)
+int MyCanvas::saveScene(const QString &fileName)
{
QFile file(fileName);
- if (!file.open(QIODevice::WriteOnly)) {
- qDebug() << tr("Opening file for writing is impossible %1").arg(fileName);
- return;
+ if (!file.open(QIODevice::WriteOnly)) {
+ return WRITING_FAIL;
}
QApplication::changeOverrideCursor(Qt::WaitCursor);
QDataStream s(&file);
@@ -322,20 +327,25 @@
foreach ( TextItem *i, myTextItems ) {
s << i->pos();
s << i->toPlainText();
- }
- if ( s.status() != QDataStream::Ok ) qDebug() << "PPC";
+ }
file.close();
- QApplication::restoreOverrideCursor();
- qDebug() << tr("Scene saved in %1").arg(fileName) ;
+ QApplication::restoreOverrideCursor();
myModified = false;
+ if ( s.status() != QDataStream::Ok ) {
+ qDebug() << "PPC";
+ return STREAM_ERROR;
+ } else {
+ qDebug() << tr("Scene saved in %1").arg(fileName) ;
+ return OPEN_OK;
+ }
}
-void MyCanvas::saveSceneXml(QString fileName)
+int MyCanvas::saveSceneXml(const QString &fileName)
{
QFile file(fileName);
- if (!file.open(QIODevice::WriteOnly)) {
- qDebug() << tr("Opening file for writing is impossible %1").arg(fileName);
- return;
+ if (!file.open(QIODevice::WriteOnly)) {
+ //qDebug() << tr("Opening file for writing is impossible %1").arg(fileName);
+ return WRITING_FAIL;
}
QApplication::changeOverrideCursor(Qt::WaitCursor);
sceneXmlWriter s(this);
@@ -344,6 +354,7 @@
QApplication::restoreOverrideCursor();
qDebug() << tr("Scene saved in %1").arg(fileName) ;
myModified = false;
+ return OPEN_OK;
}
//-------------------------------------------------------------------------
/*!
Modified: trunk/src/mycanvas.h
===================================================================
--- trunk/src/mycanvas.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/mycanvas.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -32,7 +32,7 @@
class DevicePort;
class Device;
class DeviceImpl;
-class abstractState;
+class AbstractState;
typedef QList<Device*> DeviceList;
typedef QList<TextItem*> TextItemList;
@@ -56,6 +56,9 @@
enum { width = 2000 , height = 2000 };
// типы устройств : Нет устройства , компьютер , концентратор , коммутатор
enum { noDev = 0 , busDev = 2 ,compDev = 3 , hubDev = 4 , switchDev = 5 , routerDev = 7 };
+
+ enum { OPEN_OK = 0 , READING_FAIL , WRITING_FAIL , OUTDATED_VERSION , STREAM_ERROR };
+
MyCanvas(QMenu *context,QObject *parent = 0); // Конструктор
~MyCanvas();
@@ -92,6 +95,16 @@
void putItems(QMap<QGraphicsItem*,QPointF> map);
void calibrateAll(QList<QGraphicsItem*> list);
bool isDevice(QGraphicsItem *t) const;
+
+ static QString IOErrorString(int n) {
+ static const QString strs[] = { tr("Open complite") ,
+ tr("Opening file for reading is impossible"),
+ tr("Opening file for writing is impossible"),
+ tr("Outdated version of the file, file can't be opened"),
+ tr("Stream I/O error") };
+ return strs[n];
+ }
+
signals:
void uncheck(); //!< Сообщает панели о сбросе текущего устройства
void fileOpened(); //!< Сообщает главному окно что открыт новый файл
@@ -108,10 +121,10 @@
void play();
void stop() { killTimer(myTimer); myTimer = 0; } // Выключаем таймер
bool isPlayed() const { return myTimer; }
- void saveScene(QString fileName);
- void openScene(QString fileName);
- void saveSceneXml(QString fileName);
- void openSceneXml(QString fileName);
+ int saveScene(const QString &fileName);
+ int openScene(const QString &fileName);
+ int saveSceneXml(const QString &fileName);
+ int openSceneXml(const QString &fileName);
DeviceImpl* addComputer(int x,int y);
DeviceImpl* addSwitch(int x,int y);
DeviceImpl* addHub(int x,int y);
@@ -132,7 +145,7 @@
Device* deviceWithImpl(DeviceImpl *d);
bool myOpen;
bool myModified;
- abstractState *myState;
+ AbstractState *myState;
public:
DeviceList devices() const { return myDevices; }
@@ -160,7 +173,7 @@
int myTimer;
// My dear Friends =)
friend class statisticsScene;
- friend class abstractState;
+ friend class AbstractState;
friend class moveState;
friend class insertState;
friend class cableState;
@@ -168,4 +181,5 @@
friend class sendState;
};
//------------------------------------------------------------------
+
#endif // MYCANVAS_H
Modified: trunk/src/states/abstractstate.cpp
===================================================================
--- trunk/src/states/abstractstate.cpp 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/abstractstate.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -26,60 +26,60 @@
#include "textstate.h"
#include "sendstate.h"
-abstractState::abstractState(MyCanvas *s)
+AbstractState::AbstractState(MyCanvas *s)
{
scene = s;
}
-abstractState* abstractState::initialize(MyCanvas *s)
+AbstractState* AbstractState::initialize(MyCanvas *s)
{
return new emptyState(s);
}
-void abstractState::goMove()
+void AbstractState::goMove()
{
- abstractState *oldState = scene->myState;
+ AbstractState *oldState = scene->myState;
scene->myState = new moveState(scene);
delete oldState;
}
-void abstractState::goInsert()
+void AbstractState::goInsert()
{
- abstractState *oldState = scene->myState;
+ AbstractState *oldState = scene->myState;
scene->myState = new insertState(scene);
delete oldState;
}
-void abstractState::goCable()
+void AbstractState::goCable()
{
- abstractState *oldState = scene->myState;
+ AbstractState *oldState = scene->myState;
scene->myState = new cableState(scene);
delete oldState;
}
-void abstractState::goText()
+void AbstractState::goText()
{
- abstractState *oldState = scene->myState;
+ AbstractState *oldState = scene->myState;
scene->myState = new textState(scene);
delete oldState;
}
-void abstractState::goSend()
+void AbstractState::goSend()
{
- abstractState *oldState = scene->myState;
+ AbstractState *oldState = scene->myState;
scene->myState = new sendState(scene);
delete oldState;
}
-void abstractState::goEmpty()
+void AbstractState::goEmpty()
{
- abstractState *oldState = scene->myState;
+ AbstractState *oldState = scene->myState;
scene->myState = new emptyState(scene);
delete oldState;
}
-void abstractState::goTo(int mode)
+void AbstractState::goTo(int mode)
{
switch ( mode ) {
case move : goMove(); break;
Modified: trunk/src/states/abstractstate.h
===================================================================
--- trunk/src/states/abstractstate.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/abstractstate.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -23,12 +23,12 @@
class MyCanvas;
class QGraphicsSceneMouseEvent;
-class abstractState
+class AbstractState
{
public:
- abstractState(MyCanvas *s);
+ AbstractState(MyCanvas *s);
enum { move = 0 , cable = 1 , insert = 2 , send = 6 , text = 8};
- virtual ~abstractState() { }
+ virtual ~AbstractState() { }
virtual void mouseMove(QGraphicsSceneMouseEvent*) = 0;
virtual void mousePress(QGraphicsSceneMouseEvent*) = 0;
virtual void mouseRelease(QGraphicsSceneMouseEvent*) = 0;
@@ -39,7 +39,7 @@
virtual void goSend();
virtual void goEmpty();
virtual void hideState() { }
- static abstractState* initialize(MyCanvas *s);
+ static AbstractState* initialize(MyCanvas *s);
void goTo(int mode);
protected:
MyCanvas *scene;
Modified: trunk/src/states/cablestate.cpp
===================================================================
--- trunk/src/states/cablestate.cpp 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/cablestate.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -24,7 +24,7 @@
#include "mycanvas.h"
#include "device.h"
-cableState::cableState(MyCanvas *s) : abstractState(s)
+cableState::cableState(MyCanvas *s) : AbstractState(s)
{
line = 0; // Провода нет
}
Modified: trunk/src/states/cablestate.h
===================================================================
--- trunk/src/states/cablestate.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/cablestate.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -24,7 +24,7 @@
class QGraphicsLineItem;
-class cableState : public abstractState
+class cableState : public AbstractState
{
public:
cableState(MyCanvas *s);
Modified: trunk/src/states/emptystate.h
===================================================================
--- trunk/src/states/emptystate.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/emptystate.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -22,10 +22,10 @@
#include "abstractstate.h"
-class emptyState : public abstractState
+class emptyState : public AbstractState
{
public:
- emptyState(MyCanvas *s) : abstractState(s) { }
+ emptyState(MyCanvas *s) : AbstractState(s) { }
void mouseMove(QGraphicsSceneMouseEvent*) { }
void mousePress(QGraphicsSceneMouseEvent*) { }
void mouseRelease(QGraphicsSceneMouseEvent*) { }
Modified: trunk/src/states/insertstate.cpp
===================================================================
--- trunk/src/states/insertstate.cpp 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/insertstate.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -23,7 +23,7 @@
#include "insertrect.h"
#include "addcommand.h"
-insertState::insertState(MyCanvas *s) : abstractState(s)
+insertState::insertState(MyCanvas *s) : AbstractState(s)
{
insertRect = new InsertRect;
s->addItem(insertRect);
Modified: trunk/src/states/insertstate.h
===================================================================
--- trunk/src/states/insertstate.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/insertstate.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -24,7 +24,7 @@
class InsertRect;
-class insertState : public abstractState
+class insertState : public AbstractState
{
public:
insertState(MyCanvas *s);
Modified: trunk/src/states/movestate.cpp
===================================================================
--- trunk/src/states/movestate.cpp 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/movestate.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -26,7 +26,7 @@
#include "cabledev.h"
#include "movecommand.h"
-moveState::moveState(MyCanvas *s) : abstractState(s)
+moveState::moveState(MyCanvas *s) : AbstractState(s)
{
selectRect = 0; // Выделения нет
p2Rect = QPoint();
Modified: trunk/src/states/movestate.h
===================================================================
--- trunk/src/states/movestate.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/movestate.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -28,7 +28,7 @@
typedef QList<QGraphicsItem*> itemList;
-class moveState : public abstractState
+class moveState : public AbstractState
{
public:
moveState(MyCanvas *s);
Modified: trunk/src/states/sendstate.cpp
===================================================================
--- trunk/src/states/sendstate.cpp 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/sendstate.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -25,7 +25,7 @@
#include "sendellipse.h"
#include "device.h"
-sendState::sendState(MyCanvas *s) : abstractState(s)
+sendState::sendState(MyCanvas *s) : AbstractState(s)
{
mySendState = noSendItem;
sendEllipse = new SendEllipse;
Modified: trunk/src/states/sendstate.h
===================================================================
--- trunk/src/states/sendstate.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/sendstate.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -25,7 +25,7 @@
class Device;
class SendEllipse;
-class sendState : public abstractState
+class sendState : public AbstractState
{
public:
sendState(MyCanvas *s);
Modified: trunk/src/states/textstate.h
===================================================================
--- trunk/src/states/textstate.h 2010-11-24 20:35:39 UTC (rev 228)
+++ trunk/src/states/textstate.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -22,10 +22,10 @@
#include "abstractstate.h"
-class textState : public abstractState
+class textState : public AbstractState
{
public:
- textState(MyCanvas *s) : abstractState(s) { }
+ textState(MyCanvas *s) : AbstractState(s) { }
void mouseMove(QGraphicsSceneMouseEvent*) { }
void mousePress(QGraphicsSceneMouseEvent *event);
void mouseRelease(QGraphicsSceneMouseEvent*) { }
Added: trunk/test/mycanvas/abstractstate.cpp
===================================================================
--- trunk/test/mycanvas/abstractstate.cpp (rev 0)
+++ trunk/test/mycanvas/abstractstate.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,10 @@
+#include "abstractstate.h"
+
+AbstractState::AbstractState()
+{
+}
+
+void AbstractState::initialize(MyCanvas *)
+{
+
+}
Added: trunk/test/mycanvas/abstractstate.h
===================================================================
--- trunk/test/mycanvas/abstractstate.h (rev 0)
+++ trunk/test/mycanvas/abstractstate.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,18 @@
+#ifndef ABSTRACTSTATE_H
+#define ABSTRACTSTATE_H
+
+#include <QGraphicsSceneMouseEvent>
+
+class MyCanvas;
+
+class AbstractState
+{
+public:
+ AbstractState();
+ static void initialize(MyCanvas*);
+ virtual void mouseMove(QGraphicsSceneMouseEvent*) = 0;
+ virtual void mousePress(QGraphicsSceneMouseEvent*) = 0;
+ virtual void mouseRelease(QGraphicsSceneMouseEvent*) = 0;
+};
+
+#endif // ABSTRACTSTATE_H
Added: trunk/test/mycanvas/addcablecommand.cpp
===================================================================
--- trunk/test/mycanvas/addcablecommand.cpp (rev 0)
+++ trunk/test/mycanvas/addcablecommand.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,5 @@
+#include "addcablecommand.h"
+
+AddCableCommand::AddCableCommand()
+{
+}
Added: trunk/test/mycanvas/addcablecommand.h
===================================================================
--- trunk/test/mycanvas/addcablecommand.h (rev 0)
+++ trunk/test/mycanvas/addcablecommand.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,10 @@
+#ifndef ADDCABLECOMMAND_H
+#define ADDCABLECOMMAND_H
+
+class AddCableCommand
+{
+public:
+ AddCableCommand();
+};
+
+#endif // ADDCABLECOMMAND_H
Added: trunk/test/mycanvas/appsetting.cpp
===================================================================
--- trunk/test/mycanvas/appsetting.cpp (rev 0)
+++ trunk/test/mycanvas/appsetting.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,5 @@
+#include "appsetting.h"
+
+AppSetting::AppSetting()
+{
+}
Added: trunk/test/mycanvas/appsetting.h
===================================================================
--- trunk/test/mycanvas/appsetting.h (rev 0)
+++ trunk/test/mycanvas/appsetting.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,10 @@
+#ifndef APPSETTING_H
+#define APPSETTING_H
+
+class AppSetting
+{
+public:
+ AppSetting();
+};
+
+#endif // APPSETTING_H
Added: trunk/test/mycanvas/cabledev.cpp
===================================================================
--- trunk/test/mycanvas/cabledev.cpp (rev 0)
+++ trunk/test/mycanvas/cabledev.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,5 @@
+#include "cabledev.h"
+
+Cable::Cable()
+{
+}
Added: trunk/test/mycanvas/cabledev.h
===================================================================
--- trunk/test/mycanvas/cabledev.h (rev 0)
+++ trunk/test/mycanvas/cabledev.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,15 @@
+#ifndef CABLEDEV_H
+#define CABLEDEV_H
+
+#include <QList>
+
+class Cable;
+typedef QList<Cable*> CableList;
+
+class Cable
+{
+public:
+ Cable();
+};
+
+#endif // CABLEDEV_H
Added: trunk/test/mycanvas/deletecommand.cpp
===================================================================
--- trunk/test/mycanvas/deletecommand.cpp (rev 0)
+++ trunk/test/mycanvas/deletecommand.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,5 @@
+#include "deletecommand.h"
+
+DeleteCommand::DeleteCommand()
+{
+}
Added: trunk/test/mycanvas/deletecommand.h
===================================================================
--- trunk/test/mycanvas/deletecommand.h (rev 0)
+++ trunk/test/mycanvas/deletecommand.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,10 @@
+#ifndef DELETECOMMAND_H
+#define DELETECOMMAND_H
+
+class DeleteCommand
+{
+public:
+ DeleteCommand();
+};
+
+#endif // DELETECOMMAND_H
Added: trunk/test/mycanvas/device.cpp
===================================================================
--- trunk/test/mycanvas/device.cpp (rev 0)
+++ trunk/test/mycanvas/device.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,5 @@
+#include "device.h"
+
+Device::Device()
+{
+}
Added: trunk/test/mycanvas/device.h
===================================================================
--- trunk/test/mycanvas/device.h (rev 0)
+++ trunk/test/mycanvas/device.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,17 @@
+#ifndef DEVICE_H
+#define DEVICE_H
+
+#include <QString>
+
+class DevicePort;
+
+class Device
+{
+public:
+ Device();
+ DevicePort* findPortByName(const QString &str) {
+ return 0;
+ }
+};
+
+#endif // DEVICE_H
Added: trunk/test/mycanvas/mycanvas.pro
===================================================================
--- trunk/test/mycanvas/mycanvas.pro (rev 0)
+++ trunk/test/mycanvas/mycanvas.pro 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,41 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-12-05T22:29:47
+#
+#-------------------------------------------------
+
+QT += script testlib xml
+
+TARGET = tst_mycanvastest
+CONFIG += console
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+INCLUDEPATH += ../../src \
+../../src/tools
+
+SOURCES += tst_mycanvastest.cpp \
+ ../../src/mycanvas.cpp \
+ textitem.cpp \
+ cabledev.cpp \
+ device.cpp \
+ appsetting.cpp \
+ abstractstate.cpp \
+ deletecommand.cpp \
+ addcablecommand.cpp \
+ ../../src/tools/scenexmlwriter.cpp \
+ ../../src/tools/scenexmlreader.cpp
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+HEADERS += \
+ ../../src/mycanvas.h \
+ textitem.h \
+ cabledev.h \
+ device.h \
+ appsetting.h \
+ abstractstate.h \
+ deletecommand.h \
+ addcablecommand.h \
+ ../../src/tools/scenexmlwriter.h \
+ ../../src/tools/scenexmlreader.h
Added: trunk/test/mycanvas/textitem.cpp
===================================================================
--- trunk/test/mycanvas/textitem.cpp (rev 0)
+++ trunk/test/mycanvas/textitem.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,5 @@
+#include "textitem.h"
+
+TextItem::TextItem()
+{
+}
Added: trunk/test/mycanvas/textitem.h
===================================================================
--- trunk/test/mycanvas/textitem.h (rev 0)
+++ trunk/test/mycanvas/textitem.h 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,10 @@
+#ifndef TEXTITEM_H
+#define TEXTITEM_H
+
+class TextItem
+{
+public:
+ TextItem();
+};
+
+#endif // TEXTITEM_H
Added: trunk/test/mycanvas/tst_mycanvastest.cpp
===================================================================
--- trunk/test/mycanvas/tst_mycanvastest.cpp (rev 0)
+++ trunk/test/mycanvas/tst_mycanvastest.cpp 2011-02-07 20:34:22 UTC (rev 229)
@@ -0,0 +1,29 @@
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+#include <QtCore/QCoreApplication>
+
+#include "mycanvas.h"
+
+class MycanvasTest : public QObject
+{
+ Q_OBJECT
+
+public:
+ MycanvasTest();
+
+private Q_SLOTS:
+ void testCase1();
+};
+
+MycanvasTest::MycanvasTest()
+{
+}
+
+void MycanvasTest::testCase1()
+{
+
+}
+
+QTEST_MAIN(MycanvasTest);
+
+#include "tst_mycanvastest.moc"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Lisandro D. N. P. M. <per...@gm...> - 2010-09-19 19:25:34
|
Hello! I was kindly pleased to see that there has been commits to the svn lately :-) Please, tell me in advance if you are planning to do a release so I can update the spanish translation and have the Debian package ready. Reagrds, Lisandro. -- La vida no se mide por la cantidad de veces que respiramos, sino por la cantidad de momentos que nos quitan la respiración. Anónimo Lisandro Damián Nicanor Pérez Meyer http://perezmeyer.com.ar/ http://perezmeyer.blogspot.com/ |
|
From: Jozef R. <jos...@gm...> - 2009-12-31 19:45:50
|
thank you, this works! i updated pkgbuild for arch linux users accordingly: http://aur.archlinux.org/packages.php?ID=29557 wish you a great start in 2010! jose 2009/12/31 Lisandro Damián Nicanor Pérez Meyer <per...@gm...>: > Please, always answer to the list (I guess I failed in that same part first, > sorry for that). > > On Saturday 26 December 2009 16:13:23 Jozef Riha wrote: >> Thank you, Lisandro but your proposed solution did not work. Netemul >> is still installed into /usr/local prefix. Could you please take a >> look why? Thank you, joe > > Sorry, it was: > > qmake PREFIX=/usr > > Regards, Lisandro. > > -- > > Lisandro Damián Nicanor Pérez Meyer > http://perezmeyer.com.ar/ > http://perezmeyer.blogspot.com/ > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Netemul-develop mailing list > Net...@li... > https://lists.sourceforge.net/lists/listinfo/netemul-develop |
|
From: Lisandro D. N. P. M. <per...@gm...> - 2009-12-31 17:46:56
|
Please, always answer to the list (I guess I failed in that same part first, sorry for that). On Saturday 26 December 2009 16:13:23 Jozef Riha wrote: > Thank you, Lisandro but your proposed solution did not work. Netemul > is still installed into /usr/local prefix. Could you please take a > look why? Thank you, joe Sorry, it was: qmake PREFIX=/usr Regards, Lisandro. -- Lisandro Damián Nicanor Pérez Meyer http://perezmeyer.com.ar/ http://perezmeyer.blogspot.com/ |
|
From: Jozef R. <jos...@gm...> - 2009-12-26 18:25:36
|
hello, could you please remove hardcoded path pointing to usr/local? i currently cannot find a way how to install it to e. g. /usr. thank you, joyef |
|
From: <per...@us...> - 2009-11-19 01:17:47
|
Revision: 210
http://netemul.svn.sourceforge.net/netemul/?rev=210&view=rev
Author: perezmeyer
Date: 2009-11-19 01:17:31 +0000 (Thu, 19 Nov 2009)
Log Message:
-----------
Also install the 32x32 icon file
Modified Paths:
--------------
trunk/netemul.pro
Modified: trunk/netemul.pro
===================================================================
--- trunk/netemul.pro 2009-11-18 21:38:59 UTC (rev 209)
+++ trunk/netemul.pro 2009-11-19 01:17:31 UTC (rev 210)
@@ -108,6 +108,7 @@
# Icons
icons.path = $${PREFIX}/share/netemul/pixmap/
icons.files = ../images/NetEmul.png
+ icons.files = ../images/NetEmul_32x32.png
INSTALLS += icons
# Desktop
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <per...@us...> - 2009-11-18 21:39:08
|
Revision: 209
http://netemul.svn.sourceforge.net/netemul/?rev=209&view=rev
Author: perezmeyer
Date: 2009-11-18 21:38:59 +0000 (Wed, 18 Nov 2009)
Log Message:
-----------
Fixed some typos: compability -> compatibility ; programm -> program ; programms -> programs. Thanks Ana Guerrero for the tips.
Modified Paths:
--------------
trunk/src/devices/deviceimpl.h
trunk/src/forms/installdialog.ui
trunk/src/forms/programmdialog.ui
trunk/src/forms/ripproperty.ui
Modified: trunk/src/devices/deviceimpl.h
===================================================================
--- trunk/src/devices/deviceimpl.h 2009-11-16 18:45:58 UTC (rev 208)
+++ trunk/src/devices/deviceimpl.h 2009-11-18 21:38:59 UTC (rev 209)
@@ -70,10 +70,10 @@
virtual bool hasTable() const { return false; }
virtual void dialog() = 0;
virtual void showLogDialog(logDialog*) const = 0;
- virtual void tableDialog() { qFatal("error not compability Table!"); }
- virtual void adapterDialog() { qFatal("error not compability adapter!"); }
- virtual void programmsDialog() { qFatal("error not compability"); }
- virtual void arpDialog() { qFatal("error not compability"); }
+ virtual void tableDialog() { qFatal("error not compatibility Table!"); }
+ virtual void adapterDialog() { qFatal("error not compatibility adapter!"); }
+ virtual void programmsDialog() { qFatal("error not compatibility"); }
+ virtual void arpDialog() { qFatal("error not compatibility"); }
virtual void showDesignerDialog() { qFatal("Error designer!"); }
virtual void showVirtualNetworkDialog() { qFatal("Error virtual network"); }
Modified: trunk/src/forms/installdialog.ui
===================================================================
--- trunk/src/forms/installdialog.ui 2009-11-16 18:45:58 UTC (rev 208)
+++ trunk/src/forms/installdialog.ui 2009-11-18 21:38:59 UTC (rev 209)
@@ -17,7 +17,7 @@
</size>
</property>
<property name="windowTitle">
- <string>Programms</string>
+ <string>Programs</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
Modified: trunk/src/forms/programmdialog.ui
===================================================================
--- trunk/src/forms/programmdialog.ui 2009-11-16 18:45:58 UTC (rev 208)
+++ trunk/src/forms/programmdialog.ui 2009-11-18 21:38:59 UTC (rev 209)
@@ -17,7 +17,7 @@
</size>
</property>
<property name="windowTitle">
- <string>Programms</string>
+ <string>Programs</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Modified: trunk/src/forms/ripproperty.ui
===================================================================
--- trunk/src/forms/ripproperty.ui 2009-11-16 18:45:58 UTC (rev 208)
+++ trunk/src/forms/ripproperty.ui 2009-11-18 21:38:59 UTC (rev 209)
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Rip programm property</string>
+ <string>Rip program property</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <per...@us...> - 2009-11-16 18:46:18
|
Revision: 208
http://netemul.svn.sourceforge.net/netemul/?rev=208&view=rev
Author: perezmeyer
Date: 2009-11-16 18:45:58 +0000 (Mon, 16 Nov 2009)
Log Message:
-----------
Updated translation except for two lines in mycanvas.cpp that need fixing.
Modified Paths:
--------------
trunk/translation/netemul_es.ts
Modified: trunk/translation/netemul_es.ts
===================================================================
--- trunk/translation/netemul_es.ts 2009-11-13 00:21:51 UTC (rev 207)
+++ trunk/translation/netemul_es.ts 2009-11-16 18:45:58 UTC (rev 208)
@@ -350,22 +350,22 @@
<message>
<location filename="../src/mainwindow.cpp" line="174"/>
<source>Configure VLAN...</source>
- <translation type="unfinished"></translation>
+ <translation>Configurar VLAN...</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="174"/>
<source>Configure VLAN</source>
- <translation type="unfinished"></translation>
+ <translation>Configurar VLAN</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="175"/>
<source>Set description...</source>
- <translation type="unfinished"></translation>
+ <translation>Establecer descripción...</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="175"/>
<source>Set description of device</source>
- <translation type="unfinished"></translation>
+ <translation>Establecer descripción del dispositivo</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="176"/>
@@ -430,42 +430,42 @@
<message>
<location filename="../src/mainwindow.cpp" line="237"/>
<source>Ctrl+1</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+1</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="241"/>
<source>Ctrl+2</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+2</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="245"/>
<source>Ctrl+3</source>
- <translation type="unfinished"></translation>
+ <translation>libqt4-dev</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="252"/>
<source>Ctrl+4</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+4</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="256"/>
<source>Ctrl+5</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+5</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="260"/>
<source>Ctrl+6</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+6</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="264"/>
<source>Ctrl+7</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+7</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="268"/>
<source>Ctrl+8</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+8</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="274"/>
@@ -672,12 +672,12 @@
<message>
<location filename="../src/devices/smartdevice.cpp" line="241"/>
<source>Can't set this gateway! See adapter settings!</source>
- <translation type="unfinished"></translation>
+ <translation>¡No puedo encontrar ésta puerta de enlace! ¡Ver la configuración del adaptador!</translation>
</message>
<message>
<location filename="../src/tools/scenexmlreader.cpp" line="22"/>
<source>The file is not a NetEmul file.</source>
- <translation type="unfinished"></translation>
+ <translation>Éste no es un archivo de NetEmul.</translation>
</message>
</context>
<context>
@@ -798,7 +798,7 @@
<message>
<location filename="../src/dialogs/adapterproperty.cpp" line="79"/>
<source>Receive settings automatically</source>
- <translation type="unfinished"></translation>
+ <translation>Recibir configuraciones automáticamente</translation>
</message>
<message>
<location filename="../src/dialogs/adapterproperty.cpp" line="85"/>
@@ -1060,22 +1060,22 @@
<message>
<location filename="../src/forms/devicenotedialog.ui" line="14"/>
<source>Description</source>
- <translation type="unfinished"></translation>
+ <translation>Descripción</translation>
</message>
<message>
<location filename="../src/forms/devicenotedialog.ui" line="20"/>
<source>Description:</source>
- <translation type="unfinished">Descripción:</translation>
+ <translation>Descripción:</translation>
</message>
<message>
<location filename="../src/forms/devicenotedialog.ui" line="49"/>
<source>Ok</source>
- <translation type="unfinished">Ok</translation>
+ <translation>Ok</translation>
</message>
<message>
<location filename="../src/forms/devicenotedialog.ui" line="60"/>
<source>Cancel</source>
- <translation type="unfinished">Cancelar</translation>
+ <translation>Cancelar</translation>
</message>
</context>
<context>
@@ -1162,12 +1162,12 @@
<message>
<location filename="../src/programms/dhcpserverprogramm.cpp" line="72"/>
<source>Warning</source>
- <translation type="unfinished"></translation>
+ <translation>Advertencia</translation>
</message>
<message>
<location filename="../src/programms/dhcpserverprogramm.cpp" line="72"/>
<source>Your DHCP server isn't configured.</source>
- <translation type="unfinished"></translation>
+ <translation>Su servidor DHCP no está configurado</translation>
</message>
</context>
<context>
@@ -2411,7 +2411,7 @@
<message>
<location filename="../src/dialogs/switchproperty.cpp" line="44"/>
<source>Manageable</source>
- <translation type="unfinished"></translation>
+ <translation>Administrable</translation>
</message>
<message>
<location filename="../src/dialogs/switchproperty.cpp" line="49"/>
@@ -2634,7 +2634,7 @@
<location filename="../src/chips/switchchip.cpp" line="102"/>
<location filename="../src/chips/switchchip.cpp" line="125"/>
<source>LAN%1</source>
- <translation type="unfinished">LAN%1</translation>
+ <translation>LAN%1</translation>
</message>
</context>
<context>
@@ -2642,7 +2642,7 @@
<message>
<location filename="../src/forms/virtualnetworkdialog.ui" line="13"/>
<source>Dialog</source>
- <translation type="unfinished"></translation>
+ <translation>Diálogo</translation>
</message>
</context>
</TS>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <per...@us...> - 2009-10-31 22:55:16
|
Revision: 188
http://netemul.svn.sourceforge.net/netemul/?rev=188&view=rev
Author: perezmeyer
Date: 2009-10-31 22:55:09 +0000 (Sat, 31 Oct 2009)
Log Message:
-----------
Debian's menu policies requires an icon to be no larger than 32x32 bits... I can leave it as a patch, but I think it's better to have it available in the svn.
Added Paths:
-----------
trunk/images/NetEmul_32x32.png
Added: trunk/images/NetEmul_32x32.png
===================================================================
(Binary files differ)
Property changes on: trunk/images/NetEmul_32x32.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|