89625f44ab144b5b678b519f3ee1fa412ad90fc8
[quassel.git] / src / common / protocol.h
1 /***************************************************************************
2  *   Copyright (C) 2005-2013 by the Quassel Project                        *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) version 3.                                           *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
19  ***************************************************************************/
20
21 #ifndef PROTOCOL_H_
22 #define PROTOCOL_H_
23
24 #include <QByteArray>
25 #include <QDateTime>
26 #include <QVariantList>
27
28 namespace Protocol {
29
30 enum Handler {
31     SignalProxy
32 };
33
34
35 /*** handled by SignalProxy ***/
36
37 struct SignalProxyMessage
38 {
39     inline Handler handler() const { return SignalProxy; }
40 };
41
42
43 struct SyncMessage : public SignalProxyMessage
44 {
45     inline SyncMessage(const QByteArray &className, const QString &objectName, const QByteArray &slotName, const QVariantList &params)
46     : className(className), objectName(objectName), slotName(slotName), params(params) {}
47
48     QByteArray className;
49     QString objectName;
50     QByteArray slotName;
51     QVariantList params;
52 };
53
54
55 struct RpcCall : public SignalProxyMessage
56 {
57     inline RpcCall(const QByteArray &slotName, const QVariantList &params)
58     : slotName(slotName), params(params) {}
59
60     QByteArray slotName;
61     QVariantList params;
62 };
63
64
65 struct InitRequest : public SignalProxyMessage
66 {
67     inline InitRequest(const QByteArray &className, const QString &objectName)
68     : className(className), objectName(objectName) {}
69
70     QByteArray className;
71     QString objectName;
72 };
73
74
75 struct InitData : public SignalProxyMessage
76 {
77     inline InitData(const QByteArray &className, const QString &objectName, const QVariantMap &initData)
78     : className(className), objectName(objectName), initData(initData) {}
79
80     QByteArray className;
81     QString objectName;
82     QVariantMap initData;
83 };
84
85
86 /*** handled by RemoteConnection ***/
87
88 struct HeartBeat
89 {
90     inline HeartBeat(const QDateTime &timestamp) : timestamp(timestamp) {}
91
92     QDateTime timestamp;
93 };
94
95
96 struct HeartBeatReply
97 {
98     inline HeartBeatReply(const QDateTime &timestamp) : timestamp(timestamp) {}
99
100     QDateTime timestamp;
101 };
102
103
104 };
105
106 #endif