KTcpSocket

Search for usage in LXR

#include <ktcpsocket.h>

Inheritance diagram for KTcpSocket:

Public Types

enum  EncryptionMode { UnencryptedMode = 0, SslClientMode, SslServerMode }
 
enum  Error {
  UnknownError = 0, ConnectionRefusedError, RemoteHostClosedError, HostNotFoundError,
  SocketAccessError, SocketResourceError, SocketTimeoutError, NetworkError,
  UnsupportedSocketOperationError, SslHandshakeFailedError
}
 
enum  ProxyPolicy { AutoProxy = 0, ManualProxy }
 
enum  SslVersion {
  UnknownSslVersion = 0x01, SslV2 = 0x02, SslV3 = 0x04, TlsV1 = 0x08,
  SslV3_1 = 0x08, TlsV1SslV3 = 0x10, SecureProtocols = 0x20, TlsV1_0 = TlsV1,
  TlsV1_1 = 0x40, TlsV1_2 = 0x80, TlsV1_3 = 0x100, AnySslVersion = SslV2 | SslV3 | TlsV1
}
 
typedef QFlags< SslVersionSslVersions
 
enum  State {
  UnconnectedState = 0, HostLookupState, ConnectingState, ConnectedState,
  BoundState, ListeningState, ClosingState
}
 
- Public Types inherited from QIODevice
enum  OpenModeFlag
 

Signals

void connected ()
 
void disconnected ()
 
void encrypted ()
 
void encryptedBytesWritten (qint64 written)
 
void encryptionModeChanged (EncryptionMode)
 
void error (KTcpSocket::Error)
 
void hostFound ()
 
void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator)
 
void sslErrors (const QList< KSslError > &errors)
 
void stateChanged (KTcpSocket::State)
 

Public Slots

void ignoreSslErrors ()
 
void startClientEncryption ()
 

Public Member Functions

 KTcpSocket (QObject *parent=nullptr)
 
void abort ()
 
void addCaCertificate (const QSslCertificate &certificate)
 
void addCaCertificates (const QList< QSslCertificate > &certificates)
 
SslVersion advertisedSslVersion () const
 
bool atEnd () const override
 
qint64 bytesAvailable () const override
 
qint64 bytesToWrite () const override
 
QList< QSslCertificatecaCertificates () const
 
bool canReadLine () const override
 
QList< KSslCipherciphers () const
 
void close () override
 
void connectToHost (const QHostAddress &hostAddress, quint16 port, ProxyPolicy policy=AutoProxy)
 
void connectToHost (const QString &hostName, quint16 port, ProxyPolicy policy=AutoProxy)
 
void connectToHost (const QUrl &url, ProxyPolicy policy=AutoProxy)
 
void connectToHostEncrypted (const QString &hostName, quint16 port, OpenMode openMode=ReadWrite)
 
void disconnectFromHost ()
 
EncryptionMode encryptionMode () const
 
Error error () const
 
bool flush ()
 
bool isSequential () const override
 
bool isValid () const
 
QHostAddress localAddress () const
 
QSslCertificate localCertificate () const
 
SslVersion negotiatedSslVersion () const
 
QString negotiatedSslVersionName () const
 
bool open (QIODevice::OpenMode open) override
 
QHostAddress peerAddress () const
 
QList< QSslCertificatepeerCertificateChain () const
 
QString peerName () const
 
quint16 peerPort () const
 
KSslKey privateKey () const
 
QNetworkProxy proxy () const
 
qint64 readBufferSize () const
 
KSslCipher sessionCipher () const
 
void setAdvertisedSslVersion (SslVersion version)
 
void setCaCertificates (const QList< QSslCertificate > &certificates)
 
void setCiphers (const QList< KSslCipher > &ciphers)
 
void setLocalCertificate (const QSslCertificate &certificate)
 
void setLocalCertificate (const QString &fileName, QSsl::EncodingFormat format=QSsl::Pem)
 
void setPrivateKey (const KSslKey &key)
 
void setPrivateKey (const QString &fileName, KSslKey::Algorithm algorithm=KSslKey::Rsa, QSsl::EncodingFormat format=QSsl::Pem, const QByteArray &passPhrase=QByteArray())
 
void setProxy (const QNetworkProxy &proxy)
 
void setReadBufferSize (qint64 size)
 
void setSocketOption (QAbstractSocket::SocketOption options, const QVariant &value)
 
void setSslConfiguration (const QSslConfiguration &configuration)
 
void setVerificationPeerName (const QString &hostName)
 
QVariant socketOption (QAbstractSocket::SocketOption options) const
 
QSslConfiguration sslConfiguration () const
 
QList< KSslErrorsslErrors () const
 
State state () const
 
bool waitForBytesWritten (int msecs) override
 
bool waitForConnected (int msecs=30000)
 
bool waitForDisconnected (int msecs=30000)
 
bool waitForEncrypted (int msecs=30000)
 
bool waitForReadyRead (int msecs=30000) override
 
- Public Member Functions inherited from QIODevice
 QIODevice (QObject *parent)
 
