slave.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# slave.h

    00001 // -*- c++ -*-
    00002 /*
    00003  *  This file is part of the KDE libraries
    00004  *  Copyright (c) 2000 Waldo Bastian <bastian@kde.org>
    00005  *                2000 Stephan Kulow <coolo@kde.org>
    00006  *
    00007  * $Id: slave.h,v 1.32.2.1 2003/05/17 11:19:23 mueller Exp $
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU Library General Public
    00011  *  License version 2 as published by the Free Software Foundation.
    00012  *
    00013  *  This library is distributed in the hope that it will be useful,
    00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00016  *  Library General Public License for more details.
    00017  *
    00018  *  You should have received a copy of the GNU Library General Public License
    00019  *  along with this library; see the file COPYING.LIB.  If not, write to
    00020  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00021  *  Boston, MA 02111-1307, USA.
    00022  **/
    00023
    00024 #ifndef KIO_SLAVE_H
    00025 #define KIO_SLAVE_H
    00026
    00027 #include <time.h>
    00028 #include <unistd.h>
    00029
    00030 #include <qobject.h>
    00031
    00032 #include <kurl.h>
    00033
    00034 #include "kio/slaveinterface.h"
    00035 #include "kio/connection.h"
    00036
    00037 class KServerSocket;
    00038 class KSocket;
    00039
    00040 namespace KIO {
    00041
    00042     class Slave : public KIO::SlaveInterface
    00043     {
    00044         Q_OBJECT
    00045
    00046     public:
    00047         Slave(KServerSocket *unixdomain,
    00048               const QString &protocol, const QString &socketname);
    00049
    00050         virtual ~Slave();
    00051
    00052         void setPID(pid_t);
    00053
    00054         int slave_pid() { return m_pid; }
    00055
    00059         void kill();
    00060
    00064         bool isAlive() { return !dead; }
    00065
    00073         void setHost( const QString &host, int port,
    00074                       const QString &user, const QString &passwd);
    00075
    00079         void resetHost();
    00080
    00084         void setConfig(const MetaData &config);
    00085
    00091         QString protocol() { return m_protocol; }
    00092
    00093         void setProtocol(const QString & protocol);
    00106         QString slaveProtocol() { return m_slaveProtocol; }
    00107
    00111         QString host() { return m_host; }
    00112
    00116         int port() { return m_port; }
    00117
    00121         QString user() { return m_user; }
    00122
    00126         QString passwd() { return m_passwd; }
    00127
    00136         static Slave* createSlave( const QString &protocol, const KURL& url, int& error, QString& error_text );
    00137
    00138         static Slave* holdSlave( const QString &protocol, const KURL& url );
    00139
    00140         void suspend();
    00141         void resume();
    00142         void hold(const KURL &url);
    00143
    00144         bool suspended();
    00145
    00149         time_t idleTime();
    00150
    00154         void setIdle();
    00155
    00156         /*
    00157          * @returns Whether the slave is connencted
    00158          * (Connection oriented slaves only)
    00159          */
    00160         bool isConnected() { return contacted; }
    00161         void setConnected(bool c) { contacted = c; }
    00162
    00163         Connection *connection() { return &slaveconn; }
    00164
    00165         void ref() { m_refCount++; }
    00166         void deref() { m_refCount--; if (!m_refCount) delete this; }
    00167
    00168     public slots:
    00169         void accept(KSocket *socket);
    00170         void gotInput();
    00171         void timeout();
    00172     signals:
    00173         void slaveDied(KIO::Slave *slave);
    00174
    00175     protected:
    00176         void unlinkSocket();
    00177
    00178     private:
    00179         QString m_protocol;
    00180         QString m_slaveProtocol;
    00181         QString m_host;
    00182         int m_port;
    00183         QString m_user;
    00184         QString m_passwd;
    00185         KServerSocket *serv;
    00186         QString m_socket;
    00187         pid_t m_pid;
    00188         bool contacted;
    00189         bool dead;
    00190         time_t contact_started;
    00191         time_t idle_since;
    00192         KIO::Connection slaveconn;
    00193         int m_refCount;
    00194     protected:
    00195         virtual void virtual_hook( int id, void* data );
    00196     private:
    00197         class SlavePrivate* d;
    00198     };
    00199
    00200 }
    00201
    00202 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:38 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001