Skip to content

Commit

Permalink
Merge branch 'jb48683' into 'master'
Browse files Browse the repository at this point in the history
[libconnman-qt] Add AnonymousIdentity -property. Contributes to JB#48683

See merge request mer-core/libconnman-qt!44
  • Loading branch information
inzanity committed Mar 24, 2020
2 parents ba15264 + 2e816c1 commit 7c91231
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
28 changes: 26 additions & 2 deletions libconnman-qt/networkservice.cpp
Expand Up @@ -32,6 +32,7 @@
ClassNoArg(CACertAvailable,caCertAvailable) \
ClassNoArg(CACertFileAvailable,caCertFileAvailable) \
ClassNoArg(DomainSuffixMatchAvailable,domainSuffixMatchAvailable) \
ClassNoArg(AnonymousIdentityAvailable,anonymousIdentityAvailable) \
ClassNoArg(LastConnectError,lastConnectError) \
ConnmanArg("Type",Type,type) \
ConnmanArg("Name",Name,name) \
Expand Down Expand Up @@ -70,7 +71,8 @@
ConnmanArg("ClientCertFile",ClientCertFile,clientCertFile) \
ConnmanArg("PrivateKey",PrivateKey,privateKey) \
ConnmanArg("PrivateKeyFile",PrivateKeyFile,privateKeyFile) \
ConnmanArg("PrivateKeyPasshprase",PrivateKeyPassphrase,privateKeyPassphrase) \
ConnmanArg("PrivateKeyPassphrase",PrivateKeyPassphrase,privateKeyPassphrase) \
ConnmanArg("AnonymousIdentity",AnonymousIdentity,anonymousIdentity) \
ConnmanNoArg("Available",Available,available) \
ConnmanNoArg("Saved",Saved,saved) \
ClassNoArg(Valid,valid)
Expand Down Expand Up @@ -122,7 +124,8 @@ class NetworkService::Private: public QObject
PropertyCACert = 0x00000200,
PropertyCACertFile = 0x00000400,
PropertyDomainSuffixMatch = 0x00000800,
PropertyAll = 0x00000fff
PropertyAnonymousIdentity = 0x00001000,
PropertyAll = 0x00001fff
};

enum CallFlags {
Expand Down Expand Up @@ -166,6 +169,7 @@ class NetworkService::Private: public QObject
static const PropertyAccessInfo PropCACert;
static const PropertyAccessInfo PropCACertFile;
static const PropertyAccessInfo PropDomainSuffixMatch;
static const PropertyAccessInfo PropAnonymousIdentity;

static QVariantMap adaptToConnmanProperties(const QVariantMap &map);

Expand Down Expand Up @@ -396,6 +400,9 @@ const NetworkService::Private::PropertyAccessInfo NetworkService::Private::PropC
const NetworkService::Private::PropertyAccessInfo NetworkService::Private::PropDomainSuffixMatch =
{ NetworkService::Private::DomainSuffixMatch, NetworkService::Private::PropertyDomainSuffixMatch,
NetworkService::Private::SignalDomainSuffixMatchAvailableChanged };
const NetworkService::Private::PropertyAccessInfo NetworkService::Private::PropAnonymousIdentity =
{ NetworkService::Private::AnonymousIdentity, NetworkService::Private::PropertyAnonymousIdentity,
NetworkService::Private::SignalAnonymousIdentityChanged };

const NetworkService::Private::PropertyAccessInfo* NetworkService::Private::Properties[] = {
&NetworkService::Private::PropAccess,
Expand All @@ -410,6 +417,7 @@ const NetworkService::Private::PropertyAccessInfo* NetworkService::Private::Prop
&NetworkService::Private::PropCACert,
&NetworkService::Private::PropCACertFile,
&NetworkService::Private::PropDomainSuffixMatch,
&NetworkService::Private::PropAnonymousIdentity,
};

// The order must match EapMethod enum
Expand Down Expand Up @@ -1089,6 +1097,9 @@ void NetworkService::Private::resetProperties()
} else if (key == PrivateKeyFile) {
queueSignal(SignalPrivateKeyFileChanged);
setPropertyAvailable(&PropPrivateKeyFile, false);
} else if (key == AnonymousIdentity) {
queueSignal(SignalAnonymousIdentityChanged);
setPropertyAvailable(&PropAnonymousIdentity, false);
}
}
updateManaged();
Expand Down Expand Up @@ -1205,6 +1216,9 @@ void NetworkService::Private::updatePropertyCache(const QString &name, const QVa
} else if (name == PrivateKeyPassphrase) {
queueSignal(SignalPrivateKeyPassphraseChanged);
setPropertyAvailable(&PropPrivateKeyPassphrase, true);
} else if (name == AnonymousIdentity) {
queueSignal(SignalAnonymousIdentityChanged);
setPropertyAvailable(&PropAnonymousIdentity, true);
}

