summaryrefslogtreecommitdiffstats
path: root/src/remoteobjects/qremoteobjectreplica_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Mark QtRemoteObjects as security criticalØystein Heskestad2025-07-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | The QtRemoteObjects serialization is built on top of QDataStream, but QDataStream is not secure. Mark all files parsing data as security critical. The security is dependent on the backend used. The local and QNX backends communicate only locally but are insecure on a compromised host. The TCP backend is by default insecure, but it supports TLS, and can be secure if that is used. The two files in the repparser directory are used for parsing, but only at build time, and are therefore kept at security significant. The remaining files are marked as security signifcant. QUIP: 23 Task-number: QTBUG-135570 Pick-to: 6.10 6.9 6.8 Change-Id: I11176c036d95f8c706bd05e1cab1ba499003f683 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-141-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I315d7ce1d6c6c3497afdfe8b61a113fdc181c935 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Refactor decodeVariant to pass by rvalue ref/std::moveBrett Stottlemyer2021-08-041-8/+8
| | | | | | | | | | | | | | The decodeVariant calls were weird in how their parameters were pass by reference so they could be changed, but without forcing a copy. It is clearer to pass by rvalue ref, using std::move on the calling side. This rippled up to calls that called the method, including setProperties which is part of the repc generated code. Because of the repc change, this should *not* be picked to Qt5. Pick-to: 6.2 Change-Id: Ieb1b0620569ad8eb9797edc57cc189d0b426510c Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Rename the classes for adding a custom transport supportSona Kurazyan2021-06-171-3/+3
| | | | | | | | | | | | | Added QtRO prefix to IoDeviceBase, ServerIoDevice and ClientIoDevice classes. These classes are exported and can be used externally for supporting a custom transport by deriving from them and implementing the virtual methods. Added the prefix also to ExternalIoDevice, to keep the naming consistent. Pick-to: 6.2 Change-Id: I64845cff55687a127d2c43de03ecc65ac9bd321b Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Move client-side Codec to IoDeviceBaseBrett Stottlemyer2021-05-271-1/+0
| | | | | | | | | | This is more appropriate than having a separate mapping of connection to Codec. Change-Id: I3b54bfb479de04706a3f9563e7a987af91d0282d Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Refactor serialization code into an abstracted classBrett Stottlemyer2021-05-271-1/+1
| | | | | | | | | | | This hides implementation details and allows for different implementations in the future. Change-Id: I5502bb040afe502f7b127668cf7ff81ee79f5e89 Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Use QList instead of QVectorJarek Kobus2021-02-161-6/+5
| | | | | | | | | Task-number: QTBUG-84469 Task-number: QTBUG-90907 Change-Id: Ifc6f05fb5e17e32ec04b383770080e812c854510 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Add QRemoteObjectReplica::notified signalMichael Brasser2019-12-131-0/+1
| | | | | | | | This allows distinguishing between property changes at initialization and later property changes. Change-Id: Ic4d27cb93e780b7a182b89eb3e7d952f4394200d Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fix deprecation warnings related to QBasicAtomicIntegerFriedemann Kleint2019-09-191-1/+1
| | | | | | | | | Use loadRelaxed(), fixing: remoteobjectreplica_p.h: In member function ‘virtual QRemoteObjectReplica::State QRemoteObjectReplicaImplementation::state() const’: qremoteobjectreplica_p.h:120:106: warning: ‘T QBasicAtomicInteger<T>::load() const [with T = int]’ is deprecated: Use loadRelaxed [-Wdeprecated-declarations] Change-Id: I8feef08c5de8355e02442ccf7ca1ebca05e26c1f Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
* Fix dynamic use_enum logic (Qt types only)Brett Stottlemyer2019-05-181-1/+1
| | | | | | | | This is the first step in getting use_enum working. Since Qt types are already declared, we just need to register them get support into QtRO. Change-Id: I9b1b52f3012fa066acede921db338a755295d8d7 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix include directivesFriedemann Kleint2019-01-181-5/+5
| | | | | | | | | | Always prepend the module and use headers directly. Qt for Python requires the modules to be present. Task-number: PYSIDE-862 Fixes: QTBUG-72675 Change-Id: I94e38fbab0f041370ca9d67ca13c78f0d33816b7 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Support externally generated QIODevicesBrett Stottlemyer2018-08-151-3/+3
| | | | | | | | | | | | | | | This adds the APIs that will be necessary to create SSL sockets flexibly (and outside of QtRO) and pass them in. The integration tests are extended to show everything works if the tcp/ip connection is created outside QtRO. The Registry is supported by allowing an "external schema" to be set as the HostNode's url, which is then used by the registry as the address for any remoted() source objects. The client Node calls registerExternalSchema() with a std::function callback that can create the client-side QIODevice given the registry provided url. Change-Id: I0f2d0ea270771e096a787134ef87d537769045f6 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-141-7/+0
|\ | | | | | | Change-Id: I73d64a790b976881e92ede9b6527f319f09eedae
| * Remove dead codeMichael Brasser2018-08-101-7/+0
| | | | | | | | | | Change-Id: I4203bf3789771210cd258f031eab725326494b05 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-141-5/+9
|\| | | | | | | Change-Id: I7d3ccacaf7d2ce429a530993e4ea81cf3adf7958
| * Allow recursive packetizing of typesBrett Stottlemyer2018-04-051-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | We create a new type (QRO_) to allow storing a subclass as a variant. Thus when a QObject* property is marshalled, all of the pointed to properties can be sent as a single variant. This can be decoded into the proper type on the replica side. This required giving Node's private a new QRemoteObjectMetaObjectManager, a class to handle the building of dynamic metatypes. Change-Id: Ib83b1edb2fd37dd12defb066d4c2b69509985eaa Reviewed-by: Michael Brasser <michael.brasser@live.com>
| * Make (internal) Source objects hierarchicalBrett Stottlemyer2018-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QRemoteObjectSource is the class used to handle forwarding QObject changes over QtRO, internally storing the listener pointers and managing the send and receive of packets when changes occur. Previously, MODEL and CLASS objects in a parent class were handled by calling enableRemoting separately for each nested pointer type, resulting in separate (and independent) QRemoteObjectSource instances. This change defines a "Root" object (tied to the object enableRemoting() is called on), and any nested QObject types are then created as child source objects of the root object. The implementation creates an abstract QRemoteObjectSourceBase class, with QRemoteObjectRootSource and QRemoteObjectSource types derived from it. Only the Root objects become "known" types on the bus (and thus only Root objects can be acquired. A Private class instance is created by the Root object and the pointer passed to all child sources, providing a mechanism for sharing needed information (such as the list of listeners) amonst all members of the hierarchy. Change-Id: I632e847cad288b4540c7de6676f791ca2e675f46 Reviewed-by: Konstantin Tokarev <annulen@yandex.ru> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | Clean up override/final, consistent destructorsBrett Stottlemyer2018-03-201-3/+3
|/ | | | | | | Change-Id: I3ab651af68389bb7ea3aad1595873c9488f3dd9d Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
* Say hello to QRemoteObjectNode::heartbeatInterval propertyBogDan Vatra2017-12-081-1/+3
| | | | | | | | | | This property can be used to periodically check the connection between the replica and the source. If the connection is lost, the replica enters in the "Suspect" state and will attempt to reconnect. Task-number: QTBUG-64086 Change-Id: Icf67e173073c9d277575c8faf01a0a1ffab5bc07 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Rename ReplicaPrivate -> ReplicaImplementationKevin Funk2017-10-061-14/+14
| | | | | | | | | | | | | | All those implementations for the QtROReplica ('InProcess', 'Connected', 'RemoteObject') aren't technically d-pointers. Mark them as such by naming them differently. This also has the nice benefit that one does not override QObject's 'd_ptr' variable accidentally with these implementation instances. Needed in order to pimpl QRemoteObjectRegistry properly Change-Id: I88322e37d2ff7e5044980e8fdf9f713d6be80c38 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Modernize: Use override where possibleKevin Funk2017-09-211-11/+11
| | | | | Change-Id: Id67366f3eaf251b1f2c8d9a91a41dec72117cc7c Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Correct QtRO license headers and added missing license filesv5.9.0-beta4Jani Heikkinen2017-05-021-13/+19
| | | | | | | | | | | | | Unify licensing as it is in other submodules - Src is licensed under Commercial, LGPLv3, GPLv2 and GPLv3 licenses - Examples are licensed under Commercial and BSD licenses - Tools and tests are licensed under commercial and GPLv3 license with some exceptions Task-number: QTBUG-58921 Change-Id: I4494bf8b705568b243340c98316bedd706145db5 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Replace Q_DECL_OVERRIDE -> overrideKevin Funk2017-03-291-37/+37
| | | | | Change-Id: I0ff4b3434a5d4b26bf68b96db28691186813e10d Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Replace Q_NULLPTR -> nullptrKevin Funk2017-03-291-1/+1
| | | | | | | | Skip the moc/ directory intentionally, since it contains third-party code Change-Id: I97105e475c109231e001dc4525b3096a06601868 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fixes for license checkBrett Stottlemyer2017-01-141-21/+13
| | | | | | | | Change-Id: I3cf39180b08b80ea65c46e7b6a9e81f3aa79d1af Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix warnings from syncqt.plKevin Funk2016-11-301-0/+11
| | | | | | | | | - Add "we mean it" warning to private headers - Properly include module headers in public headers Change-Id: I3feded431f890fd451c07920edb102ae902a0fb9 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Generate, send and check class signature for .rep generated classesBogDan Vatra2016-09-081-6/+6
| | | | | | | | | If the signature mismatch it will not complete the connection and will signal the error. Change-Id: Idd4a7a5290bb60d7428e16047a1b82db5e52b372 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fix override warningsBrett Stottlemyer2016-02-031-2/+2
| | | | | | Change-Id: I52426344cbcb8a61439c62cf4a23805fcec3c363 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Set ReplicaPrivate Node explicitlyBrett Stottlemyer2015-12-311-3/+3
| | | | | | Change-Id: If958880adca1dccc79595141e3f793effac829ee Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Add Node as a Replica PropertyBrett Stottlemyer2015-12-311-0/+4
| | | | | | | | | This will make it easier to create a Replica from QML. Change-Id: I42c9c927426cb4c872a9b1b8af565c87454145c9 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Provide ReplicaPrivateStubBrett Stottlemyer2015-12-311-9/+42
| | | | | | | | | | | | Before a default Replica constructor can be provided, there needs to be a Replica private type that supports the default functionality (isInitialized, get/set/default properties) but isn't tied to a Node. This change adds said stub private type. Change-Id: I3665586670967edbeeda6e03130e6cfe544f324f Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Kevin Funk <kfunk@kde.org> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* [internal] Don't use QRemoteObjectPacketBrett Stottlemyer2015-08-311-5/+5
| | | | | | | | | | | | | | | This is a large change, but it is the same thing repeated. QRemoteObjectPacket was a set of types for (de-)serializing QtRO changes to send over the wire. But it required copying the changes to/from the packet before using those changes. This goes directly to/from QDataStream instead. I think it also makes the InitPacket/InitDynamic steps a bit easier to read, and should improve the init performance. Change-Id: I62b1776858ff74a8532c8f2682aa94ac7248a803 Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
* [internal] Remove packet->serialize()Brett Stottlemyer2015-08-311-2/+2
| | | | | | | | | | | Remove QRemoteObjectPacket::serialize() functions in favor of direct serialize<Type>Packet() functions. This remove the need to copy data into the Packet type before serializing. Change-Id: Ic5953a6e63731b64e79ffa5bef38a5b62179dd35 Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
* Improved backend transmission performance.Björn Breitmeyer2015-08-271-0/+4
| | | | | | | | | Reduced the memory overhead by removing the allocation of a QDataStream QByteArray pair per packet. Change-Id: I600fdbdd86b89e94ce2a025e95c9188e8b4a1c9c Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* [minor] Rename ReplicaPrivate methodBrett Stottlemyer2015-06-141-1/+1
| | | | | | | | | isDynamicReplica() -> needsDynamicInitialization() Change-Id: Id907d91c11b442528af543008eaa6778ca10906c Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
* Fix connection between Replica and ReplicaPrivateBrett Stottlemyer2015-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | This is a set of related bugs. If you have multiple Replicas of the same object, they share a ReplicaPrivate so change packets are only sent once (to the private), not to each Replica. This bug manifested itself when a compiled Replica is acquired first, then a dynamic one. The m_numSignals member was not initialized in this case (as the metaobject was already available from the compiled replica), which caused Signals to be handled as Slots on the dynamic Replica. This also makes sure every Replica is connected to the initialized signal. Finally, if a Replica connects to the ReplicaPrivate which is already initialzed, the initialized signal is still emitted. Change-Id: I384fa89374801163e625c89d28d05a7bb98d06ca Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
* QRemoteObjectSourcePrivate -> QRemoteObjectSourceKevin Funk2015-04-301-2/+2
| | | | | | | Consistency++ Change-Id: I80b0a949790ca52a6c061278f4cd6b1452463729 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fix slots with argumentsSebastian Sauer2015-04-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new unittest to verify that slots with arguments work as expected. Unfortunately they did not (segfault using msvc@windows). This is fixed and the unittest passes now with the modification done to QRemoteObjectDynamicReplica. In detail: In QRemoteObjectDynamicReplica::qt_metacall the QMetaObject::ReadProperty and WriteProperty code-paths already use the metaObject's parameter-types do cast the void **argv. For slots we where using the remote objects types but it seems its possible the remote methodIndex is different from the local methodIndex what resulted in reinterpret_cast the void **argv to the wrong types. What we do now is to use the local QMetaMethod's parameterTypes just like for the properties which are always correct means match to the void **argv. Drawback; An additional char* typeName<=>int typeId lookup per parameter-type that could also be cached... Change-Id: Icdbf96d1da1267f027a749002ad0a4cc3e6b827d Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
* [minor] Some code cleanupBrett Stottlemyer2015-03-091-1/+1
| | | | | Change-Id: Id7c08dd9eaf604666e5cac66c031d84a78a2aacf Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
* Allow .rep API to differ from Source APIBrett Stottlemyer2015-01-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | This is a Big Change. Before this change, QtRO allowed either a .rep based implementation (which defined the API that had to be implemented), or supported using arbitrary QObjects (which exposed every Property/Signal/Slot in that class - excluding inherited ones). This change allows the .rep file to define an arbitrary subset of Properties/Signals/Slots to be exposed on the QtRO network. The mapping is implemented in the same way the compile time Signal/Slot connections are, which allows compile errors if the APIs are incompatible. It also supports the same types of conversions available for connect() calls. Backwards compatibility is provided by generating a mapping at runtime that exposes all Property/Signal/Slot features (in the class itself) in the mapped api. Change-Id: I8e9f5fc467dddb050355edb6c7b6098a116ce8ce Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
* Put packetization types into private APIKevin Funk2014-11-211-4/+9
| | | | | Change-Id: Id95fdece9b19a81a4960e9a19239d3b8d6f3904a Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
* Implement QRemoteObjectPending{Call, Reply}Kevin Funk2014-11-201-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces the following classes in QTRO: * QRemoteObjectPendingCall (let's call it ROPC) * template<typename T> QRemoteObjectPendingReply (based on ROPC) * QRemoteObjectPendingCallWatcher (QObject, based on ROPC) This works for both in-process and connected versions replicas. Also works with dynamic replicas. Note that these classes' design is loosely copied from QtDBus's API. (They also have a 'pending call', and watchers.) Usage: QRemoteObjectPendingReply<bool> reply = engine_r->start(); QCOMPARE(reply.error(), QRemoteObjectPendingCall::InvalidMessage); reply.waitForFinished(); QVERIFY(reply.isFinished()); QCOMPARE(reply.returnValue(), true); TODO: * Error handling (i.e. what to do with invocations where we never get a reply for?) Change-Id: I9d2556b3fcd47a3804c1ada5db526b78c311c0a1 Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
* Say hello to QtRemoteObjectsBrett Stottlemyer2014-10-161-0/+135
This is a module that allows you to create copies/replicas of your QObjects in other processes, without having to write a bunch of IPC code. Change-Id: I4a62f120eca34c9f50089b7d9d09dcfcad14476c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>