aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Hide the API of QCoapProtocolSona Kurazyan2019-05-147-104/+97
| | | | | | | | No need to keep this class public, there is no public API for accessing it anyway. Change-Id: I231a560becb5799667819c30eca6372282adeb41 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Hide the APIs of QCoapConnection and QCoapQUdpConnectionSona Kurazyan2019-05-1411-178/+118
| | | | | | | | | | | | At the moment only the QCoapQUdpConnection class implements the QCoapConnection interface. If later we decide to add other implementations, and it turns out that the current API is not good enough, it won't be possible to change it without breaking the source compatibility. Let's make these classes private, we can make them public when there is a need for it. Change-Id: I41336dda0e6eaa762f0eb9c8f4aa98a9c7b62a2c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove the "Error" ending from QtCoap::Error enum value namesv5.13.0-rc3v5.13.0-rc2v5.13.0-rc1v5.13.0-beta4v5.13.05.13.0Sona Kurazyan2019-05-035-43/+45
| | | | | | | | | | | | | QtCoap::Error is a scoped enum class, so its value names will get the "Error::" prefix anyway. No need to have it as a suffix for the value names. For the same reason replaced QtCoap::Error::NoError by QtCoap::Error::Ok. Change-Id: Iaf7b51cdab6ea330e940e5af73ba93a55eb48315 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Use scoped enumsSona Kurazyan2019-05-0321-77/+77
| | | | | | | | | | | Execptions are made for QCoapOption::OptionName and QtCoap::Port enums, because the values of these types are not limited only to the values listed in the enums. In case of using custom values, it would be more convenient to use integers directly, instead of using a static_cast each time the user needs a custom value. Change-Id: Ibc63e26c59629702c03528dd7e5e5eedc6bcc90a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix the location of '&' in a method signatureSona Kurazyan2019-04-263-3/+3
| | | | | Change-Id: Ibf19500b897c0d2eb3a9ab9420ee98b04074b20a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Move the declaration of QCoapInternalMessage to the private headerSona Kurazyan2019-04-265-78/+33
| | | | | | | | This class is intended for internal use only, so it should not have a public header. Change-Id: I18f2433d06e978582b470e14dc89a7c0e404f7d4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Replace the Q_DECL_OVERRIDE macros with 'override'Sona Kurazyan2019-04-264-6/+6
| | | | | Change-Id: I32f3712ed2c160e1dc26397d58114fa441c0fc9b Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Make QCoapMessage::addOption non-virtualSona Kurazyan2019-04-261-2/+2
| | | | | | | This method doesn't need to be virtual, no one overrides it. Change-Id: Ia8c06c40fcb7cb97e413da6dc0458553540803cf Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Mention CBOR when documenting CoAP's content formatsSona Kurazyan2019-04-253-4/+21
| | | | | Change-Id: Ifb15180619c1d7e056a5578c30d22e2e9e16edd5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add an API for closing the connection's transportSona Kurazyan2019-04-256-10/+72
| | | | | | Change-Id: I916ddb226b653aaf563ecf0adc3a1110d6da3132 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add documentation for Qt CoAP overviewv5.13.0-beta3Sona Kurazyan2019-04-173-2/+209
| | | | | | | Change-Id: I1ebf03d68c267f87ca2b690d4c666c26717f8d07 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix URL adjustment of URLs with no hostSona Kurazyan2019-04-171-0/+5
| | | | | | | | | | | | QUrl can have an empty host, but still considered to be valid. This is possible, for example, when setting an invalid host address or when the URL is a path. Adjusting such URLs leads to unexpected results. Added a check for preventing sending requests to URLs with no host. Fixes: QTBUG-75155 Change-Id: I6c899f824233f32cddb8c9255fd3d1c333bb6385 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add navigation homepage for the QtCoAP moduleSona Kurazyan2019-04-161-0/+1
| | | | | Change-Id: I565cd306ab36230371cde6475d8417b40752a2a5 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Move example folders to the 'coap' subdirectorySona Kurazyan2019-04-151-1/+1
| | | | | Change-Id: Iebded58e8cfd307cd54fc3bdcca3a1002aa21bd4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add example documentation projectv5.13.0-beta2Sona Kurazyan2019-04-101-1/+1
| | | | | | Change-Id: I00c8d6221aa730051733c48816aed3cc4f79abb4 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove the disabled method for setting a custom protocolSona Kurazyan2019-04-103-11/+46
| | | | | | | | | | | | | | | | | | | Firstly, the current QCoapProtocol interface only supports customizing some parameters like timeouts, counters, etc., which can also be done via the QCoapClient class, so there is no need for a setter method for the protocol. Secondly, the protocol runs on a separate thread, so it is not a good idea to allow users to change the protocol at runtime. Even if later we decide to support custom protocols, it can be set during the construction of the client. So the setter method is not needed. Removed the setter method and added the missing methods for customizing protocol-related parameters. Change-Id: I89375ac502be4d29d3cb617da9c2f99a3ab410ec Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add parameter for specifying the port for multicast discoverySona Kurazyan2019-03-292-5/+7
| | | | | | Change-Id: I75db1a9fc3bf17df87a834a90d0e5bb5150ccc1c Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Close the DTLS connection during destructionSona Kurazyan2019-03-292-0/+11
| | | | | Change-Id: Id7bc8ac1506ae543c7964b0bdcacf39588cd7334 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Initialize QCoapPrivateKey correctlySona Kurazyan2019-03-291-2/+2
| | | | | | | This fixes the handling of an empty QCoapPrivateKey. Change-Id: I0dd92b2edcb0aacf56a8cb1933227f6673404f52 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Add missing metatype declarations for QtCoap namespaceSona Kurazyan2019-03-291-0/+2
| | | | | Change-Id: I5a98f9d27a1aeaa81ee7d132d44f9473c801e8cc Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Do not capture q-pointer by referenceSona Kurazyan2019-03-221-1/+1
| | | | | | | This fixes a crash introduced by one of the recent commits. Change-Id: I4742a77585d764a1da8e07de44869b974009f626 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add missing type registrations for enums from QtCoap namespaceSona Kurazyan2019-03-211-0/+3
| | | | | Change-Id: Ie286cabb6a451899cf70a55aad4b8a85694ea56b Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Use Q_INVOKABLE for the methods not meant to be used as slotsSona Kurazyan2019-03-203-14/+11
| | | | | | | | | | Declaring methods to be invoked via QMetaObject::invokeMethod in the Q_SLOTS section, makes the API confusing. Use Q_INVOKABLE instead. Change-Id: I1a04b279fe2ddb505e63dfd48efa1a3b4cb7ad7a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Hide the API for sending byte array requestsSona Kurazyan2019-03-204-15/+24
| | | | | | | | | | | Users should not be able to send "manually" constructed requests with raw byte array data. Only QCoapProtocol knows how to correctly construct/send coap messages and make the proper signal/slot connections. Change-Id: I8fd64638ea7f8e7b20671b80e6db4e1a7758c4fa Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Improve logging of the CoAP moduleSona Kurazyan2019-03-199-41/+74
| | | | | | | | | | | | | - Introduced different log categories and categorized log messages accordingly. - Improved logs from console example by: * Changing debug messages to info or warning, * Removing extra spaces from the log messages. Change-Id: Ia6b2006db5e7cce853e59fb7d0a1c20064444c8e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add the sender address to responses for a multicast requestSona Kurazyan2019-03-114-7/+13
| | | | | | | | | | | For the responses to multicast requests the address of the sender of the reply does not match with the host address in the request URI. There should be a way to find out who has sent the response. Change-Id: Icbc6c6ae926198870dbc7dbbb92dc319c46d7de7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Hide APIs for specifying the request methodSona Kurazyan2019-03-113-39/+23
| | | | | | | | | | | | Since the request method is set anyway when sending a request (get, put, post, etc.), allowing users to specify the request method is fatuous (it will be overridden anyway when sending the request). Change-Id: Ibf079bd513f145c791d5d703aa5685bfe66dda7d Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix URL adjustment for URLs with no schemev5.13.0-beta1Sona Kurazyan2019-03-062-4/+5
| | | | | | | | | Prepend the "scheme://" part a to URL only if it is relative and doesn't have a host. Non-relative URLs having a host already contain the "://" part. Change-Id: If2ac3db4f2eb0d18ffa1893415f44b9d2c85db26 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Move resourcesFromCoreLinkList() where it fits betterSona Kurazyan2019-03-064-47/+47
| | | | | Change-Id: I930f53462598fd7019da2144ddf1bf04dc5930c8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Code cleanup: replace int by uint, where it makes senseSona Kurazyan2019-03-055-62/+46
| | | | | | | | This saves us several checks and "static_cast"s. Change-Id: I81e2253929f1fe0a7a052e8c2988e28229b0c9db Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Improve the documentation and fix warningsSona Kurazyan2019-03-0511-109/+219
| | | | | | | Change-Id: I9b26337ba976079608ece4781999ad0ef49a4f19 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix documentation for the QtCoap::Error enumSona Kurazyan2019-03-041-75/+48
| | | | | | Change-Id: I3401d7f66f7f14273c07b2df236a047dca4d348f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Change QtCoap to be a namespace and improve the docsSona Kurazyan2019-03-045-188/+351
| | | | | | | | | | | | | - QtCoap was changed to be a namespace instead of a class. - Moved the static QtCoap::randomGenerator to a method returning a reference to a local static object. - The corresponding documentation and function definitions were moved to its .cpp file. - Added the missing documentation. Change-Id: Ie0c60189b18b8f5e8d9a94f91b6fb7b9259984dd Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Code cleanup: avoid calling lambdas with deleted contextsSona Kurazyan2019-02-211-2/+2
| | | | | Change-Id: I65e59f609decac4f7c26eb4980624a58c4d2bcb3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add an API for multicast discoverySona Kurazyan2019-02-214-4/+84
| | | | | | | | | Use CoAP multicast group addresses, if the user haven't provided a group discovery URI. Change-Id: Id4e4eedc2c4596d738b3e9c3c0461ca3feddf3ef Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add support for multicast CoAP requestsSona Kurazyan2019-02-217-16/+159
| | | | | | | Change-Id: I9cf6d4f97c863c232b17bc8e560c6b62c3f39624 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Rename InternalServerError to InternalServerFaultSona Kurazyan2019-02-211-1/+1
| | | | | | | | | | | Since the same identifiers are used for generating enum values for QtCoap::ResponseCode and QtCoap::Error, using the "InternalServerError" identifier leads to an InternalServerErrorError value in the QtCoap::Error enum. Renamed the identifier, to generate a more meaningful name. Change-Id: Ia85acc40f6d5f12eb4ee9834825c637b70cd1a5e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Do not override the request token, if it was set beforeSona Kurazyan2019-02-151-1/+2
| | | | | | | | | | | | Currently the request token is generated randomly, and even if the user sets a token to the request, it is being overridden. It makes sense to allow users to provide the desired token. This is also useful for unit tests. Change-Id: Ia45ec70a1eaa125bcd35e00fa2cce753d081ab9d Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Introduce timeouts needed for multicast requestsSona Kurazyan2019-02-146-0/+67
| | | | | Change-Id: I7abb22364531af43e0ab4f10436f0b787cd36291 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add API for canceling observe for the given URLSona Kurazyan2019-02-056-21/+69
| | | | | Change-Id: Idb84601dd8f1d8c011ecccd95c0e65e77920bd11 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Interface cleanupSona Kurazyan2019-02-053-33/+25
| | | | | | | | | - restrict access to QCoapProtocol::cancelObserve slot - fixed const-correctness of QCoapProtocolPrivate - removed unnecessary QCoapProtocolPrivate::encode method Change-Id: I63948418e21708526c11b9608baba60e0e6d3532 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Use function pointer syntax for connect statementsSona Kurazyan2019-02-059-82/+51
| | | | | Change-Id: I0fe67e7307f67543f0c63a5be46b92f2dd074d45 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Add DTLS support to CoAP implementationv5.13.0-alpha1Sona Kurazyan2019-01-3023-292/+1436
| | | | | | | | | | | | | | | | | | | | | | | | | Added transport layer security based on QDtls. This implementation supports authentication using pre-shared keys and X.509 certificates. Split the QCoapConnection class into a base class to be shared with other transports and a specialized class that relies on QUdpSocket using QDtls for security. Note, that raw public key mode (which is mandatory to implement according to RFC) is not implemented yet, since the underlying OpenSSL library does not support it yet. However, if we later decide to integrate another DTLS implementation, it can be done with minimal changes, by having the new implementations's connection type inherit the QCoapConnection class, which hides the implementation of the transport layer. Tests and examples will be added in a later commit. Change-Id: I14b34a9fd978e1993e86d47becbeed74397d1d6e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Doc: Add a documentation projectLeena Miettinen2019-01-177-0/+371
| | | | | | | | | A configuration file and some standard topic files are needed for building the documentation. Change-Id: Id4ecc9cde7487f998f31dfdc984d7214e329a8fd Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Improve QCoapMessage and corresponding testsSona Kurazyan2018-12-213-3/+27
| | | | | | | | | * Add possibility to retrieve multiple options with the same option name * Add more tests for QCoapMessage Change-Id: Ib5ccb45633488e7654427d7513835502f8011257 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Fix review comments left from the initial commitSona Kurazyan2018-12-207-18/+27
| | | | | | | | | Added some minor improvements and fixes for review comments from the initial commit. Change-Id: Ic3b36118262660c110ccf7ef2209a25208703ab7 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Add the CoAP module, providing a client for QtAdrien Leravat2018-12-1438-0/+7006
Features: - Send GET/POST/PUT/DELETE requests - Discover resources (single server) - Observe resources and cancel the observation - Blockwise requests and replies - Requests (and replies) can be confirmable or non-confirmable - Some options can be added to the request - Replies can be received in a separate or piggybacked message Change-Id: I31e0e20a4f19bdc6d6489281fde73a4ff848eda4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>