Protocols

---------
	- all protocols on allocation of a configWidget, also populate it before returning from configWidget()
	- VLAN TPID override is now correctly saved and restored from/to its widget (vlan.cpp)
	- Payload protocol returns a minimum frame value of 1 byte size (Hack to avoid crash in stream config dialog when sum of all protocol frame sizes is greater than the frame length
	- small layout changes in mac widget (mac.ui)
	- src/dst ip mask changed from 255.255.255.255 to 255.255.255.0 (ip4.proto)
	- src mac changed from u32 to u64 (mac.proto)
	- "Combo Protocol" protocol container introduced to define newer protocols as a combination of existing protocols e.g. dot2 = dot3 + llc - THIS IS NOT YET COMPLETE (comboprotocol.h)


Client/StreamConfigDialog
-------------------------
	- Advanced Protocol Selection implemented
	- Simple Protocol Selection rewritten to work alongside Advanced
	- Payload Widget is treated like any other protocol - hence it is not placedinto the dialog specially
	- Any protocol selection change (in Simple/Advanced mode) immediately triggers change in the Stream's protocolList
	- Protocol Widgets now are arranged in a toolBox on a top level tab of the dialog instead of a nested tabWidget
	- Vlan selection (Simple Mode) uses Radio buttons instead of checkboxes
	- Double Tagged (SVlan + CVlan) now works via Simple Mode
This commit is contained in:
Srivats P. 2009-09-23 14:53:26 +00:00
parent 1357f495ac
commit 4c2df3c5a7
24 changed files with 1782 additions and 1068 deletions

BIN
client/icons/arrow_down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

BIN
client/icons/arrow_up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

BIN
client/icons/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

View File

@ -1,5 +1,8 @@
<RCC>
<qresource prefix="/" >
<file>icons/arrow_down.png</file>
<file>icons/arrow_right.png</file>
<file>icons/arrow_up.png</file>
<file>icons/bullet_error.png</file>
<file>icons/bullet_green.png</file>
<file>icons/bullet_orange.png</file>
@ -7,6 +10,7 @@
<file>icons/bullet_yellow.png</file>
<file>icons/control_play.png</file>
<file>icons/control_stop.png</file>
<file>icons/delete.png</file>
<file>icons/magnifier.png</file>
<file>icons/portgroup_add.png</file>
<file>icons/portgroup_connect.png</file>

File diff suppressed because it is too large Load Diff

View File

@ -29,10 +29,13 @@ public:
private:
QButtonGroup *bgFrameType;
QButtonGroup *bgVlan;
QButtonGroup *bgL3Proto;
QButtonGroup *bgL4Proto;
QButtonGroup *bgPayloadProto;
QStringListModel *mpAvailableProtocolsModel;
QStringListModel *mpSelectedProtocolsModel;
Port& mPort;
uint mCurrentStreamIndex;
@ -40,6 +43,8 @@ private:
Stream *mpStream;
ProtocolListIterator *_iter;
bool isUpdateInProgress;
PacketModel *mpPacketModel;
ModelTest *mpPacketModelTester;
@ -47,7 +52,6 @@ private:
// for the various tab widgets so that it can be restored when the dialog
// is opened the next time
static int lastTopLevelTabIndex;
static int lastProtoTabIndex;
void setupUiExtra();
void updateSelectedProtocols();
@ -56,15 +60,37 @@ private:
private slots:
void on_cmbPktLenMode_currentIndexChanged(QString mode);
void on_pbPrev_clicked();
void on_pbNext_clicked();
void updateContents();
void update_NumPacketsAndNumBursts();
void on_twTopLevel_currentChanged(int index);
void on_twProto_currentChanged(int index);
void on_tbSelectProtocols_currentChanged(int index);
void update_NumPacketsAndNumBursts();
// "Simple" Protocol Selection related
bool skipProtocols(int layer);
void updateFrameTypeProtocol(int id);
void updateVlanProtocol(int id);
void updateL3Protocol(int id);
void updateL4Protocol(int id);
void updatePayloadProtocol(int id);
void updateSelectProtocolsSimpleWidget();
// "Advanced" Protocol Selection related
void when_lvAllProtocols_selectionChanged(
const QItemSelection &selected, const QItemSelection &deselected);
void when_lvSelectedProtocols_currentChanged(
const QModelIndex &current, const QModelIndex &previous);
void on_tbAdd_clicked();
void on_tbDelete_clicked();
void on_tbUp_clicked();
void on_tbDown_clicked();
void updateSelectProtocolsAdvancedWidget();
void on_pbPrev_clicked();
void on_pbNext_clicked();
void on_pbOk_clicked();
};

