2008-05-03 09:37:10 -05:00
|
|
|
#include <QHostAddress>
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
#include "streamconfigdialog.h"
|
|
|
|
#include "stream.h"
|
2009-08-02 09:52:34 -05:00
|
|
|
#include "abstractprotocol.h"
|
|
|
|
#include "protocollistiterator.h"
|
2008-05-03 09:37:10 -05:00
|
|
|
|
2008-05-25 06:30:30 -05:00
|
|
|
#include "modeltest.h"
|
|
|
|
|
2009-08-02 09:52:34 -05:00
|
|
|
// FIXME(HI) - remove
|
|
|
|
#include "../common/protocolmanager.h"
|
|
|
|
extern ProtocolManager OstProtocolManager;
|
|
|
|
|
2009-04-05 02:19:37 -05:00
|
|
|
int StreamConfigDialog::lastTopLevelTabIndex = 0;
|
|
|
|
|
2008-08-23 23:39:08 -05:00
|
|
|
StreamConfigDialog::StreamConfigDialog(Port &port, uint streamIndex,
|
|
|
|
QWidget *parent) : QDialog (parent), mPort(port)
|
2008-05-03 09:37:10 -05:00
|
|
|
{
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
OstProto::Stream s;
|
2009-04-27 11:51:44 -05:00
|
|
|
mCurrentStreamIndex = streamIndex;
|
|
|
|
mpStream = new Stream;
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
mPort.streamByIndex(mCurrentStreamIndex)->protoDataCopyInto(s);
|
|
|
|
mpStream->protoDataCopyFrom(s);
|
2009-08-02 09:52:34 -05:00
|
|
|
_iter = mpStream->createProtocolListIterator();
|
2009-09-23 09:53:26 -05:00
|
|
|
isUpdateInProgress = false;
|
2009-04-27 11:51:44 -05:00
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
setupUi(this);
|
|
|
|
setupUiExtra();
|
2008-10-05 12:07:33 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
connect(bgL1Proto, SIGNAL(buttonClicked(int)),
|
|
|
|
this, SLOT(updateL1Protocol(int)));
|
|
|
|
connect(bgL2Proto, SIGNAL(buttonClicked(int)),
|
2009-09-23 09:53:26 -05:00
|
|
|
this, SLOT(updateFrameTypeProtocol(int)));
|
|
|
|
connect(bgVlan, SIGNAL(buttonClicked(int)),
|
|
|
|
this, SLOT(updateVlanProtocol(int)));
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
connect(bgL3Proto, SIGNAL(buttonClicked(int)),
|
2009-09-23 09:53:26 -05:00
|
|
|
this, SLOT(updateL3Protocol(int)));
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
connect(bgL4Proto, SIGNAL(buttonClicked(int)),
|
2009-09-23 09:53:26 -05:00
|
|
|
this, SLOT(updateL4Protocol(int)));
|
|
|
|
connect(bgPayloadProto, SIGNAL(buttonClicked(int)),
|
|
|
|
this, SLOT(updatePayloadProtocol(int)));
|
|
|
|
|
2009-05-24 09:54:11 -05:00
|
|
|
//! \todo causes a crash!
|
|
|
|
#if 0
|
|
|
|
connect(lePktLen, SIGNAL(textEdited(QString)),
|
|
|
|
this, SLOT(updateContents()));
|
|
|
|
#endif
|
|
|
|
|
2008-09-28 13:01:52 -05:00
|
|
|
// Time to play match the signals and slots!
|
2009-05-24 09:54:11 -05:00
|
|
|
|
|
|
|
// Enable VLAN Choices only if FT = Eth2 or SNAP
|
2009-10-11 01:07:27 -05:00
|
|
|
#if 0
|
2009-05-24 09:54:11 -05:00
|
|
|
connect(rbFtNone, SIGNAL(toggled(bool)), gbVlan, SLOT(setDisabled(bool)));
|
2009-09-23 09:53:26 -05:00
|
|
|
connect(rbFtOther, SIGNAL(toggled(bool)), gbVlan, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbFtNone, SIGNAL(clicked(bool)), rbVlanNone, SLOT(click()));
|
2009-10-11 01:07:27 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Force all protocols = None if L1 = None
|
|
|
|
connect(rbL1None, SIGNAL(clicked(bool)), rbVlanNone, SLOT(click()));
|
|
|
|
connect(rbL1None, SIGNAL(clicked(bool)), rbFtNone, SLOT(click()));
|
|
|
|
connect(rbL1None, SIGNAL(clicked(bool)), rbPayloadNone, SLOT(click()));
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
connect(rbFtNone, SIGNAL(clicked(bool)), rbL3None, SLOT(click()));
|
2008-09-28 13:01:52 -05:00
|
|
|
|
2008-10-05 12:07:33 -05:00
|
|
|
// Enable/Disable L3 Protocol Choices for FT None
|
|
|
|
connect(rbFtNone, SIGNAL(toggled(bool)), rbL3None, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbFtNone, SIGNAL(toggled(bool)), rbL3Ipv4, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbFtNone, SIGNAL(toggled(bool)), rbL3Arp, SLOT(setDisabled(bool)));
|
|
|
|
|
|
|
|
// Enable/Disable L3 Protocol Choices for FT Ethernet2
|
|
|
|
connect(rbFtEthernet2, SIGNAL(toggled(bool)), rbL3None, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbFtEthernet2, SIGNAL(toggled(bool)), rbL3Ipv4, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbFtEthernet2, SIGNAL(toggled(bool)), rbL3Arp, SLOT(setEnabled(bool)));
|
|
|
|
|
|
|
|
// Force L3 = None if FT = 802.3 Raw
|
2009-09-23 09:53:26 -05:00
|
|
|
connect(rbFt802Dot3Raw, SIGNAL(clicked(bool)), rbL3None, SLOT(click()));
|
2008-10-05 12:07:33 -05:00
|
|
|
|
|
|
|
// Enable/Disable L3 Protocol Choices for FT 802Dot3Raw
|
|
|
|
connect(rbFt802Dot3Raw, SIGNAL(toggled(bool)), rbL3None, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbFt802Dot3Raw, SIGNAL(toggled(bool)), rbL3Ipv4, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbFt802Dot3Raw, SIGNAL(toggled(bool)), rbL3Arp, SLOT(setDisabled(bool)));
|
|
|
|
|
|
|
|
// Force L3 = None if FT = 802.3 LLC (to ensure a valid L3 is selected)
|
2009-09-23 09:53:26 -05:00
|
|
|
connect(rbFt802Dot3Llc, SIGNAL(clicked(bool)), rbL3None, SLOT(click()));
|
2008-10-05 12:07:33 -05:00
|
|
|
|
|
|
|
// Enable/Disable L3 Protocol Choices for FT 802Dot3Llc
|
|
|
|
connect(rbFt802Dot3Llc, SIGNAL(toggled(bool)), rbL3None, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbFt802Dot3Llc, SIGNAL(toggled(bool)), rbL3Ipv4, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbFt802Dot3Llc, SIGNAL(toggled(bool)), rbL3Arp, SLOT(setDisabled(bool)));
|
|
|
|
|
|
|
|
// Enable/Disable L3 Protocol Choices for FT 802.3 LLC SNAP
|
|
|
|
connect(rbFtLlcSnap, SIGNAL(toggled(bool)), rbL3None, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbFtLlcSnap, SIGNAL(toggled(bool)), rbL3Ipv4, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbFtLlcSnap, SIGNAL(toggled(bool)), rbL3Arp, SLOT(setEnabled(bool)));
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
// Force L3 = Other if FT = Other
|
|
|
|
connect(rbFtOther, SIGNAL(toggled(bool)), rbL3Other, SLOT(setChecked(bool)));
|
|
|
|
connect(rbFtOther, SIGNAL(toggled(bool)), gbL3Proto, SLOT(setDisabled(bool)));
|
|
|
|
|
2008-09-28 13:01:52 -05:00
|
|
|
// Enable/Disable L4 Protocol Choices for L3 Protocol None
|
|
|
|
connect(rbL3None, SIGNAL(toggled(bool)), rbL4None, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbL3None, SIGNAL(toggled(bool)), rbL4Icmp, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbL3None, SIGNAL(toggled(bool)), rbL4Igmp, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbL3None, SIGNAL(toggled(bool)), rbL4Tcp, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbL3None, SIGNAL(toggled(bool)), rbL4Udp, SLOT(setDisabled(bool)));
|
|
|
|
|
|
|
|
// Force L4 Protocol = None if L3 Protocol is set to None
|
2009-09-23 09:53:26 -05:00
|
|
|
connect(rbL3None, SIGNAL(clicked(bool)), rbL4None, SLOT(click()));
|
2008-09-28 13:01:52 -05:00
|
|
|
|
|
|
|
// Enable/Disable L4 Protocol Choices for L3 Protocol IPv4
|
|
|
|
connect(rbL3Ipv4, SIGNAL(toggled(bool)), rbL4None, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbL3Ipv4, SIGNAL(toggled(bool)), rbL4Icmp, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbL3Ipv4, SIGNAL(toggled(bool)), rbL4Igmp, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbL3Ipv4, SIGNAL(toggled(bool)), rbL4Tcp, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbL3Ipv4, SIGNAL(toggled(bool)), rbL4Udp, SLOT(setEnabled(bool)));
|
|
|
|
|
|
|
|
// Enable/Disable L4 Protocol Choices for L3 Protocol ARP
|
|
|
|
connect(rbL3Arp, SIGNAL(toggled(bool)), rbL4None, SLOT(setEnabled(bool)));
|
|
|
|
connect(rbL3Arp, SIGNAL(toggled(bool)), rbL4Icmp, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbL3Arp, SIGNAL(toggled(bool)), rbL4Igmp, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbL3Arp, SIGNAL(toggled(bool)), rbL4Tcp, SLOT(setDisabled(bool)));
|
|
|
|
connect(rbL3Arp, SIGNAL(toggled(bool)), rbL4Udp, SLOT(setDisabled(bool)));
|
|
|
|
|
|
|
|
// Force L4 Protocol = None if L3 Protocol is set to ARP
|
2009-09-23 09:53:26 -05:00
|
|
|
connect(rbL3Arp, SIGNAL(clicked(bool)), rbL4None, SLOT(click()));
|
|
|
|
|
|
|
|
// Force L4 = Other if L3 = Other
|
|
|
|
connect(rbL3Other, SIGNAL(toggled(bool)), rbL4Other, SLOT(setChecked(bool)));
|
|
|
|
connect(rbL3Other, SIGNAL(toggled(bool)), gbL4Proto, SLOT(setDisabled(bool)));
|
|
|
|
|
|
|
|
// Force Payload = Other if L4 = Other
|
|
|
|
connect(rbL4Other, SIGNAL(toggled(bool)), rbPayloadOther, SLOT(setChecked(bool)));
|
|
|
|
connect(rbL4Other, SIGNAL(toggled(bool)), gbPayloadProto, SLOT(setDisabled(bool)));
|
2008-09-28 13:01:52 -05:00
|
|
|
|
2009-08-02 09:52:34 -05:00
|
|
|
mpAvailableProtocolsModel = new QStringListModel(
|
|
|
|
OstProtocolManager.protocolDatabase(), this);
|
|
|
|
lvAllProtocols->setModel(mpAvailableProtocolsModel);
|
2009-09-23 09:53:26 -05:00
|
|
|
mpSelectedProtocolsModel = new QStringListModel(this);
|
|
|
|
lvSelectedProtocols->setModel(mpSelectedProtocolsModel);
|
|
|
|
|
|
|
|
|
|
|
|
connect(lvAllProtocols->selectionModel(),
|
|
|
|
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
|
|
|
|
this, SLOT(when_lvAllProtocols_selectionChanged(
|
|
|
|
const QItemSelection&, const QItemSelection&)));
|
|
|
|
connect(lvSelectedProtocols->selectionModel(),
|
|
|
|
SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
|
|
|
|
this, SLOT(when_lvSelectedProtocols_currentChanged(const QModelIndex&,
|
|
|
|
const QModelIndex&)));
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
LoadCurrentStream();
|
2009-08-02 09:52:34 -05:00
|
|
|
mpPacketModel = new PacketModel(this);
|
2008-05-25 06:30:30 -05:00
|
|
|
tvPacketTree->setModel(mpPacketModel);
|
|
|
|
mpPacketModelTester = new ModelTest(mpPacketModel);
|
|
|
|
tvPacketTree->header()->hide();
|
2008-08-30 03:49:08 -05:00
|
|
|
vwPacketDump->setModel(mpPacketModel);
|
|
|
|
vwPacketDump->setSelectionModel(tvPacketTree->selectionModel());
|
2008-05-03 09:37:10 -05:00
|
|
|
|
2008-09-28 13:01:52 -05:00
|
|
|
// TODO(MED):
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
//! \todo Implement then enable these protocols - ARP, IPv6, ICMP, IGMP
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
rbL3Arp->setHidden(true);
|
2009-05-24 09:54:11 -05:00
|
|
|
rbL3Ipv6->setHidden(true);
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
rbL4Icmp->setHidden(true);
|
|
|
|
rbL4Igmp->setHidden(true);
|
2008-09-28 13:01:52 -05:00
|
|
|
//! \todo Enable navigation of streams
|
2008-08-23 23:39:08 -05:00
|
|
|
pbPrev->setDisabled(true);
|
|
|
|
pbNext->setDisabled(true);
|
2008-09-28 13:01:52 -05:00
|
|
|
//! \todo Support Goto Stream Id
|
2009-03-10 11:48:03 -05:00
|
|
|
leStreamId->setDisabled(true);
|
|
|
|
disconnect(rbActionGotoStream, SIGNAL(toggled(bool)), leStreamId, SLOT(setEnabled(bool)));
|
2008-09-28 13:01:52 -05:00
|
|
|
//! \todo Support Continuous Mode
|
|
|
|
rbModeContinuous->setDisabled(true);
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
|
2009-04-05 02:19:37 -05:00
|
|
|
// Finally, restore the saved last selected tab for the various tab widgets
|
|
|
|
twTopLevel->setCurrentIndex(lastTopLevelTabIndex);
|
2008-05-03 09:37:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void StreamConfigDialog::setupUiExtra()
|
|
|
|
{
|
|
|
|
QRegExp reHex2B("[0-9,a-f,A-F]{1,4}");
|
|
|
|
QRegExp reHex4B("[0-9,a-f,A-F]{1,8}");
|
|
|
|
QRegExp reMac("([0-9,a-f,A-F]{2,2}[:-]){5,5}[0-9,a-f,A-F]{2,2}");
|
|
|
|
|
2008-10-05 12:07:33 -05:00
|
|
|
// ---- Setup default stuff that cannot be done in designer ----
|
2009-10-11 01:07:27 -05:00
|
|
|
#if 0
|
2009-05-24 09:54:11 -05:00
|
|
|
gbVlan->setDisabled(true);
|
2009-10-11 01:07:27 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
bgL1Proto = new QButtonGroup();
|
|
|
|
bgL1Proto->addButton(rbL1None, ButtonIdNone);
|
|
|
|
bgL1Proto->addButton(rbL1Mac, OstProto::Protocol::kMacFieldNumber);
|
|
|
|
bgL1Proto->addButton(rbL1Other, ButtonIdOther);
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
bgL2Proto = new QButtonGroup();
|
2009-09-23 09:53:26 -05:00
|
|
|
#if 0
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
foreach(QRadioButton *btn, gbFrameType->findChildren<QRadioButton*>())
|
2009-10-11 01:07:27 -05:00
|
|
|
bgL2Proto->addButton(btn);
|
2009-09-23 09:53:26 -05:00
|
|
|
#else
|
2009-10-11 01:07:27 -05:00
|
|
|
bgL2Proto->addButton(rbFtNone, ButtonIdNone);
|
|
|
|
bgL2Proto->addButton(rbFtEthernet2, OstProto::Protocol::kEth2FieldNumber);
|
|
|
|
bgL2Proto->addButton(rbFt802Dot3Raw, OstProto::Protocol::kDot3FieldNumber);
|
|
|
|
bgL2Proto->addButton(rbFt802Dot3Llc, OstProto::Protocol::kDot2LlcFieldNumber);
|
|
|
|
bgL2Proto->addButton(rbFtLlcSnap, OstProto::Protocol::kDot2SnapFieldNumber);
|
|
|
|
bgL2Proto->addButton(rbFtOther, ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
bgVlan = new QButtonGroup();
|
2009-10-11 01:07:27 -05:00
|
|
|
bgVlan->addButton(rbVlanNone, ButtonIdNone);
|
|
|
|
bgVlan->addButton(rbVlanSingle, OstProto::Protocol::kVlanFieldNumber);
|
|
|
|
bgVlan->addButton(rbVlanDouble, OstProto::Protocol::kVlanStackFieldNumber);
|
2008-10-05 12:07:33 -05:00
|
|
|
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
bgL3Proto = new QButtonGroup();
|
2009-09-23 09:53:26 -05:00
|
|
|
#if 0
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
foreach(QRadioButton *btn, gbL3Proto->findChildren<QRadioButton*>())
|
|
|
|
bgL3Proto->addButton(btn);
|
2009-09-23 09:53:26 -05:00
|
|
|
#else
|
2009-10-11 01:07:27 -05:00
|
|
|
bgL3Proto->addButton(rbL3None, ButtonIdNone);
|
|
|
|
bgL3Proto->addButton(rbL3Ipv4, OstProto::Protocol::kIp4FieldNumber);
|
|
|
|
bgL3Proto->addButton(rbL3Ipv6, 0xFFFF);
|
|
|
|
bgL3Proto->addButton(rbL3Arp, 0xFFFF);
|
|
|
|
bgL3Proto->addButton(rbL3Other, ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
#endif
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
|
|
|
|
bgL4Proto = new QButtonGroup();
|
2009-09-23 09:53:26 -05:00
|
|
|
#if 0
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
foreach(QRadioButton *btn, gbL4Proto->findChildren<QRadioButton*>())
|
|
|
|
bgL4Proto->addButton(btn);
|
2009-09-23 09:53:26 -05:00
|
|
|
#else
|
|
|
|
bgL4Proto->addButton(rbL4None, 0);
|
2009-10-11 01:07:27 -05:00
|
|
|
bgL4Proto->addButton(rbL4Tcp, OstProto::Protocol::kTcpFieldNumber);
|
|
|
|
bgL4Proto->addButton(rbL4Udp, OstProto::Protocol::kUdpFieldNumber);
|
|
|
|
bgL4Proto->addButton(rbL4Icmp, 0xFFFF);
|
|
|
|
bgL4Proto->addButton(rbL4Igmp, 0xFFFF);
|
|
|
|
bgL4Proto->addButton(rbL4Other, ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
#endif
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
bgPayloadProto = new QButtonGroup();
|
|
|
|
#if 0
|
|
|
|
foreach(QRadioButton *btn, gbPayloadProto->findChildren<QRadioButton*>())
|
|
|
|
bgPayloadProto->addButton(btn);
|
|
|
|
#else
|
2009-10-11 01:07:27 -05:00
|
|
|
bgPayloadProto->addButton(rbPayloadNone, ButtonIdNone);
|
|
|
|
bgPayloadProto->addButton(rbPayloadPattern, OstProto::Protocol::kPayloadFieldNumber);
|
|
|
|
bgPayloadProto->addButton(rbPayloadOther, ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
#endif
|
2008-05-03 09:37:10 -05:00
|
|
|
/*
|
|
|
|
** Setup Validators
|
|
|
|
*/
|
|
|
|
// Meta Data
|
2009-05-24 09:54:11 -05:00
|
|
|
//! \todo - doesn't seem to work - range validator needs a spinbox?
|
|
|
|
//lePktLen->setValidator(new QIntValidator(MIN_PKT_LEN, MAX_PKT_LEN, this));
|
2008-05-03 09:37:10 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
** Setup Connections
|
|
|
|
*/
|
|
|
|
connect(rbSendPackets, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(update_NumPacketsAndNumBursts()));
|
|
|
|
connect(rbSendBursts, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(update_NumPacketsAndNumBursts()));
|
|
|
|
connect(rbModeFixed, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(update_NumPacketsAndNumBursts()));
|
|
|
|
connect(rbModeContinuous, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(update_NumPacketsAndNumBursts()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
StreamConfigDialog::~StreamConfigDialog()
|
|
|
|
{
|
2008-05-25 06:30:30 -05:00
|
|
|
delete mpPacketModelTester;
|
|
|
|
delete mpPacketModel;
|
2008-05-03 09:37:10 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
delete bgL1Proto;
|
|
|
|
delete bgL2Proto;
|
2009-09-23 09:53:26 -05:00
|
|
|
delete bgVlan;
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
delete bgL3Proto;
|
|
|
|
delete bgL4Proto;
|
2009-09-23 09:53:26 -05:00
|
|
|
delete bgPayloadProto;
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
|
2009-08-02 09:52:34 -05:00
|
|
|
delete _iter;
|
2009-04-27 11:51:44 -05:00
|
|
|
delete mpStream;
|
|
|
|
}
|
|
|
|
|
2008-10-05 12:07:33 -05:00
|
|
|
void StreamConfigDialog::on_cmbPktLenMode_currentIndexChanged(QString mode)
|
|
|
|
{
|
|
|
|
if (mode == "Fixed")
|
|
|
|
{
|
|
|
|
lePktLen->setEnabled(true);
|
|
|
|
lePktLenMin->setDisabled(true);
|
|
|
|
lePktLenMax->setDisabled(true);
|
|
|
|
}
|
|
|
|
else if (mode == "Increment")
|
|
|
|
{
|
|
|
|
lePktLen->setDisabled(true);
|
|
|
|
lePktLenMin->setEnabled(true);
|
|
|
|
lePktLenMax->setEnabled(true);
|
|
|
|
}
|
|
|
|
else if (mode == "Decrement")
|
|
|
|
{
|
|
|
|
lePktLen->setDisabled(true);
|
|
|
|
lePktLenMin->setEnabled(true);
|
|
|
|
lePktLenMax->setEnabled(true);
|
|
|
|
}
|
|
|
|
else if (mode == "Random")
|
|
|
|
{
|
|
|
|
lePktLen->setDisabled(true);
|
|
|
|
lePktLenMin->setEnabled(true);
|
|
|
|
lePktLenMax->setEnabled(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
qWarning("Unhandled/Unknown PktLenMode = %s", mode.toAscii().data());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
void StreamConfigDialog::on_pbPrev_clicked()
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
StoreCurrentStream(currStreamIdx);
|
|
|
|
currStreamIdx--;
|
|
|
|
LoadCurrentStream(currStreamIdx);
|
|
|
|
|
|
|
|
pbPrev->setDisabled((currStreamIdx == 0));
|
|
|
|
pbNext->setDisabled((currStreamIdx == 2));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void StreamConfigDialog::on_pbNext_clicked()
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
StoreCurrentStream(currStreamIdx);
|
|
|
|
currStreamIdx++;
|
|
|
|
LoadCurrentStream(currStreamIdx);
|
|
|
|
|
|
|
|
pbPrev->setDisabled((currStreamIdx == 0));
|
|
|
|
pbNext->setDisabled((currStreamIdx == 2));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
void StreamConfigDialog::on_tbSelectProtocols_currentChanged(int index)
|
2009-04-27 11:51:44 -05:00
|
|
|
{
|
2009-09-23 09:53:26 -05:00
|
|
|
qDebug("%s, index = %d", __FUNCTION__, index);
|
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
updateSelectProtocolsSimpleWidget();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
updateSelectProtocolsAdvancedWidget();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
qFatal("%s: unexpected index = %d", __FUNCTION__, index);
|
|
|
|
}
|
|
|
|
}
|
2009-04-27 11:51:44 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
void StreamConfigDialog::when_lvAllProtocols_selectionChanged(
|
|
|
|
const QItemSelection &selected, const QItemSelection &deselected)
|
|
|
|
{
|
|
|
|
int size = lvAllProtocols->selectionModel()->selectedIndexes().size();
|
|
|
|
|
|
|
|
qDebug("%s: selected.indexes().size = %d\n", __FUNCTION__, size);
|
|
|
|
|
|
|
|
tbAdd->setEnabled(size > 0);
|
2009-04-27 11:51:44 -05:00
|
|
|
}
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
void StreamConfigDialog::when_lvSelectedProtocols_currentChanged(
|
|
|
|
const QModelIndex ¤t, const QModelIndex &previous)
|
2009-04-27 11:51:44 -05:00
|
|
|
{
|
2009-09-23 09:53:26 -05:00
|
|
|
qDebug("%s: currentRow = %d\n", __FUNCTION__, current.row());
|
2009-04-27 11:51:44 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
tbDelete->setEnabled(current.isValid());
|
|
|
|
tbUp->setEnabled(current.isValid() && (current.row() != 0));
|
|
|
|
tbDown->setEnabled(current.isValid() &&
|
|
|
|
(current.row() != (current.model()->rowCount() - 1)));
|
|
|
|
}
|
|
|
|
|
|
|
|
void StreamConfigDialog::on_tbAdd_clicked()
|
|
|
|
{
|
|
|
|
int n = 0;
|
|
|
|
QModelIndex idx2;
|
|
|
|
AbstractProtocol *p;
|
|
|
|
QModelIndexList selection;
|
|
|
|
|
|
|
|
selection = lvAllProtocols->selectionModel()->selectedIndexes();
|
|
|
|
|
|
|
|
// Validation
|
|
|
|
if (selection.size() == 0)
|
2009-04-27 11:51:44 -05:00
|
|
|
return;
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
idx2 = lvSelectedProtocols->currentIndex();
|
|
|
|
if (idx2.isValid())
|
|
|
|
n = idx2.row();
|
|
|
|
|
|
|
|
_iter->toFront();
|
|
|
|
while (n--)
|
2009-04-27 11:51:44 -05:00
|
|
|
{
|
2009-09-23 09:53:26 -05:00
|
|
|
if (!_iter->hasNext())
|
|
|
|
return;
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
p = _iter->next();
|
|
|
|
}
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
foreach(QModelIndex idx, selection)
|
|
|
|
_iter->insert(OstProtocolManager.createProtocol(
|
|
|
|
mpAvailableProtocolsModel->stringList().at(idx.row()), mpStream));
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
updateSelectProtocolsAdvancedWidget();
|
|
|
|
lvSelectedProtocols->setCurrentIndex(idx2);
|
|
|
|
}
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
void StreamConfigDialog::on_tbDelete_clicked()
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
QModelIndex idx;
|
|
|
|
AbstractProtocol *p;
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
idx = lvSelectedProtocols->currentIndex();
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
// Validation
|
|
|
|
if (!idx.isValid())
|
|
|
|
return;
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
n = idx.row() + 1;
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->toFront();
|
|
|
|
while (n--)
|
|
|
|
{
|
|
|
|
if (!_iter->hasNext())
|
|
|
|
return;
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
p = _iter->next();
|
|
|
|
}
|
2009-04-27 11:51:44 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->remove();
|
|
|
|
delete p;
|
2009-04-27 11:51:44 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
updateSelectProtocolsAdvancedWidget();
|
|
|
|
lvSelectedProtocols->setCurrentIndex(idx);
|
|
|
|
}
|
2009-04-27 11:51:44 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
void StreamConfigDialog::on_tbUp_clicked()
|
|
|
|
{
|
|
|
|
int m, n;
|
|
|
|
QModelIndex idx;
|
|
|
|
AbstractProtocol *p;
|
|
|
|
|
|
|
|
idx = lvSelectedProtocols->currentIndex();
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
// Validation
|
|
|
|
if (!idx.isValid() || idx.row() == 0)
|
2009-08-02 09:52:34 -05:00
|
|
|
return;
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
m = n = idx.row() + 1;
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->toFront();
|
|
|
|
while (n--)
|
|
|
|
{
|
|
|
|
if (!_iter->hasNext())
|
|
|
|
return;
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
p = _iter->next();
|
|
|
|
}
|
|
|
|
|
|
|
|
_iter->remove();
|
|
|
|
_iter->previous();
|
|
|
|
_iter->insert(p);
|
|
|
|
|
|
|
|
updateSelectProtocolsAdvancedWidget();
|
|
|
|
lvSelectedProtocols->setCurrentIndex(idx.sibling(m-2, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
void StreamConfigDialog::on_tbDown_clicked()
|
|
|
|
{
|
|
|
|
int m, n;
|
|
|
|
QModelIndex idx;
|
|
|
|
AbstractProtocol *p;
|
|
|
|
|
|
|
|
idx = lvSelectedProtocols->currentIndex();
|
|
|
|
|
|
|
|
// Validation
|
|
|
|
if (!idx.isValid() || idx.row() == idx.model()->rowCount())
|
|
|
|
return;
|
|
|
|
|
|
|
|
m = n = idx.row() + 1;
|
|
|
|
|
|
|
|
_iter->toFront();
|
|
|
|
while (n--)
|
2009-08-02 09:52:34 -05:00
|
|
|
{
|
2009-09-23 09:53:26 -05:00
|
|
|
if (!_iter->hasNext())
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = _iter->next();
|
2009-08-02 09:52:34 -05:00
|
|
|
}
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->remove();
|
|
|
|
_iter->next();
|
|
|
|
_iter->insert(p);
|
|
|
|
|
|
|
|
updateSelectProtocolsAdvancedWidget();
|
|
|
|
lvSelectedProtocols->setCurrentIndex(idx.sibling(m,0));
|
|
|
|
}
|
|
|
|
|
|
|
|
void StreamConfigDialog::updateSelectProtocolsAdvancedWidget()
|
|
|
|
{
|
|
|
|
QStringList selProtoList;
|
|
|
|
|
|
|
|
qDebug("%s", __FUNCTION__);
|
|
|
|
|
2009-08-02 09:52:34 -05:00
|
|
|
_iter->toFront();
|
2009-09-23 09:53:26 -05:00
|
|
|
while(_iter->hasNext())
|
2009-08-02 09:52:34 -05:00
|
|
|
{
|
|
|
|
AbstractProtocol* p = _iter->next();
|
2009-09-23 09:53:26 -05:00
|
|
|
qDebug("%p -- %d", p, p->protocolNumber());
|
|
|
|
selProtoList.append(p->shortName());
|
2009-08-02 09:52:34 -05:00
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
mpSelectedProtocolsModel->setStringList(selProtoList);
|
|
|
|
}
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
void StreamConfigDialog::on_twTopLevel_currentChanged(int index)
|
|
|
|
{
|
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
// Protocol Data
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
QWidget *selWidget;
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
// Hide the ToolBox before modifying it - else we have a crash !!!
|
|
|
|
tbProtocolData->hide();
|
|
|
|
|
|
|
|
selWidget = tbProtocolData->currentWidget();
|
|
|
|
|
|
|
|
// Remove all existing protocol widgets
|
|
|
|
while (tbProtocolData->count() > 0)
|
|
|
|
{
|
|
|
|
QWidget* w = tbProtocolData->widget(0);
|
|
|
|
tbProtocolData->removeItem(0);
|
|
|
|
w->setParent(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Repopulate the widgets
|
|
|
|
_iter->toFront();
|
|
|
|
while (_iter->hasNext())
|
|
|
|
{
|
|
|
|
AbstractProtocol* p = _iter->next();
|
|
|
|
tbProtocolData->addItem(p->configWidget(), p->name());
|
|
|
|
}
|
|
|
|
|
|
|
|
tbProtocolData->setCurrentWidget(selWidget);
|
|
|
|
|
|
|
|
tbProtocolData->show();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Packet View
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
StoreCurrentStream();
|
|
|
|
mpPacketModel->setSelectedProtocols(*_iter);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2009-04-27 11:51:44 -05:00
|
|
|
}
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
void StreamConfigDialog::update_NumPacketsAndNumBursts()
|
|
|
|
{
|
|
|
|
if (rbSendPackets->isChecked() && rbModeFixed->isChecked())
|
|
|
|
leNumPackets->setEnabled(true);
|
|
|
|
else
|
|
|
|
leNumPackets->setEnabled(false);
|
|
|
|
|
|
|
|
if (rbSendBursts->isChecked() && rbModeFixed->isChecked())
|
|
|
|
leNumBursts->setEnabled(true);
|
|
|
|
else
|
|
|
|
leNumBursts->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
void StreamConfigDialog::on_lePattern_editingFinished()
|
|
|
|
{
|
|
|
|
ulong num = 0;
|
|
|
|
bool isOk;
|
|
|
|
QString str;
|
|
|
|
|
|
|
|
num = lePattern->text().remove(QChar(' ')).toULong(&isOk, 16);
|
|
|
|
qDebug("editfinished (%s | %x)\n", lePattern->text().toAscii().data(), num);
|
|
|
|
lePattern->setText(uintToHexStr(num, str, 4));
|
|
|
|
qDebug("editfinished (%s | %x)\n", lePattern->text().toAscii().data(), num);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
/*!
|
|
|
|
Skip protocols upto and including the layer specified.
|
|
|
|
0 - L1
|
|
|
|
1 - VLAN
|
|
|
|
2 - L2
|
|
|
|
3 - L3
|
|
|
|
4 - L4
|
|
|
|
TODO: Convert the above values to enum??
|
|
|
|
*/
|
2009-09-23 09:53:26 -05:00
|
|
|
bool StreamConfigDialog::skipProtocols(int layer)
|
2008-05-03 09:37:10 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
int id;
|
|
|
|
QAbstractButton *btn;
|
2008-05-03 09:37:10 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->toFront();
|
2008-05-03 09:37:10 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// Skip L1
|
|
|
|
if (_iter->hasNext())
|
|
|
|
{
|
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgL1Proto->button(id);
|
|
|
|
if (btn == NULL)
|
|
|
|
_iter->previous();
|
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
if (layer == 0)
|
|
|
|
goto _done;
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// Skip VLAN
|
|
|
|
if(_iter->hasNext())
|
|
|
|
{
|
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgVlan->button(id);
|
|
|
|
if (btn == NULL)
|
|
|
|
_iter->previous();
|
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
if (layer == 1)
|
|
|
|
goto _done;
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// Skip L2
|
|
|
|
if(_iter->hasNext())
|
2008-05-03 09:37:10 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgL2Proto->button(id);
|
|
|
|
if (btn == NULL)
|
|
|
|
_iter->previous();
|
2008-05-03 09:37:10 -05:00
|
|
|
}
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
if (layer == 2)
|
|
|
|
goto _done;
|
|
|
|
|
|
|
|
// Skip L3
|
2009-10-11 01:07:27 -05:00
|
|
|
if (_iter->hasNext())
|
|
|
|
{
|
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgL3Proto->button(id);
|
|
|
|
if (btn == NULL)
|
|
|
|
_iter->previous();
|
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
if (layer == 3)
|
|
|
|
goto _done;
|
|
|
|
|
|
|
|
// Skip L4
|
2009-10-11 01:07:27 -05:00
|
|
|
if(_iter->hasNext())
|
|
|
|
{
|
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgL4Proto->button(id);
|
|
|
|
if (btn == NULL)
|
|
|
|
_iter->previous();
|
|
|
|
}
|
2009-04-27 11:51:44 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
if (layer == 4)
|
|
|
|
goto _done;
|
2008-08-08 22:22:13 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
return false;
|
2008-08-23 23:39:08 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
_done:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
void StreamConfigDialog::updateL1Protocol(int newId)
|
2009-09-23 09:53:26 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
static int oldId;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
qDebug("%s:old id = %d new id = %d upd? = %d", __FUNCTION__, oldId, newId,
|
2009-09-23 09:53:26 -05:00
|
|
|
isUpdateInProgress);
|
|
|
|
|
|
|
|
if (oldId == newId)
|
|
|
|
return; // Nothing to be done
|
|
|
|
|
|
|
|
if (!isUpdateInProgress)
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
AbstractProtocol *p;
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
_iter->toFront();
|
|
|
|
|
|
|
|
Q_ASSERT(newId != ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
switch (oldId)
|
2008-08-23 23:39:08 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdNone:
|
|
|
|
_iter->insert(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
2009-09-23 09:53:26 -05:00
|
|
|
break;
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdOther:
|
|
|
|
default:
|
|
|
|
Q_ASSERT(_iter->hasNext());
|
2009-09-23 09:53:26 -05:00
|
|
|
p =_iter->next();
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
if (newId)
|
|
|
|
_iter->setValue(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
else
|
|
|
|
_iter->remove();
|
2009-09-23 09:53:26 -05:00
|
|
|
delete p;
|
|
|
|
break;
|
2009-10-11 01:07:27 -05:00
|
|
|
}
|
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
oldId = newId;
|
|
|
|
return;
|
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
void StreamConfigDialog::updateVlanProtocol(int newId)
|
|
|
|
{
|
|
|
|
static int oldId;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
qDebug("%s:old id = %d new id = %d upd? = %d", __FUNCTION__, oldId, newId,
|
|
|
|
isUpdateInProgress);
|
|
|
|
|
|
|
|
if (oldId == newId)
|
|
|
|
return; // Nothing to be done
|
|
|
|
|
|
|
|
if (!isUpdateInProgress)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
AbstractProtocol *p;
|
|
|
|
|
|
|
|
ret = skipProtocols(0);
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
Q_ASSERT(ret == true);
|
|
|
|
Q_ASSERT(oldId != ButtonIdOther);
|
|
|
|
Q_ASSERT(newId != ButtonIdOther);
|
|
|
|
|
|
|
|
switch (oldId)
|
2008-08-23 23:39:08 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdNone:
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->insert(OstProtocolManager.createProtocol(
|
2009-10-11 01:07:27 -05:00
|
|
|
newId, mpStream));
|
2009-09-23 09:53:26 -05:00
|
|
|
break;
|
2009-10-11 01:07:27 -05:00
|
|
|
|
|
|
|
case ButtonIdOther:
|
2009-09-23 09:53:26 -05:00
|
|
|
default:
|
2009-10-11 01:07:27 -05:00
|
|
|
Q_ASSERT(_iter->hasNext());
|
|
|
|
p =_iter->next();
|
|
|
|
|
|
|
|
if (newId)
|
|
|
|
_iter->setValue(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
else
|
|
|
|
_iter->remove();
|
|
|
|
delete p;
|
|
|
|
break;
|
2008-08-23 23:39:08 -05:00
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
oldId = newId;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
void StreamConfigDialog::updateFrameTypeProtocol(int newId)
|
2009-09-23 09:53:26 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
static int oldId;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
qDebug("%s:old id = %d new id = %d upd? = %d", __FUNCTION__, oldId, newId,
|
|
|
|
isUpdateInProgress);
|
|
|
|
|
|
|
|
if (oldId == newId)
|
|
|
|
return; // Nothing to be done
|
|
|
|
|
|
|
|
if (!isUpdateInProgress)
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
int ret;
|
|
|
|
AbstractProtocol *p;
|
|
|
|
|
|
|
|
ret = skipProtocols(1);
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
Q_ASSERT(ret == true);
|
|
|
|
Q_ASSERT(newId != ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
switch (oldId)
|
2008-05-03 09:37:10 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdNone:
|
|
|
|
_iter->insert(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
2009-09-23 09:53:26 -05:00
|
|
|
break;
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdOther:
|
|
|
|
default:
|
|
|
|
Q_ASSERT(_iter->hasNext());
|
2009-09-23 09:53:26 -05:00
|
|
|
p =_iter->next();
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
if (newId)
|
|
|
|
_iter->setValue(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
else
|
|
|
|
_iter->remove();
|
|
|
|
delete p;
|
2009-09-23 09:53:26 -05:00
|
|
|
break;
|
2008-05-03 09:37:10 -05:00
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
}
|
2009-10-11 01:07:27 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
oldId = newId;
|
|
|
|
return;
|
|
|
|
}
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
void StreamConfigDialog::updateL3Protocol(int newId)
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
static int oldId;
|
2008-05-03 09:37:10 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
qDebug("%s:old id = %d new id = %d upd? = %d", __FUNCTION__, oldId, newId,
|
|
|
|
isUpdateInProgress);
|
2008-05-03 09:37:10 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
if (oldId == newId)
|
|
|
|
return; // Nothing to be done
|
|
|
|
|
|
|
|
if (!isUpdateInProgress)
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
int ret;
|
|
|
|
AbstractProtocol *p;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
ret = skipProtocols(2);
|
|
|
|
|
|
|
|
Q_ASSERT(ret == true);
|
|
|
|
Q_ASSERT(newId != ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
switch (oldId)
|
2008-05-03 09:37:10 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdNone:
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->insert(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
break;
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdOther:
|
2009-09-23 09:53:26 -05:00
|
|
|
default:
|
2009-10-11 01:07:27 -05:00
|
|
|
Q_ASSERT(_iter->hasNext());
|
2009-09-23 09:53:26 -05:00
|
|
|
p =_iter->next();
|
|
|
|
|
|
|
|
if (newId)
|
|
|
|
_iter->setValue(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
else
|
|
|
|
_iter->remove();
|
|
|
|
delete p;
|
|
|
|
break;
|
2009-04-27 11:51:44 -05:00
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
oldId = newId;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void StreamConfigDialog::updateL4Protocol(int newId)
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
static int oldId;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
qDebug("%s:old id = %d new id = %d upd? = %d", __FUNCTION__, oldId, newId,
|
|
|
|
isUpdateInProgress);
|
|
|
|
|
|
|
|
if (oldId == newId)
|
|
|
|
return; // Nothing to be done
|
|
|
|
|
|
|
|
if (!isUpdateInProgress)
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
int ret;
|
|
|
|
AbstractProtocol *p;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
ret = skipProtocols(3);
|
|
|
|
|
|
|
|
Q_ASSERT(ret == true);
|
|
|
|
Q_ASSERT(newId != ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
switch (oldId)
|
2009-04-27 11:51:44 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdNone:
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->insert(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
break;
|
2009-04-27 11:51:44 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdOther:
|
2009-09-23 09:53:26 -05:00
|
|
|
default:
|
2009-10-11 01:07:27 -05:00
|
|
|
Q_ASSERT(_iter->hasNext());
|
2009-09-23 09:53:26 -05:00
|
|
|
p =_iter->next();
|
|
|
|
|
|
|
|
if (newId)
|
|
|
|
_iter->setValue(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
else
|
|
|
|
_iter->remove();
|
|
|
|
delete p;
|
|
|
|
break;
|
|
|
|
}
|
2009-08-02 09:52:34 -05:00
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
oldId = newId;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void StreamConfigDialog::updatePayloadProtocol(int newId)
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
static int oldId;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
qDebug("%s:old id = %d new id = %d upd? = %d", __FUNCTION__, oldId, newId,
|
|
|
|
isUpdateInProgress);
|
|
|
|
|
|
|
|
if (oldId == newId)
|
|
|
|
return; // Nothing to be done
|
|
|
|
|
|
|
|
if (!isUpdateInProgress)
|
2009-08-02 09:52:34 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
int ret;
|
|
|
|
AbstractProtocol *p;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
ret = skipProtocols(4);
|
|
|
|
|
|
|
|
Q_ASSERT(ret == true);
|
|
|
|
Q_ASSERT(newId != ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
switch (oldId)
|
|
|
|
{
|
|
|
|
case ButtonIdNone:
|
|
|
|
_iter->insert(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
break;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
case ButtonIdOther:
|
|
|
|
default:
|
|
|
|
Q_ASSERT(_iter->hasNext());
|
|
|
|
p =_iter->next();
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
if (newId)
|
|
|
|
_iter->setValue(OstProtocolManager.createProtocol(
|
|
|
|
newId, mpStream));
|
|
|
|
else
|
|
|
|
_iter->remove();
|
|
|
|
delete p;
|
|
|
|
while (_iter->hasNext())
|
|
|
|
{
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
p = _iter->next();
|
|
|
|
_iter->remove();
|
|
|
|
delete p;
|
|
|
|
}
|
|
|
|
break;
|
2009-08-02 09:52:34 -05:00
|
|
|
}
|
2009-09-23 09:53:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
oldId = newId;
|
|
|
|
return;
|
|
|
|
}
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
void StreamConfigDialog::updateSelectProtocolsSimpleWidget()
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
quint32 id;
|
|
|
|
QAbstractButton *btn;
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
qDebug("%s", __FUNCTION__);
|
|
|
|
|
|
|
|
isUpdateInProgress = true;
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// Reset to default state
|
|
|
|
rbL1None->setChecked(true);
|
|
|
|
rbVlanNone->setChecked(true);
|
|
|
|
rbFtNone->setChecked(true);
|
|
|
|
rbL3None->setChecked(true);
|
|
|
|
rbL4None->setChecked(true);
|
|
|
|
rbPayloadNone->setChecked(true);
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
_iter->toFront();
|
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// L1 (optional if followed by Payload)
|
|
|
|
if (!_iter->hasNext()) // No protocols at all?
|
2009-09-23 09:53:26 -05:00
|
|
|
goto _done;
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgL1Proto->button(id);
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
btn->click();
|
|
|
|
else
|
2009-09-23 09:53:26 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
btn = bgPayloadProto->button(id);
|
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
goto _payload;
|
2009-09-23 09:53:26 -05:00
|
|
|
else
|
2009-10-11 01:07:27 -05:00
|
|
|
goto _otherL1;
|
2009-09-23 09:53:26 -05:00
|
|
|
}
|
2009-10-11 01:07:27 -05:00
|
|
|
|
|
|
|
// VLAN (optional)
|
|
|
|
if (!_iter->hasNext())
|
|
|
|
goto _done;
|
|
|
|
|
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgVlan->button(id);
|
|
|
|
|
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
btn->click();
|
2009-09-23 09:53:26 -05:00
|
|
|
else
|
2009-10-11 01:07:27 -05:00
|
|
|
_iter->previous();
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// L2 (optional if followed by Payload)
|
|
|
|
if (!_iter->hasNext())
|
|
|
|
goto _done;
|
2009-09-23 09:53:26 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgL2Proto->button(id);
|
|
|
|
|
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
btn->click();
|
|
|
|
else
|
2009-09-23 09:53:26 -05:00
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
btn = bgPayloadProto->button(id);
|
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
goto _payload;
|
2009-08-02 09:52:34 -05:00
|
|
|
else
|
2009-10-11 01:07:27 -05:00
|
|
|
goto _otherL2;
|
2009-09-23 09:53:26 -05:00
|
|
|
}
|
2009-10-11 01:07:27 -05:00
|
|
|
|
|
|
|
// L3 (optional if followed by Payload)
|
|
|
|
if (!_iter->hasNext())
|
2009-09-23 09:53:26 -05:00
|
|
|
goto _done;
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgL3Proto->button(id);
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
btn->click();
|
2009-09-23 09:53:26 -05:00
|
|
|
else
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
btn = bgPayloadProto->button(id);
|
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
goto _payload;
|
|
|
|
else
|
|
|
|
goto _otherL3;
|
2009-09-23 09:53:26 -05:00
|
|
|
}
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// L4 (optional if followed by Payload)
|
2009-09-23 09:53:26 -05:00
|
|
|
if (!_iter->hasNext())
|
|
|
|
goto _done;
|
2009-10-11 01:07:27 -05:00
|
|
|
|
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgL4Proto->button(id);
|
|
|
|
|
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
btn->click();
|
2009-09-23 09:53:26 -05:00
|
|
|
else
|
|
|
|
{
|
2009-10-11 01:07:27 -05:00
|
|
|
btn = bgPayloadProto->button(id);
|
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
goto _payload;
|
|
|
|
else
|
|
|
|
goto _otherL4;
|
2009-09-23 09:53:26 -05:00
|
|
|
}
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// Payload Data
|
|
|
|
if (!_iter->hasNext())
|
|
|
|
goto _done;
|
|
|
|
|
|
|
|
id = _iter->next()->protocolNumber();
|
|
|
|
btn = bgPayloadProto->button(id);
|
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
_payload:
|
2009-10-11 01:07:27 -05:00
|
|
|
if (btn && btn->isEnabled())
|
|
|
|
btn->click();
|
|
|
|
else
|
|
|
|
goto _otherPayload;
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-10-11 01:07:27 -05:00
|
|
|
// If more protocol(s) beyond payload ...
|
2009-09-23 09:53:26 -05:00
|
|
|
if (_iter->hasNext())
|
2009-10-11 01:07:27 -05:00
|
|
|
goto _otherPayload;
|
|
|
|
|
|
|
|
goto _done;
|
|
|
|
|
|
|
|
_otherL1:
|
|
|
|
bgL1Proto->button(ButtonIdOther)->setChecked(true);
|
|
|
|
updateL1Protocol(ButtonIdOther);
|
|
|
|
_otherL2:
|
|
|
|
bgL2Proto->button(ButtonIdOther)->setChecked(true);
|
|
|
|
updateFrameTypeProtocol(ButtonIdOther);
|
|
|
|
_otherL3:
|
|
|
|
bgL3Proto->button(ButtonIdOther)->setChecked(true);
|
|
|
|
updateL3Protocol(ButtonIdOther);
|
|
|
|
_otherL4:
|
|
|
|
bgL4Proto->button(ButtonIdOther)->setChecked(true);
|
|
|
|
updateL4Protocol(ButtonIdOther);
|
|
|
|
_otherPayload:
|
|
|
|
bgPayloadProto->button(ButtonIdOther)->setChecked(true);
|
|
|
|
updatePayloadProtocol(ButtonIdOther);
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
_done:
|
|
|
|
isUpdateInProgress = false;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void StreamConfigDialog::LoadCurrentStream()
|
|
|
|
{
|
|
|
|
QString str;
|
|
|
|
|
|
|
|
qDebug("loading mpStream %p", mpStream);
|
|
|
|
|
|
|
|
// Meta Data
|
|
|
|
{
|
|
|
|
cmbPktLenMode->setCurrentIndex(mpStream->lenMode());
|
|
|
|
lePktLen->setText(str.setNum(mpStream->frameLen()));
|
|
|
|
lePktLenMin->setText(str.setNum(mpStream->frameLenMin()));
|
|
|
|
lePktLenMax->setText(str.setNum(mpStream->frameLenMax()));
|
2008-05-03 09:37:10 -05:00
|
|
|
}
|
2008-09-28 13:01:52 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
// Protocols
|
|
|
|
{
|
|
|
|
updateSelectProtocolsSimpleWidget();
|
|
|
|
updateSelectProtocolsAdvancedWidget();
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2009-09-23 09:53:26 -05:00
|
|
|
mpStream->loadProtocolWidgets();
|
|
|
|
}
|
2009-08-02 09:52:34 -05:00
|
|
|
|
2008-09-28 13:01:52 -05:00
|
|
|
// Stream Control
|
|
|
|
{
|
2009-04-27 11:51:44 -05:00
|
|
|
switch (mpStream->sendUnit())
|
2008-09-28 13:01:52 -05:00
|
|
|
{
|
|
|
|
case Stream::e_su_packets:
|
|
|
|
rbSendPackets->setChecked(true);
|
|
|
|
break;
|
|
|
|
case Stream::e_su_bursts:
|
|
|
|
rbSendBursts->setChecked(true);
|
|
|
|
break;
|
|
|
|
default:
|
2009-04-27 11:51:44 -05:00
|
|
|
qWarning("Unhandled sendUnit = %d\n", mpStream->sendUnit());
|
2008-09-28 13:01:52 -05:00
|
|
|
}
|
|
|
|
|
2009-04-27 11:51:44 -05:00
|
|
|
switch (mpStream->sendMode())
|
2008-09-28 13:01:52 -05:00
|
|
|
{
|
|
|
|
case Stream::e_sm_fixed:
|
|
|
|
rbModeFixed->setChecked(true);
|
|
|
|
break;
|
|
|
|
case Stream::e_sm_continuous:
|
|
|
|
rbModeContinuous->setChecked(true);
|
|
|
|
break;
|
|
|
|
default:
|
2009-04-27 11:51:44 -05:00
|
|
|
qWarning("Unhandled sendMode = %d\n", mpStream->sendMode());
|
2008-09-28 13:01:52 -05:00
|
|
|
}
|
|
|
|
|
2009-04-27 11:51:44 -05:00
|
|
|
switch(mpStream->nextWhat())
|
2008-09-28 13:01:52 -05:00
|
|
|
{
|
|
|
|
case Stream::e_nw_stop:
|
|
|
|
rbActionStop->setChecked(true);
|
|
|
|
break;
|
|
|
|
case Stream::e_nw_goto_next:
|
|
|
|
rbActionGotoNext->setChecked(true);
|
|
|
|
break;
|
|
|
|
case Stream::e_nw_goto_id:
|
|
|
|
rbActionGotoStream->setChecked(true);
|
|
|
|
break;
|
|
|
|
default:
|
2009-04-27 11:51:44 -05:00
|
|
|
qWarning("Unhandled nextAction = %d\n", mpStream->nextWhat());
|
2008-09-28 13:01:52 -05:00
|
|
|
}
|
|
|
|
|
2009-04-27 11:51:44 -05:00
|
|
|
leNumPackets->setText(QString().setNum(mpStream->numPackets()));
|
|
|
|
leNumBursts->setText(QString().setNum(mpStream->numBursts()));
|
|
|
|
lePacketsPerBurst->setText(QString().setNum(mpStream->burstSize()));
|
|
|
|
lePacketsPerSec->setText(QString().setNum(mpStream->packetRate()));
|
|
|
|
leBurstsPerSec->setText(QString().setNum(mpStream->burstRate()));
|
2009-03-10 11:48:03 -05:00
|
|
|
// TODO(MED): Change this when we support goto to specific stream
|
|
|
|
leStreamId->setText(QString("0"));
|
2008-09-28 13:01:52 -05:00
|
|
|
}
|
2009-08-02 09:52:34 -05:00
|
|
|
qDebug("loading stream done");
|
2008-05-03 09:37:10 -05:00
|
|
|
}
|
|
|
|
|
2009-05-24 09:54:11 -05:00
|
|
|
void StreamConfigDialog::StoreCurrentStream()
|
2008-05-03 09:37:10 -05:00
|
|
|
{
|
|
|
|
QString str;
|
|
|
|
bool isOk;
|
2009-05-24 09:54:11 -05:00
|
|
|
Stream *pStream = mpStream;
|
2008-05-03 09:37:10 -05:00
|
|
|
|
|
|
|
qDebug("storing pStream %p", pStream);
|
|
|
|
|
|
|
|
// Meta Data
|
2008-08-08 22:22:13 -05:00
|
|
|
pStream->setLenMode((Stream::FrameLengthMode) cmbPktLenMode->currentIndex());
|
|
|
|
pStream->setFrameLen(lePktLen->text().toULong(&isOk));
|
|
|
|
pStream->setFrameLenMin(lePktLenMin->text().toULong(&isOk));
|
|
|
|
pStream->setFrameLenMax(lePktLenMax->text().toULong(&isOk));
|
2008-08-23 23:39:08 -05:00
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
// Protocols
|
|
|
|
{
|
2009-04-27 11:51:44 -05:00
|
|
|
pStream->storeProtocolWidgets();
|
2008-05-03 09:37:10 -05:00
|
|
|
}
|
2008-09-28 13:01:52 -05:00
|
|
|
|
|
|
|
// Stream Control
|
|
|
|
{
|
|
|
|
if (rbSendPackets->isChecked())
|
|
|
|
pStream->setSendUnit(Stream::e_su_packets);
|
|
|
|
if (rbSendBursts->isChecked())
|
|
|
|
pStream->setSendUnit(Stream::e_su_bursts);
|
|
|
|
|
|
|
|
if (rbModeFixed->isChecked())
|
|
|
|
pStream->setSendMode(Stream::e_sm_fixed);
|
|
|
|
if (rbModeContinuous->isChecked())
|
|
|
|
pStream->setSendMode(Stream::e_sm_continuous);
|
|
|
|
|
|
|
|
if (rbActionStop->isChecked())
|
|
|
|
pStream->setNextWhat(Stream::e_nw_stop);
|
|
|
|
if (rbActionGotoNext->isChecked())
|
|
|
|
pStream->setNextWhat(Stream::e_nw_goto_next);
|
|
|
|
if (rbActionGotoStream->isChecked())
|
|
|
|
pStream->setNextWhat(Stream::e_nw_goto_id);
|
|
|
|
|
|
|
|
pStream->setNumPackets(leNumPackets->text().toULong(&isOk));
|
|
|
|
pStream->setNumBursts(leNumBursts->text().toULong(&isOk));
|
|
|
|
pStream->setBurstSize(lePacketsPerBurst->text().toULong(&isOk));
|
|
|
|
pStream->setPacketRate(lePacketsPerSec->text().toULong(&isOk));
|
|
|
|
pStream->setBurstRate(leBurstsPerSec->text().toULong(&isOk));
|
|
|
|
}
|
2008-05-03 09:37:10 -05:00
|
|
|
}
|
2008-08-23 23:39:08 -05:00
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
void StreamConfigDialog::on_pbOk_clicked()
|
|
|
|
{
|
2009-05-24 09:54:11 -05:00
|
|
|
OstProto::Stream s;
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
// Store dialog contents into stream
|
2009-05-24 09:54:11 -05:00
|
|
|
StoreCurrentStream();
|
2009-09-23 09:53:26 -05:00
|
|
|
|
|
|
|
// Copy the data from the "local working copy of stream" to "actual stream"
|
2009-05-24 09:54:11 -05:00
|
|
|
mpStream->protoDataCopyInto(s);
|
2009-09-23 09:53:26 -05:00
|
|
|
mPort.streamByIndex(mCurrentStreamIndex)->protoDataCopyFrom(s);
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
qDebug("stream stored");
|
2009-05-24 09:54:11 -05:00
|
|
|
|
2009-04-05 02:19:37 -05:00
|
|
|
lastTopLevelTabIndex = twTopLevel->currentIndex();
|
2008-05-03 09:37:10 -05:00
|
|
|
}
|
|
|
|
|