updateManaged();
Expand Down Expand Up @@ -1744,4 +1758,14 @@ bool NetworkService::privateKeyFileAvailable() const
return (m_priv->m_propGetFlags & Private::PropertyPrivateKeyFile) != 0;
}

QString NetworkService::anonymousIdentity() const
{
return m_priv->stringValue(Private::AnonymousIdentity);
}

void NetworkService::setAnonymousIdentity(const QString &anonymousIdentity)
{
m_priv->setProperty(Private::AnonymousIdentity, anonymousIdentity);
}

#include "networkservice.moc"
7 changes: 7 additions & 0 deletions libconnman-qt/networkservice.h
Expand Up @@ -62,6 +62,7 @@ class NetworkService : public QObject
Q_PROPERTY(bool privateKeyAvailable READ privateKeyAvailable NOTIFY privateKeyAvailableChanged)
Q_PROPERTY(bool privateKeyFileAvailable READ privateKeyFileAvailable NOTIFY privateKeyFileAvailableChanged)
Q_PROPERTY(bool privateKeyPassphraseAvailable READ privateKeyPassphraseAvailable NOTIFY privateKeyPassphraseAvailableChanged)
Q_PROPERTY(bool anonymousIdentityAvailable READ anonymousIdentityAvailable NOTIFY anonymousIdentityAvailableChanged)
Q_PROPERTY(QString bssid READ bssid NOTIFY bssidChanged)
Q_PROPERTY(quint32 maxRate READ maxRate NOTIFY maxRateChanged)
Q_PROPERTY(quint16 frequency READ frequency NOTIFY frequencyChanged)
Expand All @@ -81,6 +82,7 @@ class NetworkService : public QObject
Q_PROPERTY(QString privateKeyPassphrase READ privateKeyPassphrase WRITE setPrivateKeyPassphrase NOTIFY privateKeyPassphraseChanged)
Q_PROPERTY(QString domainSuffixMatch READ domainSuffixMatch WRITE setDomainSuffixMatch NOTIFY domainSuffixMatchChanged)
Q_PROPERTY(QString phase2 READ phase2 WRITE setPhase2 NOTIFY phase2Changed)
Q_PROPERTY(QString anonymousIdentity READ anonymousIdentity WRITE setAnonymousIdentity NOTIFY anonymousIdentityChanged)

class Private;
friend class Private;
Expand Down Expand Up @@ -134,6 +136,7 @@ class NetworkService : public QObject
QString clientCertFile() const;
QString domainSuffixMatch() const;
QString phase2() const;
QString anonymousIdentity() const;

void setPath(const QString &path);
void updateProperties(const QVariantMap &properties);
Expand Down Expand Up @@ -183,6 +186,7 @@ class NetworkService : public QObject
bool caCertAvailable() const;
bool caCertFileAvailable() const;
bool domainSuffixMatchAvailable() const;
bool anonymousIdentityAvailable() const;

int peapVersion() const;
void setPeapVersion(int version);
Expand Down Expand Up @@ -216,6 +220,7 @@ class NetworkService : public QObject
void privateKeyPassphraseChanged(const QString &privateKeyFile);
void domainSuffixMatchChanged(const QString &domainSuffixMatch);
void phase2Changed(const QString &phase2);
void anonymousIdentityChanged(const QString &anonymousIdentity);
void ethernetChanged(const QVariantMap &ethernet);
void connectRequestFailed(const QString &error);
void typeChanged(const QString &type);
Expand Down Expand Up @@ -251,6 +256,7 @@ class NetworkService : public QObject
void caCertAvailableChanged();
void caCertFileAvailableChanged();
void domainSuffixMatchAvailableChanged();
void anonymousIdentityAvailableChanged();
void availableChanged();
void savedChanged();
void connectingChanged();
Expand All @@ -273,6 +279,7 @@ public Q_SLOTS:
void setClientCertFile(const QString &clientCertFile);
void setDomainSuffixMatch(const QString &domainSuffixMatch);
void setPhase2(const QString &phase2);
void setAnonymousIdentity(const QString &anonymousIdentity);

void resetCounters();

Expand Down

0 comments on commit 7c91231

Please sign in to comment.