author | zecke <zecke> | 2002-10-01 14:27:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-01 14:27:17 (UTC) |
commit | bba0335bbea81519beafb7fec1979a0abbd8a7ea (patch) (unidiff) | |
tree | ee334cf518c59582a36a3dd24238a05dfc3535a2 /x11/ipc/server/ocopserver.h | |
parent | ef8d0a15d706b0e230f052efcb1eab6f905a8737 (diff) | |
download | opie-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
-rw-r--r-- | x11/ipc/server/ocopserver.h | 95 |
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 @@ | |||
1 | |||
2 | #ifndef OPIE_OCOP_SERVER_H | ||
3 | #define OPIE_OCOP_SERVER_H | ||
4 | |||
5 | #include <sys/un.h> | ||
6 | |||
7 | #include <qvaluelist.h> | ||
8 | #include <qobject.h> | ||
9 | #include <qmap.h> | ||
10 | #include <qstring.h> | ||
11 | #include <qsocketnotifier.h> | ||
12 | |||
13 | #include "../common/ocoppacket.h" | ||
14 | #include "ocopclient.h" | ||
15 | /** | ||
16 | * This is the main server | ||
17 | * It starts the socket | ||
18 | * takes care of the receiving and sending | ||
19 | */ | ||
20 | class OCopServer : public QObject { | ||
21 | Q_OBJECT | ||
22 | public: | ||
23 | OCopServer(); | ||
24 | ~OCopServer(); | ||
25 | |||
26 | QStringList channels(); | ||
27 | bool isChannelRegistered(const QCString& )const; | ||
28 | |||
29 | private slots: | ||
30 | void errorOnServer();// error on Server | ||
31 | void newOnServer();// accept to be taken | ||
32 | void newOnClient(int fd ); // new package received | ||
33 | |||
34 | private: | ||
35 | /* replace fd with a special class in future | ||
36 | * to even work on Windoze aye aye | ||
37 | */ | ||
38 | /** | ||
39 | * add a channel with a fd | ||
40 | * if the channel is not present | ||
41 | * then it'll be created | ||
42 | * if it's present we will ad the fd | ||
43 | */ | ||
44 | void addChannel( const QCString& channel, | ||
45 | int fd ); | ||
46 | void delChannel( const QCString& channel, | ||
47 | int fd ); | ||
48 | |||
49 | /** | ||
50 | * fd was closed | ||
51 | */ | ||
52 | void deregisterClient( int fd ); | ||
53 | |||
54 | /** | ||
55 | * fd popped up | ||
56 | */ | ||
57 | void registerClient( int fd ); | ||
58 | |||
59 | private: | ||
60 | void init(); | ||
61 | private slots: | ||
62 | void initSocket(); | ||
63 | private: | ||
64 | int accept(); | ||
65 | void isRegistered( const QCString& channel, int ); | ||
66 | void dispatch( const OCOPPacket&, int sourceFD ); | ||
67 | void call( const OCOPPacket&, int sourceFD ); | ||
68 | QValueList<int> clients(const QCString& channel ); | ||
69 | /* | ||
70 | * All clients | ||
71 | * They include a fd and a QSocketNotifier | ||
72 | */ | ||
73 | QMap<int, OCOPClient> m_clients; | ||
74 | |||
75 | /* | ||
76 | * The channels avilable | ||
77 | */ | ||
78 | QMap<QCString, QValueList<int> > m_channels; | ||
79 | |||
80 | /* | ||
81 | * a notifier for our server | ||
82 | * if new stuff is arriving | ||
83 | */ | ||
84 | QSocketNotifier* m_server; | ||
85 | |||
86 | /* | ||
87 | * error | ||
88 | */ | ||
89 | QSocketNotifier* m_serverError; | ||
90 | int m_serverfd; | ||
91 | struct sockaddr_un m_address; | ||
92 | unsigned int m_adrlaenge; | ||
93 | }; | ||
94 | |||
95 | #endif | ||