1 /***************************************************************************
2 * Copyright (C) 2005-2019 by the Quassel Project *
3 * devel@quassel-irc.org *
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. *
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. *
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 ***************************************************************************/
28 #include "coreidentity.h"
30 class MetricsServer : public QObject
35 explicit MetricsServer(QObject* parent = nullptr);
37 bool startListening();
38 void stopListening(const QString& msg);
40 void addLoginAttempt(UserId user, bool successful);
41 void addLoginAttempt(const QString& user, bool successful);
43 void addSession(UserId user, const QString& name);
44 void removeSession(UserId user);
46 void addClient(UserId user);
47 void removeClient(UserId user);
49 void addNetwork(UserId user);
50 void removeNetwork(UserId user);
52 void transmitDataNetwork(UserId user, uint64_t size);
53 void receiveDataNetwork(UserId user, uint64_t size);
55 void loginSuccessful();
58 void messageQueue(UserId user, uint64_t size);
60 void setCertificateExpires(QDateTime expires);
63 void incomingConnection();
67 QTcpServer _server, _v6server;
69 QHash<UserId, uint64_t> _loginAttempts{};
70 QHash<UserId, uint64_t> _successfulLogins{};
72 QHash<UserId, QString> _sessions{};
74 QHash<UserId, int64_t> _clientSessions{};
75 QHash<UserId, int64_t> _networkSessions{};
77 QHash<UserId, uint64_t> _networkDataTransmit{};
78 QHash<UserId, uint64_t> _networkDataReceive{};
80 QHash<UserId, uint64_t> _messageQueue{};
82 uint64_t _loginSuccessful{};
83 uint64_t _loginFailed{};
85 QDateTime _certificateExpires{};