parent
de89299b88
commit
8adb3d79aa
@ -50,22 +50,8 @@ Length (x4)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_22" >
|
||||
<property name="text" >
|
||||
<string>TOS/DSCP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLineEdit" name="leIpTos" >
|
||||
<property name="inputMask" >
|
||||
<string>>HH; </string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="TosDscpWidget" name="tosDscp" native="true" />
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QCheckBox" name="cbIpLengthOverride" >
|
||||
@ -91,7 +77,7 @@ Length (x4)</string>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QLineEdit" name="leIpId" >
|
||||
<property name="inputMask" >
|
||||
<string>>HH HH; </string>
|
||||
<string>>HH HH</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -143,7 +129,7 @@ Length (x4)</string>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="inputMask" >
|
||||
<string>>HH; </string>
|
||||
<string>>HH</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
@ -163,7 +149,7 @@ Length (x4)</string>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="inputMask" >
|
||||
<string>>HH HH; </string>
|
||||
<string>>HH HH</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -395,12 +381,20 @@ Length (x4)</string>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>TosDscpWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>tosdscp.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cbIpVersionOverride</tabstop>
|
||||
<tabstop>leIpVersion</tabstop>
|
||||
<tabstop>cbIpHdrLenOverride</tabstop>
|
||||
<tabstop>leIpHdrLen</tabstop>
|
||||
<tabstop>leIpTos</tabstop>
|
||||
<tabstop>tosDscp</tabstop>
|
||||
<tabstop>cbIpLengthOverride</tabstop>
|
||||
<tabstop>leIpLength</tabstop>
|
||||
<tabstop>leIpId</tabstop>
|
||||
|
@ -71,11 +71,11 @@ void Ip4ConfigForm::loadWidget(AbstractProtocol *proto)
|
||||
AbstractProtocol::FieldValue
|
||||
).toString());
|
||||
|
||||
leIpTos->setText(uintToHexStr(
|
||||
tosDscp->setValue(
|
||||
proto->fieldData(
|
||||
Ip4Protocol::ip4_tos,
|
||||
AbstractProtocol::FieldValue
|
||||
).toUInt(), 1));
|
||||
).toUInt());
|
||||
|
||||
cbIpLengthOverride->setChecked(
|
||||
proto->fieldData(
|
||||
@ -205,7 +205,7 @@ void Ip4ConfigForm::storeWidget(AbstractProtocol *proto)
|
||||
|
||||
proto->setFieldData(
|
||||
Ip4Protocol::ip4_tos,
|
||||
hexStrToUInt(leIpTos->text()));
|
||||
tosDscp->value());
|
||||
|
||||
proto->setFieldData(
|
||||
Ip4Protocol::ip4_totLen,
|
||||
|
@ -56,25 +56,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_22" >
|
||||
<property name="text" >
|
||||
<string>Traffic Class</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>trafficClass</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="trafficClass" >
|
||||
<property name="inputMask" >
|
||||
<string>>HH; </string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="TosDscpWidget" name="tosDscp" native="true" />
|
||||
</item>
|
||||
<item row="1" column="3" >
|
||||
<widget class="QCheckBox" name="isNextHeaderOverride" >
|
||||
@ -394,10 +377,18 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>TosDscpWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>tosdscp.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>isVersionOverride</tabstop>
|
||||
<tabstop>version</tabstop>
|
||||
<tabstop>trafficClass</tabstop>
|
||||
<tabstop>tosDscp</tabstop>
|
||||
<tabstop>flowLabel</tabstop>
|
||||
<tabstop>isPayloadLengthOverride</tabstop>
|
||||
<tabstop>payloadLength</tabstop>
|
||||
|
@ -84,11 +84,11 @@ void Ip6ConfigForm::loadWidget(AbstractProtocol *ip6Proto)
|
||||
AbstractProtocol::FieldValue
|
||||
).toString());
|
||||
|
||||
trafficClass->setText(uintToHexStr(
|
||||
tosDscp->setValue(
|
||||
ip6Proto->fieldData(
|
||||
Ip6Protocol::ip6_trafficClass,
|
||||
AbstractProtocol::FieldValue
|
||||
).toUInt(), 1));
|
||||
).toUInt());
|
||||
|
||||
flowLabel->setText(QString("%1").arg(
|
||||
ip6Proto->fieldData(
|
||||
@ -180,7 +180,7 @@ void Ip6ConfigForm::storeWidget(AbstractProtocol *ip6Proto)
|
||||
|
||||
ip6Proto->setFieldData(
|
||||
Ip6Protocol::ip6_trafficClass,
|
||||
trafficClass->text().remove(QChar(' ')).toUInt(&isOk, BASE_HEX));
|
||||
tosDscp->value());
|
||||
|
||||
ip6Proto->setFieldData(
|
||||
Ip6Protocol::ip6_flowLabel,
|
||||
|
@ -24,6 +24,7 @@ FORMS += \
|
||||
tcp.ui \
|
||||
udp.ui \
|
||||
textproto.ui \
|
||||
tosdscp.ui \
|
||||
hexdump.ui \
|
||||
payload.ui \
|
||||
sample.ui \
|
||||
@ -51,6 +52,9 @@ HEADERS = \
|
||||
streamfileformat.h \
|
||||
spinboxdelegate.h
|
||||
|
||||
HEADERS += \
|
||||
tosdscp.h
|
||||
|
||||
HEADERS += \
|
||||
abstractprotocolconfig.h \
|
||||
comboprotocolconfig.h \
|
||||
@ -98,6 +102,9 @@ SOURCES += \
|
||||
streamfileformat.cpp \
|
||||
spinboxdelegate.cpp
|
||||
|
||||
SOURCES += \
|
||||
tosdscp.cpp
|
||||
|
||||
SOURCES += \
|
||||
protocolwidgetfactory.cpp \
|
||||
macconfig.cpp \
|
||||
|
99
common/tosdscp.cpp
Normal file
99
common/tosdscp.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
Copyright (C) 2018 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 FoundatiTosDscpWidget::on, either versiTosDscpWidget::on 3 of the License, or
|
||||
(at your optiTosDscpWidget::on) any later versiTosDscpWidget::on.
|
||||
|
||||
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
|
||||
alTosDscpWidget::ong with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "tosdscp.h"
|
||||
|
||||
TosDscpWidget::TosDscpWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
codePoints_.insert("cs0", 0);
|
||||
codePoints_.insert("cs1", 8);
|
||||
codePoints_.insert("cs2", 16);
|
||||
codePoints_.insert("cs3", 24);
|
||||
codePoints_.insert("cs4", 32);
|
||||
codePoints_.insert("cs5", 40);
|
||||
codePoints_.insert("cs6", 48);
|
||||
codePoints_.insert("cs7", 56);
|
||||
codePoints_.insert("af11", 10);
|
||||
codePoints_.insert("af12", 12);
|
||||
codePoints_.insert("af13", 14);
|
||||
codePoints_.insert("af21", 18);
|
||||
codePoints_.insert("af22", 20);
|
||||
codePoints_.insert("af23", 22);
|
||||
codePoints_.insert("af31", 26);
|
||||
codePoints_.insert("af32", 28);
|
||||
codePoints_.insert("af33", 30);
|
||||
codePoints_.insert("af41", 34);
|
||||
codePoints_.insert("af42", 36);
|
||||
codePoints_.insert("af43", 38);
|
||||
codePoints_.insert("ef", 46);
|
||||
codePoints_.insert("voice-admit", 44);
|
||||
|
||||
setupUi(this);
|
||||
dscp->addItems(codePoints_.keys());
|
||||
|
||||
connect(precedence, SIGNAL(activated(int)), SLOT(setTosValue()));
|
||||
connect(lowDelay, SIGNAL(clicked(bool)), SLOT(setTosValue()));
|
||||
connect(highThroughput, SIGNAL(clicked(bool)), SLOT(setTosValue()));
|
||||
connect(highReliability, SIGNAL(clicked(bool)), SLOT(setTosValue()));
|
||||
|
||||
connect(dscp, SIGNAL(activated(int)), SLOT(setDscpValue()));
|
||||
connect(ecn, SIGNAL(activated(int)), SLOT(setDscpValue()));
|
||||
|
||||
connect(customValue, SIGNAL(valueChanged(int)), SLOT(setValue(int)));
|
||||
}
|
||||
|
||||
int TosDscpWidget::value()
|
||||
{
|
||||
return customValue->value() & 0xff;
|
||||
}
|
||||
|
||||
void TosDscpWidget::setValue(int value)
|
||||
{
|
||||
value &= 0xff;
|
||||
qDebug("value %02x", value);
|
||||
customValue->blockSignals(true);
|
||||
customValue->setValue(value); // avoid signal-slot loop
|
||||
customValue->blockSignals(false);
|
||||
|
||||
dscp->setCurrentIndex(codePoints_.values().indexOf(value >> 2));
|
||||
ecn->setCurrentIndex(value & 0x03);
|
||||
|
||||
precedence->setCurrentIndex(value >> 5);
|
||||
lowDelay->setChecked(value & 0x10);
|
||||
highThroughput->setChecked(value & 0x08);
|
||||
highReliability->setChecked(value & 0x04);
|
||||
}
|
||||
|
||||
void TosDscpWidget::setTosValue()
|
||||
{
|
||||
qDebug("prec %d", precedence->currentIndex());
|
||||
qDebug("delay %d", lowDelay->isChecked() ? 1 : 0);
|
||||
setValue((precedence->currentIndex() << 5)
|
||||
| (lowDelay->isChecked() ? 0x10 : 0x00)
|
||||
| (highThroughput->isChecked() ? 0x08 : 0x00)
|
||||
| (highReliability->isChecked() ? 0x04 : 0x00)
|
||||
| 0x00);
|
||||
}
|
||||
|
||||
void TosDscpWidget::setDscpValue()
|
||||
{
|
||||
setValue((codePoints_.value(dscp->currentText()) << 2)
|
||||
| ecn->currentIndex());
|
||||
}
|
47
common/tosdscp.h
Normal file
47
common/tosdscp.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (C) 2018 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 _TOS_DSCP_H
|
||||
#define _TOS_DSCP_H
|
||||
|
||||
#include "ui_tosdscp.h"
|
||||
#include <QWidget>
|
||||
|
||||
class TosDscpWidget: public QWidget, private Ui::TosDscp
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TosDscpWidget(QWidget *parent);
|
||||
|
||||
int value();
|
||||
|
||||
public slots:
|
||||
void setValue(int value);
|
||||
|
||||
private slots:
|
||||
void setTosValue();
|
||||
void setDscpValue();
|
||||
|
||||
private:
|
||||
QMap<QString, quint8> codePoints_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
258
common/tosdscp.ui
Normal file
258
common/tosdscp.ui
Normal file
@ -0,0 +1,258 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TosDscp</class>
|
||||
<widget class="QWidget" name="TosDscp">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>232</width>
|
||||
<height>38</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cosType">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TOS</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DSCP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="precedence">
|
||||
<property name="toolTip">
|
||||
<string>Precedence</string>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Routine</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Priority</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Immediate</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flash</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flash Override</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Critical</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Internetwork Control</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Network Control</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lowDelay">
|
||||
<property name="toolTip">
|
||||
<string>Low Delay</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="highThroughput">
|
||||
<property name="toolTip">
|
||||
<string>High Throughput</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>T</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="highReliability">
|
||||
<property name="toolTip">
|
||||
<string>High Reliability</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>R</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="dscp">
|
||||
<property name="toolTip">
|
||||
<string>DSCP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="ecn">
|
||||
<property name="toolTip">
|
||||
<string>ECN</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Not-ECT</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ECT (1)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ECT (0)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CE</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="IntEdit" name="customValue">
|
||||
<property name="toolTip">
|
||||
<string>Enter value in hexadecimal</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="displayIntegerBase">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>IntEdit</class>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>intedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cosType</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>stackedWidget</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>58</x>
|
||||
<y>67</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>110</x>
|
||||
<y>36</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user