From: <per...@us...> - 2009-10-03 17:35:13
|
Revision: 156 http://netemul.svn.sourceforge.net/netemul/?rev=156&view=rev Author: perezmeyer Date: 2009-10-03 17:33:30 +0000 (Sat, 03 Oct 2009) Log Message: ----------- Images and source code are not executable files. Fixing. Property Changed: ---------------- trunk/images/arrow.png trunk/images/back.png trunk/images/cable.png trunk/images/computer.png trunk/images/edit_add.png trunk/images/edit_remove.png trunk/images/hub.png trunk/images/k10i100.png trunk/images/k10i100i1000.png trunk/images/left_right.png trunk/images/not.png trunk/images/ok.png trunk/images/redo.png trunk/images/refresh.png trunk/images/router.png trunk/images/sharebus.png trunk/images/switch.png trunk/netemul.qrc trunk/src/chips/abstractchip.cpp trunk/src/chips/abstractchip.h trunk/src/chips/interface.cpp trunk/src/chips/interface.h trunk/src/deviceport.cpp trunk/src/deviceport.h trunk/src/devices/boxdevice.cpp trunk/src/devices/boxdevice.h trunk/src/devices/computer.cpp trunk/src/devices/computer.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/connectdialog.cpp trunk/src/dialogs/connectdialog.h trunk/src/dialogs/dialogtemplate.cpp trunk/src/dialogs/dialogtemplate.h trunk/src/dialogs/hubproperty.cpp trunk/src/dialogs/hubproperty.h trunk/src/dialogs/interfacedialog.cpp trunk/src/dialogs/interfacedialog.h trunk/src/dialogs/routeeditor.cpp trunk/src/dialogs/routeeditor.h trunk/src/dialogs/routerproperty.cpp trunk/src/dialogs/routerproperty.h trunk/src/dialogs/senddialog.cpp trunk/src/dialogs/senddialog.h trunk/src/dialogs/settingdialog.cpp trunk/src/dialogs/settingdialog.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/testdialog.h trunk/src/forms/testdialog.ui trunk/src/frame.cpp trunk/src/frame.h trunk/src/graphics/cabledev.cpp trunk/src/graphics/cabledev.h trunk/src/graphics/device.cpp trunk/src/graphics/device.h trunk/src/ipaddress.cpp trunk/src/ipaddress.h trunk/src/ipedit.cpp trunk/src/ipedit.h trunk/src/macaddress.cpp trunk/src/macaddress.h trunk/src/main.cpp trunk/src/mainwindow.cpp trunk/src/mainwindow.h trunk/src/mycanvas.cpp trunk/src/mycanvas.h trunk/src/packets/arppacket.cpp trunk/src/packets/arppacket.h trunk/src/packets/ippacket.cpp trunk/src/packets/ippacket.h Property changes on: trunk/images/arrow.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/back.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/cable.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/computer.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/edit_add.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/edit_remove.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/hub.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/k10i100.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/k10i100i1000.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/left_right.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/not.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/ok.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/redo.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/refresh.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/router.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/sharebus.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/images/switch.png ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/netemul.qrc ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/chips/abstractchip.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/chips/abstractchip.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/chips/interface.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/chips/interface.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/deviceport.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/deviceport.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/boxdevice.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/boxdevice.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/computer.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/computer.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/hubdevice.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/hubdevice.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/routerdevice.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/routerdevice.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/sharebus.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/sharebus.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/smartdevice.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/smartdevice.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/switchdevice.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/devices/switchdevice.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/adapterproperty.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/adapterproperty.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/computerproperty.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/computerproperty.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/connectdialog.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/connectdialog.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/dialogtemplate.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/dialogtemplate.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/hubproperty.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/hubproperty.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/interfacedialog.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/interfacedialog.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/routeeditor.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/routeeditor.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/routerproperty.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/routerproperty.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/senddialog.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/senddialog.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/settingdialog.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/settingdialog.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/switchproperty.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/switchproperty.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/tableswitch.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/tableswitch.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/testdialog.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/dialogs/testdialog.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/forms/testdialog.ui ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/frame.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/frame.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/graphics/cabledev.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/graphics/cabledev.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/graphics/device.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/graphics/device.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/ipaddress.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/ipaddress.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/ipedit.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/ipedit.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/macaddress.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/macaddress.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/main.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/mainwindow.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/mainwindow.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/mycanvas.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/mycanvas.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/packets/arppacket.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/packets/arppacket.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/packets/ippacket.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/src/packets/ippacket.h ___________________________________________________________________ Deleted: svn:executable - * 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: <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 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-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-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. |