ostinato/common/mac.cpp

317 lines
8.8 KiB
C++
Raw Normal View History

/*
Copyright (C) 2010 Srivats P.
This file is part of "Ostinato"
This is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#include <qendian.h>
#include <QHostAddress>
#include "mac.h"
MacConfigForm::MacConfigForm(QWidget *parent)
: QWidget(parent)
{
QRegExp reMac("([0-9,a-f,A-F]{2,2}[:-]){5,5}[0-9,a-f,A-F]{2,2}");
setupUi(this);
leDstMac->setValidator(new QRegExpValidator(reMac, this));
leSrcMac->setValidator(new QRegExpValidator(reMac, this));
leDstMacCount->setValidator(new QIntValidator(1, MAX_MAC_ITER_COUNT, this));
leSrcMacCount->setValidator(new QIntValidator(1, MAX_MAC_ITER_COUNT, this));
}
Major rewrite of the protocol framework - changes not yet complete Common ------ - Change in OstProto - Individual protocols are now extensions of (new) message 'Protocol' instead of 'Stream' - Stream now contains a repeated Protocol which also determines the ordered set of currently selected protocols; StreamCore.frame_proto which was doing this earlier has been removed - Change in AbstractProtocol Interface - Parent changed to StreamBase - Corresponding change in constructor and factory func - createInstance() - new method protocolNumber() - returns unique id for each protocol - protoDataCopyInto/From() now copies into OstProto::Protocol instead of OstProto::Stream - Change in all subclasses of AbstractProtocol to match new interface - For all protocols, configFrom is no longer static, but each protocol has its own configForm - configForm creation is lazy - configForm is still a child of the protocol i.e. it will be destroyed alongwith the protocol - TODO: convert configWidget() to a pure factory function i.e. the protocol does not own the configForm - this requires us to pass the widget into load/storeConfigWidget() methods - ProtocolCollection class removed alongwith its .h and .cpp - ProtocolList class redefined to serve the purpose of ProtocolCollection - New class ProtocolListIterator defined to iterate ProtocolList - AbstractProtocol methods now use the ProtocolListIterator - Factory function createProtocol() added to ProtocolManager - OstProto::StreamCore accessor functions moved from Stream to StreamBase Server ------ - MyService uses the newly moved accessors to StreamBase for OstProto::StreamCore members - StreamInfo now uses the protocols to create the packet Client ------ - StreamConfigDialog now uses ProtocolListIterator - So does PacketModel
2009-08-02 09:52:34 -05:00
MacConfigForm::~MacConfigForm()
{
qDebug("In MacConfigForm destructor");
Major rewrite of the protocol framework - changes not yet complete Common ------ - Change in OstProto - Individual protocols are now extensions of (new) message 'Protocol' instead of 'Stream' - Stream now contains a repeated Protocol which also determines the ordered set of currently selected protocols; StreamCore.frame_proto which was doing this earlier has been removed - Change in AbstractProtocol Interface - Parent changed to StreamBase - Corresponding change in constructor and factory func - createInstance() - new method protocolNumber() - returns unique id for each protocol - protoDataCopyInto/From() now copies into OstProto::Protocol instead of OstProto::Stream - Change in all subclasses of AbstractProtocol to match new interface - For all protocols, configFrom is no longer static, but each protocol has its own configForm - configForm creation is lazy - configForm is still a child of the protocol i.e. it will be destroyed alongwith the protocol - TODO: convert configWidget() to a pure factory function i.e. the protocol does not own the configForm - this requires us to pass the widget into load/storeConfigWidget() methods - ProtocolCollection class removed alongwith its .h and .cpp - ProtocolList class redefined to serve the purpose of ProtocolCollection - New class ProtocolListIterator defined to iterate ProtocolList - AbstractProtocol methods now use the ProtocolListIterator - Factory function createProtocol() added to ProtocolManager - OstProto::StreamCore accessor functions moved from Stream to StreamBase Server ------ - MyService uses the newly moved accessors to StreamBase for OstProto::StreamCore members - StreamInfo now uses the protocols to create the packet Client ------ - StreamConfigDialog now uses ProtocolListIterator - So does PacketModel
2009-08-02 09:52:34 -05:00
}
void MacConfigForm::on_cmbDstMacMode_currentIndexChanged(int index)
{
if (index == OstProto::Mac::e_mm_fixed)
{
leDstMacCount->setEnabled(false);
leDstMacStep->setEnabled(false);
}
else
{
leDstMacCount->setEnabled(true);
leDstMacStep->setEnabled(true);
}
}
void MacConfigForm::on_cmbSrcMacMode_currentIndexChanged(int index)
{
if (index == OstProto::Mac::e_mm_fixed)
{
leSrcMacCount->setEnabled(false);
leSrcMacStep->setEnabled(false);
}
else
{
leSrcMacCount->setEnabled(true);
leSrcMacStep->setEnabled(true);
}
}
Protocol Framework related -------------------------- - AbstractProtocol Constructor and Factory function now take an optional (default NULL) "parent" abstract protocol in addition to the stream; this "parent" protocol is non-NULL for protocols which are aggregated in a ComboProtocol - All subclasses of AbstractProtocol modified as per the above interface change - ProtocolManager also modifed as per the above interface change - new data members in AbstractProtocol - prev, next; the AbstractProtocol implementation now uses these members to traverse protocols on the list instead of ProtocolListIterator; this change required for ComboProtocol - ProtocolListIterator updates these new members - prev/next on insert/remove/replace - ComboProtocol and ProtocolListIterator classes made friends of AbstractProtocol - ComboProtocol implemented as a template class (completed) - Dot2LLc implemented as a combo of Dot3Raw and LLC - Dot2Snap implemented as a combo of Dot2Llc and SNAP - VlanStack implemented as a combo of VLAN + VLAN - ProtocolManager now uses the ProtocolId enums rather than hardcoded values Stream Config Dialog -------------------- - "None" radio button added to all protocol levels - Protocol Level 1 added with 'mac' as the only valid protocol in the "simple" mode widget - With Dot2Llc, Dot2Snap and VlanStack implemented as "combo" protocols, the protocol choice radiobuttons in the "simple" mode are now 1:1 with a protocol; this has the following implications/advantages: - Updates of the "simple" mode widget from/to stream's protocolList is simpler; this code has now been rewritten to take advantage of 1:1 - This paves the way for exporting tunneled protocols 4over4, 4over6, 6over4 etc. in the "simple" mode - This should also (hopefully) require less changes when adding a new protocol; more work needs to be done to reach this goal Fixes ----- - Dot3Protocol now derives "length" correctly for VLAN tagged packets - StreamBase now uses the ProtocolListIterator to append the default protocols in a stream instead of directly manipulating ProtocolList; also in protoDataCopyFrom() Others (Client/Server) ---------------------- - Port Packet Capture implemented; "view capture" is pending (hack put in place now for testing)
2009-10-14 10:16:56 -05:00
MacProtocol::MacProtocol(StreamBase *stream, AbstractProtocol *parent)
: AbstractProtocol(stream, parent)
{
configForm = NULL;
}
MacProtocol::~MacProtocol()
{
delete configForm;
}
Protocol Framework related -------------------------- - AbstractProtocol Constructor and Factory function now take an optional (default NULL) "parent" abstract protocol in addition to the stream; this "parent" protocol is non-NULL for protocols which are aggregated in a ComboProtocol - All subclasses of AbstractProtocol modified as per the above interface change - ProtocolManager also modifed as per the above interface change - new data members in AbstractProtocol - prev, next; the AbstractProtocol implementation now uses these members to traverse protocols on the list instead of ProtocolListIterator; this change required for ComboProtocol - ProtocolListIterator updates these new members - prev/next on insert/remove/replace - ComboProtocol and ProtocolListIterator classes made friends of AbstractProtocol - ComboProtocol implemented as a template class (completed) - Dot2LLc implemented as a combo of Dot3Raw and LLC - Dot2Snap implemented as a combo of Dot2Llc and SNAP - VlanStack implemented as a combo of VLAN + VLAN - ProtocolManager now uses the ProtocolId enums rather than hardcoded values Stream Config Dialog -------------------- - "None" radio button added to all protocol levels - Protocol Level 1 added with 'mac' as the only valid protocol in the "simple" mode widget - With Dot2Llc, Dot2Snap and VlanStack implemented as "combo" protocols, the protocol choice radiobuttons in the "simple" mode are now 1:1 with a protocol; this has the following implications/advantages: - Updates of the "simple" mode widget from/to stream's protocolList is simpler; this code has now been rewritten to take advantage of 1:1 - This paves the way for exporting tunneled protocols 4over4, 4over6, 6over4 etc. in the "simple" mode - This should also (hopefully) require less changes when adding a new protocol; more work needs to be done to reach this goal Fixes ----- - Dot3Protocol now derives "length" correctly for VLAN tagged packets - StreamBase now uses the ProtocolListIterator to append the default protocols in a stream instead of directly manipulating ProtocolList; also in protoDataCopyFrom() Others (Client/Server) ---------------------- - Port Packet Capture implemented; "view capture" is pending (hack put in place now for testing)
2009-10-14 10:16:56 -05:00
AbstractProtocol* MacProtocol::createInstance(StreamBase *stream
, AbstractProtocol *parent)
{
return new MacProtocol(stream, parent);
}
Major rewrite of the protocol framework - changes not yet complete Common ------ - Change in OstProto - Individual protocols are now extensions of (new) message 'Protocol' instead of 'Stream' - Stream now contains a repeated Protocol which also determines the ordered set of currently selected protocols; StreamCore.frame_proto which was doing this earlier has been removed - Change in AbstractProtocol Interface - Parent changed to StreamBase - Corresponding change in constructor and factory func - createInstance() - new method protocolNumber() - returns unique id for each protocol - protoDataCopyInto/From() now copies into OstProto::Protocol instead of OstProto::Stream - Change in all subclasses of AbstractProtocol to match new interface - For all protocols, configFrom is no longer static, but each protocol has its own configForm - configForm creation is lazy - configForm is still a child of the protocol i.e. it will be destroyed alongwith the protocol - TODO: convert configWidget() to a pure factory function i.e. the protocol does not own the configForm - this requires us to pass the widget into load/storeConfigWidget() methods - ProtocolCollection class removed alongwith its .h and .cpp - ProtocolList class redefined to serve the purpose of ProtocolCollection - New class ProtocolListIterator defined to iterate ProtocolList - AbstractProtocol methods now use the ProtocolListIterator - Factory function createProtocol() added to ProtocolManager - OstProto::StreamCore accessor functions moved from Stream to StreamBase Server ------ - MyService uses the newly moved accessors to StreamBase for OstProto::StreamCore members - StreamInfo now uses the protocols to create the packet Client ------ - StreamConfigDialog now uses ProtocolListIterator - So does PacketModel
2009-08-02 09:52:34 -05:00
quint32 MacProtocol::protocolNumber() const
{
return OstProto::Protocol::kMacFieldNumber;
}
Major rewrite of the protocol framework - changes not yet complete Common ------ - Change in OstProto - Individual protocols are now extensions of (new) message 'Protocol' instead of 'Stream' - Stream now contains a repeated Protocol which also determines the ordered set of currently selected protocols; StreamCore.frame_proto which was doing this earlier has been removed - Change in AbstractProtocol Interface - Parent changed to StreamBase - Corresponding change in constructor and factory func - createInstance() - new method protocolNumber() - returns unique id for each protocol - protoDataCopyInto/From() now copies into OstProto::Protocol instead of OstProto::Stream - Change in all subclasses of AbstractProtocol to match new interface - For all protocols, configFrom is no longer static, but each protocol has its own configForm - configForm creation is lazy - configForm is still a child of the protocol i.e. it will be destroyed alongwith the protocol - TODO: convert configWidget() to a pure factory function i.e. the protocol does not own the configForm - this requires us to pass the widget into load/storeConfigWidget() methods - ProtocolCollection class removed alongwith its .h and .cpp - ProtocolList class redefined to serve the purpose of ProtocolCollection - New class ProtocolListIterator defined to iterate ProtocolList - AbstractProtocol methods now use the ProtocolListIterator - Factory function createProtocol() added to ProtocolManager - OstProto::StreamCore accessor functions moved from Stream to StreamBase Server ------ - MyService uses the newly moved accessors to StreamBase for OstProto::StreamCore members - StreamInfo now uses the protocols to create the packet Client ------ - StreamConfigDialog now uses ProtocolListIterator - So does PacketModel
2009-08-02 09:52:34 -05:00
void MacProtocol::protoDataCopyInto(OstProto::Protocol &protocol) const
{
protocol.MutableExtension(OstProto::mac)->CopyFrom(data);
protocol.mutable_protocol_id()->set_id(protocolNumber());
Major rewrite of the protocol framework - changes not yet complete Common ------ - Change in OstProto - Individual protocols are now extensions of (new) message 'Protocol' instead of 'Stream' - Stream now contains a repeated Protocol which also determines the ordered set of currently selected protocols; StreamCore.frame_proto which was doing this earlier has been removed - Change in AbstractProtocol Interface - Parent changed to StreamBase - Corresponding change in constructor and factory func - createInstance() - new method protocolNumber() - returns unique id for each protocol - protoDataCopyInto/From() now copies into OstProto::Protocol instead of OstProto::Stream - Change in all subclasses of AbstractProtocol to match new interface - For all protocols, configFrom is no longer static, but each protocol has its own configForm - configForm creation is lazy - configForm is still a child of the protocol i.e. it will be destroyed alongwith the protocol - TODO: convert configWidget() to a pure factory function i.e. the protocol does not own the configForm - this requires us to pass the widget into load/storeConfigWidget() methods - ProtocolCollection class removed alongwith its .h and .cpp - ProtocolList class redefined to serve the purpose of ProtocolCollection - New class ProtocolListIterator defined to iterate ProtocolList - AbstractProtocol methods now use the ProtocolListIterator - Factory function createProtocol() added to ProtocolManager - OstProto::StreamCore accessor functions moved from Stream to StreamBase Server ------ - MyService uses the newly moved accessors to StreamBase for OstProto::StreamCore members - StreamInfo now uses the protocols to create the packet Client ------ - StreamConfigDialog now uses ProtocolListIterator - So does PacketModel
2009-08-02 09:52:34 -05:00
}
void MacProtocol::protoDataCopyFrom(const OstProto::Protocol &protocol)
{
if (protocol.protocol_id().id() == protocolNumber() &&
protocol.HasExtension(OstProto::mac))
data.MergeFrom(protocol.GetExtension(OstProto::mac));
}
QString MacProtocol::name() const
{
return QString("Media Access Protocol");
}
QString MacProtocol::shortName() const
{
return QString("MAC");
}
int MacProtocol::fieldCount() const
{
return mac_fieldCount;
}
AbstractProtocol::FieldFlags MacProtocol::fieldFlags(int index) const
{
AbstractProtocol::FieldFlags flags;
flags = AbstractProtocol::fieldFlags(index);
switch (index)
{
case mac_dstAddr:
case mac_srcAddr:
break;
case mac_dstMacMode:
case mac_dstMacCount:
case mac_dstMacStep:
case mac_srcMacMode:
case mac_srcMacCount:
case mac_srcMacStep:
flags |= FieldIsMeta;
break;
}
return flags;
}
QVariant MacProtocol::fieldData(int index, FieldAttrib attrib,
int streamIndex) const
{
switch (index)
{
case mac_dstAddr:
{
int u;
quint64 dstMac = 0;
switch (data.dst_mac_mode())
{
case OstProto::Mac::e_mm_fixed:
dstMac = data.dst_mac();
break;
case OstProto::Mac::e_mm_inc:
u = (streamIndex % data.dst_mac_count()) *
data.dst_mac_step();
dstMac = data.dst_mac() + u;
break;
case OstProto::Mac::e_mm_dec:
u = (streamIndex % data.dst_mac_count()) *
data.dst_mac_step();
dstMac = data.dst_mac() - u;
break;
default:
qWarning("Unhandled dstMac_mode %d", data.dst_mac_mode());
}
switch(attrib)
{
case FieldName:
return QString("Desination");
case FieldValue:
return dstMac;
case FieldTextValue:
return uintToHexStr(dstMac, 6);
case FieldFrameValue:
{
QByteArray fv;
fv.resize(8);
qToBigEndian(dstMac, (uchar*) fv.data());
fv.remove(0, 2);
return fv;
}
default:
break;
}
break;
}
case mac_srcAddr:
{
int u;
quint64 srcMac = 0;
switch (data.src_mac_mode())
{
case OstProto::Mac::e_mm_fixed:
srcMac = data.src_mac();
break;
case OstProto::Mac::e_mm_inc:
u = (streamIndex % data.src_mac_count()) *
data.src_mac_step();
srcMac = data.src_mac() + u;
break;
case OstProto::Mac::e_mm_dec:
u = (streamIndex % data.src_mac_count()) *
data.src_mac_step();
srcMac = data.src_mac() - u;
break;
default:
qWarning("Unhandled srcMac_mode %d", data.src_mac_mode());
}
switch(attrib)
{
case FieldName:
return QString("Source");
case FieldValue:
return srcMac;
case FieldTextValue:
return uintToHexStr(srcMac, 6);
case FieldFrameValue:
{
QByteArray fv;
fv.resize(8);
qToBigEndian(srcMac, (uchar*) fv.data());
fv.remove(0, 2);
return fv;
}
default:
break;
}
break;
}
// Meta fields
case mac_dstMacMode:
case mac_dstMacCount:
case mac_dstMacStep:
case mac_srcMacMode:
case mac_srcMacCount:
case mac_srcMacStep:
default:
break;
}
return AbstractProtocol::fieldData(index, attrib, streamIndex);
}
bool MacProtocol::setFieldData(int /*index*/, const QVariant& /*value*/,
FieldAttrib /*attrib*/)
{
return false;
}
Refactoring, optimization et. al. --------------------------------- - StreamConfigDialog: Valid subsequent protocol choices for a particular protocol in the simple protocol selection widget is no longer hardcoded - ProtocolManager is queried for validitity of each pair of possible protocols; signal-slot connections are made accordingly. This refactoring makes it easier to add a protocol to the simple protocol selection widget - ProtocolManager: populates and maintains a database of valid 'neighbour protocols' and implements a method - isValidNeighbour() to query the same for a pair of protocols - AbstractProtocol: new method protocolIdType() introduced to build the above database (in conjunction with the existing method protocolId(ProtocolIdType)); default implementation returns ProtocolIdNone - Protocols which include a valid/supported ProtocolIdType (eth/llc/ip) reimplement protocolIdType() to return the apporpirate ProtocolIdType. These are viz. - combo - eth - llc - snap - ip - Speed optimization while populating streamqueues if the protocolFrameValue/Size() does not vary across packets - AbstractProtocol: new methods to support the above optimization - isProtocolFrameValueVariable() - isProtocolFrameSizeVariable() - isProtocolFramePayloadValueVariable() - isProtocolFramePayloadSizeVariable() (each of the default implementations returns false indicating that the protocol frame value or frame size is fixed and not variable) - Protocols which support variable values/size (list follows) reimplement the above methods appropriately - combo - mac - dot3 - ip4 - tcp - udp - payload - StreamInfo::makePacket() moved to base class as StreamBase::frameValue() - StreamBase: all 'get' accessor functions made 'const' - class ProtocolManager: while registering a protocol, no need to pass the protocol name; ProtocolManager finds it out internally by using the protocol's shortName() method Fixes ----- - Fixed issue with port capture not starting the first time 'start capture' was clicked
2009-11-13 10:00:57 -06:00
bool MacProtocol::isProtocolFrameValueVariable() const
{
if ((data.dst_mac_mode() != OstProto::Mac::e_mm_fixed) ||
(data.src_mac_mode() != OstProto::Mac::e_mm_fixed))
return true;
else
return false;
Refactoring, optimization et. al. --------------------------------- - StreamConfigDialog: Valid subsequent protocol choices for a particular protocol in the simple protocol selection widget is no longer hardcoded - ProtocolManager is queried for validitity of each pair of possible protocols; signal-slot connections are made accordingly. This refactoring makes it easier to add a protocol to the simple protocol selection widget - ProtocolManager: populates and maintains a database of valid 'neighbour protocols' and implements a method - isValidNeighbour() to query the same for a pair of protocols - AbstractProtocol: new method protocolIdType() introduced to build the above database (in conjunction with the existing method protocolId(ProtocolIdType)); default implementation returns ProtocolIdNone - Protocols which include a valid/supported ProtocolIdType (eth/llc/ip) reimplement protocolIdType() to return the apporpirate ProtocolIdType. These are viz. - combo - eth - llc - snap - ip - Speed optimization while populating streamqueues if the protocolFrameValue/Size() does not vary across packets - AbstractProtocol: new methods to support the above optimization - isProtocolFrameValueVariable() - isProtocolFrameSizeVariable() - isProtocolFramePayloadValueVariable() - isProtocolFramePayloadSizeVariable() (each of the default implementations returns false indicating that the protocol frame value or frame size is fixed and not variable) - Protocols which support variable values/size (list follows) reimplement the above methods appropriately - combo - mac - dot3 - ip4 - tcp - udp - payload - StreamInfo::makePacket() moved to base class as StreamBase::frameValue() - StreamBase: all 'get' accessor functions made 'const' - class ProtocolManager: while registering a protocol, no need to pass the protocol name; ProtocolManager finds it out internally by using the protocol's shortName() method Fixes ----- - Fixed issue with port capture not starting the first time 'start capture' was clicked
2009-11-13 10:00:57 -06:00
}
QWidget* MacProtocol::configWidget()
{
if (configForm == NULL)
{
configForm = new MacConfigForm;
loadConfigWidget();
}
return configForm;
}
void MacProtocol::loadConfigWidget()
{
configWidget();
Major rewrite of the protocol framework - changes not yet complete Common ------ - Change in OstProto - Individual protocols are now extensions of (new) message 'Protocol' instead of 'Stream' - Stream now contains a repeated Protocol which also determines the ordered set of currently selected protocols; StreamCore.frame_proto which was doing this earlier has been removed - Change in AbstractProtocol Interface - Parent changed to StreamBase - Corresponding change in constructor and factory func - createInstance() - new method protocolNumber() - returns unique id for each protocol - protoDataCopyInto/From() now copies into OstProto::Protocol instead of OstProto::Stream - Change in all subclasses of AbstractProtocol to match new interface - For all protocols, configFrom is no longer static, but each protocol has its own configForm - configForm creation is lazy - configForm is still a child of the protocol i.e. it will be destroyed alongwith the protocol - TODO: convert configWidget() to a pure factory function i.e. the protocol does not own the configForm - this requires us to pass the widget into load/storeConfigWidget() methods - ProtocolCollection class removed alongwith its .h and .cpp - ProtocolList class redefined to serve the purpose of ProtocolCollection - New class ProtocolListIterator defined to iterate ProtocolList - AbstractProtocol methods now use the ProtocolListIterator - Factory function createProtocol() added to ProtocolManager - OstProto::StreamCore accessor functions moved from Stream to StreamBase Server ------ - MyService uses the newly moved accessors to StreamBase for OstProto::StreamCore members - StreamInfo now uses the protocols to create the packet Client ------ - StreamConfigDialog now uses ProtocolListIterator - So does PacketModel
2009-08-02 09:52:34 -05:00
configForm->leDstMac->setText(uintToHexStr(data.dst_mac(), 6));
configForm->cmbDstMacMode->setCurrentIndex(data.dst_mac_mode());
configForm->leDstMacCount->setText(QString().setNum(data.dst_mac_count()));
configForm->leDstMacStep->setText(QString().setNum(data.dst_mac_step()));
configForm->leSrcMac->setText(uintToHexStr(data.src_mac(), 6));
configForm->cmbSrcMacMode->setCurrentIndex(data.src_mac_mode());
configForm->leSrcMacCount->setText(QString().setNum(data.src_mac_count()));
configForm->leSrcMacStep->setText(QString().setNum(data.src_mac_step()));
}
void MacProtocol::storeConfigWidget()
{
bool isOk;
configWidget();
data.set_dst_mac(configForm->leDstMac->text().remove(QChar(' ')).
toULongLong(&isOk, 16));
data.set_dst_mac_mode((OstProto::Mac::MacAddrMode) configForm->
cmbDstMacMode->currentIndex());
data.set_dst_mac_count(configForm->leDstMacCount->text().toULong(&isOk));
data.set_dst_mac_step(configForm->leDstMacStep->text().toULong(&isOk));
data.set_src_mac(configForm->leSrcMac->text().remove(QChar(' ')).
toULongLong(&isOk, 16));
data.set_src_mac_mode((OstProto::Mac::MacAddrMode) configForm->
cmbSrcMacMode->currentIndex());
data.set_src_mac_count(configForm->leSrcMacCount->text().toULong(&isOk));
data.set_src_mac_step(configForm->leSrcMacStep->text().toULong(&isOk));
}