View File

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>636</width>
<height>589</height>
<width>524</width>
<height>458</height>
</rect>
</property>
<property name="sizePolicy" >
@ -35,8 +35,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="modal" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QTabWidget" name="twTopLevel" >
<property name="toolTip" >
<string/>
@ -46,7 +46,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</property>
<widget class="QWidget" name="packetConfigTab" >
<attribute name="title" >
<string>Packet Config</string>
<string>Protocol Selection</string>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
@ -56,7 +56,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</property>
<property name="sizeHint" >
<size>
<width>171</width>
<width>241</width>
<height>20</height>
</size>
</property>
@ -164,34 +164,40 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QTabWidget" name="twProto" >
<widget class="QToolBox" name="tbSelectProtocols" >
<property name="currentIndex" >
<number>4</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_7" >
<attribute name="title" >
<string>Protocols</string>
<widget class="QWidget" name="page" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>465</width>
<height>226</height>
</rect>
</property>
<attribute name="label" >
<string>Simple</string>
</attribute>
<layout class="QHBoxLayout" >
<item>
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" >
<item rowspan="2" row="0" column="0" >
<widget class="QGroupBox" name="gbFrameType" >
<property name="title" >
<string>Frame Type</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QVBoxLayout" >
<item>
<widget class="QRadioButton" name="rbFtNone" >
<property name="text" >
<string>None</string>
<string>None (Mac Only)</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<item>
<widget class="QRadioButton" name="rbFtEthernet2" >
<property name="text" >
<string>Ethernet II</string>
@ -201,14 +207,14 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</property>
</widget>
</item>
<item row="1" column="1" >
<item>
<widget class="QRadioButton" name="rbFt802Dot3Raw" >
<property name="text" >
<string>802.3 Raw</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<item>
<widget class="QRadioButton" name="rbFt802Dot3Llc" >
<property name="text" >
<string>802.3 LLC</string>
@ -218,17 +224,27 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</property>
</widget>
</item>
<item row="2" column="1" >
<item>
<widget class="QRadioButton" name="rbFtLlcSnap" >
<property name="text" >
<string>LLC SNAP</string>
<string>802.3 LLC SNAP</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbFtOther" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Other</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<item row="0" column="1" >
<widget class="QGroupBox" name="gbVlan" >
<property name="enabled" >
<bool>true</bool>
@ -242,31 +258,35 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="checked" >
<bool>false</bool>
</property>
<layout class="QHBoxLayout" >
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="cbCVlan" >
<property name="enabled" >
<bool>true</bool>
</property>
<widget class="QRadioButton" name="rbVlanNone" >
<property name="text" >
<string>CVLAN</string>
<string>None</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbSVlan" >
<property name="enabled" >
<bool>true</bool>
</property>
<widget class="QRadioButton" name="rbVlanSingle" >
<property name="text" >
<string>SVLAN</string>
<string>Single Tag</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbVlanDouble" >
<property name="text" >
<string>Double Tag</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<item row="0" column="2" colspan="2" >
<widget class="QGroupBox" name="gbL3Proto" >
<property name="title" >
<string>L3</string>
@ -328,7 +348,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</layout>
</widget>
</item>
<item>
<item row="1" column="1" colspan="2" >
<widget class="QGroupBox" name="gbL4Proto" >
<property name="title" >
<string>L4</string>
@ -397,34 +417,62 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</layout>
</widget>
</item>
<item row="1" column="3" >
<widget class="QGroupBox" name="gbPayloadProto" >
<property name="title" >
<string>Payload</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QRadioButton" name="rbPayloadPattern" >
<property name="text" >
<string>Pattern</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbPayloadOther" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Other</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>182</width>
<height>16</height>
<width>107</width>
<height>24</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Advanced Protocol Selection</string>
</widget>
<widget class="QWidget" name="page_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>250</width>
<height>135</height>
</rect>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
<property name="checked" >
<bool>false</bool>
</property>
<layout class="QHBoxLayout" >
<item>
<attribute name="label" >
<string>Advanced</string>
</attribute>
<layout class="QHBoxLayout" >
<item>
<layout class="QVBoxLayout" >
@ -436,7 +484,17 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</widget>
</item>
<item>
<widget class="QListView" name="lvAllProtocols" />
<widget class="QListView" name="lvAllProtocols" >
<property name="dragEnabled" >
<bool>true</bool>
</property>
<property name="selectionMode" >
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
</layout>
</item>
@ -456,16 +514,15 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton" >
<widget class="QToolButton" name="tbAdd" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>></string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_2" >
<property name="text" >
<string>&lt;</string>
<property name="icon" >
<iconset resource="ostinato.qrc" >:/icons/arrow_right.png</iconset>
</property>
</widget>
</item>
@ -494,35 +551,77 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</widget>
</item>
<item>
<widget class="QListView" name="lvSelectedProtocols" />
</item>
</layout>
<layout class="QHBoxLayout" >
<item>
<widget class="QToolButton" name="tbUp" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>^</string>
</property>
<property name="icon" >
<iconset resource="ostinato.qrc" >:/icons/arrow_up.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbDown" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>v</string>
</property>
<property name="icon" >
<iconset resource="ostinato.qrc" >:/icons/arrow_down.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbDelete" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>-</string>
</property>
<property name="icon" >
<iconset resource="ostinato.qrc" >:/icons/delete.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QListView" name="lvSelectedProtocols" >
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4" >
<attribute name="title" >
<string>L2</string>
</attribute>
<layout class="QGridLayout" />
</widget>
<widget class="QWidget" name="tab_8" >
<attribute name="title" >
<string>L3</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_6" >
<attribute name="title" >
<string>L4</string>
</attribute>
<layout class="QHBoxLayout" />
</widget>
<widget class="QWidget" name="tab" >
<widget class="QWidget" name="tab_2" >
<attribute name="title" >
<string>Protocol Data</string>
</attribute>
@ -536,10 +635,6 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="streamControlTab" >
<attribute name="title" >
<string>Stream Control</string>
@ -925,7 +1020,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</widget>
</widget>
</item>
<item>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="pbPrev" >
@ -989,7 +1084,55 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<tabstop>lePktLen</tabstop>
<tabstop>lePktLenMin</tabstop>
<tabstop>lePktLenMax</tabstop>
<tabstop>twProto</tabstop>
<tabstop>rbFtNone</tabstop>
<tabstop>rbFtEthernet2</tabstop>
<tabstop>rbFt802Dot3Raw</tabstop>
<tabstop>rbFt802Dot3Llc</tabstop>
<tabstop>rbFtLlcSnap</tabstop>
<tabstop>rbFtOther</tabstop>
<tabstop>rbVlanNone</tabstop>
<tabstop>rbVlanSingle</tabstop>
<tabstop>rbVlanDouble</tabstop>
<tabstop>rbL3None</tabstop>
<tabstop>rbL3Ipv4</tabstop>
<tabstop>rbL3Ipv6</tabstop>
<tabstop>rbL3Arp</tabstop>
<tabstop>rbL3Other</tabstop>
<tabstop>rbL4None</tabstop>
<tabstop>rbL4Icmp</tabstop>
<tabstop>rbL4Igmp</tabstop>
<tabstop>rbL4Tcp</tabstop>
<tabstop>rbL4Udp</tabstop>
<tabstop>rbL4Other</tabstop>
<tabstop>rbPayloadPattern</tabstop>
<tabstop>rbPayloadOther</tabstop>
<tabstop>pbPrev</tabstop>
<tabstop>pbNext</tabstop>
<tabstop>pbOk</tabstop>
<tabstop>pbCancel</tabstop>
<tabstop>rbSendBursts</tabstop>
<tabstop>leNumPackets</tabstop>
<tabstop>leNumBursts</tabstop>
<tabstop>lePacketsPerBurst</tabstop>
<tabstop>rbActionStop</tabstop>
<tabstop>rbActionGotoNext</tabstop>
<tabstop>rbActionGotoStream</tabstop>
<tabstop>leStreamId</tabstop>
<tabstop>rbModeFixed</tabstop>
<tabstop>rbModeContinuous</tabstop>
<tabstop>lePacketsPerSec</tabstop>
<tabstop>leBurstsPerSec</tabstop>
<tabstop>leGapIsg</tabstop>
<tabstop>leGapIpg</tabstop>
<tabstop>leGapIbg</tabstop>
<tabstop>tvPacketTree</tabstop>
<tabstop>tbDown</tabstop>
<tabstop>tbDelete</tabstop>
<tabstop>lvSelectedProtocols</tabstop>
<tabstop>rbSendPackets</tabstop>
<tabstop>tbUp</tabstop>
<tabstop>lvAllProtocols</tabstop>
<tabstop>tbAdd</tabstop>
</tabstops>
<resources>
<include location="ostinato.qrc" />

