connection.h
// -*- c++ -*-
/* This file is part of the KDE libraries
Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __connection_h__
#define __connection_h__
#include <kdelibs_export.h>
#include <sys/types.h>
#include <stdio.h>
#include <qptrlist.h>
#include <qobject.h>
class KSocket;
class QSocketNotifier;
namespace KIO {
struct KIO_EXPORT Task {
int cmd;
QByteArray data;
};
class KIO_EXPORT Connection : public QObject
{
Q_OBJECT
public:
Connection();
virtual ~Connection();
void init(KSocket *sock);
void init(int fd_in, int fd_out); // Used by KDENOX
void connect(QObject *receiver = 0, const char *member = 0);
void close();
int fd_from() const { return fd_in; }
int fd_to() const { return fileno( f_out ); }
bool inited() const { return (fd_in != -1) && (f_out != 0); }
void send(int cmd, const QByteArray &arr = QByteArray());
bool sendnow( int _cmd, const QByteArray &data );
int read( int* _cmd, QByteArray &data );
void suspend();
void resume();
bool suspended() const { return m_suspended; }
protected slots:
void dequeue();
protected:
private:
int fd_in;
FILE *f_out;
KSocket *socket;
QSocketNotifier *notifier;
QObject *receiver;
const char *member;
QPtrList<Task> tasks;
bool m_suspended;
private:
class ConnectionPrivate* d;
};
}
#endif
KIO::Connection::fd_from
int fd_from() const
Returns the input file descriptor.
Definition: connection.h:82
KIO::Connection
This class provides a simple means for IPC between two applications via a pipe.
Definition: connection.h:49
KIO::Connection::fd_to
int fd_to() const
Returns the output file descriptor.
Definition: connection.h:87
KIO::Connection::suspended
bool suspended() const
Returns status of connection.
Definition: connection.h:135
KIO::Connection::inited
bool inited() const
Checks whether the connection has been initialized.
Definition: connection.h:94

KDE Home | KDE Accessibility Home | Description of Access Keys