void aboutToClose ()
 
void bytesWritten (qint64 bytes)
 
void channelBytesWritten (int channel, qint64 bytes)
 
void channelReadyRead (int channel)
 
void commitTransaction ()
 
int currentReadChannel () const const
 
int currentWriteChannel () const const
 
QString errorString () const const
 
bool getChar (char *c)
 
bool isOpen () const const
 
bool isReadable () const const
 
bool isTextModeEnabled () const const
 
bool isTransactionStarted () const const
 
bool isWritable () const const
 
QIODevice::OpenMode openMode () const const
 
qint64 peek (char *data, qint64 maxSize)
 
QByteArray peek (qint64 maxSize)
 
virtual qint64 pos () const const
 
bool putChar (char c)
 
qint64 read (char *data, qint64 maxSize)
 
QByteArray read (qint64 maxSize)
 
QByteArray readAll ()
 
int readChannelCount () const const
 
void readChannelFinished ()
 
qint64 readLine (char *data, qint64 maxSize)
 
QByteArray readLine (qint64 maxSize)
 
void readyRead ()
 
virtual bool reset ()
 
void rollbackTransaction ()
 
virtual bool seek (qint64 pos)
 
void setCurrentReadChannel (int channel)
 
void setCurrentWriteChannel (int channel)
 
void setTextModeEnabled (bool enabled)
 
virtual qint64 size () const const
 
qint64 skip (qint64 maxSize)
 
void startTransaction ()
 
void ungetChar (char c)
 
qint64 write (const char *data)
 
qint64 write (const char *data, qint64 maxSize)
 
qint64 write (const QByteArray &byteArray)
 
int writeChannelCount () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

qint64 readData (char *data, qint64 maxSize) override
 
qint64 writeData (const char *data, qint64 maxSize) override
 
- Protected Member Functions inherited from QIODevice
virtual qint64 readLineData (char *data, qint64 maxSize)
 
void setErrorString (const QString &str)
 
void setOpenMode (QIODevice::OpenMode openMode)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QIODevice
 Append
 
 ExistingOnly
 
 NewOnly
 
 NotOpen
 
typedef OpenMode
 
 ReadOnly
 
 ReadWrite
 
 Text
 
 Truncate
 
 Unbuffered
 
 WriteOnly
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

TCP socket.

Deprecated:
since 5.65, use QSslSocket instead.

Definition at line 161 of file ktcpsocket.h.

Member Enumeration Documentation

◆ Error

Enumerator
SslHandshakeFailedError 
Since
4.10.5

Definition at line 191 of file ktcpsocket.h.

◆ ProxyPolicy

Enumerator
AutoProxy 

Use the proxy that KProtocolManager suggests for the connection parameters given.

ManualProxy 

Use the proxy set by setProxy(), if any; otherwise use no proxy.

Definition at line 240 of file ktcpsocket.h.

◆ SslVersion

Enumerator
SslV2 

Note: no-op in Qt for a long time.

SslV3 

Note: no-op in Qt for a long time.

TlsV1SslV3 

Note: same as TlsV1_0.

Definition at line 175 of file ktcpsocket.h.

Member Function Documentation

◆ connectToHost()

void KTcpSocket::connectToHost ( const QUrl url,
ProxyPolicy  policy = AutoProxy 
)

Take the hostname and port from url and connect to them.

The information from a full URL enables the most accurate choice of proxy in case of proxy rules that depend on high-level information like protocol or username.

See also
KProtocolManager::proxyForUrl()

Definition at line 516 of file ktcpsocket.cpp.

◆ encryptedBytesWritten

void KTcpSocket::encryptedBytesWritten ( qint64  written)
signal
Since
4.8.1 Forwarded from QSslSocket

◆ proxy()

QNetworkProxy KTcpSocket::proxy ( ) const
See also
: connectToHost()

Definition at line 582 of file ktcpsocket.cpp.

◆ setProxy()

void KTcpSocket::setProxy ( const QNetworkProxy proxy)
See also
: connectToHost()

Definition at line 594 of file ktcpsocket.cpp.

◆ setSocketOption()

void KTcpSocket::setSocketOption ( QAbstractSocket::SocketOption  options,
const QVariant value 
)

Sets the socket option to value.

See also
QAbstractSocket::setSocketOption
Since
4.5.0

Definition at line 768 of file ktcpsocket.cpp.

◆ setSslConfiguration()

void KTcpSocket::setSslConfiguration ( const QSslConfiguration configuration)

Sets the socket's SSL configuration.

Since
4.8.4

Definition at line 778 of file ktcpsocket.cpp.

◆ socketOption()

QVariant KTcpSocket::socketOption ( QAbstractSocket::SocketOption  options) const

Returns the state of the socket option.

See also
QAbstractSocket::socketOption
Since
4.5.0

Definition at line 763 of file ktcpsocket.cpp.

◆ sslConfiguration()

QSslConfiguration KTcpSocket::sslConfiguration ( ) const

Returns the socket's SSL configuration.

Since
4.8.4

Definition at line 773 of file ktcpsocket.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:54:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.