mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-25 04:37:22 +01:00
added support for attributes tos and dscp in IPService
This commit is contained in:
parent
37dda74afa
commit
147684d7d0
@ -1,5 +1,10 @@
|
||||
2008-07-05 Vadim Kurland <vadim@vk.crocodile.org>
|
||||
|
||||
* IPServiceDialog.cpp (IPServiceDialog::loadFWObject): Added
|
||||
support for attriutes "tos" and "dscp" in IPService object. No
|
||||
support in compilers just yet. FR #1948944: "support for TOS
|
||||
matching".
|
||||
|
||||
* PolicyCompiler_PrintRule.cpp (PrintRule::_printModules):
|
||||
Implemented support for combinations of srcip, dstip, srcport,
|
||||
dstport options of the hashlimit module for iptables per bug
|
||||
|
||||
@ -64,6 +64,20 @@ IPServiceDialog::~IPServiceDialog()
|
||||
delete m_dialog;
|
||||
}
|
||||
|
||||
void IPServiceDialog::setCodeLabel()
|
||||
{
|
||||
if (m_dialog->use_dscp->isChecked())
|
||||
{
|
||||
m_dialog->code_label->setText(
|
||||
tr("DSCP code or class:"));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dialog->code_label->setText(
|
||||
tr("TOS code (numeric):"));
|
||||
}
|
||||
}
|
||||
|
||||
void IPServiceDialog::loadFWObject(FWObject *o)
|
||||
{
|
||||
obj=o;
|
||||
@ -80,17 +94,22 @@ void IPServiceDialog::loadFWObject(FWObject *o)
|
||||
m_dialog->timestamp->setChecked( s->getBool("ts") );
|
||||
m_dialog->all_fragments->setChecked( s->getBool("fragm") );
|
||||
m_dialog->short_fragments->setChecked( s->getBool("short_fragm") );
|
||||
if(s->getBool("use_dscp"))
|
||||
|
||||
string tos = s->getTOSCode();
|
||||
string dscp = s->getDSCPCode();
|
||||
|
||||
if (!dscp.empty())
|
||||
{
|
||||
m_dialog->use_dscp->setCheckable ( true );
|
||||
m_dialog->code_label->setText("DSCP code:");
|
||||
m_dialog->use_dscp->setChecked(true);
|
||||
m_dialog->code->setText(dscp.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dialog->use_tos->setCheckable ( true );
|
||||
m_dialog->code_label->setText("TOS code:");
|
||||
m_dialog->use_tos->setChecked(true);
|
||||
m_dialog->code->setText(tos.c_str());
|
||||
}
|
||||
m_dialog->code->setText(s->getStr("dscp_tos_code").c_str());
|
||||
setCodeLabel();
|
||||
|
||||
m_dialog->comment->setText( QString::fromUtf8(s->getComment().c_str()) );
|
||||
|
||||
//apply->setEnabled( false );
|
||||
@ -129,14 +148,7 @@ void IPServiceDialog::loadFWObject(FWObject *o)
|
||||
void IPServiceDialog::changed()
|
||||
{
|
||||
//apply->setEnabled( true );
|
||||
if (m_dialog->use_dscp->isChecked())
|
||||
{
|
||||
m_dialog->code_label->setText("DSCP code:");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dialog->code_label->setText("TOS code:");
|
||||
}
|
||||
setCodeLabel();
|
||||
emit changed_sign();
|
||||
}
|
||||
|
||||
@ -164,15 +176,24 @@ void IPServiceDialog::applyChanges()
|
||||
obj->setComment( string(m_dialog->comment->toPlainText().toUtf8().constData()) );
|
||||
|
||||
obj->setInt("protocol_num", m_dialog->protocolNum->value() );
|
||||
obj->setBool("m_dialog->lsrr", m_dialog->lsrr->isChecked() );
|
||||
obj->setBool("m_dialog->ssrr", m_dialog->ssrr->isChecked() );
|
||||
obj->setBool("m_dialog->rr", m_dialog->rr->isChecked() );
|
||||
obj->setBool("lsrr", m_dialog->lsrr->isChecked() );
|
||||
obj->setBool("ssrr", m_dialog->ssrr->isChecked() );
|
||||
obj->setBool("rr", m_dialog->rr->isChecked() );
|
||||
obj->setBool("ts", m_dialog->timestamp->isChecked() );
|
||||
obj->setBool("fragm", m_dialog->all_fragments->isChecked() );
|
||||
obj->setBool("short_fragm", m_dialog->short_fragments->isChecked() );
|
||||
obj->setBool("use_dscp", m_dialog->use_dscp->isChecked());
|
||||
obj->setBool("use_tos", m_dialog->use_tos->isChecked());
|
||||
obj->setStr("dscp_tos_code", m_dialog->code->text().toUtf8().constData());
|
||||
|
||||
IPService *ip = IPService::cast(obj);
|
||||
if (m_dialog->use_dscp->isChecked())
|
||||
{
|
||||
ip->setDSCPCode(m_dialog->code->text().toUtf8().constData());
|
||||
ip->setTOSCode("");
|
||||
} else
|
||||
{
|
||||
ip->setTOSCode(m_dialog->code->text().toUtf8().constData());
|
||||
ip->setDSCPCode("");
|
||||
}
|
||||
|
||||
mw->updateObjName(obj,QString::fromUtf8(oldname.c_str()));
|
||||
|
||||
//apply->setEnabled( false );
|
||||
|
||||
@ -45,7 +45,10 @@ class IPServiceDialog : public QWidget
|
||||
Ui::IPServiceDialog_q *m_dialog;
|
||||
|
||||
ProjectPanel *m_project;
|
||||
public:
|
||||
|
||||
void setCodeLabel();
|
||||
|
||||
public:
|
||||
IPServiceDialog(ProjectPanel *project, QWidget *parent);
|
||||
~IPServiceDialog();
|
||||
|
||||
|
||||
@ -245,24 +245,6 @@
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="text" >
|
||||
@ -283,7 +265,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<item row="1" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="textLabel3" >
|
||||
<property name="text" >
|
||||
<string>Protocol number:
|
||||
@ -294,13 +276,29 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<item row="1" column="2" >
|
||||
<widget class="QSpinBox" name="protocolNum" >
|
||||
<property name="maximum" >
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3" >
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
@ -327,7 +325,8 @@
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="code_label" >
|
||||
<property name="text" >
|
||||
<string>DSCP code:</string>
|
||||
<string>DSCP or TOS code
|
||||
(numerical, dec or hex):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -337,22 +336,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -374,28 +357,17 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QCheckBox" name="all_fragments" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="lsrr" >
|
||||
<property name="text" >
|
||||
<string>all fragments</string>
|
||||
<string>lsrr (loose source route)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="ssrr" >
|
||||
<property name="text" >
|
||||
<string>ssrr (strict source route)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -413,10 +385,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="ssrr" >
|
||||
<item row="4" column="0" >
|
||||
<widget class="QCheckBox" name="all_fragments" >
|
||||
<property name="text" >
|
||||
<string>ssrr (strict source route)</string>
|
||||
<string>all fragments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -427,29 +399,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="lsrr" >
|
||||
<property name="text" >
|
||||
<string>lsrr (loose source route)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
</item>
|
||||
@ -483,6 +435,9 @@
|
||||
<tabstops>
|
||||
<tabstop>obj_name</tabstop>
|
||||
<tabstop>protocolNum</tabstop>
|
||||
<tabstop>use_dscp</tabstop>
|
||||
<tabstop>use_tos</tabstop>
|
||||
<tabstop>code</tabstop>
|
||||
<tabstop>lsrr</tabstop>
|
||||
<tabstop>ssrr</tabstop>
|
||||
<tabstop>rr</tabstop>
|
||||
@ -639,5 +594,53 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>use_dscp</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>IPServiceDialog_q</receiver>
|
||||
<slot>changed()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>use_tos</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>IPServiceDialog_q</receiver>
|
||||
<slot>changed()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>code</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>IPServiceDialog_q</receiver>
|
||||
<slot>changed()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>271</x>
|
||||
<y>266</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>438</x>
|
||||
<y>158</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user