• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
slave.h
1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2000 Waldo Bastian <bastian@kde.org>
4 * 2000 Stephan Kulow <coolo@kde.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License version 2 as published by the Free Software Foundation.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 **/
20
21#ifndef TDEIO_SLAVE_H
22#define TDEIO_SLAVE_H
23
24#include <time.h>
25#include <unistd.h>
26
27#include <tqobject.h>
28
29#include <kurl.h>
30
31#include "tdeio/slaveinterface.h"
32#include "tdeio/connection.h"
33
34class TDEServerSocket;
35class TDESocket;
36
37namespace TDEIO {
38
43 class TDEIO_EXPORT Slave : public TDEIO::SlaveInterface
44 {
45 TQ_OBJECT
46
47
48 protected:
55 Slave(bool derived, TDEServerSocket *unixdomain, const TQString &protocol,
56 const TQString &socketname); // TODO(BIC): Remove in KDE 4
57
58 public:
59 Slave(TDEServerSocket *unixdomain,
60 const TQString &protocol, const TQString &socketname);
61
62 virtual ~Slave();
63
64 void setPID(pid_t);
65
66 int slave_pid() { return m_pid; }
67
71 void kill();
72
76 bool isAlive() { return !dead; }
77
85 void setHost( const TQString &host, int port,
86 const TQString &user, const TQString &passwd); // TODO(BIC): make virtual
87
91 void resetHost();
92
96 void setConfig(const MetaData &config); // TODO(BIC): make virtual
97
103 TQString protocol() { return m_protocol; }
104
105 void setProtocol(const TQString & protocol);
118 TQString slaveProtocol() { return m_slaveProtocol; }
119
123 TQString host() { return m_host; }
124
128 int port() { return m_port; }
129
133 TQString user() { return m_user; }
134
138 TQString passwd() { return m_passwd; }
139
151 static Slave* createSlave( const TQString &protocol, const KURL& url, int& error, TQString& error_text );
152
153 static Slave* holdSlave( const TQString &protocol, const KURL& url );
154
155 // == communication with connected tdeioslave ==
156 // whenever possible prefer these methods over the respective
157 // methods in connection()
161 void suspend(); // TODO(BIC): make virtual
165 void resume(); // TODO(BIC): make virtual
171 bool suspended(); // TODO(BIC): make virtual
178 void send(int cmd, const TQByteArray &data = TQByteArray());// TODO(BIC): make virtual
179 // == end communication with connected tdeioslave ==
180
184 void hold(const KURL &url); // TODO(BIC): make virtual
185
189 time_t idleTime();
190
194 void setIdle();
195
196 /*
197 * @returns Whether the slave is connected
198 * (Connection oriented slaves only)
199 */
200 bool isConnected() { return contacted; }
201 void setConnected(bool c) { contacted = c; }
202
207 TDE_DEPRECATED Connection *connection() { return &slaveconn; } // TODO(BIC): remove before KDE 4
208
209 void ref() { m_refCount++; }
210 void deref() { m_refCount--; if (!m_refCount) delete this; }
211
212 public slots:
213 void accept(TDESocket *socket);
214 void gotInput();
215 void timeout();
216 signals:
217 void slaveDied(TDEIO::Slave *slave);
218
219 protected:
220 void unlinkSocket();
221
222 private:
223 TQString m_protocol;
224 TQString m_slaveProtocol;
225 TQString m_host;
226 int m_port;
227 TQString m_user;
228 TQString m_passwd;
229 TDEServerSocket *serv;
230 TQString m_socket;
231 pid_t m_pid;
232 bool contacted;
233 bool dead;
234 time_t contact_started;
235 time_t idle_since;
236 TDEIO::Connection slaveconn;
237 int m_refCount;
238 protected:
239 virtual void virtual_hook( int id, void* data );
240 // grant SlaveInterface all IDs < 0x200
241 enum { VIRTUAL_SUSPEND = 0x200, VIRTUAL_RESUME, VIRTUAL_SEND,
242 VIRTUAL_HOLD, VIRTUAL_SUSPENDED,
243 VIRTUAL_SET_HOST, VIRTUAL_SET_CONFIG };
244 struct SendParams {
245 int cmd;
246 const TQByteArray *arr;
247 };
248 struct HoldParams {
249 const KURL *url;
250 };
251 struct SuspendedParams {
252 bool retval;
253 };
254 struct SetHostParams {
255 const TQString *host;
256 int port;
257 const TQString *user;
258 const TQString *passwd;
259 };
260 struct SetConfigParams {
261 const MetaData *config;
262 };
263 private:
264 class SlavePrivate* d;
265 };
266
267}
268
269#endif
TDEIO::Connection
This class provides a simple means for IPC between two applications via a pipe.
Definition: connection.h:49
TDEIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:516
TDEIO::SlaveInterface
There are two classes that specifies the protocol between application (TDEIO::Job) and tdeioslave.
Definition: slaveinterface.h:94
TDEIO::Slave
Attention developers: If you change the implementation of TDEIO::Slave, do not use connection() or sl...
Definition: slave.h:44
TDEIO::Slave::passwd
TQString passwd()
Definition: slave.h:138
TDEIO::Slave::connection
TDE_DEPRECATED Connection * connection()
Definition: slave.h:207
TDEIO::Slave::slaveProtocol
TQString slaveProtocol()
The actual protocol used to handle the request.
Definition: slave.h:118
TDEIO::Slave::port
int port()
Definition: slave.h:128
TDEIO::Slave::user
TQString user()
Definition: slave.h:133
TDEIO::Slave::host
TQString host()
Definition: slave.h:123
TDEIO::Slave::protocol
TQString protocol()
The protocol this slave handles.
Definition: slave.h:103
TDEIO::Slave::isAlive
bool isAlive()
Definition: slave.h:76
TDEIO
A namespace for TDEIO globals.
Definition: authinfo.h:29

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.4
This website is maintained by Timothy Pearson.