Пример #1
0
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());
}
Пример #2
0
void PayloadProtocol::loadConfigWidget()
{
    configWidget();

    configForm->cmbPatternMode->setCurrentIndex(data.pattern_mode());
    configForm->lePattern->setText(uintToHexStr(data.pattern(), 4));
}
Пример #3
0
void Eth2ConfigForm::loadWidget(AbstractProtocol *proto)
{
    cbOverrideType->setChecked(
        proto->fieldData(
            Eth2Protocol::eth2_is_override_type,
            AbstractProtocol::FieldValue
        ).toBool());
    leType->setText(uintToHexStr(
                        proto->fieldData(
                            Eth2Protocol::eth2_type,
                            AbstractProtocol::FieldValue
                        ).toUInt(), 2));
}
Пример #4
0
void PayloadConfigForm::loadWidget(AbstractProtocol *proto)
{
    cmbPatternMode->setCurrentIndex(
            proto->fieldData(
                PayloadProtocol::payload_dataPatternMode,
                AbstractProtocol::FieldValue
                ).toUInt());
    lePattern->setText(uintToHexStr(
            proto->fieldData(
                PayloadProtocol::payload_dataPattern,
                AbstractProtocol::FieldValue
                ).toUInt(), 4));
}
Пример #5
0
void SnapConfigForm::loadWidget(AbstractProtocol *proto)
{
    cbOverrideOui->setChecked(
            proto->fieldData(
                SnapProtocol::snap_is_override_oui, 
                AbstractProtocol::FieldValue
            ).toBool());
    leOui->setText(uintToHexStr(
            proto->fieldData(
                SnapProtocol::snap_oui, 
                AbstractProtocol::FieldValue
            ).toUInt(), 3));

    cbOverrideType->setChecked(
            proto->fieldData(
                SnapProtocol::snap_is_override_type, 
                AbstractProtocol::FieldValue
            ).toBool());
    leType->setText(uintToHexStr(
            proto->fieldData(
                SnapProtocol::snap_type, 
                AbstractProtocol::FieldValue
            ).toUInt(), 2));
}
Пример #6
0
void LacpProtocol::loadConfigWidget()
{
    configWidget();


   configForm->ui_Subtype->setText(QString().setNum(data.proto_subtype()));
   configForm->ui_Version->setText(QString().setNum(data.proto_ver_num()));
   configForm->ui_TLV_Actor->setText(QString().setNum(data.proto_tlv_typea()));
   configForm->ui_ActorInfo->setText(QString().setNum(data.proto_act_info_len()));
   configForm->ui_act_sys_prior->setText(QString().setNum(data.proto_act_sys_prior()));
   configForm->ui_lacp_asys->setText(uintToHexStr(data.proto_asys(),6));
   configForm->ui_akey->setText(QString().setNum(data.proto_akey()));
   configForm->ui_aport_prior->setText(QString().setNum(data.proto_aport_prior()));
   configForm->ui_aport->setText(QString().setNum(data.proto_aport()));

   configForm->ui_TLV_Partner->setText(QString().setNum(data.proto_tlv_typep()));
   configForm->ui_PartnerInfo->setText(QString().setNum(data.proto_par_info_len()));
   configForm->ui_par_sys_prior->setText(QString().setNum(data.proto_par_sys_prior()));
   configForm->ui_psys->setText(uintToHexStr(data.proto_psys(),6));
   configForm->ui_pkey->setText(QString().setNum(data.proto_pkey()));
   configForm->ui_pport_prior->setText(QString().setNum(data.proto_pport_prior()));
   configForm->ui_pport->setText(QString().setNum(data.proto_pport()));

   configForm->ui_TLV_Collector->setText(QString().setNum(data.proto_tlv_typec()));
   configForm->ui_CollectorInfo->setText(QString().setNum(data.proto_coll_info_len()));
   configForm->ui_collMaxDel->setText(QString().setNum(data.proto_collmaxdelay()));
   configForm->ui_collMaxDel->setText(QString().setNum(data.proto_collmaxdelay()));

   configForm->ui_TLV_Terminator->setText(QString().setNum(data.proto_tlv_typeterm()));
   configForm->ui_TerminatoLen->setText(QString().setNum(data.proto_term_len()));

   if((data.proto_pstate() & 1)) configForm->checkActivity_p->setChecked(true);
   if((data.proto_pstate() & 2)) configForm->checkTimeout_p->setChecked(true);
   if((data.proto_pstate() & 4)) configForm->checkAggregation_p->setChecked(true);
   if((data.proto_pstate() & 8))configForm->checkSynchronization_p->setChecked(true);
   if((data.proto_pstate() & 16))configForm->checkCollecting_p->setChecked(true);
   if((data.proto_pstate() & 32))configForm->checkDistributing_p->setChecked(true);
   if((data.proto_pstate() & 64))configForm->checkDefaulted_p->setChecked(true);
   if((data.proto_pstate() & 128)) configForm->checkExpired_p->setChecked(true);

   if((data.proto_astate() & 1)) configForm->checkActivity->setChecked(true);
   if((data.proto_astate() & 2)) configForm->checkTimeout->setChecked(true);
   if((data.proto_astate() & 4)) configForm->checkAggregation->setChecked(true);
   if((data.proto_astate() & 8))configForm->checkSynchronization->setChecked(true);
   if((data.proto_astate() & 16))configForm->checkCollecting->setChecked(true);
   if((data.proto_astate() & 32))configForm->checkDistributing->setChecked(true);
   if((data.proto_astate() & 64))configForm->checkDefaulted->setChecked(true);
   if((data.proto_astate() & 128)) configForm->checkExpired->setChecked(true);

    configForm->ui_FCS->setText(uintToHexStr(data.proto_fcs(),4));
   // meta data

   configForm->checkSubtype->setChecked(data.proto_is_subtype());
   configForm->checkVersion->setChecked(data.proto_is_version());
   configForm->checkTLV_A->setChecked(data.proto_is_tlv_a());
   configForm->checkActorInfo->setChecked(data.proto_is_actor_info());
   configForm->checkTLV_P->setChecked(data.proto_is_tlv_p());
   configForm->checkPartnerInfo->setChecked(data.proto_is_partner_info());
   configForm->checkTLVCollector->setChecked(data.proto_is_tlv_c());
   configForm->checkCollectorInfo->setChecked(data.proto_is_collector_info());
   configForm->checkTLV_T->setChecked(data.proto_is_tlv_t());
   configForm->checkTerminatorLen->setChecked(data.proto_is_terminator_len());
}
Пример #7
0
QVariant LacpProtocol::fieldData(int index, FieldAttrib attrib,
        int streamIndex) const
{
    QString str[8]={"Activity","Timeout" ,"Aggregation", "Synchronization",
                    "Collecting", "Distributing","Defaulted","Expired"};

    switch (index)
    {

        case lacp_subtype:
        {
            switch(attrib)
            {
                case FieldName:
                    return QString("Subtype = LACP");
                case FieldValue:
                     return data.proto_subtype();
                case FieldTextValue:
                return QString("0x%1").
                        arg(data.proto_subtype(), 2, BASE_HEX, QChar('0'));
                case FieldFrameValue:
                   return QByteArray(1, (char) data.proto_subtype());
            default:
                break;
            }
            break;

        }
        case lacp_ver_num:
        {

            switch(attrib)
            {
                case FieldName:
                    return QString("Version Number");
                case FieldValue:
                     return data.proto_ver_num();
                case FieldTextValue:
                return QString("0x%1").
                        arg(data.proto_ver_num(), 2, BASE_HEX, QChar('0'));
                case FieldFrameValue:
                return QByteArray(1, (char) data.proto_ver_num());
            default:
                break;
            }
            break;

        }
    case lacp_TLV_typeA:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Actor Information");
            case FieldValue:
                 return data.proto_tlv_typea();
            case FieldTextValue:
                 return QString("0x%1").
                         arg(data.proto_tlv_typea(), 2, BASE_HEX, QChar('0'));
            case FieldFrameValue:
               return QByteArray(1, (char) data.proto_tlv_typea());
            default:
                break;
        }
        break;

    }
    case lacp_Act_info_len:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Actor Information Length");
            case FieldValue:
                 return data.proto_act_info_len();
            case FieldTextValue:
            return QString("0x%1").
                    arg(data.proto_act_info_len(), 2, BASE_HEX, QChar('0'));
            case FieldFrameValue:
               return QByteArray(1, (char) data.proto_act_info_len());
        default:
            break;
        }
        break;

    }
    case lacp_Act_sys_prior:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Actor System Priority");
            case FieldValue:
                 return data.proto_act_sys_prior();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_act_sys_prior());
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(4);
                qToBigEndian((quint32) data.proto_act_sys_prior(), (uchar*) fv.data());
                fv.remove(0,2);
                return fv;
            }
        default:
            break;
        }
        break;

    }
    case lacp_Asys:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Actor System");
            case FieldValue:
                 return (quint64)data.proto_asys();
                 /* MOD */
            case FieldTextValue:
            return uintToHexStr(data.proto_asys(), 6);
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(8);
                qToBigEndian((quint64)data.proto_asys() , (uchar*) fv.data());
                fv.remove(0,2);
                return fv;
            }
        default:
            break;
        }
        break;

    }

    case lacp_Akey:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Actor Key");
            case FieldValue:
                 return data.proto_akey();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_akey());
            case FieldFrameValue:
            {
            QByteArray fv;
            fv.resize(2);
            qToBigEndian((quint16) data.proto_akey(), (uchar*) fv.data());
            return fv;
            }
        default:
            break;
        }
        break;

    }

    case lacp_Aport_prior:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Actor Port Priority");
            case FieldValue:
                 return data.proto_aport_prior();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_aport_prior());
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(2);
                qToBigEndian((quint16) data.proto_aport_prior(), (uchar*)fv.data());
                return fv;
            }

        default:
            break;
        }
        break;

    }
    case lacp_Aport:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Actor Port Priority");
            case FieldValue:
                 return data.proto_aport();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_aport());
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(2);
                qToBigEndian((quint16) data.proto_aport(), (uchar*)fv.data());
                return fv;
            }

        default:
            break;
        }
        break;

    }
    case lacp_Astate:
    {
        switch(attrib)
        {
            case FieldName:
                return QString("Actor State");
            case FieldValue:
                 return data.proto_astate();
            case FieldTextValue:
            {
            QString str_temp="( ";
            if((data.proto_astate() & 1))str_temp+=" "+str[0];
            if((data.proto_astate() & 2))str_temp+=" "+str[1];
            if((data.proto_astate() & 4))str_temp+=" "+str[2];
            if((data.proto_astate() & 8))str_temp+=" "+str[3];
            if((data.proto_astate() & 16))str_temp+=" "+str[4];
            if((data.proto_astate() & 32))str_temp+=" "+str[5];
            if((data.proto_astate() & 64))str_temp+=" "+str[6];
            if((data.proto_astate() & 128))str_temp+=" "+str[7];
            str_temp+=" )";
            return str_temp;
            }
            case FieldFrameValue:
              return QByteArray(1, (char) data.proto_astate());

        default:
            break;
        }
        break;
      }
    case lacp_Areserved:
        {

            switch(attrib)
            {
                case FieldName:
                    return QString("Reserved");
                case FieldValue:
                     return data.proto_areserved();
                case FieldTextValue:
                return uintToHexStr(data.proto_areserved(),3);
                case FieldFrameValue:
                {
                    QByteArray fv;
                    fv.resize(3);
                    qToBigEndian((quint32) data.proto_areserved(), (uchar*)fv.data());
                    return fv;
                }

            default:
                break;
            }
            break;

        }
