ArnLib  4.0.x
Active Registry Network
ArnServerRemote.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2022 Michael Wiklund.
2 // All rights reserved.
3 // Contact: arnlib@wiklunden.se
4 //
5 // This file is part of the ArnLib - Active Registry Network.
6 // Parts of ArnLib depend on Qt and/or other libraries that have their own
7 // licenses. Usage of these other libraries is subject to their respective
8 // license agreements.
9 //
10 // GNU Lesser General Public License Usage
11 // This file may be used under the terms of the GNU Lesser General Public
12 // License version 2.1 as published by the Free Software Foundation and
13 // appearing in the file LICENSE_LGPL.txt included in the packaging of this
14 // file. In addition, as a special exception, you may use the rights described
15 // in the Nokia Qt LGPL Exception version 1.1, included in the file
16 // LGPL_EXCEPTION.txt in this package.
17 //
18 // GNU General Public License Usage
19 // Alternatively, this file may be used under the terms of the GNU General Public
20 // License version 3.0 as published by the Free Software Foundation and appearing
21 // in the file LICENSE_GPL.txt included in the packaging of this file.
22 //
23 // Other Usage
24 // Alternatively, this file may be used in accordance with the terms and conditions
25 // contained in a signed written agreement between you and Michael Wiklund.
26 //
27 // This program is distributed in the hope that it will be useful, but WITHOUT ANY
28 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
29 // PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
30 //
31 
32 #ifndef ARNSERVERREMOTE_HPP
33 #define ARNSERVERREMOTE_HPP
34 
35 #include "ArnLib_global.hpp"
36 #include "ArnItem.hpp"
37 #include "MQFlags.hpp"
38 #include <QDateTime>
39 #include <QObject>
40 
41 class ArnServer;
42 class ArnServerSession;
43 class ArnServerRemote;
44 class ArnServerRemotePrivate;
45 class QHostInfo;
46 class QTimer;
47 
49  Q_GADGET
50  Q_ENUMS(E)
51 public:
52  enum E {
53  Off,
56  };
58 };
59 
60 
61 class ArnServerRemoteSession : public QObject
62 {
63  Q_OBJECT
64 public:
66 
67  ArnServerRemoteSession( ArnServerSession* arnServerSession, ArnServerRemote* arnServerRemote);
68 
69 signals:
70 
71 private slots:
72  void onInfoReceived( int type);
73  void onLoginCompleted();
74  void onIpLookup( const QHostInfo& host);
75  void doKillChanged();
76  void doPoll();
77  void doChatAdd( const QString& txt);
78  void onMessageReceived( int type, const QByteArray& data);
79  void shutdown();
80 
81 private:
82  void updateSessionValue();
83  ArnServerRemote* _arnServerRemote;
84  ArnServerSession* _arnServerSession;
85  QString _sessionPath;
86  QString _sessionValue;
87  QTimer* _timerPoll;
88  ArnItem _arnKill;
89  uint _killCountdown;
90  uint _pollCount;
91  ArnItem _arnChatPv;
92  ArnItem _arnChatAllPv;
93  ArnBasicItem _arnTraffic;
94  ArnBasicItem _arnTrafficIn;
95  ArnBasicItem _arnTrafficOut;
96  QString _clientHostName;
97  QString _clientAgent;
98  QString _clientUserName;
99  QDateTime _startTime;
100  ArnBasicItem _arnUpTime;
101 };
102 
103 
105 
122 class ARNLIBSHARED_EXPORT ArnServerRemote : public QObject
123 {
124  Q_OBJECT
125  Q_DECLARE_PRIVATE(ArnServerRemote)
126 
127 public:
128  explicit ArnServerRemote( QObject* parent = arnNullptr);
129  ~ArnServerRemote();
130 
132 
136  void startUseServer( ArnServer* arnServer);
137 
139 protected:
140  ArnServerRemote( ArnServerRemotePrivate& dd, QObject* parent);
141  ArnServerRemotePrivate* const d_ptr;
143 
144 private slots:
145  void onNewSession();
146  void onDelSession( QObject* sessionObj);
147  void doPoll();
148 
149 private:
150  void init();
151 };
152 
153 #endif // ARNSERVERREMOTE_HPP
Class for making an Arn Server.
Definition: ArnServer.hpp:98
ArnServerRemoteSession(ArnServerSession *arnServerSession, ArnServerRemote *arnServerRemote)
ArnServerRemoteSessionKillMode KillMode
Class for remote controlling an Arn Server.
#define MQ_DECLARE_ENUMTXT(EStruct)
Enums text.
Definition: MQFlags.hpp:102
#define ARNLIBSHARED_EXPORT
Handle for an Arn Data Object.
Definition: ArnItem.hpp:72
Base class handle for an Arn Data Object.