-rw-r--r-- | x11/ipc/common/ocoppacket.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/x11/ipc/common/ocoppacket.h b/x11/ipc/common/ocoppacket.h new file mode 100644 index 0000000..490ff03 --- a/dev/null +++ b/x11/ipc/common/ocoppacket.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* GPL!*/ | ||
2 | |||
3 | #ifndef OPIE_OCOP_PACKET_H | ||
4 | #define OPIE_OCOP_PACKET_H | ||
5 | |||
6 | #include <qcstring.h> | ||
7 | #include <qstring.h> | ||
8 | |||
9 | /** | ||
10 | * This is the head which will be sent | ||
11 | * in advance to every packet | ||
12 | */ | ||
13 | struct OCOPHead { | ||
14 | int magic; | ||
15 | int type; | ||
16 | int chlen; | ||
17 | int funclen; | ||
18 | int datalen; | ||
19 | }; | ||
20 | |||
21 | /** | ||
22 | * This is the basic packet we will | ||
23 | * use for the communication between server | ||
24 | * and client | ||
25 | */ | ||
26 | class OCOPPacket { | ||
27 | public: | ||
28 | enum Type { | ||
29 | Register = 0, Unregister, Call, | ||
30 | Method, Reply, RegisterChannel, | ||
31 | UnregisterChannel, Return, Signal, | ||
32 | IsRegistered | ||
33 | }; | ||
34 | /** | ||
35 | * the c'tor | ||
36 | * type the Type of this packet | ||
37 | * the Channel | ||
38 | * the header of the function | ||
39 | * the data inside a QByteArray | ||
40 | */ | ||
41 | OCOPPacket( int type, const QCString& channel = QCString(), | ||
42 | const QCString& header = QCString(), | ||
43 | const QByteArray& array = QByteArray() ); | ||
44 | |||
45 | QByteArray toByteArray()const; | ||
46 | int type()const; | ||
47 | QCString channel()const; | ||
48 | QCString header()const; | ||
49 | QByteArray content()const; | ||
50 | OCOPHead head()const; | ||
51 | |||
52 | void setType( int type ); | ||
53 | void setChannel( const QCString& ); | ||
54 | void setHeader(const QCString& ); | ||
55 | void setContent( const QByteArray& ); | ||
56 | |||
57 | private: | ||
58 | int m_type; | ||
59 | QCString m_channel; | ||
60 | QCString m_header; | ||
61 | QByteArray m_content; | ||
62 | }; | ||
63 | |||
64 | #endif | ||