summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qhostaddress.h
Commit message (Collapse)AuthorAgeFilesLines
* Add test function for private networkYAMAMOTO Atsushi2023-03-111-0/+1
| | | | | | | | | | Add a function QHostAddress::isPrivateUse to test for IPv4 private networks and IPv6 unique local unicast addresses. Task-number: QTBUG-111211 Change-Id: Ic8abefa7aa974fa83118aeb9f2506a5713f79f0d Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHostAddress: unexport QIPv6AddressThiago Macieira2022-11-181-1/+1
| | | | | | | | Only affect MSVC anyway. For all the others, since everything is inline, there's nothing to import or export. Change-Id: Id8e48e8f498c4a029619fffd17288befde9b5f83 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QHostAddress: prepare moving NetworkLayerProtocol from QAbstractSocketThiago Macieira2021-03-181-3/+20
| | | | | | | | | | This can only be completed in Qt 7, due to BC guarantees. I've only updated the source code for QHostAddress and its unit test and even then I did not touch the documentation. This needs to be completed in Qt 7.0 Change-Id: I26b8286f61534f88b649fffd166b695882f8f3b5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractSocket: fake a bind(QHostAddress::SpecialAddress)Thiago Macieira2021-03-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | Because this is misleading: socket.bind(QHostAddress::AnyIPv4); The conversion of enum to int has preference over the construction of QHostAddress from enum, so that ends up calling bind(6), which attempts to bind to privileged port 6 and just returns with error. Meanwhile, socket.bind(QHostAddress::AnyIPv4, 0); does construct the QHostAddress because that is preferred to converting the int to the BindMode enum. Ideally we'd simply add the overload to QAbstractSocket but we can't do that because QHostAddress depends on QAbstractSocket. So I've added a Qt7 task to invert that dependency. Change-Id: I26b8286f61534f88b649fffd166b683266597796 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Hide comparison of QHostAddress with SpecialAddress from ADLVolker Hilsheimer2020-10-301-5/+6
| | | | | | | | | Make global operators hidden friends. No change to the member-operators. Task-number: QTBUG-87976 Change-Id: If7b08a30700d4e2f1a304d4b6cc4b5d02ee5e251 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QHostAddress: resolve API issues marked with ##Qt6Timur Pocheptsov2020-07-281-8/+1
| | | | | | | | Also, remove the deprecated function and its auto-test. Change-Id: If04a54c4b91e0f76523960c7b1a5bcb8fe883ac6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Sweep Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 -> Q_DECLARE_SHAREDMarc Mutz2020-05-191-1/+1
| | | | | | | | | | | | This is Qt 6, so Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 is the same as Q_DECLARE_SHARED. Let's hope we'll collectively get better at detecting missing Q_DECLARE_SHARED so we won't need a Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT7 in the future. Change-Id: I3da9faff4c66b64a3b257309012a2a10a6c6d027 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change qHash() to work with size_t instead of uintLars Knoll2020-04-091-2/+2
| | | | | | | | | | | This is required, so that QHash and QSet can hold more than 2^32 items on 64 bit platforms. The actual hashing functions for strings are still 32bit, this will be changed in a follow-up commit. Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-05-011-3/+0
| | | | | | | | Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove remaining Q_DECL_NOEXCEPT/Q_DECL_NOTHROW usageAllan Sandfeld Jensen2019-04-041-4/+4
| | | | | Change-Id: I91ac9e714a465cab226b211812aa46e8fe5ff2ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNetworkInterface: Add the DNS eligibilityThiago Macieira2017-11-071-0/+1
| | | | | | | | | [ChangeLog][QtNetwork][QNetworkInterface] Added dnsEligibility() to QNetworkAddressEntry to indicate whether the address is eligible or not for publication in DNS or similar mechanisms. Change-Id: Id3ae5f853d964358ac1ab19b525334a426e0e052 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QHostAddress: add more classification functionsThiago Macieira2017-10-171-0/+5
| | | | | | | | | | [ChangeLog][QtNetwork][QHostAddress] Added isGlobal(), isLinkLocal(), isSiteLocal(), isUniqueLocalUnicast(), and isBroadcast() classification functions to complement isLoopback() and isMulticast(). Change-Id: I3868166e5efc45538544fffd14d8fca6e9042c04 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QHostAddress: add missing op!=(SpecialAddress, QHostAddress)Marc Mutz2017-01-261-0/+2
| | | | | | | | | The equality operator was supplied, but this one was missing. [ChangeLog][QtNetwork][QHostAddress] Added op!=(SpecialAddress, QHostAddress). Change-Id: Iad9c55fa0ee7a8e97d5e4ea4be0605b8b74649d1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHostAddress: make it implictly sharedGiuseppe D'Angelo2017-01-191-4/+4
| | | | | | | | | | | | | | | | | | | QHostAddress is one of the few classes in Qt which is pimpl'd but not implictly shared, making it suprisingly expensive to copy around, return by value and so on. Being pimpl'd it is also still lacking a move constructor, like most of such types in Qt. Remove a bit of the surprise factor and make it implictly shared. In practice this means making it eagerly parse host addresses from strings. Since it was entirely implemented out of line, replacing it with a implictly shared implementation is binary compatible. [ChangeLog][QtNetwork][QHostAddress] QHostAddress is now implicitly shared. Change-Id: Ia7ff94efcb74e7321b7607cd690c5c162f685605 Reviewed-by: Richard J. Moore <rich@kde.org>
* QHostAddress: fix assignment operatorsMarc Mutz2016-12-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | QHostAddress allowed assignment from a QString, but the respective constructor is explicit, and rightfully so. So it does not make sense that the assignment operator is provided, because of the asymmetry caused between QHostAddress addr = funcReturningQString(); // ERROR addr = funcReturningQString(); // OK (until now) By the same token, since SpecialAddress is implicitly convertible to QHostAddress, provide the missing assignment operator from that enum. Add tests, rewriting the _data() function to use the enum instead of an int to pass SpecialAddress values, and to test !=, too. Added setAddress(SpecialAddress), since a) it was missing and b) to share code between the ctor and the assignment operator. Change-Id: Ief64c493be13ada8c6968801d9ed083b267fa902 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add qtnetworkglobal.h and qtnetworkglobal_p.hLars Knoll2016-07-031-0/+1
| | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. That header will later on #include the configuration file for Qt Network. For now it defines the Q_NETWORK_EXPORT macro for this library. Change-Id: I9c45d425baf881c431ed71fd457c7feb2c123855 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QHostAddress: comparator with flexible conversion rulesFelix Braun2016-04-291-0/+12
| | | | | | | | | Add a named comparison method that allows the caller to specify in how far a translation between IPv4 and IPv6 should be performed before comparing. Change-Id: I9aeffcd4539a6c0537c083c4553357b22167df3f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Mark QHostAddress relocatableThiago Macieira2015-09-221-0/+1
| | | | | Change-Id: Iee8cbc07c4434ce9b560ffff13ca3fb80be56be6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add QHostAddress::isMulticastThiago Macieira2015-08-151-0/+1
| | | | | | | | This complements QHostAddress::isLoopback. The only missing check now is for the "Any" address types, though operator== is quite fast nowadays. Change-Id: Iee8cbc07c4434ce9b560ffff13cc2691e15014b6 Reviewed-by: Richard J. Moore <rich@kde.org>
* QtNetwork: make all Q_DECLARE_SHARED types nothrow move-assignableMarc Mutz2015-06-301-0/+7
| | | | | Change-Id: Ib29ec4b73a4cdc51074997f7d167c289cf5af7a4 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QHostAddress: add IPv6 address overloads that take const dataThiago Macieira2015-03-121-2/+4
| | | | | | | | It has been a historical mistake that there wasn't a const overload. Change-Id: Ia0aac2f09e9245339951ffff13c8d8b70f206a99 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Add a QHostAddress::toIPv4Address overload taking a bool *okThiago Macieira2015-03-061-1/+2
| | | | | | | | | This allows one to check whether the conversion is successful without checking for the return result, as the value of 0 represents the valid IPv4 address 0.0.0.0. Change-Id: I637fe55583f2255c85b0d955e5886b61494e0c7c Reviewed-by: Richard J. Moore <rich@kde.org>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Fix warnings from MSVC 2013Thiago Macieira2014-06-211-2/+2
| | | | | | | qhosaddress.h(88) : warning C4224: nonstandard extension used : formal parameter 'sockaddr' was previously defined as a type Change-Id: I38ee9dcb0d81d5ec4f71c2b50dc4f331eb61e7de Reviewed-by: Richard J. Moore <rich@kde.org>
* Remove default argument from declarations of qHash as friendGiuseppe D'Angelo2013-07-021-1/+5
| | | | | | | | | | | | | | | It's illegal in C++11: §8.3.6.4 [dcl.fct.default] "If a friend declaration specifies a default argument expression, that declaration shall be a definition and shall be the only declaration of the function or function template in the translation unit." Clang is starting to enforce this, thus it's making qtbase not compiling. Task-number: QTBUG-32100 Change-Id: Ifd9d4f62354d7cf4ccf275f36aab64e05c59efff Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-3/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QHostAddress: improve qHash implementationGiuseppe D'Angelo2012-04-081-3/+1
| | | | | | | | | | Avoid the conversion to a temporary QString -- just hash the address as a byte array. Change-Id: Ic35cdbbc3ee66c32a28d911bd27de0092395979f Done-with: Shane Kearns Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* More qHash(T, uint) overloads for Qt typesGiuseppe D'Angelo2012-04-071-1/+1
| | | | | | | The more we get in 5.0, the better. Change-Id: If00084477709db4fc3f6b2e15024d046491be2ae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-251-1/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Network - Add QHostAddress::isLoopback API.Shane Kearns2011-10-241-0/+2
| | | | | | | | | | | | The standard IPv4 loopback address is 127.0.0.1, however anything in the 127.0.0.0/8 range is also a loopback address. isLoopback returns true for any address that is in the IPv4 loopback address range, or is the single IPv6 loopback address ::1 Task-number: QTBUG-22246 Change-Id: Ic39100e2e97a52db700e01b109998a1cfd4335e3 Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* Remove QT3_SUPPORT from networkShane Kearns2011-07-051-9/+0
| | | | | | | Change-Id: I962bece24c958c053a3edc0e49a594b61a3725ae Reviewed-on: http://codereview.qt.nokia.com/1093 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Liang Qi <liang.qi@nokia.com>
* IPv4 + IPv6 dual stack socketsShane Kearns2011-06-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for binding "dual stack" sockets (via QUdpSocket or QTcpServer). A dual stack socket will accept incoming connections on either IPv4 or IPv6 interfaces. QHostAddress::Any - use this to bind a dual stack socket QHostAddress::AnyIPv6 - use this to bind a socket for IPv6 only QHostAddress::AnyIPv4 - use this to bind a socket for IPv4 only Binding to a specific address rather than one of the "any" addresses is restricting you to a protocol anyway so no behaviour change there. IPv6 sockets were previously dual stack on some OS and v6 only on others Any previously meant IPv4 only This commit implemented & tested on Windows 7, Linux (Ubuntu 10.04) and Mac OS 10.6.7. Windows XP and server 2003 do not support dual stack sockets, even though they can support IPv6. On those versions, QHostAddress::Any will still bind to IPv4 0.0.0.0 (which is also the behaviour anywhere QT_NO_IPV6 is defined) Autotests run: qudpsocket (includes a new test case) qtcpserver (includes a new test case) qtcpsocket qnetworkreply qhostaddress Task-number: QTBUG-17080 Change-Id: Id486677c4f832e18dc0ff1a86c5f5fc422c9eb4f Reviewed-on: http://codereview.qt.nokia.com/421 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com> Reviewed-by: Markus Goetz
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+155
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12