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