//--------------------------------Partner----------------------------------------------------------
    case lacp_TLV_typeP:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Partner Information");
            case FieldValue:
                 return data.proto_tlv_typep();
            case FieldTextValue:
                 return QString("0x%1").
                         arg(data.proto_tlv_typep(), 2, BASE_HEX, QChar('0'));
            case FieldFrameValue:
               return QByteArray(1, (char) data.proto_tlv_typep());
            default:
                break;
        }
        break;

    }
    case lacp_Par_info_len:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Partner Information Length");
            case FieldValue:
                 return data.proto_par_info_len();
            case FieldTextValue:
            return QString("0x%1").
                    arg(data.proto_par_info_len(), 2, BASE_HEX, QChar('0'));
            case FieldFrameValue:
               return QByteArray(1, (char) data.proto_par_info_len());
        default:
            break;
        }
        break;

    }
    case lacp_Par_sys_prior:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Partner System Priority");
            case FieldValue:
                 return data.proto_par_sys_prior();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_par_sys_prior());
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(2);
                qToBigEndian((quint16) data.proto_par_sys_prior(), (uchar*) fv.data());
                return fv;
            }
        default:
            break;
        }
        break;

    }
    case lacp_Psys:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Partner System");
            case FieldValue:
                 return (quint64)data.proto_psys();
            case FieldTextValue:
            return uintToHexStr(data.proto_psys(), 6);
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(8);
                qToBigEndian((quint64)data.proto_psys() , (uchar*) fv.data());
                fv.remove(0,2);
                return fv;
            }
        default:
            break;
        }
        break;

    }

    case lacp_Pkey:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Partner Key");
            case FieldValue:
                 return data.proto_pkey();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_pkey());
            case FieldFrameValue:
            {
            QByteArray fv;
            fv.resize(2);
            qToBigEndian((quint16) data.proto_pkey(), (uchar*) fv.data());
            return fv;
            }
        default:
            break;
        }
        break;

    }

    case lacp_Pport_prior:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Partner Port Priority");
            case FieldValue:
                 return data.proto_pport_prior();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_pport_prior());
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(2);
                qToBigEndian((quint16) data.proto_pport_prior(), (uchar*)fv.data());
                return fv;
            }

        default:
            break;
        }
        break;

    }
    case lacp_Pport:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Partner Port Priority");
            case FieldValue:
                 return data.proto_pport();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_pport());
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(2);
                qToBigEndian((quint16) data.proto_pport(), (uchar*)fv.data());
                return fv;
            }

        default:
            break;
        }
        break;

    }
    case lacp_Pstate:
    {
        switch(attrib)
        {
            case FieldName:
                return QString("Partner State");
            case FieldValue:
                 return data.proto_pstate();
            case FieldTextValue:
            {
            QString str_tempp="( ";
            if((data.proto_pstate() & 1))str_tempp+=" "+str[0];
            if((data.proto_pstate() & 2))str_tempp+=" "+str[1];
            if((data.proto_pstate() & 4))str_tempp+=" "+str[2];
            if((data.proto_pstate() & 8))str_tempp+=" "+str[3];
            if((data.proto_pstate() & 16))str_tempp+=" "+str[4];
            if((data.proto_pstate() & 32))str_tempp+=" "+str[5];
            if((data.proto_pstate() & 64))str_tempp+=" "+str[6];
            if((data.proto_pstate() & 128))str_tempp+=" "+str[7];
            str_tempp+=" )";
            return str_tempp;
            }
            case FieldFrameValue:
              return QByteArray(1, (char) data.proto_pstate());

        default:
            break;
        }
        break;
      }
    case lacp_Preserved:
        {

            switch(attrib)
            {
                case FieldName:
                    return QString("Reserved");
                case FieldValue:
                     return data.proto_preserved();
                case FieldTextValue:
                return uintToHexStr(data.proto_preserved(),3);
                case FieldFrameValue:
                {
                    QByteArray fv;
                    fv.resize(3);
                    qToBigEndian((quint32) data.proto_preserved(), (uchar*)fv.data());
                    return fv;
                }

            default:
                break;
            }
            break;

        }
