Debian Codegraph @

src/bnetd/versioncheck.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2000 Onlyer ([email protected])
3 * Copyright (C) 2001 Ross Combs ([email protected])
4 * Copyright (C) 2002 Gianluigi Tiesi ([email protected])
5 * Copyright (C) 2004 CreepLord ([email protected])
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21 #ifndef PVPGN_BNETD_VERSIONCHECK_H
22 #define PVPGN_BNETD_VERSIONCHECK_H
23
24 #include <cstdint>
25 #include <ctime>
26 #include <string>
27 #include <tuple>
28
29 #include "common/tag.h"
30
31
32 namespace pvpgn
33 {
34
35 namespace bnetd
36 {
37 class VersionCheck;
38
39
40 // filename, equation
41 std::tuple<std::string, std::string> select_checkrevision(t_tag architecture, t_tag client, std::uint32_t version_id);
42
43 const VersionCheck* select_versioncheck(t_tag architecture, t_tag client, std::uint32_t version_id,
44 std::uint32_t checkrevision_version, std::uint32_t checkrevision_checksum);
45
46
47 /*******************************************************************************/
48 // Conf
49 /*******************************************************************************/
50 bool load_versioncheck_conf(const std::string& filename);
51 void unload_versioncheck_conf();
52
53
54 class VersionCheck
55 {
56 public:
57 /*******************************************************************************/
58 // Getters
59 /*******************************************************************************/
60 std::string get_version_tag() const;
61
62 /*******************************************************************************/
63 // Deconstructors
64 /*******************************************************************************/
65 ~VersionCheck() = default;
66 private:
67 /*******************************************************************************/
68 // Friend functions
69 /*******************************************************************************/
70 friend bool load_versioncheck_conf(const std::string& filename);
71 friend const VersionCheck* select_versioncheck(t_tag architecture, t_tag client, std::uint32_t version_id,
72 std::uint32_t checkrevision_version, std::uint32_t checkrevision_checksum);
73
74
75 /*******************************************************************************/
76 // Constructors
77 /*******************************************************************************/
78 VersionCheck(const std::string& title, std::uint32_t version_id, const std::string& game_version,
79 const std::string& checksum, t_tag architecture, t_tag client, const std::string& version_tag);
80
81 /*******************************************************************************/
82 // Member variables
83 /*******************************************************************************/
84 std::uint32_t m_version_id; // AKA "Version Byte"
85 std::uint32_t m_game_version; // Windows file version
86 std::uint32_t m_checksum;
87 t_tag m_architecture;
88 t_tag m_client;
89 std::string m_version_tag;
90 };
91
92 } // namespace bnetd
93
94 } // namespace pvpgn
95
96 #endif //PVPGN_BNETD_VERSIONCHECK_H