TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AddonMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef _ADDONMGR_H
20 #define _ADDONMGR_H
21 
22 #include "Define.h"
23 #include <string>
24 #include <list>
25 #include <openssl/md5.h>
26 
27 struct AddonInfo
28 {
29  AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
30  : Name(name), Enabled(enabled), CRC(crc), Status(state), UsePublicKeyOrCRC(crcOrPubKey)
31  { }
32 
33  std::string Name;
38 };
39 
40 struct SavedAddon
41 {
42  SavedAddon(std::string const& name, uint32 crc) : Name(name)
43  {
44  CRC = crc;
45  }
46 
47  std::string Name;
49 };
50 
52 {
54  uint8 NameMD5[MD5_DIGEST_LENGTH];
55  uint8 VersionMD5[MD5_DIGEST_LENGTH];
57 };
58 
59 #define STANDARD_ADDON_CRC 0x4C1C776D
60 
61 namespace AddonMgr
62 {
63  void LoadFromDB();
64  void SaveAddon(AddonInfo const& addon);
65  SavedAddon const* GetAddonInfo(const std::string& name);
66 
67  typedef std::list<BannedAddon> BannedAddonList;
68  BannedAddonList const* GetBannedAddons();
69 }
70 
71 #endif
bool UsePublicKeyOrCRC
Definition: AddonMgr.h:37
uint8 VersionMD5[MD5_DIGEST_LENGTH]
Definition: AddonMgr.h:55
Definition: AddonMgr.h:40
uint32 Timestamp
Definition: AddonMgr.h:56
Definition: AddonMgr.h:27
std::string Name
Definition: AddonMgr.h:33
std::list< BannedAddon > BannedAddonList
Definition: AddonMgr.h:67
void LoadFromDB()
Definition: AddonMgr.cpp:40
uint32 CRC
Definition: AddonMgr.h:35
uint32 CRC
Definition: AddonMgr.h:48
BannedAddonList const * GetBannedAddons()
Definition: AddonMgr.cpp:124
AddonInfo(const std::string &name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
Definition: AddonMgr.h:29
uint32_t uint32
Definition: Define.h:150
Definition: AddonMgr.cpp:25
SavedAddon const * GetAddonInfo(const std::string &name)
Definition: AddonMgr.cpp:112
uint8 NameMD5[MD5_DIGEST_LENGTH]
Definition: AddonMgr.h:54
uint8_t uint8
Definition: Define.h:152
uint8 Status
Definition: AddonMgr.h:36
std::string Name
Definition: AddonMgr.h:47
uint32 Id
Definition: AddonMgr.h:53
SavedAddon(std::string const &name, uint32 crc)
Definition: AddonMgr.h:42
uint8 Enabled
Definition: AddonMgr.h:34
void SaveAddon(AddonInfo const &addon)
Definition: AddonMgr.cpp:98
Definition: AddonMgr.h:51