//--------------------------------------------Collector------------------------------------
    case lacp_TLV_typeC:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Collector Information");
            case FieldValue:
                 return data.proto_tlv_typec();
            case FieldTextValue:
                 return QString("0x%1").
                         arg(data.proto_tlv_typec(), 2, BASE_HEX, QChar('0'));
            case FieldFrameValue:
               return QByteArray(1, (char) data.proto_tlv_typec());
            default:
                break;
        }
        break;

    }
    case lacp_Coll_info_len:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Collector Information Length");
            case FieldValue:
                 return data.proto_coll_info_len();
            case FieldTextValue:
            return QString("0x%1").
                    arg(data.proto_coll_info_len(), 2, BASE_HEX, QChar('0'));
            case FieldFrameValue:
               return QByteArray(1, (char) data.proto_coll_info_len());
        default:
            break;
        }
        break;

    }
    case lacp_CollMaxDelay:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Collector Max Delay");
            case FieldValue:
                 return data.proto_collmaxdelay();
            case FieldTextValue:
            return QString("%1").
                    arg(data.proto_collmaxdelay());
            case FieldFrameValue:
            {
                QByteArray fv;
                fv.resize(2);
                qToBigEndian((quint16) data.proto_collmaxdelay(), (uchar*)fv.data());
                return fv;
            }

        default:
            break;
        }
        break;

    }
    case lacp_Creserved:
        {

            switch(attrib)
            {
                case FieldName:
                    return QString("Reserved");
                case FieldValue:
                return 0;
                case FieldTextValue:
                return 0;
                case FieldFrameValue:
                {
                    QByteArray fv;
                    fv.resize(12);
                    qToBigEndian((quint64) data.proto_creserved0(), (uchar*)fv.data());
                    qToBigEndian((quint64) data.proto_creserved1(), (uchar*)fv.data()+8);
                    return fv;
                }

            default:
                break;
            }
            break;

        }

    case lacp_TLV_typeTerm:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Terminator Information");
            case FieldValue:
                 return data.proto_tlv_typeterm();
            case FieldTextValue:
            return QString("0x%1").
                    arg(data.proto_tlv_typeterm(), 2, BASE_HEX, QChar('0'));
            case FieldFrameValue:
               return QByteArray(1, (char) data.proto_tlv_typeterm());
        default:
            break;
        }
        break;
    }
    case lacp_Term_len:
    {

        switch(attrib)
        {
            case FieldName:
                return QString("Terminator Length");
            case FieldValue:
                 return data.proto_term_len();
            case FieldTextValue:
            return QString("0x%1").
                    arg(data.proto_term_len(), 2, BASE_HEX, QChar('0'));
            case FieldFrameValue:
               return QByteArray(1, (char) data.proto_term_len());
        default:
            break;
        }
        break;
    }
    case lacp_reserved:
        {

            switch(attrib)
            {
                case FieldName:
                    return QString("Reserved");
                case FieldValue:
                return 0;
                case FieldTextValue:
                return 0;
                case FieldFrameValue:
                {
                    QByteArray fv;
                    fv.resize(50);
                    qToBigEndian((quint64) data.proto_reserved0(), (uchar*)fv.data());
                    qToBigEndian((quint64) data.proto_reserved1(), (uchar*)fv.data()+8);
                    qToBigEndian((quint64) data.proto_reserved2(), (uchar*)fv.data()+16);
                    qToBigEndian((quint64) data.proto_reserved3(), (uchar*)fv.data()+24);
                    qToBigEndian((quint64) data.proto_reserved4(), (uchar*)fv.data()+32);
                    qToBigEndian((quint64) data.proto_reserved5(), (uchar*)fv.data()+40);
                    qToBigEndian((quint64) data.proto_reserved6(), (uchar*)fv.data()+48);
                    return fv;
                }

            default:
                break;
            }
            break;
        }
    case lacp_FCS:
        {

            switch(attrib)
            {
                case FieldName:
                    return QString("FCS");
                case FieldValue:
                return (quint64)data.proto_fcs();
                case FieldTextValue:
                return uintToHexStr(data.proto_fcs(), 4);
                case FieldFrameValue:
                {
                    QByteArray fv;
                    fv.resize(8);
                    qToBigEndian((quint64) data.proto_fcs(), (uchar*)fv.data());
                    fv.remove(0,4);
                    return fv;
                }

            default:
                break;
            }
            break;
        }

    case is_subtype:
    case is_version:
    case is_tlv_a :
    case is_actor_info:
    case is_tlv_p:
    case is_partner_info:
    case is_tlv_c:
    case is_collector_info:
    case is_tlv_t:
    case is_terminator_len:
    default:
            break;
    }

    return AbstractProtocol::fieldData(index, attrib, streamIndex);
}
Пример #8
0
void TcpConfigForm::loadWidget(AbstractProtocol *proto)
{
    leTcpSrcPort->setText(
            proto->fieldData(
                TcpProtocol::tcp_src_port, 
                AbstractProtocol::FieldValue
            ).toString());
    cbTcpSrcPortOverride->setChecked(
            proto->fieldData(
                TcpProtocol::tcp_is_override_src_port, 
                AbstractProtocol::FieldValue
            ).toBool());

    leTcpDstPort->setText(
            proto->fieldData(
                TcpProtocol::tcp_dst_port, 
                AbstractProtocol::FieldValue
            ).toString());
    cbTcpDstPortOverride->setChecked(
            proto->fieldData(
                TcpProtocol::tcp_is_override_dst_port, 
                AbstractProtocol::FieldValue
            ).toBool());

    leTcpSeqNum->setText(
            proto->fieldData(
                TcpProtocol::tcp_seq_num, 
                AbstractProtocol::FieldValue
            ).toString());
    leTcpAckNum->setText(
            proto->fieldData(
                TcpProtocol::tcp_ack_num, 
                AbstractProtocol::FieldValue
            ).toString());

    leTcpHdrLen->setText(
            proto->fieldData(
                TcpProtocol::tcp_hdrlen, 
                AbstractProtocol::FieldValue
            ).toString());
    cbTcpHdrLenOverride->setChecked(
            proto->fieldData(
                TcpProtocol::tcp_is_override_hdrlen, 
                AbstractProtocol::FieldValue
            ).toBool());

    leTcpWindow->setText(
            proto->fieldData(
                TcpProtocol::tcp_window, 
                AbstractProtocol::FieldValue
            ).toString());

    leTcpCksum->setText(uintToHexStr(
                proto->fieldData(
                    TcpProtocol::tcp_cksum, 
                    AbstractProtocol::FieldValue
                ).toUInt(), 2));
    cbTcpCksumOverride->setChecked(
            proto->fieldData(
                TcpProtocol::tcp_is_override_cksum, 
                AbstractProtocol::FieldValue
                ).toBool());

    leTcpUrgentPointer->setText(
            proto->fieldData(
                TcpProtocol::tcp_urg_ptr, 
                AbstractProtocol::FieldValue
            ).toString());

    uint flags = proto->fieldData(
                            TcpProtocol::tcp_flags, 
                            AbstractProtocol::FieldValue
                        ).toUInt();

    cbTcpFlagsUrg->setChecked((flags & TCP_FLAG_URG) > 0);
    cbTcpFlagsAck->setChecked((flags & TCP_FLAG_ACK) > 0);
    cbTcpFlagsPsh->setChecked((flags & TCP_FLAG_PSH) > 0);
    cbTcpFlagsRst->setChecked((flags & TCP_FLAG_RST) > 0);
    cbTcpFlagsSyn->setChecked((flags & TCP_FLAG_SYN) > 0);
    cbTcpFlagsFin->setChecked((flags & TCP_FLAG_FIN) > 0);
}
Пример #9
0
void GmpConfigForm::loadWidget(AbstractProtocol *proto)
{
    msgTypeCombo->setValue(
            proto->fieldData(
                GmpProtocol::kType,
                AbstractProtocol::FieldValue
            ).toUInt());

    // XXX: maxResponseTime set by subclass
    
    overrideChecksum->setChecked(
            proto->fieldData(
                GmpProtocol::kIsOverrideChecksum,
                AbstractProtocol::FieldValue
            ).toBool());
    checksum->setText(uintToHexStr(
            proto->fieldData(
                GmpProtocol::kChecksum,
                AbstractProtocol::FieldValue
            ).toUInt(), 2));

    groupAddress->setText(
            proto->fieldData(
                GmpProtocol::kGroupAddress,
                AbstractProtocol::FieldValue
            ).toString());
    groupMode->setCurrentIndex(
            proto->fieldData(
                GmpProtocol::kGroupMode,
                AbstractProtocol::FieldValue
            ).toUInt());
    groupCount->setText(
            proto->fieldData(
                GmpProtocol::kGroupCount,
                AbstractProtocol::FieldValue
            ).toString());
    groupPrefix->setText(
            proto->fieldData(
                GmpProtocol::kGroupPrefix,
                AbstractProtocol::FieldValue
            ).toString());

    sFlag->setChecked(
            proto->fieldData(
                GmpProtocol::kSFlag,
                AbstractProtocol::FieldValue
            ).toBool());
    qrv->setText(
            proto->fieldData(
                GmpProtocol::kQrv,
                AbstractProtocol::FieldValue
            ).toString());
    qqi->setText(
            proto->fieldData(
                GmpProtocol::kQqic,
                AbstractProtocol::FieldValue
            ).toString());

    QStringList sl = 
            proto->fieldData(
                GmpProtocol::kSources,
                AbstractProtocol::FieldValue
            ).toStringList();
    sourceList->clear();
    foreach(QString src, sl)
    {
        QListWidgetItem *item = new QListWidgetItem(src);
        item->setFlags(item->flags() | Qt::ItemIsEditable);
        sourceList->addItem(item);
    }