2011-01-30 06:08:03 -06:00
|
|
|
/*
|
|
|
|
Copyright (C) 2010 Srivats P.
|
|
|
|
|
|
|
|
This file is part of "Ostinato"
|
|
|
|
|
|
|
|
This is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _STREAM_CONFIG_DIALOG_H
|
|
|
|
#define _STREAM_CONFIG_DIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include "ui_streamconfigdialog.h"
|
|
|
|
#include "port.h"
|
|
|
|
#include "stream.h"
|
|
|
|
#include "packetmodel.h"
|
|
|
|
#include "modeltest.h"
|
|
|
|
|
|
|
|
#define MAX_MAC_ITER_COUNT 256
|
|
|
|
#define MIN_PKT_LEN 64
|
|
|
|
#define MAX_PKT_LEN 16384
|
|
|
|
|
|
|
|
/*
|
|
|
|
** TODO
|
|
|
|
** \todo Improve HexStr handling
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
class StreamConfigDialog : public QDialog, public Ui::StreamConfigDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
StreamConfigDialog(Port &port, uint streamIndex, QWidget *parent = 0);
|
|
|
|
~StreamConfigDialog();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
enum ButtonId
|
|
|
|
{
|
|
|
|
ButtonIdNone = 0,
|
|
|
|
ButtonIdOther = -2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ProtoButtonGroup
|
|
|
|
{
|
|
|
|
ProtoMin,
|
|
|
|
ProtoL1 = 0,
|
|
|
|
ProtoVlan = 1,
|
|
|
|
ProtoL2 = 2,
|
|
|
|
ProtoL3 = 3,
|
|
|
|
ProtoL4 = 4,
|
|
|
|
ProtoL5 = 5,
|
|
|
|
ProtoPayload = 6,
|
|
|
|
ProtoMax
|
|
|
|
};
|
|
|
|
|
|
|
|
QButtonGroup *bgProto[ProtoMax];
|
|
|
|
|
|
|
|
QStringListModel *mpAvailableProtocolsModel;
|
|
|
|
QStringListModel *mpSelectedProtocolsModel;
|
|
|
|
|
|
|
|
Port& mPort;
|
|
|
|
uint mCurrentStreamIndex;
|
|
|
|
|
|
|
|
Stream *mpStream;
|
|
|
|
ProtocolListIterator *_iter;
|
|
|
|
|
|
|
|
bool isUpdateInProgress;
|
|
|
|
|
|
|
|
PacketModel *mpPacketModel;
|
|
|
|
ModelTest *mpPacketModelTester;
|
|
|
|
|
|
|
|
// The following static variables are used to track the "selected" tab
|
|
|
|
// for the various tab widgets so that it can be restored when the dialog
|
2011-03-21 11:55:34 -05:00
|
|
|
// is opened the next time. We also track the last Dialog geometry.
|
|
|
|
static QRect lastGeometry;
|
|
|
|
static int lastTopLevelTabIndex;
|
|
|
|
static int lastProtocolDataIndex;
|
2011-01-30 06:08:03 -06:00
|
|
|
|
|
|
|
void setupUiExtra();
|
|
|
|
void LoadCurrentStream();
|
|
|
|
void StoreCurrentStream();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_cmbPktLenMode_currentIndexChanged(QString mode);
|
|
|
|
void update_NumPacketsAndNumBursts();
|
|
|
|
|
|
|
|
void on_twTopLevel_currentChanged(int index);
|
|
|
|
void on_tbSelectProtocols_currentChanged(int index);
|
|
|
|
|
|
|
|
// "Simple" Protocol Selection related
|
|
|
|
bool skipProtocols(int layer);
|
|
|
|
|
|
|
|
void disableProtocols(QButtonGroup *protocolGroup, bool checked);
|
|
|
|
void forceProtocolNone(bool checked);
|
|
|
|
|
|
|
|
void updateProtocol(int newId);
|
|
|
|
void __updateProtocol(int level, int newId);
|
|
|
|
|
|
|
|
void updateSelectProtocolsSimpleWidget();
|
|
|
|
|
|
|
|
// "Advanced" Protocol Selection related
|
|
|
|
void when_lvAllProtocols_selectionChanged(
|
|
|
|
const QItemSelection &selected, const QItemSelection &deselected);
|
|
|
|
void when_lvSelectedProtocols_currentChanged(
|
|
|
|
const QModelIndex ¤t, const QModelIndex &previous);
|
|
|
|
|
|
|
|
void on_tbAdd_clicked();
|
|
|
|
void on_tbDelete_clicked();
|
|
|
|
void on_tbUp_clicked();
|
|
|
|
void on_tbDown_clicked();
|
|
|
|
|
|
|
|
void updateSelectProtocolsAdvancedWidget();
|
|
|
|
|
|
|
|
// "Protocol Data" related
|
|
|
|
void on_tbProtocolData_currentChanged(int index);
|
|
|
|
|
|
|
|
void on_pbPrev_clicked();
|
|
|
|
void on_pbNext_clicked();
|
|
|
|
|
|
|
|
void on_pbOk_clicked();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|