- AbstractProtocol
- new method: fieldFlags() - isCksum, isMeta; Note: isMeta is a flag now not a attrib - fieldData() bit fields are now in lsb not msb - protocolFrameValue() and subclasses changed accordingly - protocolFrameValue() now takes an additional bool param indicating whether the frameValue is being requested for a checksum calculation; if so fields which are checksum fields are assumed to be zero and their value is not fetched to prevent infinite recursion - Other Protocols - mac: srcMac/dstMac modes is now working - vlan: implemented VLAN protocol - ip4: src/dst Addr modes is now working - udp/tcp: checksum done - Basic testing done for MAC, VLAN, IPv4, UDP and TCP protocols - sample protocol: .cpp/.h added to repos - need to be made compilable - StreamConfigDialog - Redesigned the protocol selection tab to accomodate "Advanced Protocol Selection" - L2 Tab config widgets are now in 2 columns - Packet Tree View is no longer collapsed if selected protocols don't change
This commit is contained in:
parent
2ec7fb30c2
commit
0103696016
@ -10,8 +10,11 @@ PacketModel::PacketModel(const QList<AbstractProtocol*> &selectedProtocols,
|
|||||||
void PacketModel::setSelectedProtocols(
|
void PacketModel::setSelectedProtocols(
|
||||||
const QList<AbstractProtocol*> &selectedProtocols)
|
const QList<AbstractProtocol*> &selectedProtocols)
|
||||||
{
|
{
|
||||||
mSelectedProtocols = selectedProtocols;
|
if (mSelectedProtocols != selectedProtocols)
|
||||||
reset();
|
{
|
||||||
|
mSelectedProtocols = selectedProtocols;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int PacketModel::rowCount(const QModelIndex &parent) const
|
int PacketModel::rowCount(const QModelIndex &parent) const
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame" >
|
<widget class="QFrame" name="frame" >
|
||||||
<property name="frameShape" >
|
<property name="frameShape" >
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::Panel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow" >
|
<property name="frameShadow" >
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
|
@ -19,14 +19,24 @@ StreamConfigDialog::StreamConfigDialog(Port &port, uint streamIndex,
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
setupUiExtra();
|
setupUiExtra();
|
||||||
|
|
||||||
connect(bgFrameType, SIGNAL(buttonClicked(int)),
|
connect(bgFrameType, SIGNAL(buttonClicked(int)),
|
||||||
this, SLOT(updateSelectedProtocols()));
|
this, SLOT(updateContents()));
|
||||||
connect(bgL3Proto, SIGNAL(buttonClicked(int)),
|
connect(bgL3Proto, SIGNAL(buttonClicked(int)),
|
||||||
this, SLOT(updateSelectedProtocols()));
|
this, SLOT(updateContents()));
|
||||||
connect(bgL4Proto, SIGNAL(buttonClicked(int)),
|
connect(bgL4Proto, SIGNAL(buttonClicked(int)),
|
||||||
this, SLOT(updateSelectedProtocols()));
|
this, SLOT(updateContents()));
|
||||||
|
|
||||||
|
//! \todo causes a crash!
|
||||||
|
#if 0
|
||||||
|
connect(lePktLen, SIGNAL(textEdited(QString)),
|
||||||
|
this, SLOT(updateContents()));
|
||||||
|
#endif
|
||||||
|
|
||||||
// Time to play match the signals and slots!
|
// Time to play match the signals and slots!
|
||||||
|
|
||||||
|
// Enable VLAN Choices only if FT = Eth2 or SNAP
|
||||||
|
connect(rbFtNone, SIGNAL(toggled(bool)), gbVlan, SLOT(setDisabled(bool)));
|
||||||
|
|
||||||
connect(rbFtNone, SIGNAL(toggled(bool)), rbL3None, SLOT(setChecked(bool)));
|
connect(rbFtNone, SIGNAL(toggled(bool)), rbL3None, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
// Enable/Disable L3 Protocol Choices for FT None
|
// Enable/Disable L3 Protocol Choices for FT None
|
||||||
@ -96,8 +106,11 @@ StreamConfigDialog::StreamConfigDialog(Port &port, uint streamIndex,
|
|||||||
vwPacketDump->setSelectionModel(tvPacketTree->selectionModel());
|
vwPacketDump->setSelectionModel(tvPacketTree->selectionModel());
|
||||||
|
|
||||||
// TODO(MED):
|
// TODO(MED):
|
||||||
//! \todo Implement then enable these protocols
|
|
||||||
|
//! \todo Implement then enable these protocols - SVLAN, ARP, ICMP, IGMP
|
||||||
|
cbSVlan->setHidden(true);
|
||||||
rbL3Arp->setHidden(true);
|
rbL3Arp->setHidden(true);
|
||||||
|
rbL3Ipv6->setHidden(true);
|
||||||
rbL4Icmp->setHidden(true);
|
rbL4Icmp->setHidden(true);
|
||||||
rbL4Igmp->setHidden(true);
|
rbL4Igmp->setHidden(true);
|
||||||
//! \todo Enable navigation of streams
|
//! \todo Enable navigation of streams
|
||||||
@ -132,6 +145,8 @@ void StreamConfigDialog::setupUiExtra()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---- Setup default stuff that cannot be done in designer ----
|
// ---- Setup default stuff that cannot be done in designer ----
|
||||||
|
gbVlan->setDisabled(true);
|
||||||
|
|
||||||
bgFrameType = new QButtonGroup();
|
bgFrameType = new QButtonGroup();
|
||||||
foreach(QRadioButton *btn, gbFrameType->findChildren<QRadioButton*>())
|
foreach(QRadioButton *btn, gbFrameType->findChildren<QRadioButton*>())
|
||||||
bgFrameType->addButton(btn);
|
bgFrameType->addButton(btn);
|
||||||
@ -151,7 +166,8 @@ void StreamConfigDialog::setupUiExtra()
|
|||||||
** Setup Validators
|
** Setup Validators
|
||||||
*/
|
*/
|
||||||
// Meta Data
|
// Meta Data
|
||||||
lePktLen->setValidator(new QIntValidator(MIN_PKT_LEN, MAX_PKT_LEN, this));
|
//! \todo - doesn't seem to work - range validator needs a spinbox?
|
||||||
|
//lePktLen->setValidator(new QIntValidator(MIN_PKT_LEN, MAX_PKT_LEN, this));
|
||||||
|
|
||||||
// L2 Ethernet
|
// L2 Ethernet
|
||||||
#if 0 // Proto FW
|
#if 0 // Proto FW
|
||||||
@ -228,6 +244,9 @@ void StreamConfigDialog::updateSelectedProtocols()
|
|||||||
// Mac
|
// Mac
|
||||||
mSelectedProtocols.append(51);
|
mSelectedProtocols.append(51);
|
||||||
|
|
||||||
|
if (cbCVlan->isEnabled() && cbCVlan->isChecked())
|
||||||
|
mSelectedProtocols.append(126);
|
||||||
|
|
||||||
if (rbFtEthernet2->isChecked())
|
if (rbFtEthernet2->isChecked())
|
||||||
mSelectedProtocols.append(121);
|
mSelectedProtocols.append(121);
|
||||||
else if (rbFt802Dot3Raw->isChecked())
|
else if (rbFt802Dot3Raw->isChecked())
|
||||||
@ -260,12 +279,13 @@ void StreamConfigDialog::updateSelectedProtocols()
|
|||||||
|
|
||||||
// Payload
|
// Payload
|
||||||
mSelectedProtocols.append(52);
|
mSelectedProtocols.append(52);
|
||||||
|
|
||||||
mpStream->setFrameProtocol(mSelectedProtocols);
|
|
||||||
mpStream->storeProtocolWidgets();
|
|
||||||
mpStream->loadProtocolWidgets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StreamConfigDialog::updateContents()
|
||||||
|
{
|
||||||
|
StoreCurrentStream();
|
||||||
|
LoadCurrentStream();
|
||||||
|
}
|
||||||
|
|
||||||
void StreamConfigDialog::on_cmbPktLenMode_currentIndexChanged(QString mode)
|
void StreamConfigDialog::on_cmbPktLenMode_currentIndexChanged(QString mode)
|
||||||
{
|
{
|
||||||
@ -331,13 +351,12 @@ void StreamConfigDialog::on_twTopLevel_currentChanged(int index)
|
|||||||
if (index != 2)
|
if (index != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateSelectedProtocols();
|
updateContents();
|
||||||
foreach(int i, mSelectedProtocols)
|
foreach(int i, mSelectedProtocols)
|
||||||
if (mpStream->protocol(i))
|
if (mpStream->protocol(i))
|
||||||
protoList.append(mpStream->protocol(i));
|
protoList.append(mpStream->protocol(i));
|
||||||
|
|
||||||
mpPacketModel->setSelectedProtocols(protoList);
|
mpPacketModel->setSelectedProtocols(protoList);
|
||||||
StoreCurrentStream(mpStream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamConfigDialog::on_twProto_currentChanged(int index)
|
void StreamConfigDialog::on_twProto_currentChanged(int index)
|
||||||
@ -368,6 +387,8 @@ void StreamConfigDialog::on_twProto_currentChanged(int index)
|
|||||||
{
|
{
|
||||||
case 1: // L2
|
case 1: // L2
|
||||||
wl.append(mpStream->protocol("mac")->configWidget());
|
wl.append(mpStream->protocol("mac")->configWidget());
|
||||||
|
if (cbCVlan->isEnabled() && cbCVlan->isChecked())
|
||||||
|
wl.append(mpStream->protocol("vlan")->configWidget());
|
||||||
if (rbFtEthernet2->isChecked())
|
if (rbFtEthernet2->isChecked())
|
||||||
wl.append(mpStream->protocol("eth2")->configWidget());
|
wl.append(mpStream->protocol("eth2")->configWidget());
|
||||||
else if (rbFt802Dot3Raw->isChecked())
|
else if (rbFt802Dot3Raw->isChecked())
|
||||||
@ -383,28 +404,63 @@ void StreamConfigDialog::on_twProto_currentChanged(int index)
|
|||||||
wl.append(mpStream->protocol("llc")->configWidget());
|
wl.append(mpStream->protocol("llc")->configWidget());
|
||||||
wl.append(mpStream->protocol("snap")->configWidget());
|
wl.append(mpStream->protocol("snap")->configWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int i, r = 0, c = 0;
|
||||||
|
QGridLayout *layout = new QGridLayout;
|
||||||
|
|
||||||
|
Q_ASSERT(wl.size() > 0);
|
||||||
|
|
||||||
|
// We use a 2 column layout for the L2 Tab
|
||||||
|
|
||||||
|
layout->addWidget(wl.at(0), r, c, 1, -1);
|
||||||
|
r++;
|
||||||
|
for (i=1; i < wl.size(); i++)
|
||||||
|
{
|
||||||
|
layout->addWidget(wl.at(i), r, c);
|
||||||
|
if ((i % 2) == 0)
|
||||||
|
r++;
|
||||||
|
c = (c+1) % 2;
|
||||||
|
|
||||||
|
}
|
||||||
|
if ((i % 2) == 0)
|
||||||
|
r++;
|
||||||
|
layout->setRowStretch(r, 10);
|
||||||
|
|
||||||
|
twProto->widget(index)->setLayout(layout);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // L3
|
case 2: // L3
|
||||||
if (rbL3Ipv4->isChecked())
|
if (rbL3Ipv4->isChecked())
|
||||||
wl.append(mpStream->protocol("ip4")->configWidget());
|
wl.append(mpStream->protocol("ip4")->configWidget());
|
||||||
|
|
||||||
|
if (wl.size())
|
||||||
|
{
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
|
||||||
|
for (int i=0; i < wl.size(); i++)
|
||||||
|
layout->addWidget(wl.at(i));
|
||||||
|
|
||||||
|
twProto->widget(index)->setLayout(layout);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3: // L4
|
case 3: // L4
|
||||||
if (rbL4Tcp->isChecked())
|
if (rbL4Tcp->isChecked())
|
||||||
wl.append(mpStream->protocol("tcp")->configWidget());
|
wl.append(mpStream->protocol("tcp")->configWidget());
|
||||||
else if (rbL4Udp->isChecked())
|
else if (rbL4Udp->isChecked())
|
||||||
wl.append(mpStream->protocol("udp")->configWidget());
|
wl.append(mpStream->protocol("udp")->configWidget());
|
||||||
|
|
||||||
|
if (wl.size())
|
||||||
|
{
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
|
||||||
|
for (int i=0; i < wl.size(); i++)
|
||||||
|
layout->addWidget(wl.at(i));
|
||||||
|
|
||||||
|
twProto->widget(index)->setLayout(layout);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl.size())
|
|
||||||
{
|
|
||||||
layout = new QVBoxLayout;
|
|
||||||
|
|
||||||
for (int i=0; i < wl.size(); i++)
|
|
||||||
layout->addWidget(wl.at(i));
|
|
||||||
|
|
||||||
twProto->widget(index)->setLayout(layout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamConfigDialog::update_NumPacketsAndNumBursts()
|
void StreamConfigDialog::update_NumPacketsAndNumBursts()
|
||||||
@ -464,6 +520,13 @@ void StreamConfigDialog::LoadCurrentStream()
|
|||||||
Q_ASSERT(mSelectedProtocols.at(i) == 51); // Mac
|
Q_ASSERT(mSelectedProtocols.at(i) == 51); // Mac
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
// VLAN
|
||||||
|
if (mSelectedProtocols.at(i) == 126) // VLAN
|
||||||
|
{
|
||||||
|
cbCVlan->setChecked(true);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
if (mSelectedProtocols.at(i) == 52) // Payload
|
if (mSelectedProtocols.at(i) == 52) // Payload
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
@ -500,6 +563,7 @@ void StreamConfigDialog::LoadCurrentStream()
|
|||||||
else
|
else
|
||||||
rbFtNone->setChecked(true);
|
rbFtNone->setChecked(true);
|
||||||
|
|
||||||
|
|
||||||
// L3
|
// L3
|
||||||
if (mSelectedProtocols.at(i) == 52) // Payload
|
if (mSelectedProtocols.at(i) == 52) // Payload
|
||||||
{
|
{
|
||||||
@ -611,10 +675,11 @@ _proto_parse_done:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamConfigDialog::StoreCurrentStream(Stream *pStream)
|
void StreamConfigDialog::StoreCurrentStream()
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
bool isOk;
|
bool isOk;
|
||||||
|
Stream *pStream = mpStream;
|
||||||
|
|
||||||
qDebug("storing pStream %p", pStream);
|
qDebug("storing pStream %p", pStream);
|
||||||
|
|
||||||
@ -660,9 +725,15 @@ void StreamConfigDialog::StoreCurrentStream(Stream *pStream)
|
|||||||
|
|
||||||
void StreamConfigDialog::on_pbOk_clicked()
|
void StreamConfigDialog::on_pbOk_clicked()
|
||||||
{
|
{
|
||||||
|
OstProto::Stream s;
|
||||||
|
|
||||||
// Store dialog contents into stream
|
// Store dialog contents into stream
|
||||||
StoreCurrentStream(mPort.streamByIndex(mCurrentStreamIndex));
|
//updateSelectedProtocols();
|
||||||
|
StoreCurrentStream();
|
||||||
|
mpStream->protoDataCopyInto(s);
|
||||||
|
mPort.streamByIndex(mCurrentStreamIndex)->protoDataCopyFrom(s);;
|
||||||
qDebug("stream stored");
|
qDebug("stream stored");
|
||||||
|
|
||||||
lastTopLevelTabIndex = twTopLevel->currentIndex();
|
lastTopLevelTabIndex = twTopLevel->currentIndex();
|
||||||
lastProtoTabIndex = twProto->currentIndex();
|
lastProtoTabIndex = twProto->currentIndex();
|
||||||
}
|
}
|
||||||
|
@ -49,15 +49,17 @@ private:
|
|||||||
static int lastProtoTabIndex;
|
static int lastProtoTabIndex;
|
||||||
|
|
||||||
void setupUiExtra();
|
void setupUiExtra();
|
||||||
|
void updateSelectedProtocols();
|
||||||
void LoadCurrentStream();
|
void LoadCurrentStream();
|
||||||
void StoreCurrentStream(Stream *pStream);
|
void StoreCurrentStream();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cmbPktLenMode_currentIndexChanged(QString mode);
|
void on_cmbPktLenMode_currentIndexChanged(QString mode);
|
||||||
void on_pbPrev_clicked();
|
void on_pbPrev_clicked();
|
||||||
void on_pbNext_clicked();
|
void on_pbNext_clicked();
|
||||||
|
|
||||||
void updateSelectedProtocols();
|
void updateContents();
|
||||||
|
|
||||||
void on_twTopLevel_currentChanged(int index);
|
void on_twTopLevel_currentChanged(int index);
|
||||||
void on_twProto_currentChanged(int index);
|
void on_twProto_currentChanged(int index);
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>590</width>
|
<width>636</width>
|
||||||
<height>517</height>
|
<height>589</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
@ -29,8 +29,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<property name="modal" >
|
<property name="modal" >
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<item row="0" column="0" >
|
<item>
|
||||||
<widget class="QTabWidget" name="twTopLevel" >
|
<widget class="QTabWidget" name="twTopLevel" >
|
||||||
<property name="toolTip" >
|
<property name="toolTip" >
|
||||||
<string/>
|
<string/>
|
||||||
@ -98,11 +98,14 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="inputMask" >
|
||||||
|
<string>0099; </string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>64</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="maxLength" >
|
<property name="maxLength" >
|
||||||
<number>32767</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment" >
|
<property name="alignment" >
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
@ -111,8 +114,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QLineEdit" name="lePktLen" >
|
<widget class="QLineEdit" name="lePktLen" >
|
||||||
|
<property name="inputMask" >
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>64</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="maxLength" >
|
<property name="maxLength" >
|
||||||
<number>32767</number>
|
<number>32767</number>
|
||||||
@ -134,11 +140,14 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="inputMask" >
|
||||||
|
<string>0099; </string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>64</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="maxLength" >
|
<property name="maxLength" >
|
||||||
<number>32767</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment" >
|
<property name="alignment" >
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
@ -157,187 +166,337 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<attribute name="title" >
|
<attribute name="title" >
|
||||||
<string>Protocols</string>
|
<string>Protocols</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<item rowspan="2" row="0" column="0" >
|
<item>
|
||||||
<widget class="QGroupBox" name="gbFrameType" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="title" >
|
<item>
|
||||||
<string>Frame Type</string>
|
<widget class="QGroupBox" name="gbFrameType" >
|
||||||
</property>
|
<property name="title" >
|
||||||
<layout class="QVBoxLayout" >
|
<string>Frame Type</string>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QRadioButton" name="rbFtNone" >
|
<layout class="QGridLayout" >
|
||||||
<property name="text" >
|
<item row="0" column="0" >
|
||||||
<string>None</string>
|
<widget class="QRadioButton" name="rbFtNone" >
|
||||||
</property>
|
<property name="text" >
|
||||||
<property name="checked" >
|
<string>None</string>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="checked" >
|
||||||
</widget>
|
<bool>true</bool>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QRadioButton" name="rbFtEthernet2" >
|
</item>
|
||||||
<property name="text" >
|
<item row="1" column="0" >
|
||||||
<string>Ethernet II</string>
|
<widget class="QRadioButton" name="rbFtEthernet2" >
|
||||||
</property>
|
<property name="text" >
|
||||||
<property name="checked" >
|
<string>Ethernet II</string>
|
||||||
<bool>false</bool>
|
</property>
|
||||||
</property>
|
<property name="checked" >
|
||||||
</widget>
|
<bool>false</bool>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QRadioButton" name="rbFt802Dot3Raw" >
|
</item>
|
||||||
<property name="text" >
|
<item row="1" column="1" >
|
||||||
<string>802.3 Raw</string>
|
<widget class="QRadioButton" name="rbFt802Dot3Raw" >
|
||||||
</property>
|
<property name="text" >
|
||||||
</widget>
|
<string>802.3 Raw</string>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QRadioButton" name="rbFt802Dot3Llc" >
|
</item>
|
||||||
<property name="text" >
|
<item row="2" column="0" >
|
||||||
<string>802.3 LLC</string>
|
<widget class="QRadioButton" name="rbFt802Dot3Llc" >
|
||||||
</property>
|
<property name="text" >
|
||||||
<property name="checked" >
|
<string>802.3 LLC</string>
|
||||||
<bool>false</bool>
|
</property>
|
||||||
</property>
|
<property name="checked" >
|
||||||
</widget>
|
<bool>false</bool>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QRadioButton" name="rbFtLlcSnap" >
|
</item>
|
||||||
<property name="text" >
|
<item row="2" column="1" >
|
||||||
<string>LLC SNAP</string>
|
<widget class="QRadioButton" name="rbFtLlcSnap" >
|
||||||
</property>
|
<property name="text" >
|
||||||
</widget>
|
<string>LLC SNAP</string>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gbVlan" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="title" >
|
||||||
|
<string>VLAN</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbCVlan" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>CVLAN</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbSVlan" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>SVLAN</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gbL3Proto" >
|
||||||
|
<property name="title" >
|
||||||
|
<string>L3</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<widget class="QRadioButton" name="rbL3None" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>None</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<widget class="QRadioButton" name="rbL3Ipv4" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>IPv4</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" >
|
||||||
|
<widget class="QRadioButton" name="rbL3Ipv6" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>IPv6</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="QRadioButton" name="rbL3Arp" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>ARP</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QRadioButton" name="rbL3Other" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Other</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gbL4Proto" >
|
||||||
|
<property name="title" >
|
||||||
|
<string>L4</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<widget class="QRadioButton" name="rbL4None" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>None</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<widget class="QRadioButton" name="rbL4Icmp" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>ICMP</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" >
|
||||||
|
<widget class="QRadioButton" name="rbL4Igmp" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>IGMP</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="QRadioButton" name="rbL4Tcp" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>TCP</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QRadioButton" name="rbL4Udp" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>UDP</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" >
|
||||||
|
<widget class="QRadioButton" name="rbL4Other" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Other</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>182</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item>
|
||||||
<widget class="QGroupBox" name="gbL3Proto" >
|
<widget class="QGroupBox" name="groupBox" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>L3</string>
|
<string>Advanced Protocol Selection</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked" >
|
||||||
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rbL3None" >
|
<layout class="QHBoxLayout" >
|
||||||
<property name="text" >
|
<item>
|
||||||
<string>None</string>
|
<layout class="QVBoxLayout" >
|
||||||
</property>
|
<item>
|
||||||
<property name="checked" >
|
<widget class="QLabel" name="label" >
|
||||||
<bool>true</bool>
|
<property name="text" >
|
||||||
</property>
|
<string>Available Protocols</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<widget class="QRadioButton" name="rbL3Ipv4" >
|
<item>
|
||||||
<property name="enabled" >
|
<widget class="QListView" name="lvAllProtocols" />
|
||||||
<bool>false</bool>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
<property name="text" >
|
</item>
|
||||||
<string>IPv4</string>
|
<item>
|
||||||
</property>
|
<layout class="QVBoxLayout" >
|
||||||
<property name="checked" >
|
<item>
|
||||||
<bool>false</bool>
|
<spacer>
|
||||||
</property>
|
<property name="orientation" >
|
||||||
</widget>
|
<enum>Qt::Vertical</enum>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="sizeHint" >
|
||||||
<widget class="QRadioButton" name="rbL3Arp" >
|
<size>
|
||||||
<property name="enabled" >
|
<width>20</width>
|
||||||
<bool>false</bool>
|
<height>40</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="text" >
|
</property>
|
||||||
<string>ARP</string>
|
</spacer>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string><</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Selected Protocols</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListView" name="lvSelectedProtocols" />
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
|
||||||
<widget class="QGroupBox" name="gbL4Proto" >
|
|
||||||
<property name="title" >
|
|
||||||
<string>L4</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" >
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="QRadioButton" name="rbL4None" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>None</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" >
|
|
||||||
<widget class="QRadioButton" name="rbL4Icmp" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>ICMP</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2" >
|
|
||||||
<widget class="QRadioButton" name="rbL4Igmp" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>IGMP</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" >
|
|
||||||
<widget class="QRadioButton" name="rbL4Tcp" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>TCP</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" >
|
|
||||||
<widget class="QRadioButton" name="rbL4Udp" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>UDP</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>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_4" >
|
<widget class="QWidget" name="tab_4" >
|
||||||
@ -410,8 +569,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="leNumPackets" >
|
<widget class="QLineEdit" name="leNumPackets" >
|
||||||
|
<property name="inputMask" >
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>1</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment" >
|
<property name="alignment" >
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
@ -743,7 +905,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pbPrev" >
|
<widget class="QPushButton" name="pbPrev" >
|
||||||
@ -820,8 +982,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel" >
|
||||||
<x>440</x>
|
<x>496</x>
|
||||||
<y>466</y>
|
<y>552</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel" >
|
||||||
<x>533</x>
|
<x>533</x>
|
||||||
@ -836,8 +998,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel" >
|
||||||
<x>523</x>
|
<x>579</x>
|
||||||
<y>466</y>
|
<y>552</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel" >
|
||||||
<x>533</x>
|
<x>533</x>
|
||||||
@ -852,12 +1014,12 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<slot>setEnabled(bool)</slot>
|
<slot>setEnabled(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel" >
|
||||||
<x>281</x>
|
<x>158</x>
|
||||||
<y>137</y>
|
<y>149</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel" >
|
||||||
<x>281</x>
|
<x>158</x>
|
||||||
<y>169</y>
|
<y>149</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -868,12 +1030,12 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<slot>setEnabled(bool)</slot>
|
<slot>setEnabled(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel" >
|
||||||
<x>30</x>
|
<x>59</x>
|
||||||
<y>66</y>
|
<y>120</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel" >
|
||||||
<x>30</x>
|
<x>59</x>
|
||||||
<y>266</y>
|
<y>149</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -884,12 +1046,12 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<slot>setEnabled(bool)</slot>
|
<slot>setEnabled(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel" >
|
||||||
<x>30</x>
|
<x>59</x>
|
||||||
<y>91</y>
|
<y>123</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel" >
|
||||||
<x>30</x>
|
<x>59</x>
|
||||||
<y>312</y>
|
<y>149</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -900,12 +1062,12 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
|
|||||||
<slot>setEnabled(bool)</slot>
|
<slot>setEnabled(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel" >
|
||||||
<x>30</x>
|
<x>59</x>
|
||||||
<y>91</y>
|
<y>123</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel" >
|
||||||
<x>134</x>
|
<x>145</x>
|
||||||
<y>177</y>
|
<y>149</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
@ -92,7 +92,7 @@ int AbstractProtocol::fieldCount() const
|
|||||||
|
|
||||||
/*! Returns the number of meta fields \n
|
/*! Returns the number of meta fields \n
|
||||||
The default implementation counts and returns the number of fields for which
|
The default implementation counts and returns the number of fields for which
|
||||||
fieldData(index, FieldIsMeta) return true\n
|
the FieldIsMeta flag is set\n
|
||||||
The default implementation caches the count on its first invocation
|
The default implementation caches the count on its first invocation
|
||||||
and subsequently returns the cached count */
|
and subsequently returns the cached count */
|
||||||
int AbstractProtocol::metaFieldCount() const
|
int AbstractProtocol::metaFieldCount() const
|
||||||
@ -101,7 +101,7 @@ int AbstractProtocol::metaFieldCount() const
|
|||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for (int i = 0; i < fieldCount() ; i++)
|
for (int i = 0; i < fieldCount() ; i++)
|
||||||
if (fieldData(i, FieldIsMeta).toBool())
|
if (fieldFlags(i).testFlag(FieldIsMeta))
|
||||||
c++;
|
c++;
|
||||||
metaCount = c;
|
metaCount = c;
|
||||||
}
|
}
|
||||||
@ -117,6 +117,11 @@ int AbstractProtocol::frameFieldCount() const
|
|||||||
return (fieldCount() - metaFieldCount());
|
return (fieldCount() - metaFieldCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractProtocol::FieldFlags AbstractProtocol::fieldFlags(int index) const
|
||||||
|
{
|
||||||
|
return FieldIsNormal;
|
||||||
|
}
|
||||||
|
|
||||||
/*! Returns the requested field attribute data \n
|
/*! Returns the requested field attribute data \n
|
||||||
Protocols which have meta fields that vary a frame field across
|
Protocols which have meta fields that vary a frame field across
|
||||||
streams may use the streamIndex to return the appropriate field value \n
|
streams may use the streamIndex to return the appropriate field value \n
|
||||||
@ -140,6 +145,9 @@ QVariant AbstractProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
case FieldName:
|
case FieldName:
|
||||||
return QString();
|
return QString();
|
||||||
case FieldBitSize:
|
case FieldBitSize:
|
||||||
|
Q_ASSERT_X(!fieldFlags(index).testFlag(FieldIsCksum),
|
||||||
|
"AbstractProtocol::fieldData()",
|
||||||
|
"FieldBitSize for checksum fields need to be handled by the subclass");
|
||||||
return fieldData(index, FieldFrameValue, streamIndex).
|
return fieldData(index, FieldFrameValue, streamIndex).
|
||||||
toByteArray().size() * 8;
|
toByteArray().size() * 8;
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
@ -148,8 +156,6 @@ QVariant AbstractProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
return QByteArray();
|
return QByteArray();
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QString();
|
return QString();
|
||||||
case FieldIsMeta:
|
|
||||||
return false;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
qFatal("%s:%d: unhandled case %d\n", __FUNCTION__, __LINE__,
|
qFatal("%s:%d: unhandled case %d\n", __FUNCTION__, __LINE__,
|
||||||
@ -196,7 +202,7 @@ int AbstractProtocol::protocolFrameSize() const
|
|||||||
|
|
||||||
for (int i = 0; i < fieldCount(); i++)
|
for (int i = 0; i < fieldCount(); i++)
|
||||||
{
|
{
|
||||||
if (!fieldData(i, FieldIsMeta).toBool())
|
if (!fieldFlags(i).testFlag(FieldIsMeta))
|
||||||
bitsize += fieldData(i, FieldBitSize).toUInt();
|
bitsize += fieldData(i, FieldBitSize).toUInt();
|
||||||
}
|
}
|
||||||
protoSize = (bitsize+7)/8;
|
protoSize = (bitsize+7)/8;
|
||||||
@ -248,23 +254,30 @@ int AbstractProtocol::protocolFramePayloadSize() const
|
|||||||
The default implementation forms and returns an ordered concatenation of
|
The default implementation forms and returns an ordered concatenation of
|
||||||
the FrameValue of all the 'frame' fields of the protocol taking care of fields
|
the FrameValue of all the 'frame' fields of the protocol taking care of fields
|
||||||
which are not an integral number of bytes\n */
|
which are not an integral number of bytes\n */
|
||||||
QByteArray AbstractProtocol::protocolFrameValue(int streamIndex) const
|
QByteArray AbstractProtocol::protocolFrameValue(int streamIndex, bool forCksum) const
|
||||||
{
|
{
|
||||||
QByteArray proto, field;
|
QByteArray proto, field;
|
||||||
int bits, lastbitpos = 0;
|
uint bits, lastbitpos = 0;
|
||||||
|
FieldFlags flags;
|
||||||
|
|
||||||
for (int i=0; i < fieldCount() ; i++)
|
for (int i=0; i < fieldCount() ; i++)
|
||||||
{
|
{
|
||||||
if (!fieldData(i, FieldIsMeta).toBool())
|
flags = fieldFlags(i);
|
||||||
|
if (!flags.testFlag(FieldIsMeta))
|
||||||
{
|
{
|
||||||
field = fieldData(i, FieldFrameValue, streamIndex).toByteArray();
|
|
||||||
bits = fieldData(i, FieldBitSize, streamIndex).toUInt();
|
bits = fieldData(i, FieldBitSize, streamIndex).toUInt();
|
||||||
if (bits == 0)
|
Q_ASSERT(bits > 0);
|
||||||
continue;
|
|
||||||
|
|
||||||
qDebug("<<< %d, %d >>>>", proto.size(), field.size());
|
if (forCksum && flags.testFlag(FieldIsCksum))
|
||||||
|
{
|
||||||
|
field.resize((bits+7)/8);
|
||||||
|
field.fill('\0');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
field = fieldData(i, FieldFrameValue, streamIndex).toByteArray();
|
||||||
|
qDebug("<<< %d, %d/%d >>>>", proto.size(), bits, field.size());
|
||||||
|
|
||||||
if (bits == field.size() * 8)
|
if (bits == (uint) field.size() * 8)
|
||||||
{
|
{
|
||||||
if (lastbitpos == 0)
|
if (lastbitpos == 0)
|
||||||
proto.append(field);
|
proto.append(field);
|
||||||
@ -279,28 +292,44 @@ QByteArray AbstractProtocol::protocolFrameValue(int streamIndex) const
|
|||||||
field.at(j+1) >> lastbitpos);
|
field.at(j+1) >> lastbitpos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bits < field.size() * 8)
|
else if (bits < (uint) field.size() * 8)
|
||||||
{
|
{
|
||||||
int u, v;
|
uchar c;
|
||||||
|
uint v;
|
||||||
|
|
||||||
|
v = (field.size()*8) - bits;
|
||||||
|
|
||||||
|
Q_ASSERT(v < 8);
|
||||||
|
|
||||||
u = bits / 8;
|
|
||||||
v = bits % 8;
|
|
||||||
if (lastbitpos == 0)
|
if (lastbitpos == 0)
|
||||||
{
|
{
|
||||||
proto.append(field.left(u+1));
|
for (int j = 0; j < field.size(); j++)
|
||||||
char c = proto[proto.size() - 1];
|
{
|
||||||
proto[proto.size() - 1] = c & (0xFF << (8 - v));
|
c = field.at(j) << v;
|
||||||
lastbitpos = v;
|
if ((j+1) < field.size())
|
||||||
|
c |= ((uchar)field.at(j+1) >> (8-v));
|
||||||
|
proto.append(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastbitpos = (lastbitpos + bits) % 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char c = proto[proto.size() - 1];
|
Q_ASSERT(proto.size() > 0);
|
||||||
proto[proto.size() - 1] = c | (field.at(0) >> lastbitpos);
|
|
||||||
for (int j = 0; j < (u - 1); j++)
|
for (int j = 0; j < field.size(); j++)
|
||||||
proto.append(field.at(j) << lastbitpos |
|
{
|
||||||
field.at(j+1) >> lastbitpos);
|
uchar d;
|
||||||
if (u)
|
|
||||||
proto.append( field.at(u) & (0xFF << (8 - v)) );
|
c = field.at(j) << v;
|
||||||
|
if ((j+1) < field.size())
|
||||||
|
c |= ((uchar) field.at(j+1) >> (8-v));
|
||||||
|
d = proto[proto.size() - 1];
|
||||||
|
proto[proto.size() - 1] = d | ((uchar) c >> lastbitpos);
|
||||||
|
if (bits > (8*j + (8 - v)))
|
||||||
|
proto.append(c << (8-lastbitpos));
|
||||||
|
}
|
||||||
|
|
||||||
lastbitpos = (lastbitpos + bits) % 8;
|
lastbitpos = (lastbitpos + bits) % 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,53 +344,124 @@ QByteArray AbstractProtocol::protocolFrameValue(int streamIndex) const
|
|||||||
return proto;
|
return proto;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AbstractProtocol::protocolFrameCksum() const
|
/*!
|
||||||
|
\note If a subclass uses protocolFrameCksum() from within fieldData() to
|
||||||
|
derive a cksum field, it MUST handle and return the 'FieldBitSize'
|
||||||
|
attribute also for that particular field instead of using the default
|
||||||
|
AbstractProtocol implementation for 'FieldBitSize' - this is required
|
||||||
|
to prevent infinite recursion
|
||||||
|
*/
|
||||||
|
quint32 AbstractProtocol::protocolFrameCksum(int streamIndex,
|
||||||
|
CksumType cksumType) const
|
||||||
{
|
{
|
||||||
QByteArray fv;
|
static int recursionCount = 0;
|
||||||
quint16 *ip;
|
quint32 cksum = 0;
|
||||||
quint32 len, sum = 0;
|
|
||||||
|
|
||||||
fv = protocolFrameValue(-1);
|
recursionCount++;
|
||||||
ip = (quint16*) fv.constData();
|
Q_ASSERT_X(recursionCount < 10, "protocolFrameCksum", "potential infinite recursion - does a protocol checksum field not implement FieldBitSize?");
|
||||||
len = fv.size();
|
|
||||||
|
|
||||||
while(len > 1)
|
switch(cksumType)
|
||||||
{
|
{
|
||||||
sum += *ip;
|
case CksumIp:
|
||||||
if(sum & 0x80000000)
|
{
|
||||||
sum = (sum & 0xFFFF) + (sum >> 16);
|
QByteArray fv;
|
||||||
ip++;
|
quint16 *ip;
|
||||||
len -= 2;
|
quint32 len, sum = 0;
|
||||||
|
|
||||||
|
fv = protocolFrameValue(streamIndex, true);
|
||||||
|
ip = (quint16*) fv.constData();
|
||||||
|
len = fv.size();
|
||||||
|
|
||||||
|
while(len > 1)
|
||||||
|
{
|
||||||
|
sum += *ip;
|
||||||
|
if(sum & 0x80000000)
|
||||||
|
sum = (sum & 0xFFFF) + (sum >> 16);
|
||||||
|
ip++;
|
||||||
|
len -= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len)
|
||||||
|
sum += (unsigned short) *(unsigned char *)ip;
|
||||||
|
|
||||||
|
while(sum>>16)
|
||||||
|
sum = (sum & 0xFFFF) + (sum >> 16);
|
||||||
|
|
||||||
|
cksum = qFromBigEndian((quint16) ~sum);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CksumTcpUdp:
|
||||||
|
{
|
||||||
|
quint16 cks;
|
||||||
|
quint32 sum = 0;
|
||||||
|
|
||||||
|
cks = protocolFrameCksum(streamIndex, CksumIp);
|
||||||
|
sum += (quint16) ~cks;
|
||||||
|
cks = protocolFramePayloadCksum(streamIndex, CksumIp);
|
||||||
|
sum += (quint16) ~cks;
|
||||||
|
cks = protocolFrameHeaderCksum(streamIndex, CksumIpPseudo);
|
||||||
|
sum += (quint16) ~cks;
|
||||||
|
|
||||||
|
while(sum>>16)
|
||||||
|
sum = (sum & 0xFFFF) + (sum >> 16);
|
||||||
|
|
||||||
|
cksum = (~sum) & 0xFFFF;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len)
|
recursionCount--;
|
||||||
sum += (unsigned short) *(unsigned char *)ip;
|
return cksum;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint32 AbstractProtocol::protocolFrameHeaderCksum(int streamIndex,
|
||||||
|
CksumType cksumType) const
|
||||||
|
{
|
||||||
|
quint32 sum = 0xFFFF;
|
||||||
|
QLinkedListIterator<const AbstractProtocol*> iter(frameProtocols);
|
||||||
|
|
||||||
|
Q_ASSERT(cksumType == CksumIpPseudo);
|
||||||
|
|
||||||
|
if (iter.findNext(this))
|
||||||
|
{
|
||||||
|
iter.previous();
|
||||||
|
if (iter.hasPrevious())
|
||||||
|
sum = iter.previous()->protocolFrameCksum(streamIndex,
|
||||||
|
CksumIpPseudo);
|
||||||
|
}
|
||||||
|
|
||||||
while(sum>>16)
|
while(sum>>16)
|
||||||
sum = (sum & 0xFFFF) + (sum >> 16);
|
sum = (sum & 0xFFFF) + (sum >> 16);
|
||||||
|
|
||||||
return qFromBigEndian((quint16) ~sum);
|
return (quint16) ~sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AbstractProtocol::protocolFramePayloadCksum() const
|
quint32 AbstractProtocol::protocolFramePayloadCksum(int streamIndex,
|
||||||
|
CksumType cksumType) const
|
||||||
{
|
{
|
||||||
int cksum = 0;
|
quint32 sum = 0;
|
||||||
|
quint16 cksum;
|
||||||
QLinkedListIterator<const AbstractProtocol*> iter(frameProtocols);
|
QLinkedListIterator<const AbstractProtocol*> iter(frameProtocols);
|
||||||
|
|
||||||
|
Q_ASSERT(cksumType == CksumIp);
|
||||||
|
|
||||||
if (iter.findNext(this))
|
if (iter.findNext(this))
|
||||||
{
|
{
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
cksum += iter.next()->protocolFrameCksum().toUInt(); // TODO: chg to partial
|
{
|
||||||
|
cksum = iter.next()->protocolFrameCksum(streamIndex, CksumIp);
|
||||||
|
sum += (quint16) ~cksum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return -1;
|
return 0;
|
||||||
#if 0
|
|
||||||
while(cksum>>16)
|
|
||||||
cksum = (cksum & 0xFFFF) + (cksum >> 16);
|
|
||||||
|
|
||||||
return (quint16) ~cksum;
|
while(sum>>16)
|
||||||
#endif
|
sum = (sum & 0xFFFF) + (sum >> 16);
|
||||||
|
|
||||||
return cksum;
|
return (quint16) ~sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QLinkedList>
|
#include <QLinkedList>
|
||||||
|
#include <QFlags>
|
||||||
|
|
||||||
//#include "../rpc/pbhelper.h"
|
//#include "../rpc/pbhelper.h"
|
||||||
#include "../common/protocol.pb.h"
|
#include "../common/protocol.pb.h"
|
||||||
@ -35,13 +36,19 @@ protected:
|
|||||||
ProtocolList &frameProtocols;
|
ProtocolList &frameProtocols;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum FieldFlag {
|
||||||
|
FieldIsNormal = 0x0,
|
||||||
|
FieldIsMeta = 0x1,
|
||||||
|
FieldIsCksum = 0x2
|
||||||
|
};
|
||||||
|
Q_DECLARE_FLAGS(FieldFlags, FieldFlag);
|
||||||
|
|
||||||
enum FieldAttrib {
|
enum FieldAttrib {
|
||||||
FieldName, //! name
|
FieldName, //! name
|
||||||
FieldValue, //! value in host byte order (user editable)
|
FieldValue, //! value in host byte order (user editable)
|
||||||
FieldTextValue, //! value as text
|
FieldTextValue, //! value as text
|
||||||
FieldFrameValue, //! frame encoded value in network byte order
|
FieldFrameValue, //! frame encoded value in network byte order
|
||||||
FieldBitSize, //! size in bits
|
FieldBitSize, //! size in bits
|
||||||
FieldIsMeta //! bool indicating if field is meta
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ProtocolIdType {
|
enum ProtocolIdType {
|
||||||
@ -50,6 +57,14 @@ public:
|
|||||||
ProtocolIdIp,
|
ProtocolIdIp,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CksumType {
|
||||||
|
CksumIp,
|
||||||
|
CksumIpPseudo,
|
||||||
|
CksumTcpUdp,
|
||||||
|
|
||||||
|
CksumMax
|
||||||
|
};
|
||||||
|
|
||||||
AbstractProtocol(ProtocolList &frameProtoList,
|
AbstractProtocol(ProtocolList &frameProtoList,
|
||||||
OstProto::StreamCore *parent = 0);
|
OstProto::StreamCore *parent = 0);
|
||||||
virtual ~AbstractProtocol();
|
virtual ~AbstractProtocol();
|
||||||
@ -71,22 +86,30 @@ public:
|
|||||||
virtual int metaFieldCount() const;
|
virtual int metaFieldCount() const;
|
||||||
int frameFieldCount() const;
|
int frameFieldCount() const;
|
||||||
|
|
||||||
|
virtual FieldFlags fieldFlags(int index) const;
|
||||||
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex = 0) const;
|
int streamIndex = 0) const;
|
||||||
virtual bool setFieldData(int index, const QVariant &value,
|
virtual bool setFieldData(int index, const QVariant &value,
|
||||||
FieldAttrib attrib = FieldValue);
|
FieldAttrib attrib = FieldValue);
|
||||||
|
|
||||||
QByteArray protocolFrameValue(int streamIndex = 0) const;
|
QByteArray protocolFrameValue(int streamIndex = 0,
|
||||||
int protocolFrameSize() const;
|
bool forCksum = false) const;
|
||||||
|
virtual int protocolFrameSize() const;
|
||||||
int protocolFrameOffset() const;
|
int protocolFrameOffset() const;
|
||||||
int protocolFramePayloadSize() const;
|
int protocolFramePayloadSize() const;
|
||||||
|
|
||||||
virtual QVariant protocolFrameCksum() const;
|
virtual quint32 protocolFrameCksum(int streamIndex = 0,
|
||||||
QVariant protocolFramePayloadCksum() const;
|
CksumType cksumType = CksumIp) const;
|
||||||
|
quint32 protocolFrameHeaderCksum(int streamIndex = 0,
|
||||||
|
CksumType cksumType = CksumIp) const;
|
||||||
|
quint32 protocolFramePayloadCksum(int streamIndex = 0,
|
||||||
|
CksumType cksumType = CksumIp) const;
|
||||||
|
|
||||||
virtual QWidget* configWidget() = 0;
|
virtual QWidget* configWidget() = 0;
|
||||||
virtual void loadConfigWidget() = 0;
|
virtual void loadConfigWidget() = 0;
|
||||||
virtual void storeConfigWidget() = 0;
|
virtual void storeConfigWidget() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractProtocol::FieldFlags);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,8 +46,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>16</width>
|
||||||
<height>20</height>
|
<height>54</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
230
common/ip4.cpp
230
common/ip4.cpp
@ -10,10 +10,12 @@ Ip4ConfigForm::Ip4ConfigForm(QWidget *parent)
|
|||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
leIpVersion->setValidator(new QIntValidator(0, 15, this));
|
||||||
|
|
||||||
connect(cmbIpSrcAddrMode, SIGNAL(currentIndexChanged(int)),
|
connect(cmbIpSrcAddrMode, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT(on_cmbIpSrcAddrMode_currentIndexChanged(int)));
|
this, SLOT(on_cmbIpSrcAddrMode_currentIndexChanged(int)));
|
||||||
connect(cmbIpDstAddrMode, SIGNAL(currentIndexChanged(int)),
|
connect(cmbIpDstAddrMode, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT(on_cmbIpDstAddrMode_currentIndexChanged(int)));
|
this, SLOT(on_cmbIpDstAddrMode_currentIndexChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ip4ConfigForm::on_cmbIpSrcAddrMode_currentIndexChanged(int index)
|
void Ip4ConfigForm::on_cmbIpSrcAddrMode_currentIndexChanged(int index)
|
||||||
@ -110,45 +112,104 @@ int Ip4Protocol::fieldCount() const
|
|||||||
return ip4_fieldCount;
|
return ip4_fieldCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractProtocol::FieldFlags Ip4Protocol::fieldFlags(int index) const
|
||||||
|
{
|
||||||
|
AbstractProtocol::FieldFlags flags;
|
||||||
|
|
||||||
|
flags = AbstractProtocol::fieldFlags(index);
|
||||||
|
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case ip4_ver:
|
||||||
|
case ip4_hdrLen:
|
||||||
|
case ip4_tos:
|
||||||
|
case ip4_totLen:
|
||||||
|
case ip4_id:
|
||||||
|
case ip4_flags:
|
||||||
|
case ip4_fragOfs:
|
||||||
|
case ip4_ttl:
|
||||||
|
case ip4_proto:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ip4_cksum:
|
||||||
|
flags |= FieldIsCksum;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ip4_srcAddr:
|
||||||
|
case ip4_dstAddr:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ip4_isOverrideVer:
|
||||||
|
case ip4_isOverrideHdrLen:
|
||||||
|
case ip4_isOverrideTotLen:
|
||||||
|
case ip4_isOverrideCksum:
|
||||||
|
case ip4_srcAddrMode:
|
||||||
|
case ip4_srcAddrCount:
|
||||||
|
case ip4_srcAddrMask:
|
||||||
|
case ip4_dstAddrMode:
|
||||||
|
case ip4_dstAddrCount:
|
||||||
|
case ip4_dstAddrMask:
|
||||||
|
flags |= FieldIsMeta;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex) const
|
int streamIndex) const
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case ip4_ver:
|
case ip4_ver:
|
||||||
|
{
|
||||||
|
int ver;
|
||||||
|
|
||||||
|
ver = data.is_override_ver() ? (data.ver_hdrlen() >> 4) & 0x0F : 4;
|
||||||
|
|
||||||
switch(attrib)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Version");
|
return QString("Version");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return (data.ver_hdrlen() >> 4) & 0x0F;
|
return ver;
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QString("%1").arg((data.ver_hdrlen() >> 4) & 0x0F);
|
return QString("%1").arg(ver, 1, BASE_HEX, QChar('0'));
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
return QByteArray(1, (char)(data.ver_hdrlen() & 0xF0));
|
return QByteArray(1, (char) ver);
|
||||||
case FieldBitSize:
|
case FieldBitSize:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ip4_hdrLen:
|
case ip4_hdrLen:
|
||||||
|
{
|
||||||
|
int hdrlen;
|
||||||
|
|
||||||
|
hdrlen = data.is_override_hdrlen() ? data.ver_hdrlen() & 0x0F : 5;
|
||||||
|
|
||||||
switch(attrib)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Header Length");
|
return QString("Header Length");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return data.ver_hdrlen() & 0x0F;
|
return hdrlen;
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QString("%1").arg(data.ver_hdrlen() & 0x0F);
|
return QString("%1").arg(hdrlen, 1, BASE_HEX, QChar('0'));
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
return QByteArray(1, (char)(data.ver_hdrlen() << 4));
|
return QByteArray(1, (char) hdrlen);
|
||||||
case FieldBitSize:
|
case FieldBitSize:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ip4_tos:
|
case ip4_tos:
|
||||||
switch(attrib)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
@ -261,11 +322,12 @@ QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
QByteArray fv;
|
QByteArray fv;
|
||||||
// FIXME need to shift for 13 bits
|
// FIXME need to shift for 13 bits
|
||||||
fv.resize(2);
|
fv.resize(2);
|
||||||
qToBigEndian((quint16) data.frag_ofs(), (uchar*) fv.data());
|
qToBigEndian((quint16) (data.frag_ofs()),
|
||||||
|
(uchar*) fv.data());
|
||||||
return fv;
|
return fv;
|
||||||
}
|
}
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QString("%1").arg(data.frag_ofs());
|
return QString("%1").arg(data.frag_ofs()*8);
|
||||||
case FieldBitSize:
|
case FieldBitSize:
|
||||||
return 13;
|
return 13;
|
||||||
default:
|
default:
|
||||||
@ -316,7 +378,6 @@ QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
}
|
}
|
||||||
case ip4_cksum:
|
case ip4_cksum:
|
||||||
{
|
{
|
||||||
|
|
||||||
switch(attrib)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
@ -325,12 +386,10 @@ QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
{
|
{
|
||||||
quint16 cksum;
|
quint16 cksum;
|
||||||
|
|
||||||
if (streamIndex < 0)
|
if (data.is_override_cksum())
|
||||||
cksum = 0;
|
|
||||||
else if (data.is_override_cksum())
|
|
||||||
cksum = data.cksum();
|
cksum = data.cksum();
|
||||||
else
|
else
|
||||||
cksum = protocolFrameCksum().toUInt();
|
cksum = protocolFrameCksum(streamIndex, CksumIp);
|
||||||
return cksum;
|
return cksum;
|
||||||
}
|
}
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
@ -338,12 +397,11 @@ QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
QByteArray fv;
|
QByteArray fv;
|
||||||
quint16 cksum;
|
quint16 cksum;
|
||||||
|
|
||||||
if (streamIndex < 0)
|
if (data.is_override_cksum())
|
||||||
cksum = 0;
|
|
||||||
else if (data.is_override_cksum())
|
|
||||||
cksum = data.cksum();
|
cksum = data.cksum();
|
||||||
else
|
else
|
||||||
cksum = protocolFrameCksum().toUInt();
|
cksum = protocolFrameCksum(streamIndex, CksumIp);
|
||||||
|
|
||||||
fv.resize(2);
|
fv.resize(2);
|
||||||
qToBigEndian((quint16) cksum, (uchar*) fv.data());
|
qToBigEndian((quint16) cksum, (uchar*) fv.data());
|
||||||
return fv;
|
return fv;
|
||||||
@ -352,12 +410,10 @@ QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
{
|
{
|
||||||
quint16 cksum;
|
quint16 cksum;
|
||||||
|
|
||||||
if (streamIndex < 0)
|
if (data.is_override_cksum())
|
||||||
cksum = 0;
|
|
||||||
else if (data.is_override_cksum())
|
|
||||||
cksum = data.cksum();
|
cksum = data.cksum();
|
||||||
else
|
else
|
||||||
cksum = protocolFrameCksum().toUInt();
|
cksum = protocolFrameCksum(streamIndex, CksumIp);
|
||||||
return QString("0x%1").
|
return QString("0x%1").
|
||||||
arg(cksum, 4, BASE_HEX, QChar('0'));;
|
arg(cksum, 4, BASE_HEX, QChar('0'));;
|
||||||
}
|
}
|
||||||
@ -369,46 +425,111 @@ QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ip4_srcAddr:
|
case ip4_srcAddr:
|
||||||
|
{
|
||||||
|
int u;
|
||||||
|
quint32 subnet, host, srcIp = 0;
|
||||||
|
|
||||||
|
switch(data.src_ip_mode())
|
||||||
|
{
|
||||||
|
case OstProto::Ip4::e_im_fixed:
|
||||||
|
srcIp = data.src_ip();
|
||||||
|
break;
|
||||||
|
case OstProto::Ip4::e_im_inc_host:
|
||||||
|
u = streamIndex % data.src_ip_count();
|
||||||
|
subnet = data.src_ip() & data.src_ip_mask();
|
||||||
|
host = (((data.src_ip() & ~data.src_ip_mask()) + u) &
|
||||||
|
~data.src_ip_mask());
|
||||||
|
srcIp = subnet | host;
|
||||||
|
break;
|
||||||
|
case OstProto::Ip4::e_im_dec_host:
|
||||||
|
u = streamIndex % data.src_ip_count();
|
||||||
|
subnet = data.src_ip() & data.src_ip_mask();
|
||||||
|
host = (((data.src_ip() & ~data.src_ip_mask()) - u) &
|
||||||
|
~data.src_ip_mask());
|
||||||
|
srcIp = subnet | host;
|
||||||
|
break;
|
||||||
|
case OstProto::Ip4::e_im_random_host:
|
||||||
|
subnet = data.src_ip() & data.src_ip_mask();
|
||||||
|
host = (qrand() & ~data.src_ip_mask());
|
||||||
|
srcIp = subnet | host;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qWarning("Unhandled src_ip_mode = %d", data.src_ip_mode());
|
||||||
|
}
|
||||||
|
|
||||||
switch(attrib)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Source");
|
return QString("Source");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return data.src_ip();
|
return srcIp;
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
{
|
{
|
||||||
QByteArray fv;
|
QByteArray fv;
|
||||||
fv.resize(4);
|
fv.resize(4);
|
||||||
qToBigEndian((quint32) data.src_ip(), (uchar*) fv.data());
|
qToBigEndian(srcIp, (uchar*) fv.data());
|
||||||
return fv;
|
return fv;
|
||||||
}
|
}
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QHostAddress(data.src_ip()).toString();
|
return QHostAddress(srcIp).toString();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ip4_dstAddr:
|
case ip4_dstAddr:
|
||||||
|
{
|
||||||
|
int u;
|
||||||
|
quint32 subnet, host, dstIp = 0;
|
||||||
|
|
||||||
|
switch(data.dst_ip_mode())
|
||||||
|
{
|
||||||
|
case OstProto::Ip4::e_im_fixed:
|
||||||
|
dstIp = data.dst_ip();
|
||||||
|
break;
|
||||||
|
case OstProto::Ip4::e_im_inc_host:
|
||||||
|
u = streamIndex % data.dst_ip_count();
|
||||||
|
subnet = data.dst_ip() & data.dst_ip_mask();
|
||||||
|
host = (((data.dst_ip() & ~data.dst_ip_mask()) + u) &
|
||||||
|
~data.dst_ip_mask());
|
||||||
|
dstIp = subnet | host;
|
||||||
|
break;
|
||||||
|
case OstProto::Ip4::e_im_dec_host:
|
||||||
|
u = streamIndex % data.dst_ip_count();
|
||||||
|
subnet = data.dst_ip() & data.dst_ip_mask();
|
||||||
|
host = (((data.dst_ip() & ~data.dst_ip_mask()) - u) &
|
||||||
|
~data.dst_ip_mask());
|
||||||
|
dstIp = subnet | host;
|
||||||
|
break;
|
||||||
|
case OstProto::Ip4::e_im_random_host:
|
||||||
|
subnet = data.dst_ip() & data.dst_ip_mask();
|
||||||
|
host = (qrand() & ~data.dst_ip_mask());
|
||||||
|
dstIp = subnet | host;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qWarning("Unhandled dst_ip_mode = %d", data.dst_ip_mode());
|
||||||
|
}
|
||||||
|
|
||||||
switch(attrib)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Destination");
|
return QString("Destination");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return data.dst_ip();
|
return dstIp;
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
{
|
{
|
||||||
QByteArray fv;
|
QByteArray fv;
|
||||||
fv.resize(4);
|
fv.resize(4);
|
||||||
qToBigEndian((quint32) data.dst_ip(), (uchar*) fv.data());
|
qToBigEndian((quint32) dstIp, (uchar*) fv.data());
|
||||||
return fv;
|
return fv;
|
||||||
}
|
}
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QHostAddress(data.dst_ip()).toString();
|
return QHostAddress(dstIp).toString();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
// Meta fields
|
// Meta fields
|
||||||
|
|
||||||
case ip4_isOverrideVer:
|
case ip4_isOverrideVer:
|
||||||
@ -423,15 +544,6 @@ QVariant Ip4Protocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
case ip4_dstAddrMode:
|
case ip4_dstAddrMode:
|
||||||
case ip4_dstAddrCount:
|
case ip4_dstAddrCount:
|
||||||
case ip4_dstAddrMask:
|
case ip4_dstAddrMask:
|
||||||
switch(attrib)
|
|
||||||
{
|
|
||||||
case FieldIsMeta:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -461,6 +573,34 @@ bool Ip4Protocol::setFieldData(int index, const QVariant &value,
|
|||||||
return isOk;
|
return isOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint32 Ip4Protocol::protocolFrameCksum(int streamIndex,
|
||||||
|
CksumType cksumType) const
|
||||||
|
{
|
||||||
|
switch (cksumType)
|
||||||
|
{
|
||||||
|
case CksumIpPseudo:
|
||||||
|
{
|
||||||
|
quint32 sum;
|
||||||
|
|
||||||
|
sum = fieldData(ip4_srcAddr, FieldValue, streamIndex).toUInt() >> 16;
|
||||||
|
sum += fieldData(ip4_srcAddr, FieldValue, streamIndex).toUInt() & 0xFFFF;
|
||||||
|
sum += fieldData(ip4_dstAddr, FieldValue, streamIndex).toUInt() >> 16;
|
||||||
|
sum += fieldData(ip4_dstAddr, FieldValue, streamIndex).toUInt() & 0xFFFF;
|
||||||
|
|
||||||
|
sum += fieldData(ip4_proto, FieldValue, streamIndex).toUInt() & 0x00FF;
|
||||||
|
sum += (fieldData(ip4_totLen, FieldValue, streamIndex).toUInt() & 0xFFFF) - 20;
|
||||||
|
|
||||||
|
// Above calculation done assuming 'big endian'
|
||||||
|
// - so convert to host order
|
||||||
|
//return qFromBigEndian(sum);
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return AbstractProtocol::protocolFrameCksum(streamIndex, cksumType);
|
||||||
|
}
|
||||||
|
|
||||||
QWidget* Ip4Protocol::configWidget()
|
QWidget* Ip4Protocol::configWidget()
|
||||||
{
|
{
|
||||||
@ -469,15 +609,16 @@ QWidget* Ip4Protocol::configWidget()
|
|||||||
|
|
||||||
void Ip4Protocol::loadConfigWidget()
|
void Ip4Protocol::loadConfigWidget()
|
||||||
{
|
{
|
||||||
configForm->leIpVersion->setText(QString().setNum(data.ver_hdrlen() >> 4));
|
|
||||||
configForm->cbIpVersionOverride->setChecked(data.is_override_ver());
|
configForm->cbIpVersionOverride->setChecked(data.is_override_ver());
|
||||||
|
configForm->leIpVersion->setText(fieldData(ip4_ver, FieldValue).toString());
|
||||||
|
|
||||||
configForm->leIpHdrLen->setText(QString().setNum(data.ver_hdrlen() & 0x0F));
|
|
||||||
configForm->cbIpHdrLenOverride->setChecked(data.is_override_hdrlen());
|
configForm->cbIpHdrLenOverride->setChecked(data.is_override_hdrlen());
|
||||||
|
configForm->leIpHdrLen->setText(fieldData(ip4_hdrLen, FieldValue).toString());
|
||||||
|
|
||||||
configForm->leIpTos->setText(uintToHexStr(data.tos(), 1));
|
configForm->leIpTos->setText(uintToHexStr(data.tos(), 1));
|
||||||
configForm->leIpLength->setText(fieldData(ip4_totLen, FieldValue).toString());
|
|
||||||
configForm->cbIpLengthOverride->setChecked(data.is_override_totlen());
|
configForm->cbIpLengthOverride->setChecked(data.is_override_totlen());
|
||||||
|
configForm->leIpLength->setText(fieldData(ip4_totLen, FieldValue).toString());
|
||||||
|
|
||||||
configForm->leIpId->setText(uintToHexStr(data.id(), 2));
|
configForm->leIpId->setText(uintToHexStr(data.id(), 2));
|
||||||
configForm->leIpFragOfs->setText(QString().setNum(data.frag_ofs()));
|
configForm->leIpFragOfs->setText(QString().setNum(data.frag_ofs()));
|
||||||
@ -488,9 +629,9 @@ void Ip4Protocol::loadConfigWidget()
|
|||||||
configForm->leIpProto->setText(uintToHexStr(
|
configForm->leIpProto->setText(uintToHexStr(
|
||||||
fieldData(ip4_proto, FieldValue).toUInt(), 1));
|
fieldData(ip4_proto, FieldValue).toUInt(), 1));
|
||||||
|
|
||||||
|
configForm->cbIpCksumOverride->setChecked(data.is_override_cksum());
|
||||||
configForm->leIpCksum->setText(uintToHexStr(
|
configForm->leIpCksum->setText(uintToHexStr(
|
||||||
fieldData(ip4_cksum, FieldValue).toUInt(), 2));
|
fieldData(ip4_cksum, FieldValue).toUInt(), 2));
|
||||||
configForm->cbIpCksumOverride->setChecked(data.is_override_cksum());
|
|
||||||
|
|
||||||
configForm->leIpSrcAddr->setText(QHostAddress(data.src_ip()).toString());
|
configForm->leIpSrcAddr->setText(QHostAddress(data.src_ip()).toString());
|
||||||
configForm->cmbIpSrcAddrMode->setCurrentIndex(data.src_ip_mode());
|
configForm->cmbIpSrcAddrMode->setCurrentIndex(data.src_ip_mode());
|
||||||
@ -528,8 +669,8 @@ void Ip4Protocol::storeConfigWidget()
|
|||||||
data.set_ttl(configForm->leIpTtl->text().toULong(&isOk));
|
data.set_ttl(configForm->leIpTtl->text().toULong(&isOk));
|
||||||
data.set_proto(configForm->leIpProto->text().remove(QChar(' ')).toULong(&isOk, 16));
|
data.set_proto(configForm->leIpProto->text().remove(QChar(' ')).toULong(&isOk, 16));
|
||||||
|
|
||||||
data.set_cksum(configForm->leIpCksum->text().remove(QChar(' ')).toULong(&isOk));
|
|
||||||
data.set_is_override_cksum(configForm->cbIpCksumOverride->isChecked());
|
data.set_is_override_cksum(configForm->cbIpCksumOverride->isChecked());
|
||||||
|
data.set_cksum(configForm->leIpCksum->text().remove(QChar(' ')).toULong(&isOk));
|
||||||
|
|
||||||
data.set_src_ip(QHostAddress(configForm->leIpSrcAddr->text()).toIPv4Address());
|
data.set_src_ip(QHostAddress(configForm->leIpSrcAddr->text()).toIPv4Address());
|
||||||
data.set_src_ip_mode((OstProto::Ip4_IpAddrMode)configForm->cmbIpSrcAddrMode->currentIndex());
|
data.set_src_ip_mode((OstProto::Ip4_IpAddrMode)configForm->cmbIpSrcAddrMode->currentIndex());
|
||||||
@ -539,5 +680,6 @@ void Ip4Protocol::storeConfigWidget()
|
|||||||
data.set_dst_ip(QHostAddress(configForm->leIpDstAddr->text()).toIPv4Address());
|
data.set_dst_ip(QHostAddress(configForm->leIpDstAddr->text()).toIPv4Address());
|
||||||
data.set_dst_ip_mode((OstProto::Ip4_IpAddrMode)configForm->cmbIpDstAddrMode->currentIndex());
|
data.set_dst_ip_mode((OstProto::Ip4_IpAddrMode)configForm->cmbIpDstAddrMode->currentIndex());
|
||||||
data.set_dst_ip_count(configForm->leIpDstAddrCount->text().toULong(&isOk));
|
data.set_dst_ip_count(configForm->leIpDstAddrCount->text().toULong(&isOk));
|
||||||
|
data.set_dst_ip_mask(QHostAddress(configForm->leIpDstAddrMask->text()).toIPv4Address());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
#include "ip4.pb.h"
|
#include "ip4.pb.h"
|
||||||
#include "ui_ip4.h"
|
#include "ui_ip4.h"
|
||||||
|
|
||||||
#define IP_FLAG_UNUSED 0x1
|
#define IP_FLAG_MF 0x1
|
||||||
#define IP_FLAG_DF 0x2
|
#define IP_FLAG_DF 0x2
|
||||||
#define IP_FLAG_MF 0x4
|
#define IP_FLAG_UNUSED 0x4
|
||||||
|
|
||||||
|
|
||||||
class Ip4ConfigForm : public QWidget, public Ui::ip4
|
class Ip4ConfigForm : public QWidget, public Ui::ip4
|
||||||
@ -74,10 +74,13 @@ public:
|
|||||||
virtual quint32 protocolId(ProtocolIdType type) const;
|
virtual quint32 protocolId(ProtocolIdType type) const;
|
||||||
virtual int fieldCount() const;
|
virtual int fieldCount() const;
|
||||||
|
|
||||||
|
virtual AbstractProtocol::FieldFlags fieldFlags(int index) const;
|
||||||
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex = 0) const;
|
int streamIndex = 0) const;
|
||||||
virtual bool setFieldData(int index, const QVariant &value,
|
virtual bool setFieldData(int index, const QVariant &value,
|
||||||
FieldAttrib attrib = FieldValue);
|
FieldAttrib attrib = FieldValue);
|
||||||
|
virtual quint32 protocolFrameCksum(int streamIndex = 0,
|
||||||
|
CksumType cksumType = CksumIp) const;
|
||||||
|
|
||||||
virtual QWidget* configWidget();
|
virtual QWidget* configWidget();
|
||||||
virtual void loadConfigWidget();
|
virtual void loadConfigWidget();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>504</width>
|
<width>527</width>
|
||||||
<height>296</height>
|
<height>296</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QCheckBox" name="cbIpHdrLenOverride" >
|
<widget class="QCheckBox" name="cbIpHdrLenOverride" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Override Header Length</string>
|
<string>Override Header Length (x4)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -118,7 +118,7 @@
|
|||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QLabel" name="label_25" >
|
<widget class="QLabel" name="label_25" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Fragment Offset</string>
|
<string>Fragment Offset (x8)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -94,26 +94,73 @@ int MacProtocol::fieldCount() const
|
|||||||
return mac_fieldCount;
|
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,
|
QVariant MacProtocol::fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex) const
|
int streamIndex) const
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case mac_dstAddr:
|
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)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Desination");
|
return QString("Desination");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return data.dst_mac();
|
return dstMac;
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QString("%1").arg(data.dst_mac(), 12, BASE_HEX,
|
return uintToHexStr(dstMac, 6);
|
||||||
QChar('0'));
|
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
{
|
{
|
||||||
QByteArray fv;
|
QByteArray fv;
|
||||||
fv.resize(8);
|
fv.resize(8);
|
||||||
qToBigEndian((quint64) data.dst_mac(), (uchar*) fv.data());
|
qToBigEndian(dstMac, (uchar*) fv.data());
|
||||||
fv.remove(0, 2);
|
fv.remove(0, 2);
|
||||||
return fv;
|
return fv;
|
||||||
}
|
}
|
||||||
@ -121,22 +168,44 @@ QVariant MacProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case mac_srcAddr:
|
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)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Source");
|
return QString("Source");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return data.src_mac();
|
return srcMac;
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QString("%1").arg(data.src_mac(), 12, BASE_HEX,
|
return uintToHexStr(srcMac, 6);
|
||||||
QChar('0'));
|
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
{
|
{
|
||||||
QByteArray fv;
|
QByteArray fv;
|
||||||
fv.resize(8);
|
fv.resize(8);
|
||||||
qToBigEndian((quint64) data.src_mac(), (uchar*) fv.data());
|
qToBigEndian(srcMac, (uchar*) fv.data());
|
||||||
fv.remove(0, 2);
|
fv.remove(0, 2);
|
||||||
return fv;
|
return fv;
|
||||||
}
|
}
|
||||||
@ -144,7 +213,7 @@ QVariant MacProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
// Meta fields
|
// Meta fields
|
||||||
case mac_dstMacMode:
|
case mac_dstMacMode:
|
||||||
case mac_dstMacCount:
|
case mac_dstMacCount:
|
||||||
@ -152,15 +221,6 @@ QVariant MacProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
case mac_srcMacMode:
|
case mac_srcMacMode:
|
||||||
case mac_srcMacCount:
|
case mac_srcMacCount:
|
||||||
case mac_srcMacStep:
|
case mac_srcMacStep:
|
||||||
switch(attrib)
|
|
||||||
{
|
|
||||||
case FieldIsMeta:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
|
|
||||||
virtual int fieldCount() const;
|
virtual int fieldCount() const;
|
||||||
|
|
||||||
|
virtual AbstractProtocol::FieldFlags fieldFlags(int index) const;
|
||||||
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex = 0) const;
|
int streamIndex = 0) const;
|
||||||
virtual bool setFieldData(int index, const QVariant &value,
|
virtual bool setFieldData(int index, const QVariant &value,
|
||||||
|
100
common/mac.ui
100
common/mac.ui
@ -5,8 +5,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>423</width>
|
<width>512</width>
|
||||||
<height>144</height>
|
<height>98</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
@ -19,28 +19,14 @@
|
|||||||
<string>MAC</string>
|
<string>MAC</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="2" >
|
<item row="0" column="0" >
|
||||||
<widget class="QLabel" name="label_2" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Mode</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" >
|
<widget class="QLabel" name="label" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Destination</string>
|
<string>Destination</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QLineEdit" name="leDstMac" >
|
<widget class="QLineEdit" name="leDstMac" >
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
<size>
|
<size>
|
||||||
@ -56,7 +42,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<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="QComboBox" name="cmbDstMacMode" >
|
<widget class="QComboBox" name="cmbDstMacMode" >
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
@ -75,7 +68,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3" >
|
<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" >
|
||||||
<widget class="QLineEdit" name="leDstMacCount" >
|
<widget class="QLineEdit" name="leDstMacCount" >
|
||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -88,7 +88,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="4" >
|
<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" >
|
||||||
<widget class="QLineEdit" name="leDstMacStep" >
|
<widget class="QLineEdit" name="leDstMacStep" >
|
||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -101,14 +108,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QLabel" name="label_3" >
|
<widget class="QLabel" name="label_3" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Source </string>
|
<string>Source </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" >
|
<item row="1" column="1" >
|
||||||
<widget class="QLineEdit" name="leSrcMac" >
|
<widget class="QLineEdit" name="leSrcMac" >
|
||||||
<property name="inputMask" >
|
<property name="inputMask" >
|
||||||
<string>>HH HH HH HH HH HH; </string>
|
<string>>HH HH HH HH HH HH; </string>
|
||||||
@ -118,7 +125,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2" >
|
<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" >
|
||||||
<widget class="QComboBox" name="cmbSrcMacMode" >
|
<widget class="QComboBox" name="cmbSrcMacMode" >
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
@ -137,7 +151,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3" >
|
<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" >
|
||||||
<widget class="QLineEdit" name="leSrcMacCount" >
|
<widget class="QLineEdit" name="leSrcMacCount" >
|
||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -147,7 +168,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="4" >
|
<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" >
|
||||||
<widget class="QLineEdit" name="leSrcMacStep" >
|
<widget class="QLineEdit" name="leSrcMacStep" >
|
||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -160,29 +188,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3" >
|
|
||||||
<widget class="QLabel" name="label_4" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Count</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -10,6 +10,7 @@ FORMS += \
|
|||||||
dot3.ui \
|
dot3.ui \
|
||||||
llc.ui \
|
llc.ui \
|
||||||
snap.ui \
|
snap.ui \
|
||||||
|
vlan.ui \
|
||||||
ip4.ui \
|
ip4.ui \
|
||||||
tcp.ui \
|
tcp.ui \
|
||||||
udp.ui
|
udp.ui
|
||||||
@ -21,6 +22,7 @@ PROTOS += \
|
|||||||
dot3.proto \
|
dot3.proto \
|
||||||
llc.proto \
|
llc.proto \
|
||||||
snap.proto \
|
snap.proto \
|
||||||
|
vlan.proto \
|
||||||
ip4.proto \
|
ip4.proto \
|
||||||
tcp.proto \
|
tcp.proto \
|
||||||
udp.proto
|
udp.proto
|
||||||
@ -35,6 +37,7 @@ HEADERS += \
|
|||||||
dot3.h \
|
dot3.h \
|
||||||
llc.h \
|
llc.h \
|
||||||
snap.h \
|
snap.h \
|
||||||
|
vlan.h \
|
||||||
ip4.h \
|
ip4.h \
|
||||||
tcp.h \
|
tcp.h \
|
||||||
udp.h
|
udp.h
|
||||||
@ -49,6 +52,7 @@ SOURCES += \
|
|||||||
dot3.cpp \
|
dot3.cpp \
|
||||||
llc.cpp \
|
llc.cpp \
|
||||||
snap.cpp \
|
snap.cpp \
|
||||||
|
vlan.cpp \
|
||||||
ip4.cpp \
|
ip4.cpp \
|
||||||
tcp.cpp \
|
tcp.cpp \
|
||||||
udp.cpp
|
udp.cpp
|
||||||
|
@ -74,11 +74,36 @@ QString PayloadProtocol::shortName() const
|
|||||||
return QString("DATA");
|
return QString("DATA");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PayloadProtocol::protocolFrameSize() const
|
||||||
|
{
|
||||||
|
return (stream->frame_len() - protocolFrameOffset() - SZ_FCS);
|
||||||
|
}
|
||||||
|
|
||||||
int PayloadProtocol::fieldCount() const
|
int PayloadProtocol::fieldCount() const
|
||||||
{
|
{
|
||||||
return payload_fieldCount;
|
return payload_fieldCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractProtocol::FieldFlags PayloadProtocol::fieldFlags(int index) const
|
||||||
|
{
|
||||||
|
AbstractProtocol::FieldFlags flags;
|
||||||
|
|
||||||
|
flags = AbstractProtocol::fieldFlags(index);
|
||||||
|
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case payload_dataPattern:
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Meta fields
|
||||||
|
case payload_dataPatternMode:
|
||||||
|
flags |= FieldIsMeta;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
QVariant PayloadProtocol::fieldData(int index, FieldAttrib attrib,
|
QVariant PayloadProtocol::fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex) const
|
int streamIndex) const
|
||||||
{
|
{
|
||||||
@ -118,6 +143,7 @@ QVariant PayloadProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
fv[i] = 0xFF - (i % (0xFF + 1));
|
fv[i] = 0xFF - (i % (0xFF + 1));
|
||||||
break;
|
break;
|
||||||
case OstProto::Payload::e_dp_random:
|
case OstProto::Payload::e_dp_random:
|
||||||
|
//! \todo cksum will be incorrect for random pattern
|
||||||
for (int i = 0; i < dataLen; i++)
|
for (int i = 0; i < dataLen; i++)
|
||||||
fv[i] = qrand() % (0xFF + 1);
|
fv[i] = qrand() % (0xFF + 1);
|
||||||
break;
|
break;
|
||||||
@ -136,15 +162,6 @@ QVariant PayloadProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
// Meta fields
|
// Meta fields
|
||||||
|
|
||||||
case payload_dataPatternMode:
|
case payload_dataPatternMode:
|
||||||
switch(attrib)
|
|
||||||
{
|
|
||||||
case FieldIsMeta:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,11 @@ public:
|
|||||||
virtual QString name() const;
|
virtual QString name() const;
|
||||||
virtual QString shortName() const;
|
virtual QString shortName() const;
|
||||||
|
|
||||||
|
virtual int protocolFrameSize() const;
|
||||||
|
|
||||||
virtual int fieldCount() const;
|
virtual int fieldCount() const;
|
||||||
|
|
||||||
|
virtual AbstractProtocol::FieldFlags fieldFlags(int index) const;
|
||||||
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex = 0) const;
|
int streamIndex = 0) const;
|
||||||
virtual bool setFieldData(int index, const QVariant &value,
|
virtual bool setFieldData(int index, const QVariant &value,
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "dot3.h"
|
#include "dot3.h"
|
||||||
#include "llc.h"
|
#include "llc.h"
|
||||||
#include "snap.h"
|
#include "snap.h"
|
||||||
|
#include "vlan.h"
|
||||||
#include "ip4.h"
|
#include "ip4.h"
|
||||||
#include "tcp.h"
|
#include "tcp.h"
|
||||||
#include "udp.h"
|
#include "udp.h"
|
||||||
@ -24,6 +25,7 @@ ProtocolManager::ProtocolManager()
|
|||||||
registerProtocol(122, QString("dot3"), (void*) Dot3Protocol::createInstance);
|
registerProtocol(122, QString("dot3"), (void*) Dot3Protocol::createInstance);
|
||||||
registerProtocol(123, QString("llc"), (void*) LlcProtocol::createInstance);
|
registerProtocol(123, QString("llc"), (void*) LlcProtocol::createInstance);
|
||||||
registerProtocol(124, QString("snap"), (void*) SnapProtocol::createInstance);
|
registerProtocol(124, QString("snap"), (void*) SnapProtocol::createInstance);
|
||||||
|
registerProtocol(126, QString("vlan"), (void*) VlanProtocol::createInstance);
|
||||||
registerProtocol(130, QString("ip4"), (void*) Ip4Protocol::createInstance);
|
registerProtocol(130, QString("ip4"), (void*) Ip4Protocol::createInstance);
|
||||||
registerProtocol(140, QString("tcp"), (void*) TcpProtocol::createInstance);
|
registerProtocol(140, QString("tcp"), (void*) TcpProtocol::createInstance);
|
||||||
registerProtocol(141, QString("udp"), (void*) UdpProtocol::createInstance);
|
registerProtocol(141, QString("udp"), (void*) UdpProtocol::createInstance);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
class ProtocolManager
|
class ProtocolManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//! \todo Make these data structures private/protected
|
||||||
static QMap<QString, int> nameToNumberMap;
|
static QMap<QString, int> nameToNumberMap;
|
||||||
static QMap<int, void*> factory;
|
static QMap<int, void*> factory;
|
||||||
|
|
||||||
|
170
common/sample.cpp
Normal file
170
common/sample.cpp
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
#include <qendian.h>
|
||||||
|
#include <QHostAddress>
|
||||||
|
|
||||||
|
#include "sample.h"
|
||||||
|
|
||||||
|
SampleConfigForm *SampleProtocol::configForm = NULL;
|
||||||
|
|
||||||
|
SampleConfigForm::SampleConfigForm(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
setupUi(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SampleProtocol::SampleProtocol(
|
||||||
|
ProtocolList &frameProtoList,
|
||||||
|
OstProto::StreamCore *parent)
|
||||||
|
: AbstractProtocol(frameProtoList, parent)
|
||||||
|
{
|
||||||
|
if (configForm == NULL)
|
||||||
|
configForm = new SampleConfigForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
SampleProtocol::~SampleProtocol()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractProtocol* SampleProtocol::createInstance(
|
||||||
|
ProtocolList &frameProtoList,
|
||||||
|
OstProto::StreamCore *streamCore)
|
||||||
|
{
|
||||||
|
return new SampleProtocol(frameProtoList, streamCore);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SampleProtocol::protoDataCopyInto(OstProto::Stream &stream)
|
||||||
|
{
|
||||||
|
// FIXME: multiple headers
|
||||||
|
stream.MutableExtension(OstProto::sample)->CopyFrom(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SampleProtocol::protoDataCopyFrom(const OstProto::Stream &stream)
|
||||||
|
{
|
||||||
|
// FIXME: multiple headers
|
||||||
|
if (stream.HasExtension(OstProto::sample))
|
||||||
|
data.MergeFrom(stream.GetExtension(OstProto::sample));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SampleProtocol::name() const
|
||||||
|
{
|
||||||
|
return QString("Sample");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SampleProtocol::shortName() const
|
||||||
|
{
|
||||||
|
return QString("Sample");
|
||||||
|
}
|
||||||
|
|
||||||
|
int SampleProtocol::fieldCount() const
|
||||||
|
{
|
||||||
|
return sample_fieldCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractProtocol::FieldFlags SampleProtocol::fieldFlags(int index) const
|
||||||
|
{
|
||||||
|
AbstractProtocol::FieldFlags flags;
|
||||||
|
|
||||||
|
flags = AbstractProtocol::fieldFlags(index);
|
||||||
|
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case sample_normal:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case sample_cksum:
|
||||||
|
flags |= FieldIsCksum;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case sample_meta:
|
||||||
|
flags |= FieldIsMeta;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant SampleProtocol::fieldData(int index, FieldAttrib attrib,
|
||||||
|
int streamIndex) const
|
||||||
|
{
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case sample_FIXME:
|
||||||
|
{
|
||||||
|
switch(attrib)
|
||||||
|
{
|
||||||
|
case FieldName:
|
||||||
|
return QString("FIXME");
|
||||||
|
case FieldValue:
|
||||||
|
return data.FIXME();
|
||||||
|
case FieldTextValue:
|
||||||
|
return QString("%1").arg(data.FIXME());
|
||||||
|
case FieldFrameValue:
|
||||||
|
return QByteArray(1, (char)(data.FIXME() & 0xF0));
|
||||||
|
case FieldBitSize:
|
||||||
|
return 4;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
case sample_FIXME:
|
||||||
|
{
|
||||||
|
switch(attrib)
|
||||||
|
{
|
||||||
|
case FieldName:
|
||||||
|
return QString("FIXME");
|
||||||
|
case FieldValue:
|
||||||
|
return FIXME;
|
||||||
|
case FieldTextValue:
|
||||||
|
return QString("%1").arg(FIXME);
|
||||||
|
case FieldFrameValue:
|
||||||
|
{
|
||||||
|
QByteArray fv;
|
||||||
|
fv.resize(0);
|
||||||
|
qToBigEndian(FIXME, (uchar*) fv.data());
|
||||||
|
return fv;
|
||||||
|
}
|
||||||
|
return QByteArray(1, (char)(FIXME() & 0xF0));
|
||||||
|
case FieldBitSize:
|
||||||
|
return 4;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Meta fields
|
||||||
|
|
||||||
|
case sample_FIXME:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return AbstractProtocol::fieldData(index, attrib, streamIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SampleProtocol::setFieldData(int index, const QVariant &value,
|
||||||
|
FieldAttrib attrib)
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QWidget* SampleProtocol::configWidget()
|
||||||
|
{
|
||||||
|
return configForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SampleProtocol::loadConfigWidget()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SampleProtocol::storeConfigWidget()
|
||||||
|
{
|
||||||
|
bool isOk;
|
||||||
|
}
|
||||||
|
|
56
common/sample.h
Normal file
56
common/sample.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#ifndef _SAMPLE_H
|
||||||
|
#define _SAMPLE_H
|
||||||
|
|
||||||
|
#include "abstractprotocol.h"
|
||||||
|
|
||||||
|
#include "sample.pb.h"
|
||||||
|
#include "ui_sample.h"
|
||||||
|
|
||||||
|
class SampleConfigForm : public QWidget, public Ui::Sample
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
SampleConfigForm(QWidget *parent = 0);
|
||||||
|
private slots:
|
||||||
|
};
|
||||||
|
|
||||||
|
class SampleProtocol : public AbstractProtocol
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
OstProto::Sample data;
|
||||||
|
static SampleConfigForm *configForm;
|
||||||
|
enum samplefield
|
||||||
|
{
|
||||||
|
|
||||||
|
sample_fieldCount
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
SampleProtocol(ProtocolList &frameProtoList,
|
||||||
|
OstProto::StreamCore *parent = 0);
|
||||||
|
virtual ~SampleProtocol();
|
||||||
|
|
||||||
|
static AbstractProtocol* createInstance(
|
||||||
|
ProtocolList &frameProtoList,
|
||||||
|
OstProto::StreamCore *streamCore = 0);
|
||||||
|
|
||||||
|
virtual void protoDataCopyInto(OstProto::Stream &stream);
|
||||||
|
virtual void protoDataCopyFrom(const OstProto::Stream &stream);
|
||||||
|
|
||||||
|
virtual QString name() const;
|
||||||
|
virtual QString shortName() const;
|
||||||
|
|
||||||
|
virtual int fieldCount() const;
|
||||||
|
|
||||||
|
virtual AbstractProtocol::FieldFlags fieldFlags(int index) const;
|
||||||
|
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
||||||
|
int streamIndex = 0) const;
|
||||||
|
virtual bool setFieldData(int index, const QVariant &value,
|
||||||
|
FieldAttrib attrib = FieldValue);
|
||||||
|
|
||||||
|
virtual QWidget* configWidget();
|
||||||
|
virtual void loadConfigWidget();
|
||||||
|
virtual void storeConfigWidget();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -5,15 +5,15 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>293</width>
|
<width>194</width>
|
||||||
<height>98</height>
|
<height>72</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<item row="0" column="0" >
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
<widget class="QGroupBox" name="groupBox" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>SNAP</string>
|
<string>SNAP</string>
|
||||||
@ -56,32 +56,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
105
common/tcp.cpp
105
common/tcp.cpp
@ -70,6 +70,43 @@ int TcpProtocol::fieldCount() const
|
|||||||
return tcp_fieldCount;
|
return tcp_fieldCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractProtocol::FieldFlags TcpProtocol::fieldFlags(int index) const
|
||||||
|
{
|
||||||
|
AbstractProtocol::FieldFlags flags;
|
||||||
|
|
||||||
|
flags = AbstractProtocol::fieldFlags(index);
|
||||||
|
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case tcp_src_port:
|
||||||
|
case tcp_dst_port:
|
||||||
|
case tcp_seq_num:
|
||||||
|
case tcp_ack_num:
|
||||||
|
case tcp_hdrlen:
|
||||||
|
case tcp_rsvd:
|
||||||
|
case tcp_flags:
|
||||||
|
case tcp_window:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tcp_cksum:
|
||||||
|
flags |= FieldIsCksum;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tcp_urg_ptr:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tcp_is_override_hdrlen:
|
||||||
|
case tcp_is_override_cksum:
|
||||||
|
flags |= FieldIsMeta;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
QVariant TcpProtocol::fieldData(int index, FieldAttrib attrib,
|
QVariant TcpProtocol::fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex) const
|
int streamIndex) const
|
||||||
{
|
{
|
||||||
@ -142,7 +179,7 @@ QVariant TcpProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
switch(attrib)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Sequence Number");
|
return QString("Acknowledgement Number");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return data.ack_num();
|
return data.ack_num();
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
@ -165,11 +202,22 @@ QVariant TcpProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Header Length");
|
return QString("Header Length");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return ((data.hdrlen_rsvd() >> 4) & 0x0F);
|
if (data.is_override_hdrlen())
|
||||||
|
return ((data.hdrlen_rsvd() >> 4) & 0x0F);
|
||||||
|
else
|
||||||
|
return 5;
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QString("%1").arg((data.hdrlen_rsvd() >> 4) & 0x0F);
|
if (data.is_override_hdrlen())
|
||||||
|
return QString("%1 bytes").arg(
|
||||||
|
4 * ((data.hdrlen_rsvd() >> 4) & 0x0F));
|
||||||
|
else
|
||||||
|
return QString("20 bytes");
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
return QByteArray(1, (char)(data.hdrlen_rsvd() & 0xF0));
|
if (data.is_override_hdrlen())
|
||||||
|
return QByteArray(1,
|
||||||
|
(char)((data.hdrlen_rsvd() >> 4) & 0x0F));
|
||||||
|
else
|
||||||
|
return QByteArray(1, (char) 0x05);
|
||||||
case FieldBitSize:
|
case FieldBitSize:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
default:
|
||||||
@ -253,16 +301,43 @@ QVariant TcpProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Checksum");
|
return QString("Checksum");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return data.cksum();
|
{
|
||||||
|
quint16 cksum;
|
||||||
|
|
||||||
|
if (data.is_override_cksum())
|
||||||
|
cksum = data.cksum();
|
||||||
|
else
|
||||||
|
cksum = protocolFrameCksum(streamIndex, CksumTcpUdp);
|
||||||
|
|
||||||
|
return cksum;
|
||||||
|
}
|
||||||
case FieldTextValue:
|
case FieldTextValue:
|
||||||
return QString("%1").arg(data.cksum());
|
{
|
||||||
|
quint16 cksum;
|
||||||
|
|
||||||
|
if (data.is_override_cksum())
|
||||||
|
cksum = data.cksum();
|
||||||
|
else
|
||||||
|
cksum = protocolFrameCksum(streamIndex, CksumTcpUdp);
|
||||||
|
|
||||||
|
return QString("0x%1").arg(cksum, 4, BASE_HEX, QChar('0'));
|
||||||
|
}
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
{
|
{
|
||||||
|
quint16 cksum;
|
||||||
|
|
||||||
|
if (data.is_override_cksum())
|
||||||
|
cksum = data.cksum();
|
||||||
|
else
|
||||||
|
cksum = protocolFrameCksum(streamIndex, CksumTcpUdp);
|
||||||
|
|
||||||
QByteArray fv;
|
QByteArray fv;
|
||||||
fv.resize(2);
|
fv.resize(2);
|
||||||
qToBigEndian((quint16) data.cksum(), (uchar*) fv.data());
|
qToBigEndian(cksum, (uchar*) fv.data());
|
||||||
return fv;
|
return fv;
|
||||||
}
|
}
|
||||||
|
case FieldBitSize:
|
||||||
|
return 16;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -292,15 +367,6 @@ QVariant TcpProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
// Meta fields
|
// Meta fields
|
||||||
case tcp_is_override_hdrlen:
|
case tcp_is_override_hdrlen:
|
||||||
case tcp_is_override_cksum:
|
case tcp_is_override_cksum:
|
||||||
switch(attrib)
|
|
||||||
{
|
|
||||||
case FieldIsMeta:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -329,12 +395,13 @@ void TcpProtocol::loadConfigWidget()
|
|||||||
configForm->leTcpSeqNum->setText(QString().setNum(data.seq_num()));
|
configForm->leTcpSeqNum->setText(QString().setNum(data.seq_num()));
|
||||||
configForm->leTcpAckNum->setText(QString().setNum(data.ack_num()));
|
configForm->leTcpAckNum->setText(QString().setNum(data.ack_num()));
|
||||||
|
|
||||||
configForm->leTcpHdrLen->setText(QString().setNum((data.hdrlen_rsvd() >> 4) & 0x0F));
|
configForm->leTcpHdrLen->setText(fieldData(tcp_hdrlen, FieldValue).toString());
|
||||||
configForm->cbTcpHdrLenOverride->setChecked(data.is_override_hdrlen());
|
configForm->cbTcpHdrLenOverride->setChecked(data.is_override_hdrlen());
|
||||||
|
|
||||||
configForm->leTcpWindow->setText(QString().setNum(data.window()));
|
configForm->leTcpWindow->setText(QString().setNum(data.window()));
|
||||||
|
|
||||||
configForm->leTcpCksum->setText(QString().setNum(data.cksum()));
|
configForm->leTcpCksum->setText(QString("%1").arg(
|
||||||
|
fieldData(tcp_cksum, FieldValue).toUInt(), 4, BASE_HEX, QChar('0')));
|
||||||
configForm->cbTcpCksumOverride->setChecked(data.is_override_cksum());
|
configForm->cbTcpCksumOverride->setChecked(data.is_override_cksum());
|
||||||
|
|
||||||
configForm->leTcpUrgentPointer->setText(QString().setNum(data.urg_ptr()));
|
configForm->leTcpUrgentPointer->setText(QString().setNum(data.urg_ptr()));
|
||||||
@ -363,7 +430,7 @@ void TcpProtocol::storeConfigWidget()
|
|||||||
|
|
||||||
data.set_window(configForm->leTcpWindow->text().toULong(&isOk));
|
data.set_window(configForm->leTcpWindow->text().toULong(&isOk));
|
||||||
|
|
||||||
data.set_cksum(configForm->leTcpCksum->text().remove(QChar(' ')).toULong(&isOk));
|
data.set_cksum(configForm->leTcpCksum->text().remove(QChar(' ')).toULong(&isOk, BASE_HEX));
|
||||||
data.set_is_override_cksum(configForm->cbTcpCksumOverride->isChecked());
|
data.set_is_override_cksum(configForm->cbTcpCksumOverride->isChecked());
|
||||||
|
|
||||||
data.set_urg_ptr(configForm->leTcpUrgentPointer->text().toULong(&isOk));
|
data.set_urg_ptr(configForm->leTcpUrgentPointer->text().toULong(&isOk));
|
||||||
|
13
common/tcp.h
13
common/tcp.h
@ -6,12 +6,12 @@
|
|||||||
#include "tcp.pb.h"
|
#include "tcp.pb.h"
|
||||||
#include "ui_tcp.h"
|
#include "ui_tcp.h"
|
||||||
|
|
||||||
#define TCP_FLAG_URG 0x01
|
#define TCP_FLAG_URG 0x20
|
||||||
#define TCP_FLAG_ACK 0x02
|
#define TCP_FLAG_ACK 0x10
|
||||||
#define TCP_FLAG_PSH 0x04
|
#define TCP_FLAG_PSH 0x08
|
||||||
#define TCP_FLAG_RST 0x08
|
#define TCP_FLAG_RST 0x04
|
||||||
#define TCP_FLAG_SYN 0x10
|
#define TCP_FLAG_SYN 0x02
|
||||||
#define TCP_FLAG_FIN 0x20
|
#define TCP_FLAG_FIN 0x01
|
||||||
|
|
||||||
class TcpConfigForm : public QWidget, public Ui::tcp
|
class TcpConfigForm : public QWidget, public Ui::tcp
|
||||||
{
|
{
|
||||||
@ -62,6 +62,7 @@ public:
|
|||||||
|
|
||||||
virtual int fieldCount() const;
|
virtual int fieldCount() const;
|
||||||
|
|
||||||
|
virtual AbstractProtocol::FieldFlags fieldFlags(int index) const;
|
||||||
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex = 0) const;
|
int streamIndex = 0) const;
|
||||||
virtual bool setFieldData(int index, const QVariant &value,
|
virtual bool setFieldData(int index, const QVariant &value,
|
||||||
|
@ -70,6 +70,35 @@ int UdpProtocol::fieldCount() const
|
|||||||
return udp_fieldCount;
|
return udp_fieldCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractProtocol::FieldFlags UdpProtocol::fieldFlags(int index) const
|
||||||
|
{
|
||||||
|
AbstractProtocol::FieldFlags flags;
|
||||||
|
|
||||||
|
flags = AbstractProtocol::fieldFlags(index);
|
||||||
|
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case udp_srcPort:
|
||||||
|
case udp_dstPort:
|
||||||
|
case udp_totLen:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case udp_cksum:
|
||||||
|
flags |= FieldIsCksum;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case udp_isOverrideTotLen:
|
||||||
|
case udp_isOverrideCksum:
|
||||||
|
flags |= FieldIsMeta;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
QVariant UdpProtocol::fieldData(int index, FieldAttrib attrib,
|
QVariant UdpProtocol::fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex) const
|
int streamIndex) const
|
||||||
{
|
{
|
||||||
@ -160,26 +189,49 @@ QVariant UdpProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case udp_cksum:
|
case udp_cksum:
|
||||||
|
{
|
||||||
|
quint16 cksum;
|
||||||
|
|
||||||
|
switch(attrib)
|
||||||
|
{
|
||||||
|
case FieldValue:
|
||||||
|
case FieldFrameValue:
|
||||||
|
case FieldTextValue:
|
||||||
|
{
|
||||||
|
if (data.is_override_cksum())
|
||||||
|
cksum = data.cksum();
|
||||||
|
else
|
||||||
|
cksum = protocolFrameCksum(streamIndex, CksumTcpUdp);
|
||||||
|
qDebug("UDP cksum = %hu", cksum);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch(attrib)
|
switch(attrib)
|
||||||
{
|
{
|
||||||
case FieldName:
|
case FieldName:
|
||||||
return QString("Checksum");
|
return QString("Checksum");
|
||||||
case FieldValue:
|
case FieldValue:
|
||||||
return data.cksum();
|
return cksum;
|
||||||
case FieldTextValue:
|
|
||||||
return QString("%1").arg(data.cksum());
|
|
||||||
case FieldFrameValue:
|
case FieldFrameValue:
|
||||||
{
|
{
|
||||||
QByteArray fv;
|
QByteArray fv;
|
||||||
|
|
||||||
fv.resize(2);
|
fv.resize(2);
|
||||||
qToBigEndian((quint16) data.cksum(), (uchar*) fv.data());
|
qToBigEndian(cksum, (uchar*) fv.data());
|
||||||
return fv;
|
return fv;
|
||||||
}
|
}
|
||||||
|
case FieldTextValue:
|
||||||
|
return QString("0x%1").
|
||||||
|
arg(cksum, 4, BASE_HEX, QChar('0'));;
|
||||||
|
case FieldBitSize:
|
||||||
|
return 16;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
// Meta fields
|
// Meta fields
|
||||||
case udp_isOverrideTotLen:
|
case udp_isOverrideTotLen:
|
||||||
case udp_isOverrideCksum:
|
case udp_isOverrideCksum:
|
||||||
@ -214,13 +266,14 @@ QWidget* UdpProtocol::configWidget()
|
|||||||
|
|
||||||
void UdpProtocol::loadConfigWidget()
|
void UdpProtocol::loadConfigWidget()
|
||||||
{
|
{
|
||||||
configForm->leUdpSrcPort->setText(QString().setNum(data.src_port()));
|
configForm->leUdpSrcPort->setText(fieldData(udp_srcPort, FieldValue).toString());
|
||||||
configForm->leUdpDstPort->setText(QString().setNum(data.dst_port()));
|
configForm->leUdpDstPort->setText(fieldData(udp_dstPort, FieldValue).toString());
|
||||||
|
|
||||||
configForm->leUdpLength->setText(QString().setNum(data.totlen()));
|
configForm->leUdpLength->setText(fieldData(udp_totLen, FieldValue).toString());
|
||||||
configForm->cbUdpLengthOverride->setChecked(data.is_override_totlen());
|
configForm->cbUdpLengthOverride->setChecked(data.is_override_totlen());
|
||||||
|
|
||||||
configForm->leUdpCksum->setText(QString().setNum(data.cksum()));
|
configForm->leUdpCksum->setText(QString("%1").arg(
|
||||||
|
fieldData(udp_cksum, FieldValue).toUInt(), 4, BASE_HEX, QChar('0')));
|
||||||
configForm->cbUdpCksumOverride->setChecked(data.is_override_cksum());
|
configForm->cbUdpCksumOverride->setChecked(data.is_override_cksum());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +287,7 @@ void UdpProtocol::storeConfigWidget()
|
|||||||
data.set_totlen(configForm->leUdpLength->text().toULong(&isOk));
|
data.set_totlen(configForm->leUdpLength->text().toULong(&isOk));
|
||||||
data.set_is_override_totlen(configForm->cbUdpLengthOverride->isChecked());
|
data.set_is_override_totlen(configForm->cbUdpLengthOverride->isChecked());
|
||||||
|
|
||||||
data.set_cksum(configForm->leUdpCksum->text().remove(QChar(' ')).toULong(&isOk));
|
data.set_cksum(configForm->leUdpCksum->text().remove(QChar(' ')).toULong(&isOk, BASE_HEX));
|
||||||
data.set_is_override_cksum(configForm->cbUdpCksumOverride->isChecked());
|
data.set_is_override_cksum(configForm->cbUdpCksumOverride->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
|
|
||||||
virtual int fieldCount() const;
|
virtual int fieldCount() const;
|
||||||
|
|
||||||
|
virtual AbstractProtocol::FieldFlags fieldFlags(int index) const;
|
||||||
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
||||||
int streamIndex = 0) const;
|
int streamIndex = 0) const;
|
||||||
virtual bool setFieldData(int index, const QVariant &value,
|
virtual bool setFieldData(int index, const QVariant &value,
|
||||||
|
229
common/vlan.cpp
Normal file
229
common/vlan.cpp
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
#include <qendian.h>
|
||||||
|
|
||||||
|
#include "vlan.h"
|
||||||
|
|
||||||
|
VlanConfigForm *VlanProtocol::configForm = NULL;
|
||||||
|
|
||||||
|
VlanConfigForm::VlanConfigForm(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
VlanProtocol::VlanProtocol(
|
||||||
|
ProtocolList &frameProtoList,
|
||||||
|
OstProto::StreamCore *parent)
|
||||||
|
: AbstractProtocol(frameProtoList, parent)
|
||||||
|
{
|
||||||
|
if (configForm == NULL)
|
||||||
|
configForm = new VlanConfigForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
VlanProtocol::~VlanProtocol()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractProtocol* VlanProtocol::createInstance(
|
||||||
|
ProtocolList &frameProtoList,
|
||||||
|
OstProto::StreamCore *streamCore)
|
||||||
|
{
|
||||||
|
return new VlanProtocol(frameProtoList, streamCore);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VlanProtocol::protoDataCopyInto(OstProto::Stream &stream)
|
||||||
|
{
|
||||||
|
// FIXME: multiple headers
|
||||||
|
stream.MutableExtension(OstProto::vlan)->CopyFrom(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VlanProtocol::protoDataCopyFrom(const OstProto::Stream &stream)
|
||||||
|
{
|
||||||
|
// FIXME: multiple headers
|
||||||
|
if (stream.HasExtension(OstProto::vlan))
|
||||||
|
data.MergeFrom(stream.GetExtension(OstProto::vlan));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString VlanProtocol::name() const
|
||||||
|
{
|
||||||
|
return QString("Vlan");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString VlanProtocol::shortName() const
|
||||||
|
{
|
||||||
|
return QString("Vlan");
|
||||||
|
}
|
||||||
|
|
||||||
|
int VlanProtocol::fieldCount() const
|
||||||
|
{
|
||||||
|
return vlan_fieldCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractProtocol::FieldFlags VlanProtocol::fieldFlags(int index) const
|
||||||
|
{
|
||||||
|
AbstractProtocol::FieldFlags flags;
|
||||||
|
|
||||||
|
flags = AbstractProtocol::fieldFlags(index);
|
||||||
|
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case vlan_tpid:
|
||||||
|
case vlan_prio:
|
||||||
|
case vlan_cfiDei:
|
||||||
|
case vlan_vlanId:
|
||||||
|
break;
|
||||||
|
|
||||||
|
// meta-fields
|
||||||
|
case vlan_isOverrideTpid:
|
||||||
|
flags |= FieldIsMeta;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant VlanProtocol::fieldData(int index, FieldAttrib attrib,
|
||||||
|
int streamIndex) const
|
||||||
|
{
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case vlan_tpid:
|
||||||
|
{
|
||||||
|
quint16 tpid;
|
||||||
|
|
||||||
|
tpid = data.is_override_tpid() ? data.tpid() : 0x8100;
|
||||||
|
|
||||||
|
switch(attrib)
|
||||||
|
{
|
||||||
|
case FieldName:
|
||||||
|
return QString("Tag Protocol Id");
|
||||||
|
case FieldValue:
|
||||||
|
return tpid;
|
||||||
|
case FieldTextValue:
|
||||||
|
return QString("0x%1").arg(tpid, 2, BASE_HEX, QChar('0'));
|
||||||
|
case FieldFrameValue:
|
||||||
|
{
|
||||||
|
QByteArray fv;
|
||||||
|
fv.resize(2);
|
||||||
|
qToBigEndian(tpid, (uchar*) fv.data());
|
||||||
|
return fv;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case vlan_prio:
|
||||||
|
{
|
||||||
|
uint prio = ((data.vlan_tag() >> 13) & 0x07);
|
||||||
|
|
||||||
|
switch(attrib)
|
||||||
|
{
|
||||||
|
case FieldName:
|
||||||
|
return QString("Priority");
|
||||||
|
case FieldValue:
|
||||||
|
return prio;
|
||||||
|
case FieldTextValue:
|
||||||
|
return QString("%1").arg(prio);
|
||||||
|
case FieldFrameValue:
|
||||||
|
return QByteArray(1, (char) prio);
|
||||||
|
case FieldBitSize:
|
||||||
|
return 3;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case vlan_cfiDei:
|
||||||
|
{
|
||||||
|
uint cfiDei = ((data.vlan_tag() >> 12) & 0x01);
|
||||||
|
|
||||||
|
switch(attrib)
|
||||||
|
{
|
||||||
|
case FieldName:
|
||||||
|
return QString("CFI/DEI");
|
||||||
|
case FieldValue:
|
||||||
|
return cfiDei;
|
||||||
|
case FieldTextValue:
|
||||||
|
return QString("%1").arg(cfiDei);
|
||||||
|
case FieldFrameValue:
|
||||||
|
return QByteArray(1, (char) cfiDei);
|
||||||
|
case FieldBitSize:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case vlan_vlanId:
|
||||||
|
{
|
||||||
|
quint16 vlanId = (data.vlan_tag() & 0x0FFF);
|
||||||
|
|
||||||
|
switch(attrib)
|
||||||
|
{
|
||||||
|
case FieldName:
|
||||||
|
return QString("VLAN Id");
|
||||||
|
case FieldValue:
|
||||||
|
return vlanId;
|
||||||
|
case FieldTextValue:
|
||||||
|
return QString("%1").arg(vlanId);
|
||||||
|
case FieldFrameValue:
|
||||||
|
{
|
||||||
|
QByteArray fv;
|
||||||
|
fv.resize(2);
|
||||||
|
qToBigEndian((quint16) vlanId, (uchar*) fv.data());
|
||||||
|
return fv;
|
||||||
|
}
|
||||||
|
case FieldBitSize:
|
||||||
|
return 12;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Meta fields
|
||||||
|
|
||||||
|
case vlan_isOverrideTpid:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return AbstractProtocol::fieldData(index, attrib, streamIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VlanProtocol::setFieldData(int index, const QVariant &value,
|
||||||
|
FieldAttrib attrib)
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QWidget* VlanProtocol::configWidget()
|
||||||
|
{
|
||||||
|
return configForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VlanProtocol::loadConfigWidget()
|
||||||
|
{
|
||||||
|
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());
|
||||||
|
configForm->leVlanId->setText(fieldData(vlan_vlanId, FieldValue).toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void VlanProtocol::storeConfigWidget()
|
||||||
|
{
|
||||||
|
bool isOk;
|
||||||
|
|
||||||
|
data.set_is_override_tpid(configForm->cbTpidOverride->isChecked());
|
||||||
|
data.set_tpid(configForm->leTpid->text().remove(QChar(' ')).toULong(&isOk, BASE_HEX));
|
||||||
|
data.set_vlan_tag(
|
||||||
|
((configForm->cmbPrio->currentIndex() & 0x07) << 13) |
|
||||||
|
((configForm->cmbCfiDei->currentIndex() & 0x01) << 12) |
|
||||||
|
(configForm->leVlanId->text().toULong(&isOk) & 0x0FFF));
|
||||||
|
}
|
||||||
|
|
62
common/vlan.h
Normal file
62
common/vlan.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#ifndef _Vlan_H
|
||||||
|
#define _Vlan_H
|
||||||
|
|
||||||
|
#include "abstractprotocol.h"
|
||||||
|
|
||||||
|
#include "vlan.pb.h"
|
||||||
|
#include "ui_vlan.h"
|
||||||
|
|
||||||
|
class VlanConfigForm : public QWidget, public Ui::Vlan
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
VlanConfigForm(QWidget *parent = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
class VlanProtocol : public AbstractProtocol
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
OstProto::Vlan data;
|
||||||
|
static VlanConfigForm *configForm;
|
||||||
|
enum Vlanfield
|
||||||
|
{
|
||||||
|
vlan_tpid,
|
||||||
|
vlan_prio,
|
||||||
|
vlan_cfiDei,
|
||||||
|
vlan_vlanId,
|
||||||
|
|
||||||
|
// meta-fields
|
||||||
|
vlan_isOverrideTpid,
|
||||||
|
|
||||||
|
vlan_fieldCount
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
VlanProtocol(ProtocolList &frameProtoList,
|
||||||
|
OstProto::StreamCore *parent = 0);
|
||||||
|
virtual ~VlanProtocol();
|
||||||
|
|
||||||
|
static AbstractProtocol* createInstance(
|
||||||
|
ProtocolList &frameProtoList,
|
||||||
|
OstProto::StreamCore *streamCore = 0);
|
||||||
|
|
||||||
|
virtual void protoDataCopyInto(OstProto::Stream &stream);
|
||||||
|
virtual void protoDataCopyFrom(const OstProto::Stream &stream);
|
||||||
|
|
||||||
|
virtual QString name() const;
|
||||||
|
virtual QString shortName() const;
|
||||||
|
|
||||||
|
virtual int fieldCount() const;
|
||||||
|
|
||||||
|
virtual AbstractProtocol::FieldFlags fieldFlags(int index) const;
|
||||||
|
virtual QVariant fieldData(int index, FieldAttrib attrib,
|
||||||
|
int streamIndex = 0) const;
|
||||||
|
virtual bool setFieldData(int index, const QVariant &value,
|
||||||
|
FieldAttrib attrib = FieldValue);
|
||||||
|
|
||||||
|
virtual QWidget* configWidget();
|
||||||
|
virtual void loadConfigWidget();
|
||||||
|
virtual void storeConfigWidget();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -3,13 +3,11 @@ import "protocol.proto";
|
|||||||
package OstProto;
|
package OstProto;
|
||||||
message Vlan {
|
message Vlan {
|
||||||
// VLAN presence/absence
|
// VLAN presence/absence
|
||||||
optional bool is_tpid_override = 10;
|
optional bool is_override_tpid = 1;
|
||||||
|
|
||||||
// VLAN values
|
// VLAN values
|
||||||
optional uint32 ctpid = 13;
|
optional uint32 tpid = 2;
|
||||||
optional uint32 cvlan_tag = 14; // includes prio, cfi and cvlanid
|
optional uint32 vlan_tag = 3; // includes prio, cfi and vlanid
|
||||||
optional uint32 stpid = 15;
|
|
||||||
optional uint32 svlan_tag = 16; // includes pcp, de and svlanid
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extend Stream {
|
extend Stream {
|
||||||
|
311
common/vlan.ui
311
common/vlan.ui
@ -1,168 +1,179 @@
|
|||||||
<ui version="4.0" >
|
<ui version="4.0" >
|
||||||
<class>Form</class>
|
<class>Vlan</class>
|
||||||
<widget class="QWidget" name="Form" >
|
<widget class="QWidget" name="Vlan" >
|
||||||
<property name="geometry" >
|
<property name="geometry" >
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>271</width>
|
<width>268</width>
|
||||||
<height>90</height>
|
<height>96</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<item row="0" column="0" >
|
<property name="spacing" >
|
||||||
<layout class="QGridLayout" >
|
<number>6</number>
|
||||||
<item row="0" column="0" >
|
</property>
|
||||||
<widget class="QLabel" name="label_9" >
|
<property name="leftMargin" >
|
||||||
<property name="text" >
|
<number>9</number>
|
||||||
<string>Priority</string>
|
</property>
|
||||||
</property>
|
<property name="topMargin" >
|
||||||
</widget>
|
<number>9</number>
|
||||||
</item>
|
</property>
|
||||||
<item row="0" column="1" >
|
<property name="rightMargin" >
|
||||||
<widget class="QLabel" name="label_8" >
|
<number>9</number>
|
||||||
<property name="text" >
|
</property>
|
||||||
<string>CFI</string>
|
<property name="bottomMargin" >
|
||||||
</property>
|
<number>9</number>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<item>
|
||||||
<item row="0" column="2" >
|
<widget class="QGroupBox" name="groupBox" >
|
||||||
<widget class="QLabel" name="label_10" >
|
<property name="title" >
|
||||||
<property name="text" >
|
<string>VLAN</string>
|
||||||
<string>VLAN</string>
|
</property>
|
||||||
</property>
|
<layout class="QGridLayout" >
|
||||||
</widget>
|
<item row="0" column="0" >
|
||||||
</item>
|
<widget class="QCheckBox" name="cbTpidOverride" >
|
||||||
<item row="0" column="3" >
|
<property name="enabled" >
|
||||||
<widget class="QCheckBox" name="cbCvlanTpidOverride" >
|
<bool>true</bool>
|
||||||
<property name="enabled" >
|
</property>
|
||||||
<bool>true</bool>
|
<property name="text" >
|
||||||
</property>
|
<string>Override TPID</string>
|
||||||
<property name="text" >
|
</property>
|
||||||
<string>Override TPID</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="0" column="1" >
|
||||||
</item>
|
<widget class="QLabel" name="label_9" >
|
||||||
<item row="1" column="0" >
|
<property name="text" >
|
||||||
<widget class="QComboBox" name="cmbCvlanPrio" >
|
<string>Priority</string>
|
||||||
<property name="enabled" >
|
</property>
|
||||||
<bool>true</bool>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<item>
|
<item row="0" column="2" >
|
||||||
|
<widget class="QLabel" name="label_8" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>CFI/DEI</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3" >
|
||||||
|
<widget class="QLabel" name="label_10" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>VLAN</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="QLineEdit" name="leTpid" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="inputMask" >
|
||||||
|
<string>>HH HH; </string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string> </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QComboBox" name="cmbPrio" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>2</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>3</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>4</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>5</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>6</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>7</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" >
|
||||||
|
<widget class="QComboBox" name="cmbCfiDei" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3" >
|
||||||
|
<widget class="QLineEdit" name="leVlanId" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>0</string>
|
<string>0</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<property name="text" >
|
</layout>
|
||||||
<string>1</string>
|
</widget>
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>3</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>4</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>5</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>6</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>7</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" >
|
|
||||||
<widget class="QComboBox" name="cmbCvlanCfi" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2" >
|
|
||||||
<widget class="QLineEdit" name="leCvlanId" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3" >
|
|
||||||
<widget class="QLineEdit" name="leCvlanTpid" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="inputMask" >
|
|
||||||
<string>>HH HH; </string>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string> </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>cbTpidOverride</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>leTpid</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel" >
|
||||||
|
<x>59</x>
|
||||||
|
<y>41</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel" >
|
||||||
|
<x>59</x>
|
||||||
|
<y>57</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
Reference in New Issue
Block a user