summaryrefslogtreecommitdiff
path: root/x11/ipc/server/ocopserver.h
authorzecke <zecke>2002-10-01 14:27:17 (UTC)
committer zecke <zecke>2002-10-01 14:27:17 (UTC)
commitbba0335bbea81519beafb7fec1979a0abbd8a7ea (patch) (side-by-side diff)
treeee334cf518c59582a36a3dd24238a05dfc3535a2 /x11/ipc/server/ocopserver.h
parentef8d0a15d706b0e230f052efcb1eab6f905a8737 (diff)
downloadopie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.zip
opie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.tar.gz
opie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.tar.bz2
5th try
initial checkin of X11 Opie stuff it features an IPC Server the client is todo this will become the OPIE X11 department including alternative QPEApplication, QCOP replacement
Diffstat (limited to 'x11/ipc/server/ocopserver.h') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/ipc/server/ocopserver.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/x11/ipc/server/ocopserver.h b/x11/ipc/server/ocopserver.h
new file mode 100644
index 0000000..3e08d5b
--- a/dev/null
+++ b/x11/ipc/server/ocopserver.h
@@ -0,0 +1,95 @@
+
+#ifndef OPIE_OCOP_SERVER_H
+#define OPIE_OCOP_SERVER_H
+
+#include <sys/un.h>
+
+#include <qvaluelist.h>
+#include <qobject.h>
+#include <qmap.h>
+#include <qstring.h>
+#include <qsocketnotifier.h>
+
+#include "../common/ocoppacket.h"
+#include "ocopclient.h"
+/**
+ * This is the main server
+ * It starts the socket
+ * takes care of the receiving and sending
+ */
+class OCopServer : public QObject {
+ Q_OBJECT
+public:
+ OCopServer();
+ ~OCopServer();
+
+ QStringList channels();
+ bool isChannelRegistered(const QCString& )const;
+
+private slots:
+ void errorOnServer();// error on Server
+ void newOnServer();// accept to be taken
+ void newOnClient(int fd ); // new package received
+
+private:
+ /* replace fd with a special class in future
+ * to even work on Windoze aye aye
+ */
+ /**
+ * add a channel with a fd
+ * if the channel is not present
+ * then it'll be created
+ * if it's present we will ad the fd
+ */
+ void addChannel( const QCString& channel,
+ int fd );
+ void delChannel( const QCString& channel,
+ int fd );
+
+ /**
+ * fd was closed
+ */
+ void deregisterClient( int fd );
+
+ /**
+ * fd popped up
+ */
+ void registerClient( int fd );
+
+private:
+ void init();
+private slots:
+ void initSocket();
+private:
+ int accept();
+ void isRegistered( const QCString& channel, int );
+ void dispatch( const OCOPPacket&, int sourceFD );
+ void call( const OCOPPacket&, int sourceFD );
+ QValueList<int> clients(const QCString& channel );
+ /*
+ * All clients
+ * They include a fd and a QSocketNotifier
+ */
+ QMap<int, OCOPClient> m_clients;
+
+ /*
+ * The channels avilable
+ */
+ QMap<QCString, QValueList<int> > m_channels;
+
+ /*
+ * a notifier for our server
+ * if new stuff is arriving
+ */
+ QSocketNotifier* m_server;
+
+ /*
+ * error
+ */
+ QSocketNotifier* m_serverError;
+ int m_serverfd;
+ struct sockaddr_un m_address;
+ unsigned int m_adrlaenge;
+};
+
+#endif