From bba0335bbea81519beafb7fec1979a0abbd8a7ea Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 01 Oct 2002 14:27:17 +0000 Subject: 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 --- (limited to 'x11/ipc/server/ocopserver.h') 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 + +#include +#include +#include +#include +#include + +#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 clients(const QCString& channel ); + /* + * All clients + * They include a fd and a QSocketNotifier + */ + QMap m_clients; + + /* + * The channels avilable + */ + QMap > 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 -- cgit v0.9.0.2