133
common/comboprotocol.h Normal file
View File

@ -0,0 +1,133 @@
#ifndef _COMBO_PROTOCOL_H
#define _COMBO_PROTOCOL_H
#include "abstractprotocol.h"
template <class ProtoA, class ProtoB>
class ComboProtocol : public AbstractProtocol
{
private:
ProtoA *protoA;
ProtoB *protoB;
QWidget *configForm;
public:
ComboProtocol(StreamBase *stream)
{
protoA = new ProtoA(stream);
protoB = new ProtoB(stream);
configForm = NULL;
}
virtual ~ComboProtocol()
{
delete protoA;
delete protoB;
delete configForm;
}
static ComboProtocol* createInstance(StreamBase *stream)
{
return new ComboProtocol<ProtoA, ProtoB>(stream);
}
virtual quint32 protocolNumber() const
{
return 0; //FIXME
}
virtual void protoDataCopyInto(OstProto::Protocol &protocol) const
{
// FIXME
}
virtual void protoDataCopyFrom(const OstProto::Protocol &protocol)
{
// FIXME
}
virtual QString name() const
{
return protoA->name() + "/" + protoB->name();
}
virtual QString shortName() const
{
return protoA->shortName() + "/" + protoB->shortName();
}
virtual quint32 protocolId(ProtocolIdType type) const
{
return protoA->protocolId(type);
}
//quint32 payloadProtocolId(ProtocolIdType type) const;
virtual int fieldCount() const
{
return protoA->fieldCount() + protoB->fieldCount();
}
//virtual int metaFieldCount() const;
//int frameFieldCount() const;
virtual FieldFlags fieldFlags(int index) const
{
if (index < protoA->fieldCount())
return protoA->fieldFlags(index);
else
return protoB->fieldFlags(index);
}
virtual QVariant fieldData(int index, FieldAttrib attrib,
int streamIndex = 0) const
{
if (index < protoA->fieldCount())
return protoA->fieldData(index);
else
return protoB->fieldData(index);
}
virtual bool setFieldData(int index, const QVariant &value,
FieldAttrib attrib = FieldValue)
{
if (index < protoA->fieldCount())
return protoA->fieldData(index);
else
return protoB->fieldData(index);
}
#if 0
QByteArray protocolFrameValue(int streamIndex = 0,
bool forCksum = false) const;
virtual int protocolFrameSize() const;
int protocolFrameOffset() const;
int protocolFramePayloadSize() const;
virtual quint32 protocolFrameCksum(int streamIndex = 0,
CksumType cksumType = CksumIp) const;
quint32 protocolFrameHeaderCksum(int streamIndex = 0,
CksumType cksumType = CksumIp) const;
quint32 protocolFramePayloadCksum(int streamIndex = 0,
CksumType cksumType = CksumIp) const;
#endif
virtual QWidget* configWidget()
{
if (configForm == NULL)
{
QVBoxLayout *layout = new VBoxLayout;
configForm = new QWidget;
layout->addWidget(protoA->configWidget());
layout->addWidget(protoB->configWidget());
configForm->setLayout(layout);
}
return configForm;
}
virtual void loadConfigWidget()
{
protoA->loadConfigWidget();
protoB->loadConfigWidget();
}
virtual void storeConfigWidget()
{
protoA->storeConfigWidget();
protoB->storeConfigWidget();
}
};
#endif

