NOX: VLAN - Separated protocol and widget as per new framework + cosmetic layout change in the widget
This commit is contained in:
parent
4fa4046e9e
commit
a97a7d9511
@ -48,6 +48,7 @@ HEADERS += \
|
||||
mac.h \
|
||||
payload.h \
|
||||
dot3.h \
|
||||
vlan.h \
|
||||
eth2.h \
|
||||
ip6.h
|
||||
|
||||
@ -56,7 +57,6 @@ HEADERS1 += \
|
||||
snap.h \
|
||||
dot2llc.h \
|
||||
dot2snap.h \
|
||||
vlan.h \
|
||||
svlan.h \
|
||||
vlanstack.h \
|
||||
arp.h \
|
||||
@ -89,6 +89,7 @@ SOURCES = \
|
||||
SOURCES += \
|
||||
mac.cpp \
|
||||
payload.cpp \
|
||||
vlan.cpp \
|
||||
dot3.cpp \
|
||||
eth2.cpp \
|
||||
ip6.cpp
|
||||
@ -96,7 +97,6 @@ SOURCES += \
|
||||
SOURCES1 += \
|
||||
llc.cpp \
|
||||
snap.cpp \
|
||||
vlan.cpp \
|
||||
svlan.cpp \
|
||||
arp.cpp \
|
||||
ip4.cpp \
|
||||
|
@ -10,6 +10,7 @@ FORMS = \
|
||||
FORMS += \
|
||||
mac.ui \
|
||||
payload.ui \
|
||||
vlan.ui \
|
||||
dot3.ui \
|
||||
eth2.ui \
|
||||
ip6.ui \
|
||||
@ -17,7 +18,6 @@ FORMS += \
|
||||
FORMS1 += \
|
||||
llc.ui \
|
||||
snap.ui \
|
||||
vlan.ui \
|
||||
arp.ui \
|
||||
ip4.ui \
|
||||
icmp.ui \
|
||||
@ -48,6 +48,7 @@ HEADERS += \
|
||||
protocolwidgetfactory.h \
|
||||
macconfig.h \
|
||||
payloadconfig.h \
|
||||
vlanconfig.h \
|
||||
dot3config.h \
|
||||
eth2config.h \
|
||||
ip6config.h
|
||||
@ -66,6 +67,7 @@ SOURCES += \
|
||||
protocolwidgetfactory.cpp \
|
||||
macconfig.cpp \
|
||||
payloadconfig.cpp \
|
||||
vlanconfig.cpp \
|
||||
dot3config.cpp \
|
||||
eth2config.cpp \
|
||||
ip6config.cpp
|
||||
|
@ -26,7 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "snap.h"
|
||||
#include "dot2llc.h"
|
||||
#include "dot2snap.h"
|
||||
#include "vlan.h"
|
||||
#include "vlanstack.h"
|
||||
#include "arp.h"
|
||||
#include "ip4.h"
|
||||
@ -47,6 +46,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "mac.h"
|
||||
#include "payload.h"
|
||||
#include "dot3.h"
|
||||
#include "vlan.h"
|
||||
#include "eth2.h"
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
@ -70,8 +70,6 @@ ProtocolManager::ProtocolManager()
|
||||
|
||||
registerProtocol(OstProto::Protocol::kSvlanFieldNumber,
|
||||
(void*) SVlanProtocol::createInstance);
|
||||
registerProtocol(OstProto::Protocol::kVlanFieldNumber,
|
||||
(void*) VlanProtocol::createInstance);
|
||||
registerProtocol(OstProto::Protocol::kVlanStackFieldNumber,
|
||||
(void*) VlanStackProtocol::createInstance);
|
||||
|
||||
@ -116,8 +114,13 @@ ProtocolManager::ProtocolManager()
|
||||
|
||||
registerProtocol(OstProto::Protocol::kDot3FieldNumber,
|
||||
(void*) Dot3Protocol::createInstance);
|
||||
|
||||
registerProtocol(OstProto::Protocol::kVlanFieldNumber,
|
||||
(void*) VlanProtocol::createInstance);
|
||||
|
||||
registerProtocol(OstProto::Protocol::kEth2FieldNumber,
|
||||
(void*) Eth2Protocol::createInstance);
|
||||
|
||||
registerProtocol(OstProto::Protocol::kIp6FieldNumber,
|
||||
(void*) Ip6Protocol::createInstance);
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "macconfig.h"
|
||||
#include "payloadconfig.h"
|
||||
#include "dot3config.h"
|
||||
#include "vlanconfig.h"
|
||||
#include "eth2config.h"
|
||||
#include "ip6config.h"
|
||||
|
||||
@ -44,9 +45,15 @@ ProtocolWidgetFactory::ProtocolWidgetFactory()
|
||||
OstProtocolWidgetFactory->registerProtocolConfigWidget(
|
||||
OstProto::Protocol::kDot3FieldNumber,
|
||||
(void*) Dot3ConfigForm::createInstance);
|
||||
|
||||
OstProtocolWidgetFactory->registerProtocolConfigWidget(
|
||||
OstProto::Protocol::kVlanFieldNumber,
|
||||
(void*) VlanConfigForm::createInstance);
|
||||
|
||||
OstProtocolWidgetFactory->registerProtocolConfigWidget(
|
||||
OstProto::Protocol::kEth2FieldNumber,
|
||||
(void*) Eth2ConfigForm::createInstance);
|
||||
|
||||
OstProtocolWidgetFactory->registerProtocolConfigWidget(
|
||||
OstProto::Protocol::kIp6FieldNumber,
|
||||
(void*) Ip6ConfigForm::createInstance);
|
||||
|
105
common/vlan.cpp
105
common/vlan.cpp
@ -17,25 +17,15 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include <qendian.h>
|
||||
|
||||
#include "vlan.h"
|
||||
|
||||
VlanConfigForm::VlanConfigForm(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
VlanProtocol::VlanProtocol(StreamBase *stream, AbstractProtocol *parent)
|
||||
: AbstractProtocol(stream, parent)
|
||||
{
|
||||
configForm = NULL;
|
||||
}
|
||||
|
||||
VlanProtocol::~VlanProtocol()
|
||||
{
|
||||
delete configForm;
|
||||
}
|
||||
|
||||
AbstractProtocol* VlanProtocol::createInstance(StreamBase *stream,
|
||||
@ -206,6 +196,12 @@ QVariant VlanProtocol::fieldData(int index, FieldAttrib attrib,
|
||||
// Meta fields
|
||||
|
||||
case vlan_isOverrideTpid:
|
||||
switch(attrib)
|
||||
{
|
||||
case FieldValue: return data.is_override_tpid();
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -213,45 +209,62 @@ QVariant VlanProtocol::fieldData(int index, FieldAttrib attrib,
|
||||
return AbstractProtocol::fieldData(index, attrib, streamIndex);
|
||||
}
|
||||
|
||||
bool VlanProtocol::setFieldData(int /*index*/, const QVariant &/*value*/,
|
||||
FieldAttrib /*attrib*/)
|
||||
bool VlanProtocol::setFieldData(int index, const QVariant &value,
|
||||
FieldAttrib attrib)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool isOk = false;
|
||||
|
||||
if (attrib != FieldValue)
|
||||
goto _exit;
|
||||
|
||||
QWidget* VlanProtocol::configWidget()
|
||||
{
|
||||
if (configForm == NULL)
|
||||
switch (index)
|
||||
{
|
||||
configForm = new VlanConfigForm;
|
||||
loadConfigWidget();
|
||||
case vlan_tpid:
|
||||
{
|
||||
uint tpid = value.toUInt(&isOk);
|
||||
if (isOk)
|
||||
data.set_tpid(tpid);
|
||||
break;
|
||||
}
|
||||
case vlan_prio:
|
||||
{
|
||||
uint prio = value.toUInt(&isOk);
|
||||
if (isOk)
|
||||
data.set_vlan_tag(
|
||||
((prio & 0x07) << 13) | (data.vlan_tag() & 0x1FFF));
|
||||
break;
|
||||
}
|
||||
case vlan_cfiDei:
|
||||
{
|
||||
uint cfiDei = value.toUInt(&isOk);
|
||||
if (isOk)
|
||||
data.set_vlan_tag(
|
||||
((cfiDei & 0x01) << 12) | (data.vlan_tag() & 0xEFFF));
|
||||
break;
|
||||
}
|
||||
case vlan_vlanId:
|
||||
{
|
||||
uint vlanId = value.toUInt(&isOk);
|
||||
if (isOk)
|
||||
data.set_vlan_tag(
|
||||
(vlanId & 0x0FFF) | (data.vlan_tag() & 0xF000));
|
||||
break;
|
||||
}
|
||||
|
||||
// Meta-Fields
|
||||
case vlan_isOverrideTpid:
|
||||
{
|
||||
bool override = value.toUInt(&isOk);
|
||||
if (isOk)
|
||||
data.set_is_override_tpid(override);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qFatal("%s: unimplemented case %d in switch", __PRETTY_FUNCTION__,
|
||||
index);
|
||||
break;
|
||||
}
|
||||
return configForm;
|
||||
|
||||
_exit:
|
||||
return isOk;
|
||||
}
|
||||
|
||||
void VlanProtocol::loadConfigWidget()
|
||||
{
|
||||
configWidget();
|
||||
|
||||
configForm->cbTpidOverride->setChecked(data.is_override_tpid());
|
||||
configForm->leTpid->setText(uintToHexStr(fieldData(vlan_tpid, FieldValue).toUInt(), 2));
|
||||
configForm->cmbPrio->setCurrentIndex(fieldData(vlan_prio, FieldValue).toUInt());
|
||||
configForm->cmbCfiDei->setCurrentIndex(fieldData(vlan_cfiDei, FieldValue).toUInt());
|
||||
configForm->leVlanId->setText(fieldData(vlan_vlanId, FieldValue).toString());
|
||||
}
|
||||
|
||||
void VlanProtocol::storeConfigWidget()
|
||||
{
|
||||
bool isOk;
|
||||
|
||||
configWidget();
|
||||
|
||||
data.set_is_override_tpid(configForm->cbTpidOverride->isChecked());
|
||||
data.set_tpid(configForm->leTpid->text().remove(QChar(' ')).toULong(&isOk, BASE_HEX));
|
||||
data.set_vlan_tag(
|
||||
((configForm->cmbPrio->currentIndex() & 0x07) << 13) |
|
||||
((configForm->cmbCfiDei->currentIndex() & 0x01) << 12) |
|
||||
(configForm->leVlanId->text().toULong(&isOk) & 0x0FFF));
|
||||
}
|
||||
|
||||
|
@ -17,25 +17,15 @@ 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 _Vlan_H
|
||||
#define _Vlan_H
|
||||
#ifndef _VLAN_H
|
||||
#define _VLAN_H
|
||||
|
||||
#include "abstractprotocol.h"
|
||||
|
||||
#include "vlan.pb.h"
|
||||
#include "ui_vlan.h"
|
||||
|
||||
class VlanConfigForm : public QWidget, public Ui::Vlan
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VlanConfigForm(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
class VlanProtocol : public AbstractProtocol
|
||||
{
|
||||
private:
|
||||
VlanConfigForm *configForm;
|
||||
public:
|
||||
enum Vlanfield
|
||||
{
|
||||
vlan_tpid,
|
||||
@ -49,10 +39,6 @@ private:
|
||||
vlan_fieldCount
|
||||
};
|
||||
|
||||
protected:
|
||||
OstProto::Vlan data;
|
||||
|
||||
public:
|
||||
VlanProtocol(StreamBase *stream, AbstractProtocol *parent = 0);
|
||||
virtual ~VlanProtocol();
|
||||
|
||||
@ -74,9 +60,8 @@ public:
|
||||
virtual bool setFieldData(int index, const QVariant &value,
|
||||
FieldAttrib attrib = FieldValue);
|
||||
|
||||
virtual QWidget* configWidget();
|
||||
virtual void loadConfigWidget();
|
||||
virtual void storeConfigWidget();
|
||||
protected:
|
||||
OstProto::Vlan data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
284
common/vlan.ui
284
common/vlan.ui
@ -5,156 +5,158 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>268</width>
|
||||
<height>96</height>
|
||||
<width>274</width>
|
||||
<height>106</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="cbTpidOverride" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Override TPID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Priority</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>CFI/DEI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" >
|
||||
<widget class="QLabel" name="label_10" >
|
||||
<property name="text" >
|
||||
<string>VLAN</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="cbTpidOverride" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Override TPID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Priority</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>CFI/DEI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" >
|
||||
<widget class="QLabel" name="label_10" >
|
||||
<property name="text" >
|
||||
<string>VLAN</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLineEdit" name="leTpid" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="inputMask" >
|
||||
<string>>HH HH; </string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string> </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="cmbPrio" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QComboBox" name="cmbCfiDei" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" >
|
||||
<widget class="QLineEdit" name="leVlanId" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLineEdit" name="leTpid" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="inputMask" >
|
||||
<string>>HH HH; </string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string> </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="cmbPrio" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QComboBox" name="cmbCfiDei" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" >
|
||||
<widget class="QLineEdit" name="leVlanId" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>111</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
87
common/vlanconfig.cpp
Normal file
87
common/vlanconfig.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
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/>
|
||||
*/
|
||||
|
||||
#include "vlanconfig.h"
|
||||
#include "vlan.h"
|
||||
|
||||
VlanConfigForm::VlanConfigForm(QWidget *parent)
|
||||
: AbstractProtocolConfigForm(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
VlanConfigForm::~VlanConfigForm()
|
||||
{
|
||||
}
|
||||
|
||||
VlanConfigForm* VlanConfigForm::createInstance()
|
||||
{
|
||||
return new VlanConfigForm;
|
||||
}
|
||||
|
||||
void VlanConfigForm::loadWidget(AbstractProtocol *proto)
|
||||
{
|
||||
cbTpidOverride->setChecked(
|
||||
proto->fieldData(
|
||||
VlanProtocol::vlan_isOverrideTpid,
|
||||
AbstractProtocol::FieldValue
|
||||
).toBool());
|
||||
leTpid->setText(uintToHexStr(
|
||||
proto->fieldData(
|
||||
VlanProtocol::vlan_tpid,
|
||||
AbstractProtocol::FieldValue)
|
||||
.toUInt(), 2));
|
||||
cmbPrio->setCurrentIndex(
|
||||
proto->fieldData(
|
||||
VlanProtocol::vlan_prio,
|
||||
AbstractProtocol::FieldValue)
|
||||
.toUInt());
|
||||
cmbCfiDei->setCurrentIndex(
|
||||
proto->fieldData(
|
||||
VlanProtocol::vlan_cfiDei,
|
||||
AbstractProtocol::FieldValue)
|
||||
.toUInt());
|
||||
leVlanId->setText(
|
||||
proto->fieldData(
|
||||
VlanProtocol::vlan_vlanId,
|
||||
AbstractProtocol::FieldValue)
|
||||
.toString());
|
||||
}
|
||||
|
||||
void VlanConfigForm::storeWidget(AbstractProtocol *proto)
|
||||
{
|
||||
bool isOk;
|
||||
|
||||
proto->setFieldData(
|
||||
VlanProtocol::vlan_isOverrideTpid,
|
||||
cbTpidOverride->isChecked());
|
||||
proto->setFieldData(
|
||||
VlanProtocol::vlan_tpid,
|
||||
leTpid->text().remove(QChar(' ')).toUInt(&isOk, BASE_HEX));
|
||||
proto->setFieldData(
|
||||
VlanProtocol::vlan_prio,
|
||||
cmbPrio->currentIndex());
|
||||
proto->setFieldData(
|
||||
VlanProtocol::vlan_cfiDei,
|
||||
cmbCfiDei->currentIndex());
|
||||
proto->setFieldData(
|
||||
VlanProtocol::vlan_vlanId,
|
||||
leVlanId->text());
|
||||
}
|
||||
|
41
common/vlanconfig.h
Normal file
41
common/vlanconfig.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
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 _VLAN_CONFIG_H
|
||||
#define _VLAN_CONFIG_H
|
||||
|
||||
#include "abstractprotocolconfig.h"
|
||||
#include "ui_vlan.h"
|
||||
|
||||
class VlanConfigForm :
|
||||
public AbstractProtocolConfigForm,
|
||||
private Ui::Vlan
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VlanConfigForm(QWidget *parent = 0);
|
||||
virtual ~VlanConfigForm();
|
||||
|
||||
static VlanConfigForm* createInstance();
|
||||
|
||||
virtual void loadWidget(AbstractProtocol *proto);
|
||||
virtual void storeWidget(AbstractProtocol *proto);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user