SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
ServerConnection.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #ifndef SERVERCONNECTION_H
9 #define SERVERCONNECTION_H
10 
11 #include <QObject>
12 #include <unordered_map>
13 
14 class QNetworkAccessManager;
15 class QNetworkReply;
16 class QIODevice;
17 struct ProjectApp;
18 struct ProjectList;
19 class AppVersionManifest;
20 
22 {
23  QNetworkReply * reply;
24  QString requested_url;
25  QIODevice *target;
27 };
28 class ServerConnection : public QObject
29 {
30  Q_OBJECT
31  QString m_base_url;
32  std::map< QNetworkReply *,OperationData> m_operations_in_flight;
33  QNetworkAccessManager *m_network_manager;
34 public:
35  explicit ServerConnection(const QString &baseUrl,QObject *parent = 0);
36 
37 signals:
38  void downloadProgress(const QString &req_url,qint64 bytesReceived, qint64 bytesTotal);
39  void networkFailure(const QString &msg);
40 
41  void retrievedManifest(QString req_url,QString manifestData);
42  void appDataAvailable(ProjectApp *app_data);
43  void projectListAvailable(ProjectList *projects);
44  void manifestAvailable(AppVersionManifest *projects);
45 private slots:
46  void httpDownloadFinished(QNetworkReply *);
47  void onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
48 
49  // void onAppDataRequested(QString req_url)
50 public slots:
51  void onRequestProjectList(); // should be called periodically to refresh the server list ( 1/minute ? )
52  void onRequestAppData(); // called at app startup to download slav.app_data
53  void onRequestManifest(const QString &manifestname);
54  void onRequestFileList(const QString &base_path,const QStringList &files);
55 };
56 
57 #endif // SERVERCONNECTION_H
int targetType
Definition: ServerConnection.h:26
Definition: ProjectManifest.h:28
LICENSE i e both the conditions of the OpenSSL License and the original SSLeay license apply to the toolkit See below for the actual license texts OpenSSL License Original SSLeay License The MIT free of to any person obtaining a copy of this software and associated documentation files(the "Software")
Definition: ProjectDescriptor.h:60
Definition: ServerConnection.h:21
Definition: ProjectDescriptor.h:43
QIODevice * target
Definition: ServerConnection.h:25
QString requested_url
Definition: ServerConnection.h:24
Definition: ServerConnection.h:28
QNetworkReply * reply
Definition: ServerConnection.h:23