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