pptp-connection.cpp
connectivityqt/pptp-connection.h
connectivityqt/internal/dbus-property-cache.h
dbus-types.h
PptpConnectionInterface.h
pptp-connection.moc
pptp-connection.cpp
connectivityqt/pptp-connection.h
connectivityqt/vpn-connection.h
PptpConnectionInterface.h
QDBusConnection
QDBusObjectPath
QObject
connectivityqt/internal/dbus-property-cache.h
dbus-types.h
lomiri/util/DefinesPtrs.h
pptp-connection.moc
connectivityqt
DEFINE_PROPERTY_GETTER
name
strname
type
conversion
type PptpConnection::name() const\ {\ return d->m_propertyCache->get(strname).conversion();\ }\
DEFINE_PROPERTY_GETTER_ENUM
name
strname
type
PptpConnection::type PptpConnection::name() const\ {\ return static_cast<type>(d->m_propertyCache->get(strname).toInt());\ }
DEFINE_PROPERTY_SETTER
uppername
strname
type
void PptpConnection::set##uppername(type value)\ {\ d->m_propertyCache->set(strname, value);\ }
DEFINE_PROPERTY_SETTER_ENUM
uppername
strname
type
void PptpConnection::set##uppername(type value)\ {\ d->m_propertyCache->set(strname, static_cast<int>(value));\ }
DEFINE_PROPERTY_UPDATE
varname
strname
conversion
else if (name == strname)\ {\ Q_EMIT p.varname##Changed(value.conversion());\ }
DEFINE_PROPERTY_UPDATE_ENUM
varname
strname
type
else if (name == strname)\ {\ Q_EMIT p.varname##Changed(static_cast<type>(value.toInt()));\ }

    /*
    *Copyright©2015CanonicalLtd.
    *
    *Thisprogramisfreesoftware:youcanredistributeitand/ormodifyit
    *underthetermsoftheGNULesserGeneralPublicLicenseversion3,
    *aspublishedbytheFreeSoftwareFoundation.
    *
    *Thisprogramisdistributedinthehopethatitwillbeuseful,
    *butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof
    *MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe
    *GNULesserGeneralPublicLicenseformoredetails.
    *
    *YoushouldhavereceivedacopyoftheGNULesserGeneralPublicLicense
    *alongwiththisprogram.Ifnot,see<http://www.gnu.org/licenses/>.
    *
    *Authors:
    *PeteWoods<pete.woods@canonical.com>
    */

    #include<connectivityqt/pptp-connection.h>
    #include<connectivityqt/internal/dbus-property-cache.h>
    #include<dbus-types.h>

    #include<PptpConnectionInterface.h>

    usingnamespacestd;

    #defineDEFINE_PROPERTY_GETTER(name,strname,type,conversion)\
    typePptpConnection::name()const\
    {\
    returnd->m_propertyCache->get(strname).conversion();\
    }\

    #defineDEFINE_PROPERTY_GETTER_ENUM(name,strname,type)\
    PptpConnection::typePptpConnection::name()const\
    {\
    returnstatic_cast<type>(d->m_propertyCache->get(strname).toInt());\
    }

    #defineDEFINE_PROPERTY_SETTER(uppername,strname,type)\
    voidPptpConnection::set##uppername(typevalue)\
    {\
    d->m_propertyCache->set(strname,value);\
    }

    #defineDEFINE_PROPERTY_SETTER_ENUM(uppername,strname,type)\
    voidPptpConnection::set##uppername(typevalue)\
    {\
    d->m_propertyCache->set(strname,static_cast<int>(value));\
    }

    #defineDEFINE_PROPERTY_UPDATE(varname,strname,conversion)\
    elseif(name==strname)\
    {\
    Q_EMITp.varname##Changed(value.conversion());\
    }

    #defineDEFINE_PROPERTY_UPDATE_ENUM(varname,strname,type)\
    elseif(name==strname)\
    {\
    Q_EMITp.varname##Changed(static_cast<type>(value.toInt()));\
    }

    namespaceconnectivityqt
    {

    classPptpConnection::Priv:publicQObject
    {
    Q_OBJECT

    public:
    Priv(PptpConnection&parent):
    p(parent)
    {
    }

    publicQ_SLOTS:
    voidpropertyChanged(constQString&name,constQVariant&value)
    {
    if(name==""){}

    //Basicproperties

    DEFINE_PROPERTY_UPDATE(gateway,"gateway",toString)
    DEFINE_PROPERTY_UPDATE(user,"user",toString)
    DEFINE_PROPERTY_UPDATE(password,"password",toString)
    DEFINE_PROPERTY_UPDATE(domain,"domain",toString)

    //Advancedproperties

    DEFINE_PROPERTY_UPDATE(allowPap,"allowPap",toBool)
    DEFINE_PROPERTY_UPDATE(allowChap,"allowChap",toBool)
    DEFINE_PROPERTY_UPDATE(allowMschap,"allowMschap",toBool)
    DEFINE_PROPERTY_UPDATE(allowMschapv2,"allowMschapv2",toBool)
    DEFINE_PROPERTY_UPDATE(allowEap,"allowEap",toBool)
    DEFINE_PROPERTY_UPDATE(requireMppe,"requireMppe",toBool)
    DEFINE_PROPERTY_UPDATE_ENUM(mppeType,"mppeType",MppeType)
    DEFINE_PROPERTY_UPDATE(mppeStateful,"mppeStateful",toBool)
    DEFINE_PROPERTY_UPDATE(bsdCompression,"bsdCompression",toBool)
    DEFINE_PROPERTY_UPDATE(deflateCompression,"deflateCompression",toBool)
    DEFINE_PROPERTY_UPDATE(tcpHeaderCompression,"tcpHeaderCompression",toBool)
    DEFINE_PROPERTY_UPDATE(sendPppEchoPackets,"sendPppEchoPackets",toBool)
    }

    public:
    PptpConnection&p;

    unique_ptr<ComLomiriConnectivity1VpnVpnConnectionPptpInterface>m_pptpInterface;

    internal::DBusPropertyCache::UPtrm_propertyCache;
    };

    PptpConnection::PptpConnection(constQDBusObjectPath&path,constQDBusConnection&connection):
    VpnConnection(path,connection),
    d(newPriv(*this))
    {
    d->m_pptpInterface=make_unique<
    ComLomiriConnectivity1VpnVpnConnectionPptpInterface>(
    DBusTypes::DBUS_NAME,path.path(),connection);

    d->m_propertyCache=
    make_unique<internal::DBusPropertyCache>(
    DBusTypes::DBUS_NAME,
    ComLomiriConnectivity1VpnVpnConnectionPptpInterface::staticInterfaceName(),
    path.path(),connection);

    connect(d->m_propertyCache.get(),
    &internal::DBusPropertyCache::propertyChanged,d.get(),
    &Priv::propertyChanged);
    }

    PptpConnection::~PptpConnection()
    {
    }

    VpnConnection::TypePptpConnection::type()const
    {
    returnType::PPTP;
    }

    //Basicproperties

    DEFINE_PROPERTY_GETTER(gateway,"gateway",QString,toString)
    DEFINE_PROPERTY_GETTER(user,"user",QString,toString)
    DEFINE_PROPERTY_GETTER(password,"password",QString,toString)
    DEFINE_PROPERTY_GETTER(domain,"domain",QString,toString)

    //Advancedproperties

    DEFINE_PROPERTY_GETTER(allowPap,"allowPap",bool,toBool)
    DEFINE_PROPERTY_GETTER(allowChap,"allowChap",bool,toBool)
    DEFINE_PROPERTY_GETTER(allowMschap,"allowMschap",bool,toBool)
    DEFINE_PROPERTY_GETTER(allowMschapv2,"allowMschapv2",bool,toBool)
    DEFINE_PROPERTY_GETTER(allowEap,"allowEap",bool,toBool)
    DEFINE_PROPERTY_GETTER(requireMppe,"requireMppe",bool,toBool)
    DEFINE_PROPERTY_GETTER_ENUM(mppeType,"mppeType",MppeType)
    DEFINE_PROPERTY_GETTER(mppeStateful,"mppeStateful",bool,toBool)
    DEFINE_PROPERTY_GETTER(bsdCompression,"bsdCompression",bool,toBool)
    DEFINE_PROPERTY_GETTER(deflateCompression,"deflateCompression",bool,toBool)
    DEFINE_PROPERTY_GETTER(tcpHeaderCompression,"tcpHeaderCompression",bool,toBool)
    DEFINE_PROPERTY_GETTER(sendPppEchoPackets,"sendPppEchoPackets",bool,toBool)

    //Basicproperties

    DEFINE_PROPERTY_SETTER(Gateway,"gateway",constQString&)
    DEFINE_PROPERTY_SETTER(User,"user",constQString&)
    DEFINE_PROPERTY_SETTER(Password,"password",constQString&)
    DEFINE_PROPERTY_SETTER(Domain,"domain",constQString&)

    //Advancedproperties

    DEFINE_PROPERTY_SETTER(AllowPap,"allowPap",bool)
    DEFINE_PROPERTY_SETTER(AllowChap,"allowChap",bool)
    DEFINE_PROPERTY_SETTER(AllowMschap,"allowMschap",bool)
    DEFINE_PROPERTY_SETTER(AllowMschapv2,"allowMschapv2",bool)
    DEFINE_PROPERTY_SETTER(AllowEap,"allowEap",bool)
    DEFINE_PROPERTY_SETTER(RequireMppe,"requireMppe",bool)
    DEFINE_PROPERTY_SETTER_ENUM(MppeType,"mppeType",MppeType)
    DEFINE_PROPERTY_SETTER(MppeStateful,"mppeStateful",bool)
    DEFINE_PROPERTY_SETTER(BsdCompression,"bsdCompression",bool)
    DEFINE_PROPERTY_SETTER(DeflateCompression,"deflateCompression",bool)
    DEFINE_PROPERTY_SETTER(TcpHeaderCompression,"tcpHeaderCompression",bool)
    DEFINE_PROPERTY_SETTER(SendPppEchoPackets,"sendPppEchoPackets",bool)

    }

    #include"pptp-connection.moc"