connection.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __connection_h__
00023 #define __connection_h__ "$Id: connection.h,v 1.32 2003/08/16 16:38:56 coolo Exp $"
00024
00025 #include <sys/types.h>
00026
00027 #include <stdio.h>
00028 #include <qptrlist.h>
00029 #include <qobject.h>
00030
00031 class KSocket;
00032 class QSocketNotifier;
00033
00034 namespace KIO {
00035
00036 struct Task {
00037 int cmd;
00038 QByteArray data;
00039 };
00040
00047 class Connection : public QObject
00048 {
00049 Q_OBJECT
00050 public:
00055 Connection();
00056 virtual ~Connection();
00057
00063 void init(KSocket *sock);
00071 void init(int fd_in, int fd_out);
00072 void connect(QObject *receiver = 0, const char *member = 0);
00074 void close();
00075
00080 int fd_from() const { return fd_in; }
00085 int fd_to() const { return fileno( f_out ); }
00086
00092 bool inited() const { return (fd_in != -1) && (f_out != 0); }
00093
00099 void send(int cmd, const QByteArray &arr = QByteArray());
00100
00107 bool sendnow( int _cmd, const QByteArray &data );
00108
00117 int read( int* _cmd, QByteArray &data );
00118
00122 void suspend();
00123
00127 void resume();
00128
00133 bool suspended() const { return m_suspended; }
00134
00135 protected slots:
00136 void dequeue();
00137
00138 protected:
00139
00140
00141 private:
00142 int fd_in;
00143 FILE *f_out;
00144 KSocket *socket;
00145 QSocketNotifier *notifier;
00146 QObject *receiver;
00147 const char *member;
00148 QPtrList<Task> tasks;
00149 bool m_suspended;
00150 private:
00151 class ConnectionPrivate* d;
00152 };
00153
00154 }
00155
00156 #endif
This file is part of the documentation for kio Library Version 3.3.0.