2 * Copyright (C) 2005-2013 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef _PATCHHANDLER_H_
24 #define _PATCHHANDLER_H_
26 #include <ace/Basic_Types.h>
27 #include <ace/Synch_Traits.h>
28 #include <ace/Svc_Handler.h>
29 #include <ace/SOCK_Stream.h>
30 #include <ace/Message_Block.h>
31 #include <ace/Auto_Ptr.h>
34 #include <openssl/bn.h>
35 #include <openssl/md5.h>
38 * @brief Caches MD5 hash of client patches present on the server
46 static PatchCache
* instance();
50 ACE_UINT8 md5
[MD5_DIGEST_LENGTH
];
53 typedef std::map
<std::string
, PATCH_INFO
*> Patches
;
55 Patches::const_iterator
begin() const
57 return patches_
.begin();
60 Patches::const_iterator
end() const
62 return patches_
.end();
65 void LoadPatchMD5(const char*);
66 bool GetHash(const char* pat
, ACE_UINT8 mymd5
[MD5_DIGEST_LENGTH
]);
69 void LoadPatchesInfo();
74 class PatchHandler
: public ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_NULL_SYNCH
>
77 typedef ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_NULL_SYNCH
> Base
;
80 PatchHandler(ACE_HANDLE socket
, ACE_HANDLE patch
);
81 virtual ~PatchHandler();
83 int open(void* = 0) override
;
86 virtual int svc(void) override
;
93 #endif /* _BK_PATCHHANDLER_H__ */