<?xml version="1.0" encoding="UTF-8"?>
<!--
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
-->
<typesystem package="PySide6.QtNetwork">
  <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>

    <rejection class="QTlsPrivate"/>

    <enum-type name="QDtlsError">
        <configuration condition="QT_CONFIG(ssl)"/>
    </enum-type>
    <enum-type name="QOcspCertificateStatus">
        <configuration condition="QT_CONFIG(ssl)"/>
    </enum-type>
    <enum-type name="QOcspRevocationReason">
        <configuration condition="QT_CONFIG(ssl)"/>
    </enum-type>

    <namespace-type name="QPasswordDigestor">
        <extra-includes>
            <include file-name="qpassworddigestor.h" location="global"/>
        </extra-includes>
    </namespace-type>

    <namespace-type name="QSsl">
        <enum-type name="AlertLevel"/>
        <enum-type name="AlertType"/>
        <enum-type name="AlternativeNameEntryType"/>
        <enum-type name="EncodingFormat"/>
        <enum-type name="ImplementedClass" since="6.1"/>
        <enum-type name="KeyAlgorithm"/>
        <enum-type name="KeyType"/>
        <enum-type name="SslOption" flags="SslOptions"/>
        <enum-type name="SslProtocol"/>
        <enum-type name="SupportedFeature" since="6.1"/>
        <extra-includes>
            <include file-name="qssl.h" location="global"/>
        </extra-includes>
    </namespace-type>

    <rejection class="QIPv6Address" field-name="c"/>

    <object-type name="QAbstractSocket">
        <enum-type name="BindFlag" flags="BindMode"/>
        <enum-type name="NetworkLayerProtocol"/>
        <enum-type name="PauseMode" flags="PauseModes"/>
        <enum-type name="SocketError"/>
        <enum-type name="SocketOption" since="4.6"/>
        <enum-type name="SocketState"/>
        <enum-type name="SocketType"/>
        <modify-function signature="connectToHost(const QString&amp;,quint16,QFlags&lt;QIODeviceBase::OpenModeFlag>,QAbstractSocket::NetworkLayerProtocol)" allow-thread="yes"/>
        <modify-function signature="connectToHost(const QHostAddress&amp;,quint16,QFlags&lt;QIODeviceBase::OpenModeFlag>)" allow-thread="yes"/>
        <modify-function signature="disconnectFromHost()" allow-thread="yes"/>
        <modify-function signature="waitForConnected(int)" allow-thread="yes"/>
        <modify-function signature="waitForDisconnected(int)" allow-thread="yes"/>
        <modify-function signature="waitForBytesWritten(int)" allow-thread="yes"/>
        <modify-function signature="waitForReadyRead(int)" allow-thread="yes"/>
    </object-type>

    <value-type name="QDnsDomainNameRecord"/>
    <value-type name="QDnsHostAddressRecord"/>
    <object-type name="QDnsLookup">
        <enum-type name="Error"/>
        <enum-type name="Type"/>
    </object-type>
    <value-type name="QDnsMailExchangeRecord"/>
    <value-type name="QDnsServiceRecord"/>
    <value-type name="QDnsTextRecord"/>

    <object-type name="QDtls">
        <enum-type name="HandshakeState"/>
        <configuration condition="QT_CONFIG(dtls)"/>
    </object-type>
    <object-type name="QDtlsClientVerifier">
        <configuration condition="QT_CONFIG(dtls)"/>
    </object-type>

    <value-type name="QHstsPolicy">
        <enum-type name="PolicyFlag" flags="PolicyFlags"/>
    </value-type>
    <object-type name="QHttpMultiPart">
        <enum-type name="ContentType"/>
    </object-type>
    <value-type name="QHttpPart"/>
    <value-type name="QHttp2Configuration"/>

    <object-type name="QTcpServer">
        <modify-function signature="waitForNewConnection(int,bool*)" allow-thread="yes">
            <!-- FIXME removing default expression means user will always have to pass a value, but he wouldn't have to -->
            <modify-argument index="1">
                <remove-default-expression/>
            </modify-argument>
            <modify-argument index="2">
                <remove-default-expression/>
                <remove-argument/>
            </modify-argument>
            <modify-argument index="return" pyi-type="Tuple[bool, bool]">
                <replace-type modified-type="(retval, timedOut)"/>
            </modify-argument>
            <inject-code class="target" position="beginning">
                <insert-template name="fix_args,bool*"/>
            </inject-code>
        </modify-function>
    </object-type>
    <value-type name="QOcspResponse">
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>
    <object-type name="QTcpSocket"/>
    <object-type name="QUdpSocket">
        <modify-function signature="readDatagram(char*,qint64,QHostAddress*,quint16*)" allow-thread="yes">
            <modify-argument index="1">
                <remove-argument/>
            </modify-argument>
            <modify-argument index="3">
                <remove-default-expression/>
                <remove-argument/>
            </modify-argument>
            <modify-argument index="4">
                <remove-default-expression/>
                <remove-argument/>
            </modify-argument>
            <modify-argument index="return" pyi-type="Tuple[PySide6.QtCore.QByteArray, PySide6.QtNetwork.QHostAddress, int]">
                <replace-type modified-type="(data, address, port)"/>
            </modify-argument>
            <inject-code class="target" position="beginning" file="../glue/qtnetwork.cpp" snippet="qudpsocket-readdatagram"/>
        </modify-function>
        <modify-function signature="writeDatagram(const QByteArray&amp;,const QHostAddress&amp;,quint16)" allow-thread="yes"/>
        <!-- ### writeDatagram(QByteArray, ...) does the trick -->
        <modify-function signature="writeDatagram(const char*,qint64,const QHostAddress&amp;,quint16)" remove="all"/>
        <!-- ### -->
    </object-type>

    <object-type name="QLocalServer">
        <enum-type name="SocketOption" flags="SocketOptions"/>
        <modify-function signature="waitForNewConnection(int,bool*)" allow-thread="yes">
            <!-- FIXME -->
            <modify-argument index="1">
                <remove-default-expression/>
            </modify-argument>
            <modify-argument index="2">
                <remove-default-expression/>
                <remove-argument/>
            </modify-argument>
            <inject-code class="target" position="beginning">
                <insert-template name="fix_args,bool*"/>
            </inject-code>
            <modify-argument index="return" pyi-type="Tuple[bool, bool]">
                <replace-type modified-type="(retval, timedOut)"/>
            </modify-argument>

        </modify-function>
    </object-type>
    <object-type name="QLocalSocket">
        <enum-type name="LocalSocketError"/>
        <enum-type name="SocketOption" flags="SocketOptions"/>
        <enum-type name="LocalSocketState"/>
    </object-type>
    <object-type name="QNetworkAccessManager">
        <enum-type name="Operation"/>
        <modify-function signature="createRequest(QNetworkAccessManager::Operation,const QNetworkRequest&amp;,QIODevice*)">
          <modify-argument index="3" invalidate-after-use="yes"/>
          <modify-argument index="return">
            <define-ownership class="target" owner="default"/>
          </modify-argument>
        </modify-function>
        <modify-function signature="get(const QNetworkRequest&amp;)" allow-thread="yes"/>
        <modify-function signature="post(const QNetworkRequest &amp;,QIODevice*)" allow-thread="yes"/>
        <modify-function signature="post(const QNetworkRequest &amp;,const QByteArray &amp;)" allow-thread="yes"/>
        <modify-function signature="put(const QNetworkRequest &amp;,QIODevice*)" allow-thread="yes"/>
        <modify-function signature="put(const QNetworkRequest &amp;,const QByteArray &amp;)" allow-thread="yes"/>
        <modify-function signature="sendCustomRequest(const QNetworkRequest &amp;,const QByteArray &amp;,QIODevice*)" allow-thread="yes" since="4.7"/>
        <modify-function signature="setCookieJar(QNetworkCookieJar*)">
            <modify-argument index="1">
                <define-ownership class="target" owner="c++"/>
            </modify-argument>
        </modify-function>
    </object-type>
    <object-type name="QNetworkInformation">
        <enum-type name="Reachability"/>
        <enum-type name="Feature" flags="Features"/>
        <enum-type name="TransportMedium" since="6.3"/>
    </object-type>
    <object-type name="QNetworkCookieJar"/>
    <value-type name="QNetworkDatagram"/>
    <object-type name="QNetworkReply">
        <enum-type name="NetworkError"/>
    </object-type>

    <value-type name="QHostAddress">
        <enum-type name="ConversionModeFlag" flags="ConversionMode"/>
        <enum-type name="SpecialAddress"/>
        <!-- ### QHostAddress(QIPv6Address) does this -->
        <modify-function signature="QHostAddress(const quint8*)" remove="all"/>
       <!-- ### -->
        <modify-function signature="setAddress(const quint8*)" remove="all"/>
    </value-type>

    <value-type name="QHostInfo">
        <enum-type name="HostInfoError"/>
        <add-function signature="lookupHost(const QString &amp;,PyCallable)">
            <inject-code class="target" position="beginning"
                         file="../glue/qtnetwork.cpp"
                         snippet="qhostinfo-lookuphost-callable"/>
        </add-function>
    </value-type>

    <value-type name="QNetworkAddressEntry">
        <enum-type name="DnsEligibilityStatus"/>
        <configuration condition="#ifndef QT_NO_NETWORKINTERFACE"/>
    </value-type>

    <value-type name="QNetworkInterface">
        <enum-type name="InterfaceFlag" flags="InterfaceFlags"/>
        <enum-type name="InterfaceType"/>
        <configuration condition="#ifndef QT_NO_NETWORKINTERFACE"/>
    </value-type>

    <value-type name="QNetworkProxy">
        <enum-type name="Capability" flags="Capabilities"/>
        <enum-type name="ProxyType"/>
    </value-type>

    <object-type name="QNetworkProxyFactory"/>
    <value-type name="QNetworkProxyQuery">
        <enum-type name="QueryType"/>
    </value-type>

    <value-type name="QIPv6Address">
        <add-function signature="__len__">
            <inject-code class="target" position="beginning" file="../glue/qtnetwork.cpp" snippet="qipv6address-len"/>
        </add-function>
        <add-function signature="__getitem__">
            <inject-code class="target" position="beginning" file="../glue/qtnetwork.cpp" snippet="qipv6address-getitem"/>
        </add-function>
        <add-function signature="__setitem__">
            <inject-code class="target" position="beginning" file="../glue/qtnetwork.cpp" snippet="qipv6address-setitem"/>
        </add-function>
    </value-type>

    <value-type name="QAuthenticator"/>
    <value-type name="QNetworkCookie">
        <enum-type name="RawForm"/>
        <enum-type name="SameSite" since="6.1"/>
        <extra-includes>
            <include file-name="QDateTime" location="global"/>
        </extra-includes>
    </value-type>
    <value-type name="QNetworkRequest">
        <enum-type name="Attribute"/>
        <enum-type name="LoadControl" since="4.7"/>
        <enum-type name="Priority" since="4.7"/>
        <enum-type name="CacheLoadControl"/>
        <enum-type name="KnownHeaders"/>
        <enum-type name="RedirectPolicy"/>
        <enum-type name="TransferTimeoutConstant"/>
    </value-type>

    <object-type name="QAbstractNetworkCache"/>
    <object-type name="QNetworkDiskCache"/>
    <value-type name="QNetworkCacheMetaData"/>

    <object-type name="QSctpServer">
        <configuration condition="QT_CONFIG(sctp)"/>
    </object-type>
    <object-type name="QSctpSocket">
        <configuration condition="QT_CONFIG(sctp)"/>
    </object-type>

    <!-- The following entries may be present in the system or not. Keep this section organized. -->
    <value-type name="QSslCertificate">
        <enum-type name="PatternSyntax"/>
        <enum-type name="SubjectInfo"/>
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>

    <value-type name="QSslCertificateExtension">
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>

    <value-type name="QSslCipher">
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>

    <value-type name="QSslConfiguration">
        <enum-type name="NextProtocolNegotiationStatus"/>
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>

    <value-type name="QSslDiffieHellmanParameters">
        <enum-type name="Error"/>
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>

    <value-type name="QSslEllipticCurve">
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>

    <value-type name="QSslError">
        <enum-type name="SslError"/>
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>

    <value-type name="QSslKey"/>
    <object-type name="QSslSocket">
        <enum-type name="SslMode"/>
        <enum-type name="PeerVerifyMode"/>
        <modify-function signature="connectToHostEncrypted(const QString&amp;,quint16,QFlags&lt;QIODeviceBase::OpenModeFlag>,QAbstractSocket::NetworkLayerProtocol)" allow-thread="yes"/>
        <modify-function signature="waitForEncrypted(int)" allow-thread="yes"/>
        <configuration condition="QT_CONFIG(ssl)"/>
    </object-type>

    <value-type name="QSslPreSharedKeyAuthenticator">
        <configuration condition="QT_CONFIG(ssl)"/>
    </value-type>

    <object-type name="QSslServer" since="6.4">
        <configuration condition="QT_CONFIG(ssl)"/>
    </object-type>

    <!-- The above entries may be present in the system or not. Keep this section organized. -->
</typesystem>

