Stellarium 0.15.2
SyncServerHandlers.hpp
1 /*
2  * Stellarium Remote Sync plugin
3  * Copyright (C) 2015 Florian Schaukowitsch
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
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 Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef SYNCSERVERHANDLERS_HPP_
21 #define SYNCSERVERHANDLERS_HPP_
22 
23 #include "SyncMessages.hpp"
24 
25 class SyncServer;
26 
27 class ServerHandler : public QObject, public SyncMessageHandler
28 {
29  Q_OBJECT
30  Q_INTERFACES(SyncMessageHandler)
31 
32 public:
33  ServerHandler(SyncServer *server);
34 protected:
35  SyncServer* server;
36 };
37 
39 {
40 public:
41  bool handleMessage(QDataStream &stream, SyncRemotePeer &peerData) Q_DECL_OVERRIDE;
42 };
43 
46 {
47  Q_OBJECT
48 public:
49  ServerAuthHandler(SyncServer* server, bool allowDivergingAppVersions);
50  bool handleMessage(QDataStream &stream, SyncRemotePeer &peer) Q_DECL_OVERRIDE;
51 private:
52  bool allowDivergingAppVersions;
53 };
54 
56 {
57 public:
58  bool handleMessage(QDataStream &stream, SyncRemotePeer &peer) Q_DECL_OVERRIDE;
59 };
60 
61 #endif
Base interface for message handlers, i.e. reacting to messages.
Server-side auth handler.
Handling the connection to a remote peer (i.e. all clients on the server, and the server on the clien...
virtual bool handleMessage(QDataStream &stream, SyncRemotePeer &peer)=0
Read a message directly from the stream.
Implements a server to which SyncClients can connect and receive state changes.
Definition: SyncServer.hpp:33