/* * Copyright (C) 2005-2010 MaNGOS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file \ingroup realmd */ #ifndef _PATCHHANDLER_H_ #define _PATCHHANDLER_H_ #include #include #include #include #include #include #include #include #include /** * @brief Caches MD5 hash of client patches present on the server */ class PatchCache { public: ~PatchCache(); PatchCache(); static PatchCache* instance(); struct PATCH_INFO { ACE_UINT8 md5[MD5_DIGEST_LENGTH]; }; typedef std::map Patches; Patches::const_iterator begin() const { return patches_.begin(); } Patches::const_iterator end() const { return patches_.end(); } void LoadPatchMD5(const char*); bool GetHash(const char * pat, ACE_UINT8 mymd5[MD5_DIGEST_LENGTH]); private: void LoadPatchesInfo(); Patches patches_; }; class PatchHandler: public ACE_Svc_Handler { protected: typedef ACE_Svc_Handler Base; public: PatchHandler(ACE_HANDLE socket, ACE_HANDLE patch); virtual ~PatchHandler(); int open(void* = 0); protected: virtual int svc(void); private: ACE_HANDLE patch_fd_; }; #endif /* _BK_PATCHHANDLER_H__ */