Round trip protection as described in (4)

https://dev.vatsim-germany.org/boards/22/topics/1792?r=1801#message-1801

* Individual context id
* Allows to connect >1 GUIs with core, works for cockpit so far
This commit is contained in:
Klaus Basan
2014-06-09 02:24:22 +02:00
parent 251fe70dc9
commit 3ae93190ae
10 changed files with 33 additions and 5 deletions

View File

@@ -83,6 +83,9 @@ namespace BlackCore
//! Simulator
IContextSimulator *getIContextSimulator();
//! Id and path name for round trip protection
virtual QString getPathAndContextId() const = 0;
protected:
//! Constructor
CContext(CRuntimeConfig::ContextMode mode, QObject *parent) :
@@ -91,6 +94,15 @@ namespace BlackCore
CRuntimeConfig::ContextMode m_mode; //!< How context is used
qint64 m_contextId; //!< unique identifer, avoid redirection rountrips
//! Path and context id
QString buildPathAndContextId(const QString &path) const
{
return QString(path).
append(':').
append(QString::number(this->getUniqueId()));
}
};
}
#endif // guard

View File

@@ -66,6 +66,9 @@ namespace BlackCore
return s;
}
//! \copydoc CContext::getPathAndContextId()
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
//! Destructor
virtual ~IContextApplication() {}

View File

@@ -47,6 +47,9 @@ namespace BlackCore
return s;
}
//! \copydoc CContext::getPathAndContextId()
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
//! \brief Destructor
virtual ~IContextAudio() {}

View File

@@ -43,6 +43,9 @@ namespace BlackCore
return s;
}
//! \copydoc CContext::getPathAndContextId()
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
//! Destructor
virtual ~IContextNetwork() {}

View File

@@ -62,6 +62,9 @@ namespace BlackCore
return s;
}
//! \copydoc CContext::getPathAndContextId()
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
/*!
* \brief Path for network settings
* \remarks no to be confused with DBus paths

View File

@@ -42,6 +42,9 @@ namespace BlackCore
return s;
}
//! \copydoc CContext::getPathAndContextId()
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
//! Destructor
virtual ~IContextSimulator() {}