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.28.2.1 2003/05/17 11:19:22 mueller Exp $"
00024
00025 #include <sys/types.h>
00026
00027 #include <stdio.h>
00028 #include <qptrlist.h>
00029
00030 class KSocket;
00031 class QSocketNotifier;
00032
00033 namespace KIO {
00034
00035 struct Task {
00036 int cmd;
00037 QByteArray data;
00038 };
00039
00046 class Connection : public QObject
00047 {
00048 Q_OBJECT
00049 public:
00050 Connection();
00051 virtual ~Connection();
00052
00053 void init(KSocket *sock);
00054 void init(int fd_in, int fd_out);
00055 void connect(QObject *receiver = 0, const char *member = 0);
00056 void close();
00057
00058 int fd_from() const { return fd_in; }
00059 int fd_to() const { return fileno( f_out ); }
00060
00061 bool inited() const { return (fd_in != -1) && (f_out != 0); }
00062
00063
00064 void send(int cmd, const QByteArray &arr = QByteArray());
00065
00066
00067 bool sendnow( int _cmd, const QByteArray &data );
00068
00075 int read( int* _cmd, QByteArray & );
00076
00080 void suspend();
00081
00085 void resume();
00086
00090 bool suspended() const { return m_suspended; }
00091
00092 protected slots:
00093 void dequeue();
00094
00095 protected:
00096
00097
00098 private:
00099 int fd_in;
00100 FILE *f_out;
00101 KSocket *socket;
00102 QSocketNotifier *notifier;
00103 QObject *receiver;
00104 const char *member;
00105 QPtrList<Task> tasks;
00106 bool m_suspended;
00107 private:
00108 class ConnectionPrivate* d;
00109 };
00110
00111 }
00112
00113 #endif
This file is part of the documentation for kdelibs Version 3.1.4.