View File

@ -118,7 +118,10 @@ bool Dot3Protocol::setFieldData(int index, const QVariant &value,
QWidget* Dot3Protocol::configWidget()
{
if (configForm == NULL)
{
configForm = new Dot3ConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -121,7 +121,10 @@ bool Eth2Protocol::setFieldData(int index, const QVariant &value,
QWidget* Eth2Protocol::configWidget()
{
if (configForm == NULL)
{
configForm = new Eth2ConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -604,7 +604,10 @@ quint32 Ip4Protocol::protocolFrameCksum(int streamIndex,
QWidget* Ip4Protocol::configWidget()
{
if (configForm == NULL)
{
configForm = new Ip4ConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -31,13 +31,13 @@ message Ip4 {
optional fixed32 src_ip = 14;
optional IpAddrMode src_ip_mode = 15 [default = e_im_fixed];
optional uint32 src_ip_count = 16 [default = 16];
optional fixed32 src_ip_mask = 17 [default = 0xFFFFFFFF];
optional fixed32 src_ip_mask = 17 [default = 0xFFFFFF00];
// Destination IP
optional fixed32 dst_ip = 18;
optional IpAddrMode dst_ip_mode = 19 [default = e_im_fixed];
optional uint32 dst_ip_count = 20 [default = 16];
optional fixed32 dst_ip_mask = 21 [default = 0xFFFFFFFF];
optional fixed32 dst_ip_mask = 21 [default = 0xFFFFFF00];
// TODO: Options
}

View File

@ -135,7 +135,10 @@ bool LlcProtocol::setFieldData(int index, const QVariant &value,
QWidget* LlcProtocol::configWidget()
{
if (configForm == NULL)
{
configForm = new LlcConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -243,7 +243,10 @@ bool MacProtocol::setFieldData(int index, const QVariant &value,
QWidget* MacProtocol::configWidget()
{
if (configForm == NULL)
{
configForm = new MacConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -18,7 +18,7 @@ message Mac {
optional uint32 dst_mac_step = 4 [default = 1];
// Src Mac
optional uint32 src_mac = 5;
optional uint64 src_mac = 5;
optional MacAddrMode src_mac_mode = 6 [default = e_mm_fixed];
optional uint32 src_mac_count = 7 [default = 16];
optional uint32 src_mac_step = 8 [default = 1];

View File

@ -5,28 +5,50 @@
<rect>
<x>0</x>
<y>0</y>
<width>512</width>
<height>104</height>
<width>391</width>
<height>116</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>MAC</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<item row="0" column="1" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Address</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Mode</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Count</string>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Step</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Destination</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<item row="1" column="1" >
<widget class="QLineEdit" name="leDstMac" >
<property name="minimumSize" >
<size>
@ -42,14 +64,7 @@
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Mode</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<item row="1" column="2" >
<widget class="QComboBox" name="cmbDstMacMode" >
<item>
<property name="text" >
@ -68,14 +83,7 @@
</item>
</widget>
</item>
<item row="0" column="4" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Count</string>
</property>
</widget>
</item>
<item row="0" column="5" >
<item row="1" column="3" >
<widget class="QLineEdit" name="leDstMacCount" >
<property name="enabled" >
<bool>false</bool>
@ -88,14 +96,7 @@
</property>
</widget>
</item>
<item row="0" column="6" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Step</string>
</property>
</widget>
</item>
<item row="0" column="7" >
<item row="1" column="4" >
<widget class="QLineEdit" name="leDstMacStep" >
<property name="enabled" >
<bool>false</bool>
@ -108,14 +109,14 @@
</property>
</widget>
</item>
<item row="1" column="0" >
<item row="2" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Source</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<item row="2" column="1" >
<widget class="QLineEdit" name="leSrcMac" >
<property name="inputMask" >
<string>>HH HH HH HH HH HH; </string>
@ -125,14 +126,7 @@
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Mode</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<item row="2" column="2" >
<widget class="QComboBox" name="cmbSrcMacMode" >
<item>
<property name="text" >
@ -151,14 +145,7 @@
</item>
</widget>
</item>
<item row="1" column="4" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>Count</string>
</property>
</widget>
</item>
<item row="1" column="5" >
<item row="2" column="3" >
<widget class="QLineEdit" name="leSrcMacCount" >
<property name="enabled" >
<bool>false</bool>
@ -168,14 +155,7 @@
</property>
</widget>
</item>
<item row="1" column="6" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Step</string>
</property>
</widget>
</item>
<item row="1" column="7" >
<item row="2" column="4" >
<widget class="QLineEdit" name="leSrcMacStep" >
<property name="enabled" >
<bool>false</bool>
@ -188,10 +168,7 @@
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>

View File

@ -28,6 +28,7 @@ PROTOS += \
udp.proto
HEADERS += \
abstractprotocol.h \
comboprotocol.h \
protocolmanager.h \
protocollist.h \
protocollistiterator.h \

View File

@ -126,6 +126,11 @@ QVariant PayloadProtocol::fieldData(int index, FieldAttrib attrib,
dataLen = mpStream->frameLen() - protocolFrameOffset();
dataLen -= SZ_FCS;
// FIXME: Hack! Bad! Bad! Very Bad!!!
if (dataLen <= 0)
dataLen = 1;
fv.resize(dataLen+4);
switch(data.pattern_mode())
{
@ -180,7 +185,10 @@ bool PayloadProtocol::setFieldData(int index, const QVariant &value,
QWidget* PayloadProtocol::configWidget()
{
if (configForm == NULL)
{
configForm = new PayloadConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -155,7 +155,10 @@ bool SampleProtocol::setFieldData(int index, const QVariant &value,
QWidget* SampleProtocol::configWidget()
{
if (configForm == NULL)
configFrom = new SampleConfigForm;
{
configForm = new SampleConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -140,7 +140,10 @@ bool SnapProtocol::setFieldData(int index, const QVariant &value,
QWidget* SnapProtocol::configWidget()
{
if (configForm == NULL)
{
configForm = new SnapConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -384,7 +384,10 @@ bool TcpProtocol::setFieldData(int index, const QVariant &value,
QWidget* TcpProtocol::configWidget()
{
if (configForm == NULL)
{
configForm = new TcpConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -261,7 +261,10 @@ bool UdpProtocol::setFieldData(int index, const QVariant &value,
QWidget* UdpProtocol::configWidget()
{
if (configForm == NULL)
{
configForm = new UdpConfigForm;
loadConfigWidget();
}
return configForm;
}

View File

@ -203,7 +203,10 @@ bool VlanProtocol::setFieldData(int index, const QVariant &value,
QWidget* VlanProtocol::configWidget()
{
if (configForm == NULL)
{
configForm = new VlanConfigForm;
loadConfigWidget();
}
return configForm;
}
@ -211,6 +214,7 @@ void VlanProtocol::loadConfigWidget()
{
configWidget();
configForm->cbTpidOverride->setChecked(data.is_override_tpid());
configForm->leTpid->setText(uintToHexStr(fieldData(vlan_tpid, FieldValue).toUInt(), 2));
configForm->cmbPrio->setCurrentIndex(fieldData(vlan_prio, FieldValue).toUInt());
configForm->cmbCfiDei->setCurrentIndex(fieldData(vlan_cfiDei, FieldValue).toUInt());