|
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.
|