• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • kio
connection_p.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2007 Thiago Macieira <thiago@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KIO_CONNECTION_P_H
21#define KIO_CONNECTION_P_H
22
23#include <QObject>
24#include <klocalsocket.h>
25
26class KUrl;
27
28namespace KIO {
29 struct Task {
30 int cmd;
31 QByteArray data;
32 };
33
34 class AbstractConnectionBackend: public QObject
35 {
36 Q_OBJECT
37 public:
38 QString address;
39 QString errorString;
40 enum { Idle, Listening, Connected } state;
41
42 explicit AbstractConnectionBackend(QObject *parent = 0);
43 ~AbstractConnectionBackend();
44
45 virtual void setSuspended(bool enable) = 0;
46 virtual bool connectToRemote(const KUrl &url) = 0;
47 virtual bool listenForRemote() = 0;
48 virtual bool waitForIncomingTask(int ms) = 0;
49 virtual bool sendCommand(const Task &task) = 0;
50 virtual AbstractConnectionBackend *nextPendingConnection() = 0;
51
52 Q_SIGNALS:
53 void disconnected();
54 void commandReceived(const Task &task);
55 void newConnection();
56 };
57
58 class SocketConnectionBackend: public AbstractConnectionBackend
59 {
60 Q_OBJECT
61 public:
62 enum Mode { LocalSocketMode, TcpSocketMode };
63
64 private:
65 enum { HeaderSize = 10, StandardBufferSize = 32*1024 };
66
67 QTcpSocket *socket;
68 union {
69 KLocalSocketServer *localServer;
70 QTcpServer *tcpServer;
71 };
72 long len;
73 int cmd;
74 int port;
75 bool signalEmitted;
76 quint8 mode;
77
78 public:
79 explicit SocketConnectionBackend(Mode m, QObject *parent = 0);
80 ~SocketConnectionBackend();
81
82 void setSuspended(bool enable);
83 bool connectToRemote(const KUrl &url);
84 bool listenForRemote();
85 bool waitForIncomingTask(int ms);
86 bool sendCommand(const Task &task);
87 AbstractConnectionBackend *nextPendingConnection();
88 public slots:
89 void socketReadyRead();
90 void socketDisconnected();
91 };
92}
93
94#endif
KIO::AbstractConnectionBackend
Definition: connection_p.h:35
KIO::AbstractConnectionBackend::nextPendingConnection
virtual AbstractConnectionBackend * nextPendingConnection()=0
KIO::AbstractConnectionBackend::state
enum KIO::AbstractConnectionBackend::@0 state
KIO::AbstractConnectionBackend::errorString
QString errorString
Definition: connection_p.h:39
KIO::AbstractConnectionBackend::waitForIncomingTask
virtual bool waitForIncomingTask(int ms)=0
KIO::AbstractConnectionBackend::address
QString address
Definition: connection_p.h:38
KIO::AbstractConnectionBackend::commandReceived
void commandReceived(const Task &task)
KIO::AbstractConnectionBackend::connectToRemote
virtual bool connectToRemote(const KUrl &url)=0
KIO::AbstractConnectionBackend::disconnected
void disconnected()
KIO::AbstractConnectionBackend::listenForRemote
virtual bool listenForRemote()=0
KIO::AbstractConnectionBackend::newConnection
void newConnection()
KIO::AbstractConnectionBackend::~AbstractConnectionBackend
~AbstractConnectionBackend()
Definition: connection.cpp:114
KIO::AbstractConnectionBackend::setSuspended
virtual void setSuspended(bool enable)=0
KIO::AbstractConnectionBackend::sendCommand
virtual bool sendCommand(const Task &task)=0
KIO::AbstractConnectionBackend::Connected
@ Connected
Definition: connection_p.h:40
KIO::AbstractConnectionBackend::Idle
@ Idle
Definition: connection_p.h:40
KIO::AbstractConnectionBackend::Listening
@ Listening
Definition: connection_p.h:40
KIO::SocketConnectionBackend
Definition: connection_p.h:59
KIO::SocketConnectionBackend::~SocketConnectionBackend
~SocketConnectionBackend()
Definition: connection.cpp:126
KIO::SocketConnectionBackend::connectToRemote
bool connectToRemote(const KUrl &url)
Definition: connection.cpp:160
KIO::SocketConnectionBackend::localServer
KLocalSocketServer * localServer
Definition: connection_p.h:69
KIO::SocketConnectionBackend::listenForRemote
bool listenForRemote()
Definition: connection.cpp:200
KIO::SocketConnectionBackend::Mode
Mode
Definition: connection_p.h:62
KIO::SocketConnectionBackend::TcpSocketMode
@ TcpSocketMode
Definition: connection_p.h:62
KIO::SocketConnectionBackend::LocalSocketMode
@ LocalSocketMode
Definition: connection_p.h:62
KIO::SocketConnectionBackend::setSuspended
void setSuspended(bool enable)
Definition: connection.cpp:133
KIO::SocketConnectionBackend::waitForIncomingTask
bool waitForIncomingTask(int ms)
Definition: connection.cpp:251
KIO::SocketConnectionBackend::socketDisconnected
void socketDisconnected()
Definition: connection.cpp:194
KIO::SocketConnectionBackend::nextPendingConnection
AbstractConnectionBackend * nextPendingConnection()
Definition: connection.cpp:303
KIO::SocketConnectionBackend::tcpServer
QTcpServer * tcpServer
Definition: connection_p.h:70
KIO::SocketConnectionBackend::socketReadyRead
void socketReadyRead()
Definition: connection.cpp:329
KIO::SocketConnectionBackend::sendCommand
bool sendCommand(const Task &task)
Definition: connection.cpp:282
KLocalSocketServer
KUrl
QObject
QTcpSocket
klocalsocket.h
KIO
A namespace for KIO globals.
Definition: kbookmarkmenu.h:55
KIO::Task
Definition: connection_p.h:29
KIO::Task::data
QByteArray data
Definition: connection_p.h:31
KIO::Task::cmd
int cmd
Definition: connection_p.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal