initial release.
still a lot of stuff to fix before everything works as it should. compilation works, linking produces errors. most code cleanups done.
This commit is contained in:
commit
58872f1f39
48
PseuWoW.sln
Normal file
48
PseuWoW.sln
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PseuWoW", "src\PseuWoW.vcproj", "{EFFE60F4-DA39-41E8-9E53-E462000A2D91}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
|
||||||
|
{F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270}
|
||||||
|
{262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\zlib.vcproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zthread", "src\zthread.vcproj", "{262199E8-EEDF-4700-A1D1-E9CC901CF480}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "src\shared.vcproj", "{F548FC51-24A4-45FF-A381-BEBC39F18270}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
|
Debug = Debug
|
||||||
|
Release = Release
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfiguration) = postSolution
|
||||||
|
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.Build.0 = Debug|Win32
|
||||||
|
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.ActiveCfg = Release|Win32
|
||||||
|
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.Build.0 = Release|Win32
|
||||||
|
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug.Build.0 = Debug|Win32
|
||||||
|
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release.ActiveCfg = Release|Win32
|
||||||
|
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release.Build.0 = Release|Win32
|
||||||
|
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug.Build.0 = Debug|Win32
|
||||||
|
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release.ActiveCfg = Release|Win32
|
||||||
|
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release.Build.0 = Release|Win32
|
||||||
|
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug.Build.0 = Debug|Win32
|
||||||
|
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release.ActiveCfg = Release|Win32
|
||||||
|
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
BIN
PseuWoW.suo
Normal file
BIN
PseuWoW.suo
Normal file
Binary file not shown.
237
changelog.txt
Normal file
237
changelog.txt
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
/////////////////////////////////////////////////////////////
|
||||||
|
// PseuWoW changelog // date|time: 20:31 11.12.2006 /////////
|
||||||
|
/////////////////////////////////////////////////////////////
|
||||||
|
//Format:
|
||||||
|
// + added
|
||||||
|
// - note
|
||||||
|
// % removed
|
||||||
|
// ! important
|
||||||
|
// O ToDo: open, not yet done
|
||||||
|
// x Todo: done
|
||||||
|
/////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ToDo (Overall):
|
||||||
|
================
|
||||||
|
|
||||||
|
- simulation of no installed addons
|
||||||
|
- more config possibilities in conf/pseuwow.conf
|
||||||
|
- redo controller related code and recode controller
|
||||||
|
- character creation - to be able to create chars with names bl!zz does not allow
|
||||||
|
- remove hardcoded language names, use lang names via config
|
||||||
|
-> string table? not sure.
|
||||||
|
- ppoints system? as a workaround for maps? not sure.
|
||||||
|
- much much more i cant think of yet :P
|
||||||
|
|
||||||
|
#Far future:
|
||||||
|
- kind of an AI that it can decide for itself what to do
|
||||||
|
- add ability to use blizz/mangos maps so that it can really walk around, not only teleport
|
||||||
|
- to be continued...
|
||||||
|
- looting, 2D/3D GUI, killing,... you can extend the list as you wish
|
||||||
|
|
||||||
|
ToDo (version after: Alpha 13) / Planned Features:
|
||||||
|
==================================================
|
||||||
|
|
||||||
|
O add a ZCompressor Class (a ByteBuffer using zlib deflate/inflate)
|
||||||
|
O [maybe] first touch with the UpdateFields (CMSG[_COMPRESSED]_UPDATE_OBJECT)
|
||||||
|
O [maybe] add Object/Unit/Player/Creature/... classes.
|
||||||
|
X cleanups to VarSet class (use vectors to store the vars)
|
||||||
|
O cleanups to DefScript class: use vectors to store the script text data
|
||||||
|
O DefScript: instead of only ${var} also be able to use $var like in TCL or PHP
|
||||||
|
O Implement threaded movement system. tracking of player's waypoints, better following code
|
||||||
|
(that does NOT tend to crash mangos!)
|
||||||
|
O improve chat AI? add other AI? not sure.
|
||||||
|
O logfile output
|
||||||
|
[...]
|
||||||
|
|
||||||
|
|
||||||
|
ToDo (next version: Alpha 12) / Planned features:
|
||||||
|
=================================================
|
||||||
|
|
||||||
|
X lots of general code cleanups (remove old C functions from PseuWoW Alpha 7 and before;
|
||||||
|
add objects: PseuInstance, RealmSession, WorldSession, ...; drop the old procedurel code)
|
||||||
|
X opcode handler table, no more case x case y case z
|
||||||
|
O move code portions of the chat handler to an external ChatAI.cpp file and improve
|
||||||
|
the chat AI
|
||||||
|
O -> implement a WordList class to parse sentences
|
||||||
|
O a direct local console (like mangos has). drop plans about a remote controller for now.
|
||||||
|
O lots of bugfixes to the DefScript system
|
||||||
|
X implement zthread, zlib and remove the SDL thread functions.
|
||||||
|
X change the network system from SDL_net to the system by Anders Hedstrom (the one mangos uses). no more packet errors (i hope)!
|
||||||
|
O DefScript: implement a "PermissionMap" to set by the user (for internal funcions)
|
||||||
|
O config options: EnableIngameCommands, EnableLocalConsole, OverrideLoginGuid (dangerous!),
|
||||||
|
AutoReconnect,
|
||||||
|
|
||||||
|
O DefScript fuctions: "GetGuid,var playername", "GetName,var GUID"
|
||||||
|
X add WorldPacket class
|
||||||
|
X -> add uint64 WorldPacket::GetPackedGUID()
|
||||||
|
X fix the packed GUID code if needed (not sure if its really bugged)
|
||||||
|
|
||||||
|
O When everything is done: upload to openSVN!
|
||||||
|
|
||||||
|
|
||||||
|
20:43 09.11.2006 Alpha Build 11
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
+ inluded modified WAD's TrayWoWemu.exe to work with PseuWoW -> TrayPseuWoW.exe =)
|
||||||
|
|
||||||
|
Core:
|
||||||
|
! connecting to servers running versions above 1.10.2 is now possible!
|
||||||
|
+ implemented player name cache, first touch with std::vector<> :)
|
||||||
|
-> players get added to the cache as soon as they move or say something
|
||||||
|
-> chat messages now show player names, whispers can be sent now.
|
||||||
|
-> related command: [-]savecache.
|
||||||
|
+ commands can now given directly ingame saying/whispering "-command" to PseuWoW
|
||||||
|
+ added DefScript functions _onwhisper (gets triggered when a player whispers to PseuWoW),
|
||||||
|
emote #id. the emote function still needs to be fixed and linked with targeting once
|
||||||
|
implemented.
|
||||||
|
+ included reply.def, that uses the above macros and whisper.def. use: reply to last whisp
|
||||||
|
in its original language
|
||||||
|
% removed some old obsoelete cpp files
|
||||||
|
% removed the old config reader, replaced with dynamic reader using the classes
|
||||||
|
VarSet, std::string, DefScript.
|
||||||
|
+ added CMSG_PING and SMSG_PONG (ping every 30 sec, like original WoW)
|
||||||
|
+ better detection if PseuWoW entered the world successfully
|
||||||
|
+ added macros: @thiswhisper,@lastwhisper,@thiscmd,@lastcmd,@thismsg,@lastmsg and related.
|
||||||
|
+ following a player: simply repeat movement opcodes recieved from that player.
|
||||||
|
looks very shitty and is very buggy xD
|
||||||
|
-> command/usage: [-]follow PlayerName to start, just [-]follow to stop.
|
||||||
|
+ you can access all values set in PseuWoW.conf as CAPITALIZED variables, e.g.:
|
||||||
|
"${REALMLIST}" or ingame "-sayv REALMLIST".
|
||||||
|
+ once the conf is loaded the script "_setconf" is executed, this removes dangerous vars
|
||||||
|
like ACCNAME and ACCPASS
|
||||||
|
+ auto-decline of group-invite and trade attempts
|
||||||
|
!+ added support for packed GUIDs
|
||||||
|
+ added def files: outv, sayv, _nopermission, _setconf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DefScript engine:
|
||||||
|
- renewed variable handler (renaming *local* var to scriptname::var, #var to var,
|
||||||
|
@var stays @var)
|
||||||
|
- fixed lots of bugs in the ReplaceVars() function.
|
||||||
|
- fixed a little bug in the script loader (wrongly loaded lines beginning with '#')
|
||||||
|
+ added a permission system for scripts called by players. use users.conf to set.
|
||||||
|
(like that its not possible for non-GMs to execute "-say .shutdown" or similar)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
17:23 06.10.2006 Alpha Build 10
|
||||||
|
===================================
|
||||||
|
+ FULLY working script engine with C++ interface, only very few functions implemented yet.
|
||||||
|
Dynamic loading: Scripts get only loaded if they are needed.
|
||||||
|
+ preparations to stop using C malloc/realloc/free and replace it with NEW,
|
||||||
|
also std::string instead of char*
|
||||||
|
+ PseuWoW can recieve whisper/say/party/guild/server messages, but not yet link them
|
||||||
|
to a name.
|
||||||
|
+ improved packet error/order handling, there are still some packets that get lost,
|
||||||
|
i need to find out where they go. SDL thread issue?
|
||||||
|
% removed yelling PseuWoW version on startup. Use the ./scripts/_worldenter.def script
|
||||||
|
file to modify behaviour when entering the world.
|
||||||
|
- PseuWoW can now detect if it has sent a chatmessage itself or if it came from someone else
|
||||||
|
- added a little fun code and a VERY "basic" chat AI for fun :P
|
||||||
|
- it will say a note if it is sure it has entered the world correctly. it might have been
|
||||||
|
successful anyway even without it, but at least you can be sure when it will probably work.
|
||||||
|
requires "SAY ${@version}" in scripts/_enterworld.def
|
||||||
|
|
||||||
|
|
||||||
|
18:15 10.09.2006 Alpha Build 9
|
||||||
|
===============================
|
||||||
|
+ Added CircularBuffer class for world packet reciever
|
||||||
|
+ Added SDLTCPConnection class for easier connectivity and code readability
|
||||||
|
- first preparations for builtin script engine, still excluded from build,
|
||||||
|
needs cleanups and fixes.
|
||||||
|
-> coded the variable handler
|
||||||
|
-> coded the script loader
|
||||||
|
-> coded the script line tokenizer
|
||||||
|
+ Added connection to world server
|
||||||
|
+ World Authentication done
|
||||||
|
% removed old rs_... / ws_... functions, replaced with SDLTCPConnection realmCon/worldCon
|
||||||
|
% disabled the controller interface for now. it will be included again as soon as the
|
||||||
|
script interpreter works and everything has been cleaned up.
|
||||||
|
+ Integrated AuthCrypt class from mangos
|
||||||
|
+ CHAR_ENUM integrated, char list is now requested and parsed
|
||||||
|
+ read charname from conf file and login with that char
|
||||||
|
YES, logging into the world finally WORKS! :DD
|
||||||
|
+ some checks for invalid or strange packets, which are tried to be interpreted correctly.
|
||||||
|
packet ordering and fetch queue is still buggy.
|
||||||
|
- PseuWoW yells its version once it has joined the world, and yells if an error occured.
|
||||||
|
- only server messages get interpreted correctly so far, player chat recieve does NOT work
|
||||||
|
|
||||||
|
03:12 29.07.2006 Alpha Build 8
|
||||||
|
===============================
|
||||||
|
- completely rewrote the authentication code, Imported Sha1Hash and BigNumber
|
||||||
|
classes from MaNGOS (shrunk code size to 1/4 of what it was before).
|
||||||
|
The code even seems bug-free (hope it stays so)
|
||||||
|
- Authentication WORKS! (after 2 months of failure)
|
||||||
|
+ added realmlist parser
|
||||||
|
+ set realm to login via conf file
|
||||||
|
- Tested on WoWemu (1.8.0) & MaNGOS (1.10.2), authenticating works well
|
||||||
|
+ added a neat icon :) by ©haos
|
||||||
|
|
||||||
|
|
||||||
|
14:45 12.07.2006 Alpha Build 7
|
||||||
|
===============================
|
||||||
|
- complete code reorganisation (no more code including only with .h files.
|
||||||
|
now we have several cpp files with each its own .h)
|
||||||
|
- emulation of any version
|
||||||
|
- updated comment parser, finally :)
|
||||||
|
- you can now set version, build and language via conf file
|
||||||
|
- merged the 2 controller tcpsocks into 1, controller can still only connect to localhost.
|
||||||
|
still no conf file reading implemented into the controller. rest will be implemented later.
|
||||||
|
- removed SS & server b, they were useless
|
||||||
|
- fixed crash where an attemt was made to delete a const string.
|
||||||
|
(seems this caused the GarbageStack:: realloc() size=112 failure)
|
||||||
|
- many other general improvemens and bugfixes
|
||||||
|
|
||||||
|
02:31 10.06.2006 Alpha Build 6 - Memory handling is hard.
|
||||||
|
===============================
|
||||||
|
- fixed crash when realmlist hostname could not be resolved
|
||||||
|
! forgot to malloc x_str & u_str in proof packet sender -> crash (maybe i got it fixed this time)
|
||||||
|
- made more funcions work with the garbage collector
|
||||||
|
- in debug build GarbageStack:: realloc() size=112 fails. dunno why.
|
||||||
|
- added a server S & server b for testing. they are not important and will get removed later.
|
||||||
|
- still no correct reversion.
|
||||||
|
|
||||||
|
18:12 05.06.2006 Alpha Build 5 - The I hate C++ version
|
||||||
|
===============================
|
||||||
|
- crash,crash,crash. there must be a bug in the BN_reverse routine.
|
||||||
|
+ Added a garbage collector
|
||||||
|
- updated the fileparser, because it got bugged with the garbage collector.
|
||||||
|
More configs are supported now. comments still must be at the beginning of the line
|
||||||
|
to be treated as comments.
|
||||||
|
- still working on correct reversal :C
|
||||||
|
|
||||||
|
22:55 31.05.2006 Alpha Build 4 - The DAMN FUCKING SHIT i don't get it version
|
||||||
|
===============================
|
||||||
|
- damn i just don't find it out. decided to do a random reversal on every failure.
|
||||||
|
- the program got very unstable. seems i do a mistake i am not aware of. help anyone?
|
||||||
|
-> added a debug output to find out where the bugged lines are. strage they change
|
||||||
|
everytime i run the program. fuck.
|
||||||
|
|
||||||
|
18:16 31.05.2006 Alpha Build 3 - The YAAAY it works version
|
||||||
|
==============================
|
||||||
|
- finished the packet, server still answers "password wrong".
|
||||||
|
working on correct reversion now
|
||||||
|
|
||||||
|
16:52 30.05.2006 Alpha Build 2
|
||||||
|
===============================
|
||||||
|
- added more bignum calculations, now i got until S.
|
||||||
|
- still not sure how they have to be reversed to be calculated corrctly in the B1!77 way.
|
||||||
|
SRP demo page (srp.stanford.edu/demo) says my S is correct so far, calculated in the
|
||||||
|
normal way. At least i got the right formulas. :D
|
||||||
|
- next thing to do is split S up, hash it, etc... to get M1 & M2
|
||||||
|
|
||||||
|
21:51 24.05.2006 Alpha Build 1
|
||||||
|
===============================
|
||||||
|
- first release, not working yet.
|
||||||
|
- connecting to realm server possible, detection for acc already in use / acc not existing
|
||||||
|
- OpenSSL BIGNUM and SHA1 integrated.
|
||||||
|
- first bignum calculations :), i still have to find out how the numbers are
|
||||||
|
reversed and calculated correctly
|
||||||
|
- controller connection possible. it uses 2 ports, i will change it to 1 port in future
|
||||||
|
- config file readout (conf/pseuwow.conf)
|
||||||
|
- still crashes when it cant find the realmlist. time to fix it...
|
||||||
|
- controller connection is still buggy when a connection to the realm server has been
|
||||||
|
established.
|
||||||
24
license.txt
Normal file
24
license.txt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Find the full license at:
|
||||||
|
http://www.gnu.org/licenses/gpl.html
|
||||||
|
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
|
||||||
|
Copyright (C) 2006 False.Genesis @ SnowStom Software
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
Every part of program code belongs to its respective owner.
|
||||||
308
readme.txt
Normal file
308
readme.txt
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
####################################################################################
|
||||||
|
################################# - PseuWoW ReadMe - ########## 09.11.2006 #########
|
||||||
|
####################################################################################
|
||||||
|
## ##
|
||||||
|
## Web: http://my.opera.com/PseuWoW ##
|
||||||
|
## Email/MSN: hoden386@lycos.de ##
|
||||||
|
## ##
|
||||||
|
## 1.) What is PseuWoW? ##
|
||||||
|
## 2.) Installation & configuration ##
|
||||||
|
## 3.) The DefScript engine [to be updated] ##
|
||||||
|
## 4.) The controller [*availible soon*] ##
|
||||||
|
## 5.) Interaction with PseuWoW ##
|
||||||
|
## 6.) Compiling your own version ##
|
||||||
|
## 7.) A word to Blizzard ##
|
||||||
|
## ... ##
|
||||||
|
## 8.) Appendix: [*availible soon*] ##
|
||||||
|
## A) The DefScript interface ##
|
||||||
|
## B) Macro reference ##
|
||||||
|
## C) Function reference ##
|
||||||
|
## ##
|
||||||
|
## ##
|
||||||
|
####################################################################################
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
########## 1.) What is PseuWoW? ####################
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
A custom wow client, or at least it is supposed to be a "real" client later on.
|
||||||
|
For now it is thougt to be a bot that can help GMs/admins to manage their *private(!)* WoW server.
|
||||||
|
It does not need an installation of real WoW to run, and you do not need any
|
||||||
|
good hardware to run it, since it has no graphics (yet!) and not such extensive
|
||||||
|
memory usage like the bloated WoW.exe has.
|
||||||
|
it uses only the console for now, but since it runs on SDL, you *could* easily build up
|
||||||
|
your own gui using OpenGL. buts it's not designed for that purpose in this early state.
|
||||||
|
|
||||||
|
DO NOT use this program to connect to official servers!
|
||||||
|
It does NOT work due to Blizzard's IP-Spoof filter, which PseuWoW cant bypass yet.
|
||||||
|
( YES this IS intended to be that way! For your own safety and for the legality of PseuWoW!)
|
||||||
|
If you should try anyway, the only thing you can win is the ban/loss of your account.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Performance:
|
||||||
|
============
|
||||||
|
Tested Build 8 on a 300MHz Intel Celeron notebook, took a bit longer to Auth then on a
|
||||||
|
3GHz Pentium 4 PC, but worked well so far; more benchmarks on slower hardware will follow =)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
########## 2.) Installation & Configuration ########
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
Required DLL files:
|
||||||
|
===================
|
||||||
|
|
||||||
|
- SDL.dll
|
||||||
|
- SDL_net.dll
|
||||||
|
- msvcp71(d).dll
|
||||||
|
- msvcr71(d).dll
|
||||||
|
|
||||||
|
Be sure you have them put into the same folder as PseuWoW.exe (or your windows/system32 folder).
|
||||||
|
|
||||||
|
How to make it run properly (main configuration):
|
||||||
|
=================================================
|
||||||
|
|
||||||
|
Open the file "conf/PseuWoW.conf" in a text editor and edit it to your needs.
|
||||||
|
There should be comments inside the file explaining what the options are good for.
|
||||||
|
|
||||||
|
User permission configuration:
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Open the file "conf/users.conf".
|
||||||
|
For every player you want to assign a permission level to enter the name of the player (note correct spelling!!),
|
||||||
|
followed by a "=" and the permission level ( a number from 0 - 255; 0=least; 255=all permissions ).
|
||||||
|
The lines should look like this:
|
||||||
|
|
||||||
|
Master=255
|
||||||
|
Operator=100
|
||||||
|
Playerx=1
|
||||||
|
...
|
||||||
|
|
||||||
|
If a player is not listed in this file he will get permission 0 automatically.
|
||||||
|
|
||||||
|
Note that special unicode chars in playernames like óäöüßêýà etc. DO NOT work.
|
||||||
|
|
||||||
|
|
||||||
|
Saving the cache:
|
||||||
|
=================
|
||||||
|
If you close PseuWoW using the [X] in the top-right corner it will be instantly closed
|
||||||
|
and NO data will be saved. To save the data you can either quit PseuWoW pressing Ctrl+C,
|
||||||
|
giving the "-quit" command ingame or just save without quitting giving the ingame command
|
||||||
|
"-savecache". (explained further down this file)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
########## 3.) The DefScript engine ################
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
Information:
|
||||||
|
============
|
||||||
|
|
||||||
|
PseuWoW uses a scripting language exclusively designed for it - i admit i didn't know
|
||||||
|
how to implement Python or LUA :P
|
||||||
|
DefScript has no controlling structures like IF, FOR, WHILE, etc. yet, this will come in future.
|
||||||
|
|
||||||
|
The Scripts have the extension ".def" and are stored in the "/scripts/" folder of PseuWoW.
|
||||||
|
Every file represents a single function.
|
||||||
|
|
||||||
|
Syntax:
|
||||||
|
=======
|
||||||
|
A typical function call looks like this:
|
||||||
|
|
||||||
|
command,arg1,arg2,arg3,argx defaultarg
|
||||||
|
|
||||||
|
command: name of the script or function you want to execute (UPPER- or lowercase does not matter)
|
||||||
|
arg1 - argx: OPTIONAL(!) arguments, seperated by commas.
|
||||||
|
defaultarg: the last ( or better called "typical" ) argument of the function,
|
||||||
|
seperated by [space].
|
||||||
|
Everything after the first space char will be treated as defaultarg!
|
||||||
|
To prevent this, you can use curly brackets {} to express that the given text is connected.
|
||||||
|
e.g.:
|
||||||
|
"SENDCHATMESSAGE,6,{hi there},Keks" -> correct, works. Whispers "hi there" to player "Keks".
|
||||||
|
|
||||||
|
"SENDCHATMESSAGE,6,hi there,Keks"
|
||||||
|
-> works too, BUT:
|
||||||
|
"SENDCHATMESSAGE,6,hi" -> this will be the command with its args
|
||||||
|
"there,Keks" -> this will be the defaultarg
|
||||||
|
result: the call will not produce the expected result!
|
||||||
|
|
||||||
|
|
||||||
|
Variables:
|
||||||
|
==========
|
||||||
|
|
||||||
|
Setting variables:
|
||||||
|
"x = 1" -> WRONG! DefScript knows only functions!!
|
||||||
|
You have tu use this:
|
||||||
|
"SET,x 1" -> sets the LOCAL variable x to 1. [x will be stored as "scriptname::x" internally]
|
||||||
|
"SET,#x 1" -> sets the GLOBAL variable x to 1. [#x will be stored as "x" internally]
|
||||||
|
"SET,#welcomemsg PseuWoW logged on, be careful!" -> sets the GLOBAL variable "welcomemsg" to PseuWoW logged on, be careful!".
|
||||||
|
Note that the variable name is the first arg, preceded with a comma, and its value is the defaultarg.
|
||||||
|
Variable names with a preceding "#" will be stored as GLOBAL vars, with the preceding "#" removed.
|
||||||
|
|
||||||
|
"DEFAULT,x 1" -> sets x only if it has not been set or x has no value (=is empty)
|
||||||
|
"UNSET x" -> removes the variable. you have to remove every variable you do no longer need yourself!
|
||||||
|
|
||||||
|
|
||||||
|
A special kind of variables are macros, which values can only be changed by the program itself.
|
||||||
|
Macros begin with "@".
|
||||||
|
|
||||||
|
Accessing variables:
|
||||||
|
====================
|
||||||
|
|
||||||
|
SET,x 1
|
||||||
|
SET,mystr hello world
|
||||||
|
OUT ${mystr}, x has the value ${x}
|
||||||
|
PAUSE 1000
|
||||||
|
SET,mystr ${mystr} goodbye
|
||||||
|
OUT ${mystr}
|
||||||
|
|
||||||
|
pretty obvious:
|
||||||
|
${mystr} gets replaced with "hello world"
|
||||||
|
${x} gets replaced with 1.
|
||||||
|
and the text "hello world, x has the value 1" will be written to the console.
|
||||||
|
after one second, mystr will be set to "hello world goodbye" and again written to console.
|
||||||
|
|
||||||
|
accessing globals: OUT ${#myglobal}
|
||||||
|
accessing macros: OUT ${mymacro}
|
||||||
|
|
||||||
|
[[* more explanations of the variable system will follow *]]
|
||||||
|
|
||||||
|
Load Instructions:
|
||||||
|
==================
|
||||||
|
load instructions begin with "#" and are put at the beginning of every script.
|
||||||
|
You can not use variables in them!
|
||||||
|
The following are availible:
|
||||||
|
#permission=x -> sets the permission required to execute this script. 0 by default! x=0...255
|
||||||
|
#debug -> produce more output
|
||||||
|
#load_debug -> lists every line that is loaded
|
||||||
|
#load_notify -> notifies you once the script has been loaded and is ready for use
|
||||||
|
...more to come...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
########## 5.) Interaction with PseuWoW ############
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
|
||||||
|
You can either say or whisper the command to PseuWoW; put a "-" before the command name
|
||||||
|
that PseuWoW recognizes the chat message as a command, like:
|
||||||
|
"-say hello"
|
||||||
|
"-say,orcish hello"
|
||||||
|
"-say,8 hello"
|
||||||
|
"-emote 12"
|
||||||
|
"-yell LOL"
|
||||||
|
"-yell,darnassian LOL"
|
||||||
|
"-savecache"
|
||||||
|
"-follow Keks"
|
||||||
|
"-quit"
|
||||||
|
etc.
|
||||||
|
|
||||||
|
There is also some VERY basic chat AI, say hi,lol,omg,wtf,download,... when PseuWoW will hear you and it will respond :)
|
||||||
|
A full (and useful) chat AI will be implemented later.
|
||||||
|
|
||||||
|
All trade and party invite rquests are automatically declined.
|
||||||
|
Note the "_onwhisper" script that is run everytime a whisper is recieved.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
########## 6.) Compiling your own version ##########
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
- i used Microsoft Visual Studio.NET 2003 for compiling
|
||||||
|
- download the include/lib package (see URL on top). copy the content into the
|
||||||
|
include/lib directory of the compiler.
|
||||||
|
- if needed, copy the reqired DLL files into the /bin directory (where the project files are)
|
||||||
|
- open the project and compile.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
########## 7.) A word to Blizzard ##################
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
I always liked blizz... until WoW came out.
|
||||||
|
The management is shitty, almost no customer support, and bans in case they dont know what
|
||||||
|
to do with players.
|
||||||
|
Blizzard programmers and designers, YOU ARE GREAT and you made great games before
|
||||||
|
Blizzard got eaten up by vivendi universal. KEEP UP THE GOOD WORK!
|
||||||
|
After that, vivendi management fucked it all up. the result is WoW, a always-pay game like
|
||||||
|
Diablo3 will probably be.
|
||||||
|
So here are my greetings to the vivendi management:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Eat shit and die, bitches!
|
||||||
|
|
||||||
|
_gm__gz,
|
||||||
|
,Z\/` 'c\.
|
||||||
|
/,! '[W
|
||||||
|
]!] . []
|
||||||
|
] ] .-==- b]
|
||||||
|
]i ~ -==== !]-
|
||||||
|
] ~~ -![
|
||||||
|
W d`
|
||||||
|
'b W
|
||||||
|
i[ 'M
|
||||||
|
]. ~ 4.
|
||||||
|
] -'[
|
||||||
|
d -= b
|
||||||
|
M! @
|
||||||
|
@ `-D
|
||||||
|
]@ -]A
|
||||||
|
@P , , . '@
|
||||||
|
M| ~` '` /]@
|
||||||
|
_._. Y ciP
|
||||||
|
,g/G/~Vi ![ '-V[
|
||||||
|
,Z~_/`- b@_ ,[ -` [
|
||||||
|
_v4Tv/ .m/TGs,2V~-i ] \/.[
|
||||||
|
,vf ,(f `'iY.A / -[,z --=-__
|
||||||
|
,gY` v)` \-.@! ,--]Wf =/`,~N
|
||||||
|
,gY` id / b@[ -/ ]M (b.
|
||||||
|
vf| - t[ !,i@P! ' ][. /`YZ~V,c.
|
||||||
|
if, ' , ,(] ]'@` ]b `'/@. `'*W.
|
||||||
|
K ,)`-'Z _ _ -/i@ i ' @Y |4t /Vmv.
|
||||||
|
b gz/-Z`'` @ - ] -P] ` , i ,!W ]@ ',/M.-
|
||||||
|
[ gZ\ ]! * i[ ! Z!d, ]- [W ~ \ ] X8.\
|
||||||
|
,[ '7v` A 'i ` - !' ] [@./ , ,] 4/c-
|
||||||
|
] !i- `][ ,] ' e!] i - . m ! 'W =
|
||||||
|
W s-=` ][ !A /- ] W= ][!
|
||||||
|
A -Z- @- -! P ,A, , ] ,@
|
||||||
|
[ '- ,/4. !' Z` [ . W g`/[
|
||||||
|
Y.- ' /[ . ,/ !.'c/b-
|
||||||
|
Vi'- ' ! ! / ' `` @[
|
||||||
|
'e. ] , . v @[
|
||||||
|
Vs. '. .- ` / @`
|
||||||
|
'5c. \ ! , --@.
|
||||||
|
\Zs `-. '- \ - -A
|
||||||
|
'\. - . ' ' - ` .-, = 'i[
|
||||||
|
'e. -' - , -` ,/ !vi\ v i*`
|
||||||
|
Vs -! -- ' v` ,'.-'/ _/`\`
|
||||||
|
'G. ' ! '- / '.c\,` vfm/ -
|
||||||
|
!i ` -. ,` ` , `'c ,z7!.` -
|
||||||
|
Yi ' - ! . ,`` - - !` ,zL'`
|
||||||
|
b i , - - ' - , - - ,Z|!`
|
||||||
|
Y ` \- , , '- ` , . ,Z7
|
||||||
|
8 -- . ` -` .'.- -P
|
||||||
|
] ] -, . - , ,[
|
||||||
|
]. Y- ' / 8
|
||||||
|
i| ,' - ` . - ' W
|
||||||
|
` , - - , , K
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(c) SnowStorm Software, 2006
|
||||||
|
(and the finger belogs to SSG cracking group :P )
|
||||||
|
|
||||||
83
src/Client/Auth/AuthCrypt.cpp
Normal file
83
src/Client/Auth/AuthCrypt.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
#include "common.h"
|
||||||
|
#include "AuthCrypt.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
AuthCrypt::AuthCrypt()
|
||||||
|
{
|
||||||
|
_initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthCrypt::Init()
|
||||||
|
{
|
||||||
|
_send_i = _send_j = _recv_i = _recv_j = 0;
|
||||||
|
_initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthCrypt::DecryptRecv(uint8 *data, size_t len)
|
||||||
|
{
|
||||||
|
if (!_initialized) return;
|
||||||
|
if (len < CRYPTED_RECV_LEN) return;
|
||||||
|
|
||||||
|
_recv_i2=_recv_i;
|
||||||
|
_recv_j2=_recv_j;
|
||||||
|
|
||||||
|
for (size_t t = 0; t < CRYPTED_RECV_LEN; t++)
|
||||||
|
{
|
||||||
|
_recv_i %= _key.size();
|
||||||
|
uint8 x = (data[t] - _recv_j) ^ _key[_recv_i];
|
||||||
|
++_recv_i;
|
||||||
|
_recv_j = data[t];
|
||||||
|
data[t] = x;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthCrypt::EncryptSend(uint8 *data, size_t len)
|
||||||
|
{
|
||||||
|
if (!_initialized) return;
|
||||||
|
if (len < CRYPTED_SEND_LEN) return;
|
||||||
|
|
||||||
|
for (size_t t = 0; t < CRYPTED_SEND_LEN; t++)
|
||||||
|
{
|
||||||
|
_send_i %= _key.size();
|
||||||
|
uint8 x = (data[t] ^ _key[_send_i]) + _send_j;
|
||||||
|
++_send_i;
|
||||||
|
data[t] = _send_j = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthCrypt::SetKey(uint8 *key, size_t len)
|
||||||
|
{
|
||||||
|
_key.resize(len);
|
||||||
|
std::copy(key, key + len, _key.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthCrypt::DecryptRescue(void)
|
||||||
|
{
|
||||||
|
// undos the last decrypt operation
|
||||||
|
_recv_i=_recv_i2;
|
||||||
|
_recv_j=_recv_j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthCrypt::~AuthCrypt()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
51
src/Client/Auth/AuthCrypt.h
Normal file
51
src/Client/Auth/AuthCrypt.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _AUTHCRYPT_H
|
||||||
|
#define _AUTHCRYPT_H
|
||||||
|
|
||||||
|
//#include <Common.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class AuthCrypt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AuthCrypt();
|
||||||
|
~AuthCrypt();
|
||||||
|
|
||||||
|
const static size_t CRYPTED_SEND_LEN = 6;
|
||||||
|
const static size_t CRYPTED_RECV_LEN = 4;
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
void SetKey(uint8 *, size_t);
|
||||||
|
|
||||||
|
void DecryptRecv(uint8 *, size_t);
|
||||||
|
void EncryptSend(uint8 *, size_t);
|
||||||
|
|
||||||
|
bool IsInitialized() { return _initialized; }
|
||||||
|
|
||||||
|
void DecryptRescue(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<uint8> _key;
|
||||||
|
uint8 _send_i, _send_j, _recv_i, _recv_j;
|
||||||
|
uint8 _send_i2, _send_j2, _recv_i2, _recv_j2;
|
||||||
|
bool _initialized;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
201
src/Client/Auth/BigNumber.cpp
Normal file
201
src/Client/Auth/BigNumber.cpp
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "BigNumber.h"
|
||||||
|
#include <openssl/bn.h>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
BigNumber::BigNumber()
|
||||||
|
{
|
||||||
|
_bn = BN_new();
|
||||||
|
_array = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber::BigNumber(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
_bn = BN_dup(bn._bn);
|
||||||
|
_array = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber::BigNumber(uint32 val)
|
||||||
|
{
|
||||||
|
_bn = BN_new();
|
||||||
|
BN_set_word(_bn, val);
|
||||||
|
_array = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber::~BigNumber()
|
||||||
|
{
|
||||||
|
BN_free(_bn);
|
||||||
|
delete[] _array;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BigNumber::SetDword(uint32 val)
|
||||||
|
{
|
||||||
|
BN_set_word(_bn, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BigNumber::SetQword(uint64 val)
|
||||||
|
{
|
||||||
|
BN_add_word(_bn, (uint32)(val >> 32));
|
||||||
|
BN_lshift(_bn, _bn, 32);
|
||||||
|
BN_add_word(_bn, (uint32)(val & 0xFFFFFFFF));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BigNumber::SetBinary(const uint8 *bytes, int len)
|
||||||
|
{
|
||||||
|
uint8 t[1000];
|
||||||
|
for (int i = 0; i < len; i++) t[i] = bytes[len - 1 - i];
|
||||||
|
BN_bin2bn(t, len, _bn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BigNumber::SetHexStr(const char *str)
|
||||||
|
{
|
||||||
|
BN_hex2bn(&_bn, str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BigNumber::SetRand(int numbits)
|
||||||
|
{
|
||||||
|
BN_rand(_bn, numbits, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber BigNumber::operator=(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BN_copy(_bn, bn._bn);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber BigNumber::operator+=(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BN_add(_bn, _bn, bn._bn);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber BigNumber::operator-=(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BN_sub(_bn, _bn, bn._bn);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber BigNumber::operator*=(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BN_CTX *bnctx;
|
||||||
|
|
||||||
|
bnctx = BN_CTX_new();
|
||||||
|
BN_mul(_bn, _bn, bn._bn, bnctx);
|
||||||
|
BN_CTX_free(bnctx);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber BigNumber::operator/=(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BN_CTX *bnctx;
|
||||||
|
|
||||||
|
bnctx = BN_CTX_new();
|
||||||
|
BN_div(_bn, NULL, _bn, bn._bn, bnctx);
|
||||||
|
BN_CTX_free(bnctx);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber BigNumber::operator%=(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BN_CTX *bnctx;
|
||||||
|
|
||||||
|
bnctx = BN_CTX_new();
|
||||||
|
BN_mod(_bn, _bn, bn._bn, bnctx);
|
||||||
|
BN_CTX_free(bnctx);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber BigNumber::Exp(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BigNumber ret;
|
||||||
|
BN_CTX *bnctx;
|
||||||
|
|
||||||
|
bnctx = BN_CTX_new();
|
||||||
|
BN_exp(ret._bn, _bn, bn._bn, bnctx);
|
||||||
|
BN_CTX_free(bnctx);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber BigNumber::ModExp(const BigNumber &bn1, const BigNumber &bn2)
|
||||||
|
{
|
||||||
|
BigNumber ret;
|
||||||
|
BN_CTX *bnctx;
|
||||||
|
|
||||||
|
bnctx = BN_CTX_new();
|
||||||
|
BN_mod_exp(ret._bn, _bn, bn1._bn, bn2._bn, bnctx);
|
||||||
|
BN_CTX_free(bnctx);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BigNumber::GetNumBytes(void)
|
||||||
|
{
|
||||||
|
return BN_num_bytes(_bn);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 BigNumber::AsDword()
|
||||||
|
{
|
||||||
|
return (uint32)BN_get_word(_bn);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8 *BigNumber::AsByteArray()
|
||||||
|
{
|
||||||
|
if (_array)
|
||||||
|
{
|
||||||
|
delete[] _array;
|
||||||
|
_array = NULL;
|
||||||
|
}
|
||||||
|
_array = new uint8[GetNumBytes()];
|
||||||
|
BN_bn2bin(_bn, (unsigned char *)_array);
|
||||||
|
|
||||||
|
std::reverse(_array, _array + GetNumBytes());
|
||||||
|
|
||||||
|
return _array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*ByteBuffer BigNumber::AsByteBuffer()
|
||||||
|
{
|
||||||
|
ByteBuffer ret(GetNumBytes());
|
||||||
|
ret.append(AsByteArray(), GetNumBytes());
|
||||||
|
return ret;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*std::vector<uint8> BigNumber::AsByteVector()
|
||||||
|
{
|
||||||
|
std::vector<uint8> ret;
|
||||||
|
ret.resize(GetNumBytes());
|
||||||
|
memcpy(&ret[0], AsByteArray(), GetNumBytes());
|
||||||
|
return ret;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
const char *BigNumber::AsHexStr()
|
||||||
|
{
|
||||||
|
return BN_bn2hex(_bn);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *BigNumber::AsDecStr()
|
||||||
|
{
|
||||||
|
return BN_bn2dec(_bn);
|
||||||
|
}
|
||||||
93
src/Client/Auth/BigNumber.h
Normal file
93
src/Client/Auth/BigNumber.h
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _AUTH_BIGNUMBER_H
|
||||||
|
#define _AUTH_BIGNUMBER_H
|
||||||
|
|
||||||
|
#include "../../shared/common.h"
|
||||||
|
|
||||||
|
struct bignum_st;
|
||||||
|
|
||||||
|
class BigNumber
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BigNumber();
|
||||||
|
BigNumber(const BigNumber &bn);
|
||||||
|
BigNumber(uint32);
|
||||||
|
~BigNumber();
|
||||||
|
|
||||||
|
void SetDword(uint32);
|
||||||
|
void SetQword(uint64);
|
||||||
|
void SetBinary(const uint8 *bytes, int len);
|
||||||
|
void SetHexStr(const char *str);
|
||||||
|
|
||||||
|
void SetRand(int numbits);
|
||||||
|
|
||||||
|
BigNumber operator=(const BigNumber &bn);
|
||||||
|
|
||||||
|
BigNumber operator+=(const BigNumber &bn);
|
||||||
|
BigNumber operator+(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BigNumber t(*this);
|
||||||
|
return t += bn;
|
||||||
|
}
|
||||||
|
BigNumber operator-=(const BigNumber &bn);
|
||||||
|
BigNumber operator-(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BigNumber t(*this);
|
||||||
|
return t -= bn;
|
||||||
|
}
|
||||||
|
BigNumber operator*=(const BigNumber &bn);
|
||||||
|
BigNumber operator*(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BigNumber t(*this);
|
||||||
|
return t *= bn;
|
||||||
|
}
|
||||||
|
BigNumber operator/=(const BigNumber &bn);
|
||||||
|
BigNumber operator/(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BigNumber t(*this);
|
||||||
|
return t /= bn;
|
||||||
|
}
|
||||||
|
BigNumber operator%=(const BigNumber &bn);
|
||||||
|
BigNumber operator%(const BigNumber &bn)
|
||||||
|
{
|
||||||
|
BigNumber t(*this);
|
||||||
|
return t %= bn;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigNumber ModExp(const BigNumber &bn1, const BigNumber &bn2);
|
||||||
|
BigNumber Exp(const BigNumber &);
|
||||||
|
|
||||||
|
int GetNumBytes(void);
|
||||||
|
|
||||||
|
struct bignum_st *BN() { return _bn; }
|
||||||
|
|
||||||
|
uint32 AsDword();
|
||||||
|
uint8* AsByteArray();
|
||||||
|
// ByteBuffer AsByteBuffer();
|
||||||
|
// std::vector<uint8> AsByteVector();
|
||||||
|
|
||||||
|
const char *AsHexStr();
|
||||||
|
const char *AsDecStr();
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct bignum_st *_bn;
|
||||||
|
uint8 *_array;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
390
src/Client/Auth/ByteBuffer.h
Normal file
390
src/Client/Auth/ByteBuffer.h
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BYTEBUFFER_H
|
||||||
|
#define _BYTEBUFFER_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
class ByteBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
class error
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
const static size_t DEFAULT_SIZE = 0x1000;
|
||||||
|
|
||||||
|
ByteBuffer(): _rpos(0), _wpos(0)
|
||||||
|
{
|
||||||
|
_storage.reserve(DEFAULT_SIZE);
|
||||||
|
}
|
||||||
|
ByteBuffer(size_t res): _rpos(0), _wpos(0)
|
||||||
|
{
|
||||||
|
_storage.reserve(res);
|
||||||
|
}
|
||||||
|
ByteBuffer(const ByteBuffer &buf): _rpos(buf._rpos), _wpos(buf._wpos), _storage(buf._storage) { }
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
_storage.clear();
|
||||||
|
_rpos = _wpos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> void append(T value)
|
||||||
|
{
|
||||||
|
append((uint8 *)&value, sizeof(value));
|
||||||
|
}
|
||||||
|
template <typename T> void put(size_t pos,T value)
|
||||||
|
{
|
||||||
|
put(pos,(uint8 *)&value,sizeof(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteBuffer &operator<<(bool value)
|
||||||
|
{
|
||||||
|
append<char>((char)value);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator<<(uint8 value)
|
||||||
|
{
|
||||||
|
append<uint8>(value);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator<<(uint16 value)
|
||||||
|
{
|
||||||
|
append<uint16>(value);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator<<(uint32 value)
|
||||||
|
{
|
||||||
|
append<uint32>(value);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator<<(uint64 value)
|
||||||
|
{
|
||||||
|
append<uint64>(value);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator<<(float value)
|
||||||
|
{
|
||||||
|
append<float>(value);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator<<(double value)
|
||||||
|
{
|
||||||
|
append<double>(value);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator<<(const std::string &value)
|
||||||
|
{
|
||||||
|
append((uint8 *)value.c_str(), value.length());
|
||||||
|
append((uint8)0);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator<<(const char *str)
|
||||||
|
{
|
||||||
|
append((uint8 *)str, str ? strlen(str) : 0);
|
||||||
|
append((uint8)0);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteBuffer &operator>>(bool &value)
|
||||||
|
{
|
||||||
|
value = read<char>() > 0 ? true : false;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator>>(uint8 &value)
|
||||||
|
{
|
||||||
|
value = read<uint8>();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator>>(uint16 &value)
|
||||||
|
{
|
||||||
|
value = read<uint16>();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator>>(uint32 &value)
|
||||||
|
{
|
||||||
|
value = read<uint32>();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator>>(uint64 &value)
|
||||||
|
{
|
||||||
|
value = read<uint64>();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator>>(float &value)
|
||||||
|
{
|
||||||
|
value = read<float>();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator>>(double &value)
|
||||||
|
{
|
||||||
|
value = read<double>();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
ByteBuffer &operator>>(std::string& value)
|
||||||
|
{
|
||||||
|
value.clear();
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
char c=read<char>();
|
||||||
|
if (c==0)
|
||||||
|
break;
|
||||||
|
value+=c;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8 operator[](size_t pos)
|
||||||
|
{
|
||||||
|
return read<uint8>(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t rpos()
|
||||||
|
{
|
||||||
|
return _rpos;
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t rpos(size_t rpos)
|
||||||
|
{
|
||||||
|
_rpos = rpos;
|
||||||
|
return _rpos;
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t wpos()
|
||||||
|
{
|
||||||
|
return _wpos;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t wpos(size_t wpos)
|
||||||
|
{
|
||||||
|
_wpos = wpos;
|
||||||
|
return _wpos;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> T read()
|
||||||
|
{
|
||||||
|
T r=read<T>(_rpos);
|
||||||
|
_rpos += sizeof(T);
|
||||||
|
return r;
|
||||||
|
};
|
||||||
|
template <typename T> T read(size_t pos) const
|
||||||
|
{
|
||||||
|
return *((T*)&_storage[pos]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void read(uint8 *dest, size_t len)
|
||||||
|
{
|
||||||
|
if (_rpos + len <= size())
|
||||||
|
{
|
||||||
|
memcpy(dest, &_storage[_rpos], len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw error();
|
||||||
|
}
|
||||||
|
_rpos += len;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8 *contents() const { return &_storage[0]; };
|
||||||
|
|
||||||
|
inline size_t size() const { return _storage.size(); };
|
||||||
|
|
||||||
|
void resize(size_t newsize)
|
||||||
|
{
|
||||||
|
_storage.resize(newsize);
|
||||||
|
_rpos = 0;
|
||||||
|
_wpos = size();
|
||||||
|
};
|
||||||
|
void reserve(size_t ressize)
|
||||||
|
{
|
||||||
|
if (ressize > size()) _storage.reserve(ressize);
|
||||||
|
};
|
||||||
|
|
||||||
|
void append(const std::string& str)
|
||||||
|
{
|
||||||
|
append((uint8 *)str.c_str(),str.size() + 1);
|
||||||
|
}
|
||||||
|
void append(const char *src, size_t cnt)
|
||||||
|
{
|
||||||
|
return append((const uint8 *)src, cnt);
|
||||||
|
}
|
||||||
|
void append(const uint8 *src, size_t cnt)
|
||||||
|
{
|
||||||
|
if (!cnt) return;
|
||||||
|
if (_storage.size() < _wpos + cnt)
|
||||||
|
_storage.resize(_wpos + cnt);
|
||||||
|
memcpy(&_storage[_wpos], src, cnt);
|
||||||
|
_wpos += cnt;
|
||||||
|
}
|
||||||
|
void append(const ByteBuffer& buffer)
|
||||||
|
{
|
||||||
|
if(buffer.size()) append(buffer.contents(),buffer.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void put(size_t pos, const uint8 *src, size_t cnt)
|
||||||
|
{
|
||||||
|
memcpy(&_storage[pos], src, cnt);
|
||||||
|
}
|
||||||
|
void print_storage()
|
||||||
|
{
|
||||||
|
printf("STORAGE_SIZE: %u\n", size() );
|
||||||
|
for(uint32 i = 0; i < size(); i++)
|
||||||
|
printf("%u - ", read<uint8>(i) );
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void textlike()
|
||||||
|
{
|
||||||
|
printf("STORAGE_SIZE: %u\n", size() );
|
||||||
|
for(uint32 i = 0; i < size(); i++)
|
||||||
|
printf("%c", read<uint8>(i) );
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void hexlike()
|
||||||
|
{
|
||||||
|
uint32 j = 1, k = 1;
|
||||||
|
printf("STORAGE_SIZE: %u\n", size() );
|
||||||
|
for(uint32 i = 0; i < size(); i++)
|
||||||
|
{
|
||||||
|
if ((i == (j*8)) && ((i != (k*16))))
|
||||||
|
{
|
||||||
|
if (read<uint8>(i) < 0x0F)
|
||||||
|
{
|
||||||
|
printf("| 0%X ", read<uint8>(i) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("| %X ", read<uint8>(i) );
|
||||||
|
}
|
||||||
|
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
else if (i == (k*16))
|
||||||
|
{
|
||||||
|
if (read<uint8>(i) < 0x0F)
|
||||||
|
{
|
||||||
|
printf("\n0%X ", read<uint8>(i) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\n%X ", read<uint8>(i) );
|
||||||
|
}
|
||||||
|
|
||||||
|
k++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (read<uint8>(i) < 0x0F)
|
||||||
|
{
|
||||||
|
printf("0%X ", read<uint8>(i) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%X ", read<uint8>(i) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
size_t _rpos, _wpos;
|
||||||
|
std::vector<uint8> _storage;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T> ByteBuffer &operator<<(ByteBuffer &b, std::vector<T> v)
|
||||||
|
{
|
||||||
|
b << (uint32)v.size();
|
||||||
|
for (typename std::vector<T>::iterator i = v.begin(); i != v.end(); i++)
|
||||||
|
{
|
||||||
|
b << *i;
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> ByteBuffer &operator>>(ByteBuffer &b, std::vector<T> &v)
|
||||||
|
{
|
||||||
|
uint32 vsize;
|
||||||
|
b >> vsize;
|
||||||
|
v.clear();
|
||||||
|
while(vsize--)
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
b >> t;
|
||||||
|
v.push_back(t);
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> ByteBuffer &operator<<(ByteBuffer &b, std::list<T> v)
|
||||||
|
{
|
||||||
|
b << (uint32)v.size();
|
||||||
|
for (typename std::list<T>::iterator i = v.begin(); i != v.end(); i++)
|
||||||
|
{
|
||||||
|
b << *i;
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> ByteBuffer &operator>>(ByteBuffer &b, std::list<T> &v)
|
||||||
|
{
|
||||||
|
uint32 vsize;
|
||||||
|
b >> vsize;
|
||||||
|
v.clear();
|
||||||
|
while(vsize--)
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
b >> t;
|
||||||
|
v.push_back(t);
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename K, typename V> ByteBuffer &operator<<(ByteBuffer &b, std::map<K, V> &m)
|
||||||
|
{
|
||||||
|
b << (uint32)m.size();
|
||||||
|
for (typename std::map<K, V>::iterator i = m.begin(); i != m.end(); i++)
|
||||||
|
{
|
||||||
|
b << i->first << i->second;
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename K, typename V> ByteBuffer &operator>>(ByteBuffer &b, std::map<K, V> &m)
|
||||||
|
{
|
||||||
|
uint32 msize;
|
||||||
|
b >> msize;
|
||||||
|
m.clear();
|
||||||
|
while(msize--)
|
||||||
|
{
|
||||||
|
K k;
|
||||||
|
V v;
|
||||||
|
b >> k >> v;
|
||||||
|
m.insert(make_pair(k, v));
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
65
src/Client/Auth/Sha1.cpp
Normal file
65
src/Client/Auth/Sha1.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Sha1.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
Sha1Hash::Sha1Hash()
|
||||||
|
{
|
||||||
|
SHA1_Init(&mC);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sha1Hash::~Sha1Hash()
|
||||||
|
{
|
||||||
|
SHA1_Init(&mC);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sha1Hash::UpdateData(const uint8 *dta, int len)
|
||||||
|
{
|
||||||
|
SHA1_Update(&mC, dta, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sha1Hash::UpdateData(const std::string &str)
|
||||||
|
{
|
||||||
|
UpdateData((uint8 *)str.c_str(), str.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sha1Hash::UpdateBigNumbers(BigNumber *bn0, ...)
|
||||||
|
{
|
||||||
|
va_list v;
|
||||||
|
BigNumber *bn;
|
||||||
|
|
||||||
|
va_start(v, bn0);
|
||||||
|
bn = bn0;
|
||||||
|
while (bn)
|
||||||
|
{
|
||||||
|
UpdateData(bn->AsByteArray(), bn->GetNumBytes());
|
||||||
|
bn = va_arg(v, BigNumber *);
|
||||||
|
}
|
||||||
|
va_end(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sha1Hash::Initialize()
|
||||||
|
{
|
||||||
|
SHA1_Init(&mC);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sha1Hash::Finalize(void)
|
||||||
|
{
|
||||||
|
SHA1_Final(mDigest, &mC);
|
||||||
|
}
|
||||||
51
src/Client/Auth/Sha1.h
Normal file
51
src/Client/Auth/Sha1.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _AUTH_SHA1_H
|
||||||
|
#define _AUTH_SHA1_H
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include <openssl/sha.h>
|
||||||
|
#include "BigNumber.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class Sha1Hash
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Sha1Hash();
|
||||||
|
~Sha1Hash();
|
||||||
|
|
||||||
|
void UpdateFinalizeBigNumbers(BigNumber *bn0, ...);
|
||||||
|
void UpdateBigNumbers(BigNumber *bn0, ...);
|
||||||
|
|
||||||
|
void UpdateData(const uint8 *dta, int len);
|
||||||
|
void UpdateData(const std::string &str);
|
||||||
|
|
||||||
|
void Initialize();
|
||||||
|
void Finalize();
|
||||||
|
|
||||||
|
uint8 *GetDigest(void) { return mDigest; };
|
||||||
|
int GetLength(void) { return SHA_DIGEST_LENGTH; };
|
||||||
|
|
||||||
|
BigNumber GetBigNumber();
|
||||||
|
|
||||||
|
private:
|
||||||
|
SHA_CTX mC;
|
||||||
|
uint8 mDigest[SHA_DIGEST_LENGTH];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
385
src/Client/Auth/md5.c
Normal file
385
src/Client/Auth/md5.c
Normal file
@ -0,0 +1,385 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
L. Peter Deutsch
|
||||||
|
ghost@aladdin.com
|
||||||
|
|
||||||
|
*/
|
||||||
|
/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */
|
||||||
|
/*
|
||||||
|
Independent implementation of MD5 (RFC 1321).
|
||||||
|
|
||||||
|
This code implements the MD5 Algorithm defined in RFC 1321, whose
|
||||||
|
text is available at
|
||||||
|
http://www.ietf.org/rfc/rfc1321.txt
|
||||||
|
The code is derived from the text of the RFC, including the test suite
|
||||||
|
(section A.5) but excluding the rest of Appendix A. It does not include
|
||||||
|
any code or documentation that is identified in the RFC as being
|
||||||
|
copyrighted.
|
||||||
|
|
||||||
|
The original and principal author of md5.c is L. Peter Deutsch
|
||||||
|
<ghost@aladdin.com>. Other authors are noted in the change history
|
||||||
|
that follows (in reverse chronological order):
|
||||||
|
|
||||||
|
2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
|
||||||
|
either statically or dynamically; added missing #include <string.h>
|
||||||
|
in library.
|
||||||
|
2002-03-11 lpd Corrected argument list for main(), and added int return
|
||||||
|
type, in test program and T value program.
|
||||||
|
2002-02-21 lpd Added missing #include <stdio.h> in test program.
|
||||||
|
2000-07-03 lpd Patched to eliminate warnings about "constant is
|
||||||
|
unsigned in ANSI C, signed in traditional"; made test program
|
||||||
|
self-checking.
|
||||||
|
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
|
||||||
|
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
|
||||||
|
1999-05-03 lpd Original version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "md5.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
|
||||||
|
#ifdef ARCH_IS_BIG_ENDIAN
|
||||||
|
# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
|
||||||
|
#else
|
||||||
|
# define BYTE_ORDER 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define T_MASK ((md5_word_t)~0)
|
||||||
|
#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
|
||||||
|
#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
|
||||||
|
#define T3 0x242070db
|
||||||
|
#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111)
|
||||||
|
#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050)
|
||||||
|
#define T6 0x4787c62a
|
||||||
|
#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec)
|
||||||
|
#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe)
|
||||||
|
#define T9 0x698098d8
|
||||||
|
#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850)
|
||||||
|
#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e)
|
||||||
|
#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841)
|
||||||
|
#define T13 0x6b901122
|
||||||
|
#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c)
|
||||||
|
#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71)
|
||||||
|
#define T16 0x49b40821
|
||||||
|
#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d)
|
||||||
|
#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf)
|
||||||
|
#define T19 0x265e5a51
|
||||||
|
#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855)
|
||||||
|
#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2)
|
||||||
|
#define T22 0x02441453
|
||||||
|
#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e)
|
||||||
|
#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437)
|
||||||
|
#define T25 0x21e1cde6
|
||||||
|
#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829)
|
||||||
|
#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278)
|
||||||
|
#define T28 0x455a14ed
|
||||||
|
#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa)
|
||||||
|
#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07)
|
||||||
|
#define T31 0x676f02d9
|
||||||
|
#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375)
|
||||||
|
#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd)
|
||||||
|
#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e)
|
||||||
|
#define T35 0x6d9d6122
|
||||||
|
#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3)
|
||||||
|
#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb)
|
||||||
|
#define T38 0x4bdecfa9
|
||||||
|
#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f)
|
||||||
|
#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f)
|
||||||
|
#define T41 0x289b7ec6
|
||||||
|
#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805)
|
||||||
|
#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a)
|
||||||
|
#define T44 0x04881d05
|
||||||
|
#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6)
|
||||||
|
#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a)
|
||||||
|
#define T47 0x1fa27cf8
|
||||||
|
#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a)
|
||||||
|
#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb)
|
||||||
|
#define T50 0x432aff97
|
||||||
|
#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58)
|
||||||
|
#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6)
|
||||||
|
#define T53 0x655b59c3
|
||||||
|
#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d)
|
||||||
|
#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82)
|
||||||
|
#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e)
|
||||||
|
#define T57 0x6fa87e4f
|
||||||
|
#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f)
|
||||||
|
#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb)
|
||||||
|
#define T60 0x4e0811a1
|
||||||
|
#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d)
|
||||||
|
#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
|
||||||
|
#define T63 0x2ad7d2bb
|
||||||
|
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
|
||||||
|
|
||||||
|
static void
|
||||||
|
md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
|
||||||
|
{
|
||||||
|
md5_word_t
|
||||||
|
a = pms->abcd[0], b = pms->abcd[1],
|
||||||
|
c = pms->abcd[2], d = pms->abcd[3];
|
||||||
|
md5_word_t t;
|
||||||
|
#if BYTE_ORDER > 0
|
||||||
|
/* Define storage only for big-endian CPUs. */
|
||||||
|
md5_word_t X[16];
|
||||||
|
#else
|
||||||
|
/* Define storage for little-endian or both types of CPUs. */
|
||||||
|
md5_word_t xbuf[16];
|
||||||
|
const md5_word_t *X;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
#if BYTE_ORDER == 0
|
||||||
|
/*
|
||||||
|
* Determine dynamically whether this is a big-endian or
|
||||||
|
* little-endian machine, since we can use a more efficient
|
||||||
|
* algorithm on the latter.
|
||||||
|
*/
|
||||||
|
static const int w = 1;
|
||||||
|
|
||||||
|
if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
|
||||||
|
#endif
|
||||||
|
#if BYTE_ORDER <= 0 /* little-endian */
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* On little-endian machines, we can process properly aligned
|
||||||
|
* data without copying it.
|
||||||
|
*/
|
||||||
|
if (!((data - (const md5_byte_t *)0) & 3))
|
||||||
|
{
|
||||||
|
/* data are properly aligned */
|
||||||
|
X = (const md5_word_t *)data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* not aligned */
|
||||||
|
memcpy(xbuf, data, 64);
|
||||||
|
X = xbuf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if BYTE_ORDER == 0
|
||||||
|
else /* dynamic big-endian */
|
||||||
|
#endif
|
||||||
|
#if BYTE_ORDER >= 0 /* big-endian */
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* On big-endian machines, we must arrange the bytes in the
|
||||||
|
* right order.
|
||||||
|
*/
|
||||||
|
const md5_byte_t *xp = data;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
# if BYTE_ORDER == 0
|
||||||
|
X = xbuf; /* (dynamic only) */
|
||||||
|
# else
|
||||||
|
# define xbuf X /* (static only) */
|
||||||
|
# endif
|
||||||
|
for (i = 0; i < 16; ++i, xp += 4)
|
||||||
|
xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||||
|
|
||||||
|
/* Round 1. */
|
||||||
|
/* Let [abcd k s i] denote the operation
|
||||||
|
a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
|
||||||
|
#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
|
||||||
|
#define SET(a, b, c, d, k, s, Ti)\
|
||||||
|
t = a + F(b,c,d) + X[k] + Ti;\
|
||||||
|
a = ROTATE_LEFT(t, s) + b
|
||||||
|
/* Do the following 16 operations. */
|
||||||
|
SET(a, b, c, d, 0, 7, T1);
|
||||||
|
SET(d, a, b, c, 1, 12, T2);
|
||||||
|
SET(c, d, a, b, 2, 17, T3);
|
||||||
|
SET(b, c, d, a, 3, 22, T4);
|
||||||
|
SET(a, b, c, d, 4, 7, T5);
|
||||||
|
SET(d, a, b, c, 5, 12, T6);
|
||||||
|
SET(c, d, a, b, 6, 17, T7);
|
||||||
|
SET(b, c, d, a, 7, 22, T8);
|
||||||
|
SET(a, b, c, d, 8, 7, T9);
|
||||||
|
SET(d, a, b, c, 9, 12, T10);
|
||||||
|
SET(c, d, a, b, 10, 17, T11);
|
||||||
|
SET(b, c, d, a, 11, 22, T12);
|
||||||
|
SET(a, b, c, d, 12, 7, T13);
|
||||||
|
SET(d, a, b, c, 13, 12, T14);
|
||||||
|
SET(c, d, a, b, 14, 17, T15);
|
||||||
|
SET(b, c, d, a, 15, 22, T16);
|
||||||
|
#undef SET
|
||||||
|
|
||||||
|
/* Round 2. */
|
||||||
|
/* Let [abcd k s i] denote the operation
|
||||||
|
a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
|
||||||
|
#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
|
||||||
|
#define SET(a, b, c, d, k, s, Ti)\
|
||||||
|
t = a + G(b,c,d) + X[k] + Ti;\
|
||||||
|
a = ROTATE_LEFT(t, s) + b
|
||||||
|
/* Do the following 16 operations. */
|
||||||
|
SET(a, b, c, d, 1, 5, T17);
|
||||||
|
SET(d, a, b, c, 6, 9, T18);
|
||||||
|
SET(c, d, a, b, 11, 14, T19);
|
||||||
|
SET(b, c, d, a, 0, 20, T20);
|
||||||
|
SET(a, b, c, d, 5, 5, T21);
|
||||||
|
SET(d, a, b, c, 10, 9, T22);
|
||||||
|
SET(c, d, a, b, 15, 14, T23);
|
||||||
|
SET(b, c, d, a, 4, 20, T24);
|
||||||
|
SET(a, b, c, d, 9, 5, T25);
|
||||||
|
SET(d, a, b, c, 14, 9, T26);
|
||||||
|
SET(c, d, a, b, 3, 14, T27);
|
||||||
|
SET(b, c, d, a, 8, 20, T28);
|
||||||
|
SET(a, b, c, d, 13, 5, T29);
|
||||||
|
SET(d, a, b, c, 2, 9, T30);
|
||||||
|
SET(c, d, a, b, 7, 14, T31);
|
||||||
|
SET(b, c, d, a, 12, 20, T32);
|
||||||
|
#undef SET
|
||||||
|
|
||||||
|
/* Round 3. */
|
||||||
|
/* Let [abcd k s t] denote the operation
|
||||||
|
a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
|
||||||
|
#define H(x, y, z) ((x) ^ (y) ^ (z))
|
||||||
|
#define SET(a, b, c, d, k, s, Ti)\
|
||||||
|
t = a + H(b,c,d) + X[k] + Ti;\
|
||||||
|
a = ROTATE_LEFT(t, s) + b
|
||||||
|
/* Do the following 16 operations. */
|
||||||
|
SET(a, b, c, d, 5, 4, T33);
|
||||||
|
SET(d, a, b, c, 8, 11, T34);
|
||||||
|
SET(c, d, a, b, 11, 16, T35);
|
||||||
|
SET(b, c, d, a, 14, 23, T36);
|
||||||
|
SET(a, b, c, d, 1, 4, T37);
|
||||||
|
SET(d, a, b, c, 4, 11, T38);
|
||||||
|
SET(c, d, a, b, 7, 16, T39);
|
||||||
|
SET(b, c, d, a, 10, 23, T40);
|
||||||
|
SET(a, b, c, d, 13, 4, T41);
|
||||||
|
SET(d, a, b, c, 0, 11, T42);
|
||||||
|
SET(c, d, a, b, 3, 16, T43);
|
||||||
|
SET(b, c, d, a, 6, 23, T44);
|
||||||
|
SET(a, b, c, d, 9, 4, T45);
|
||||||
|
SET(d, a, b, c, 12, 11, T46);
|
||||||
|
SET(c, d, a, b, 15, 16, T47);
|
||||||
|
SET(b, c, d, a, 2, 23, T48);
|
||||||
|
#undef SET
|
||||||
|
|
||||||
|
/* Round 4. */
|
||||||
|
/* Let [abcd k s t] denote the operation
|
||||||
|
a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
|
||||||
|
#define I(x, y, z) ((y) ^ ((x) | ~(z)))
|
||||||
|
#define SET(a, b, c, d, k, s, Ti)\
|
||||||
|
t = a + I(b,c,d) + X[k] + Ti;\
|
||||||
|
a = ROTATE_LEFT(t, s) + b
|
||||||
|
/* Do the following 16 operations. */
|
||||||
|
SET(a, b, c, d, 0, 6, T49);
|
||||||
|
SET(d, a, b, c, 7, 10, T50);
|
||||||
|
SET(c, d, a, b, 14, 15, T51);
|
||||||
|
SET(b, c, d, a, 5, 21, T52);
|
||||||
|
SET(a, b, c, d, 12, 6, T53);
|
||||||
|
SET(d, a, b, c, 3, 10, T54);
|
||||||
|
SET(c, d, a, b, 10, 15, T55);
|
||||||
|
SET(b, c, d, a, 1, 21, T56);
|
||||||
|
SET(a, b, c, d, 8, 6, T57);
|
||||||
|
SET(d, a, b, c, 15, 10, T58);
|
||||||
|
SET(c, d, a, b, 6, 15, T59);
|
||||||
|
SET(b, c, d, a, 13, 21, T60);
|
||||||
|
SET(a, b, c, d, 4, 6, T61);
|
||||||
|
SET(d, a, b, c, 11, 10, T62);
|
||||||
|
SET(c, d, a, b, 2, 15, T63);
|
||||||
|
SET(b, c, d, a, 9, 21, T64);
|
||||||
|
#undef SET
|
||||||
|
|
||||||
|
/* Then perform the following additions. (That is increment each
|
||||||
|
of the four registers by the value it had before this block
|
||||||
|
was started.) */
|
||||||
|
pms->abcd[0] += a;
|
||||||
|
pms->abcd[1] += b;
|
||||||
|
pms->abcd[2] += c;
|
||||||
|
pms->abcd[3] += d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
md5_init(md5_state_t *pms)
|
||||||
|
{
|
||||||
|
pms->count[0] = pms->count[1] = 0;
|
||||||
|
pms->abcd[0] = 0x67452301;
|
||||||
|
pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
|
||||||
|
pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
|
||||||
|
pms->abcd[3] = 0x10325476;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
|
||||||
|
{
|
||||||
|
const md5_byte_t *p = data;
|
||||||
|
int left = nbytes;
|
||||||
|
int offset = (pms->count[0] >> 3) & 63;
|
||||||
|
md5_word_t nbits = (md5_word_t)(nbytes << 3);
|
||||||
|
|
||||||
|
if (nbytes <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Update the message length. */
|
||||||
|
pms->count[1] += nbytes >> 29;
|
||||||
|
pms->count[0] += nbits;
|
||||||
|
if (pms->count[0] < nbits)
|
||||||
|
pms->count[1]++;
|
||||||
|
|
||||||
|
/* Process an initial partial block. */
|
||||||
|
if (offset)
|
||||||
|
{
|
||||||
|
int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
|
||||||
|
|
||||||
|
memcpy(pms->buf + offset, p, copy);
|
||||||
|
if (offset + copy < 64)
|
||||||
|
return;
|
||||||
|
p += copy;
|
||||||
|
left -= copy;
|
||||||
|
md5_process(pms, pms->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process full blocks. */
|
||||||
|
for (; left >= 64; p += 64, left -= 64)
|
||||||
|
md5_process(pms, p);
|
||||||
|
|
||||||
|
/* Process a final partial block. */
|
||||||
|
if (left)
|
||||||
|
memcpy(pms->buf, p, left);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
md5_finish(md5_state_t *pms, md5_byte_t digest[16])
|
||||||
|
{
|
||||||
|
static const md5_byte_t pad[64] =
|
||||||
|
{
|
||||||
|
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
md5_byte_t data[8];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Save the length before padding. */
|
||||||
|
for (i = 0; i < 8; ++i)
|
||||||
|
data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
|
||||||
|
/* Pad to 56 bytes mod 64. */
|
||||||
|
md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
|
||||||
|
/* Append the length. */
|
||||||
|
md5_append(pms, data, 8);
|
||||||
|
for (i = 0; i < 16; ++i)
|
||||||
|
digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
|
||||||
|
}
|
||||||
91
src/Client/Auth/md5.h
Normal file
91
src/Client/Auth/md5.h
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
L. Peter Deutsch
|
||||||
|
ghost@aladdin.com
|
||||||
|
|
||||||
|
*/
|
||||||
|
/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */
|
||||||
|
/*
|
||||||
|
Independent implementation of MD5 (RFC 1321).
|
||||||
|
|
||||||
|
This code implements the MD5 Algorithm defined in RFC 1321, whose
|
||||||
|
text is available at
|
||||||
|
http://www.ietf.org/rfc/rfc1321.txt
|
||||||
|
The code is derived from the text of the RFC, including the test suite
|
||||||
|
(section A.5) but excluding the rest of Appendix A. It does not include
|
||||||
|
any code or documentation that is identified in the RFC as being
|
||||||
|
copyrighted.
|
||||||
|
|
||||||
|
The original and principal author of md5.h is L. Peter Deutsch
|
||||||
|
<ghost@aladdin.com>. Other authors are noted in the change history
|
||||||
|
that follows (in reverse chronological order):
|
||||||
|
|
||||||
|
2002-04-13 lpd Removed support for non-ANSI compilers; removed
|
||||||
|
references to Ghostscript; clarified derivation from RFC 1321;
|
||||||
|
now handles byte order either statically or dynamically.
|
||||||
|
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
|
||||||
|
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
|
||||||
|
added conditionalization for C++ compilation from Martin
|
||||||
|
Purschke <purschke@bnl.gov>.
|
||||||
|
1999-05-03 lpd Original version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef md5_INCLUDED
|
||||||
|
# define md5_INCLUDED
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This package supports both compile-time and run-time determination of CPU
|
||||||
|
* byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
|
||||||
|
* compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
|
||||||
|
* defined as non-zero, the code will be compiled to run only on big-endian
|
||||||
|
* CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
|
||||||
|
* run on either big- or little-endian CPUs, but will run slightly less
|
||||||
|
* efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef unsigned char md5_byte_t; /* 8-bit byte */
|
||||||
|
typedef unsigned int md5_word_t; /* 32-bit word */
|
||||||
|
|
||||||
|
/* Define the state of the MD5 Algorithm. */
|
||||||
|
typedef struct md5_state_s
|
||||||
|
{
|
||||||
|
md5_word_t count[2]; /* message length in bits, lsw first */
|
||||||
|
md5_word_t abcd[4]; /* digest buffer */
|
||||||
|
md5_byte_t buf[64]; /* accumulate block */
|
||||||
|
} md5_state_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Initialize the algorithm. */
|
||||||
|
void md5_init(md5_state_t *pms);
|
||||||
|
|
||||||
|
/* Append a string to the message. */
|
||||||
|
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
|
||||||
|
|
||||||
|
/* Finish the message and return the digest. */
|
||||||
|
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* end extern "C" */
|
||||||
|
#endif
|
||||||
|
#endif /* md5_INCLUDED */
|
||||||
133
src/Client/ConfigReader.cpp_
Normal file
133
src/Client/ConfigReader.cpp_
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
#include <fstream>
|
||||||
|
#include "common.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
#include "ConfigReader.h"
|
||||||
|
|
||||||
|
bool ConfigReader::ReadConf(std::string fn, VarSet& vs, bool capitalize){
|
||||||
|
std::fstream f;
|
||||||
|
char z;
|
||||||
|
std::string line,label,value;
|
||||||
|
|
||||||
|
f.open(fn.c_str(), std::ios_base::in);
|
||||||
|
if(!f)
|
||||||
|
return false;
|
||||||
|
while(!f.eof()){
|
||||||
|
line.clear();
|
||||||
|
while (true) {
|
||||||
|
f.get(z);
|
||||||
|
if(z=='\n' || f.eof())
|
||||||
|
break;
|
||||||
|
line+=z;
|
||||||
|
}
|
||||||
|
if(line.empty())
|
||||||
|
continue; // line is empty, proceed with next line
|
||||||
|
while( (line.at(0)==' ' || line.at(0)=='\t') )
|
||||||
|
line.erase(0,1);
|
||||||
|
if(line.empty())
|
||||||
|
continue;
|
||||||
|
if(line.at(0)=='/' && line.at(1)=='/')
|
||||||
|
continue; // line is comment, proceed with next line
|
||||||
|
label=line.substr(0,line.find('=',0));
|
||||||
|
if(capitalize)
|
||||||
|
label=stringToUpper(label);
|
||||||
|
value=line.substr(line.find('=',0)+1,line.length());
|
||||||
|
|
||||||
|
DEBUGMODE(printf("CONF: '%s' = '%s'\n",label.c_str(),value.c_str()););
|
||||||
|
vs.Set(label,value);
|
||||||
|
}
|
||||||
|
f.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigReader::SetMainConf(VarSet& vs){
|
||||||
|
|
||||||
|
if(vs.Exists("DEBUG")){
|
||||||
|
DEBUG=atoi(vs.Get("DEBUG").c_str());
|
||||||
|
DEBUG1(printf("DEBUG level=%d\n",DEBUG););
|
||||||
|
}
|
||||||
|
if(vs.Exists("REALMLIST")){
|
||||||
|
strcpy(realmlist,vs.Get("REALMLIST").c_str());
|
||||||
|
if(DEBUG>=1)printf("Realmlist set to \"%s\"\n",realmlist);
|
||||||
|
}
|
||||||
|
if(vs.Exists("ACCNAME")){
|
||||||
|
strcpy(accname,vs.Get("ACCNAME").c_str());
|
||||||
|
if(DEBUG>=1)printf("Account Name set to \"%s\"\n",accname);
|
||||||
|
}
|
||||||
|
if(vs.Exists("ACCPASS")){
|
||||||
|
strcpy(accpass,vs.Get("ACCPASS").c_str());
|
||||||
|
if(DEBUG>=1)printf("Account Password set to \"%s\"\n",accpass);
|
||||||
|
}
|
||||||
|
if(vs.Exists("ALLOWCONTROLLER")){
|
||||||
|
std::string opt=vs.Get("ALLOWCONTROLLER");
|
||||||
|
if( opt=="1" || opt=="true" || opt=="on" ){
|
||||||
|
allowcontroller=true;
|
||||||
|
}else{
|
||||||
|
allowcontroller=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(vs.Exists("EXITONERROR")){
|
||||||
|
std::string opt=vs.Get("EXITONERROR");
|
||||||
|
if( opt=="1" || opt=="true" || opt=="on" ){
|
||||||
|
exitonerror=true;
|
||||||
|
}else{
|
||||||
|
exitonerror=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(vs.Exists("CONTROLLERPORT")){
|
||||||
|
c_port=atoi(vs.Get("CONTROLLERPORT").c_str());
|
||||||
|
if(DEBUG>=1)printf("Controller Port set to %d\n",c_port);
|
||||||
|
}
|
||||||
|
if(vs.Exists("REALMPORT")){
|
||||||
|
rs_port=atoi(vs.Get("REALMPORT").c_str());
|
||||||
|
if(DEBUG>=1)printf("Realm Server Port set to %d\n",rs_port);
|
||||||
|
}
|
||||||
|
if(vs.Exists("CLIENTVERSION")){ // e.g. 1.10.2 -- max number in this case is 255.255.255 -> address a matrix of 3x3
|
||||||
|
std::string opt=vs.Get("CLIENTVERSION")+".";
|
||||||
|
std::string num;
|
||||||
|
uint8 p=0;
|
||||||
|
for(uint8 i=0;i<opt.length();i++){
|
||||||
|
if(!isdigit(opt.at(i))){
|
||||||
|
clientversion[p]=(unsigned char)atoi(num.c_str());
|
||||||
|
num.clear();
|
||||||
|
p++;
|
||||||
|
if(p>2)
|
||||||
|
break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
num+=opt.at(i);
|
||||||
|
}
|
||||||
|
DEBUG1(printf("Emulating client version %d.%d.%d\n",clientversion[0],clientversion[1],clientversion[2]););
|
||||||
|
}
|
||||||
|
if(vs.Exists("CLIENTBUILD")){
|
||||||
|
clientbuild=atoi(vs.Get("CLIENTBUILD").c_str());
|
||||||
|
if(DEBUG>=1)printf("Client Build set to %d\n",clientbuild);
|
||||||
|
}
|
||||||
|
if(vs.Exists("CLIENTLANG")){
|
||||||
|
char *opt=(char*)vs.Get("CLIENTLANG").c_str();
|
||||||
|
clientlang[0]=opt[0];
|
||||||
|
clientlang[1]=opt[1];
|
||||||
|
clientlang[2]=opt[2];
|
||||||
|
clientlang[3]=opt[3];
|
||||||
|
DEBUG1(printf("Client language set to \"%c%c%c%c\"\n",clientlang[0],clientlang[1],clientlang[2],clientlang[3]););
|
||||||
|
}
|
||||||
|
if(vs.Exists("REALMNAME")){
|
||||||
|
strcpy(realmname,vs.Get("REALMNAME").c_str());
|
||||||
|
if(DEBUG>=1)printf("Realm Name set to \"%s\"\n",realmname);
|
||||||
|
}
|
||||||
|
if(vs.Exists("CHARNAME")){
|
||||||
|
charname=vs.Get("CHARNAME");
|
||||||
|
if(DEBUG>=1)printf("Character Name set to \"%s\"\n",charname.c_str());
|
||||||
|
}
|
||||||
|
if(vs.Exists("IDLESLEEPTIME")){
|
||||||
|
idleSleepTime=atoi(vs.Get("IDLESLEEPTIME").c_str());
|
||||||
|
if(DEBUG>=1)printf("Idle Sleep Time set to \"%u\"\n",idleSleepTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
defScp.RunScriptByName("_setconf",NULL,255);
|
||||||
|
|
||||||
|
// more conf?
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
15
src/Client/ConfigReader.h_
Normal file
15
src/Client/ConfigReader.h_
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef _CONFIGREADER_H
|
||||||
|
#define _CONFIGREADER_H
|
||||||
|
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
|
||||||
|
namespace ConfigReader {
|
||||||
|
|
||||||
|
bool ReadConf(std::string, VarSet&, bool);
|
||||||
|
void SetMainConf(VarSet&);
|
||||||
|
void SetUsersConf(VarSet&);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
639
src/Client/DefScript/DefScript.cpp
Normal file
639
src/Client/DefScript/DefScript.cpp
Normal file
@ -0,0 +1,639 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include "VarSet.h"
|
||||||
|
#include "DefScript.h"
|
||||||
|
#include "DefScriptFunctions.h"
|
||||||
|
|
||||||
|
struct DefScriptXChgResult {
|
||||||
|
std::string str;
|
||||||
|
bool change;
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- SECTION FOR SCRIPT PACKAGES ---
|
||||||
|
DefScriptPackage::DefScriptPackage(){
|
||||||
|
scripts=0;
|
||||||
|
Script=NULL;
|
||||||
|
curIsDebug=false;
|
||||||
|
recursionLevel=0;
|
||||||
|
functions=0;
|
||||||
|
functionTable=_GetFunctionTable();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// printf("---> DefScriptPackage inited!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
DefScriptPackage::~DefScriptPackage(){
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefScriptPackage::SetParentMethod(void *p)
|
||||||
|
{
|
||||||
|
parentMethod = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefScriptPackage::Clear(void){
|
||||||
|
//for(unsigned int i=0;i<scripts;i++){
|
||||||
|
// Script[i].Clear();
|
||||||
|
//}
|
||||||
|
delete [] Script;
|
||||||
|
Script=NULL;
|
||||||
|
scripts=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DefScriptFunctionTable *DefScriptPackage::_GetFunctionTable(void) const
|
||||||
|
{
|
||||||
|
static DefScriptFunctionTable table[] = {
|
||||||
|
// basic functions:
|
||||||
|
{"set",&DefScriptPackage::func_set},
|
||||||
|
{"defult",&DefScriptPackage::func_default},
|
||||||
|
{"unset",&DefScriptPackage::func_unset},
|
||||||
|
{"shdn",&DefScriptPackage::func_shdn},
|
||||||
|
{"loaddef",&DefScriptPackage::func_loaddef},
|
||||||
|
{"reloaddef",&DefScriptPackage::func_reloaddef},
|
||||||
|
|
||||||
|
// user functions:
|
||||||
|
{"pause",&DefScriptPackage::SCpause},
|
||||||
|
{"emote",&DefScriptPackage::SCemote},
|
||||||
|
//{"follow",&DefScriptPackage::SCfollow},
|
||||||
|
{"savecache",&DefScriptPackage::SCsavecache},
|
||||||
|
{"sendchatmessage",&DefScriptPackage::SCSendChatMessage},
|
||||||
|
|
||||||
|
// table termination
|
||||||
|
{NULL,NULL}
|
||||||
|
|
||||||
|
};
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefScriptPackage::SetFunctionTable(DefScriptFunctionTable *tab){
|
||||||
|
functionTable=tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefScriptPackage::SetPath(std::string p){
|
||||||
|
scPath=p;
|
||||||
|
}
|
||||||
|
|
||||||
|
DefScript DefScriptPackage::GetScript(unsigned int id){
|
||||||
|
return Script[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DefScriptPackage::GetScripts(void){
|
||||||
|
return scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DefScriptPackage::GetScriptName(unsigned int id){
|
||||||
|
if(id>scripts) return NULL;
|
||||||
|
return Script[id].GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns array position!
|
||||||
|
unsigned int DefScriptPackage::GetScriptID(std::string name){
|
||||||
|
for(unsigned int i=0;i<scripts;i++){
|
||||||
|
if( !Script[i].GetName().empty() && Script[i].GetName()==name ){
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0; // Be careful you check if the script exists before you trust it. this could
|
||||||
|
// also mean Script[0]!!
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::ScriptExists(std::string name){
|
||||||
|
if(Script==NULL) return false;
|
||||||
|
for(unsigned int i=0;i<scripts;i++){
|
||||||
|
if( !Script[i].GetName().empty() && Script[i].GetName()==name ){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::LoadByName(std::string name){
|
||||||
|
return LoadScriptFromFile((scPath+name).append(".def"),name);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::LoadScriptFromFile(std::string fn, std::string sn){
|
||||||
|
bool increase_flag=false;
|
||||||
|
std::string label, value;
|
||||||
|
unsigned int id;
|
||||||
|
if(fn.empty() || sn.empty()) return false;
|
||||||
|
if(ScriptExists(sn)){ // if the script already exists, clear it and reassign content
|
||||||
|
id=GetScriptID(sn); // script exists, get ID...
|
||||||
|
Script[id].Clear(); // ... and remove content to refill it later on
|
||||||
|
} else { // if not, set scripts as ID for new script. scripts is equal to new array index then
|
||||||
|
id=scripts;
|
||||||
|
increase_flag=true;
|
||||||
|
|
||||||
|
// Script does not yet exist, since the scriptcount will be increased we have to alloc mem before
|
||||||
|
DefScript *Script_old;
|
||||||
|
if(scripts){
|
||||||
|
Script_old=new DefScript[scripts];
|
||||||
|
memcpy(Script_old,Script,scripts*sizeof(DefScript));
|
||||||
|
delete [] Script;
|
||||||
|
}
|
||||||
|
Script = new DefScript[scripts+1];
|
||||||
|
if(scripts){
|
||||||
|
memcpy(Script,Script_old,scripts*sizeof(DefScript));
|
||||||
|
delete [] Script_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::fstream f;
|
||||||
|
f.open(fn.c_str(),std::ios_base::in);
|
||||||
|
if(!f.is_open())
|
||||||
|
return false;
|
||||||
|
std::string line;
|
||||||
|
char z;
|
||||||
|
bool load_debug=false,load_notify=false;
|
||||||
|
while(!f.eof()){
|
||||||
|
line.clear();
|
||||||
|
while (true) {
|
||||||
|
f.get(z);
|
||||||
|
if(z=='\n' || f.eof())
|
||||||
|
break;
|
||||||
|
line+=z;
|
||||||
|
}
|
||||||
|
if(line.empty())
|
||||||
|
continue; // line is empty, proceed with next line
|
||||||
|
|
||||||
|
while( !line.empty() && (line.at(0)==' ' || line.at(0)=='\t') )
|
||||||
|
line.erase(0,1);
|
||||||
|
if(line.empty())
|
||||||
|
continue;
|
||||||
|
if(line.at(0)=='/' && line.at(1)=='/')
|
||||||
|
continue; // line is comment, proceed with next line
|
||||||
|
if(line.at(0)=='#'){
|
||||||
|
line.erase(0,1); // remove #
|
||||||
|
label=line.substr(0,line.find('=',0));
|
||||||
|
value=line.substr(line.find('=',0)+1,line.length());
|
||||||
|
if(label=="permission"){
|
||||||
|
Script[id].SetPermission((unsigned char)atoi(value.c_str())); // MAYBE: instead of this use Var @permission
|
||||||
|
} // ...
|
||||||
|
if(line=="load_debug")
|
||||||
|
load_debug=true;
|
||||||
|
if(line=="load_notify")
|
||||||
|
load_notify=true;
|
||||||
|
if(line=="debug")
|
||||||
|
Script[id].SetDebug(true);
|
||||||
|
//...
|
||||||
|
continue; // line was an option, not script content
|
||||||
|
}
|
||||||
|
if(load_debug)
|
||||||
|
std::cout<<"~LOAD: "<<line<<"\n";
|
||||||
|
Script[id].AddLine(line);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
f.close();
|
||||||
|
//Script[id].AddLine("eof"); // to be sure the script is terminated correctly
|
||||||
|
Script[id].SetName(sn);
|
||||||
|
if(load_notify)
|
||||||
|
std::cout << "+> Script '" << sn << "' [" << fn << "] successfully loaded.\n";
|
||||||
|
|
||||||
|
// ...
|
||||||
|
if(increase_flag) scripts++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// --- SECTION FOR THE INDIVIDUAL SCRIPTS IN A PACKAGE ---
|
||||||
|
|
||||||
|
DefScript::DefScript(){
|
||||||
|
lines=0;
|
||||||
|
Line=NULL;
|
||||||
|
permission=0;
|
||||||
|
scriptname="{NONAME}";
|
||||||
|
debugmode=false;
|
||||||
|
// printf("--> DefScript inited!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
DefScript::~DefScript(){
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefScript::Clear(void){
|
||||||
|
//if(lines)
|
||||||
|
// delete [] Line; //?! causes crash!
|
||||||
|
Line=NULL;
|
||||||
|
lines=0;
|
||||||
|
permission=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefScript::SetDebug(bool d){
|
||||||
|
debugmode=d;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScript::GetDebug(void){
|
||||||
|
return debugmode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefScript::SetName(std::string name){
|
||||||
|
scriptname=name;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DefScript::GetName(void){
|
||||||
|
return scriptname;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefScript::SetPermission(unsigned char p){
|
||||||
|
permission=p;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char DefScript::GetPermission(void){
|
||||||
|
return permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DefScript::GetLines(void){
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DefScript::GetLine(unsigned int id){
|
||||||
|
if(id>lines)
|
||||||
|
return "";
|
||||||
|
return Line[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScript::AddLine(std::string l){
|
||||||
|
if(l.empty())
|
||||||
|
return false;
|
||||||
|
std::string *Line_old=new std::string[lines];
|
||||||
|
for(unsigned int i=0;i<lines;i++)
|
||||||
|
Line_old[i]=Line[i];
|
||||||
|
delete [] Line;
|
||||||
|
Line=new std::string[lines+1];
|
||||||
|
for(unsigned int i=0;i<lines;i++)
|
||||||
|
Line[i]=Line_old[i];
|
||||||
|
Line[lines]=l;
|
||||||
|
lines++;
|
||||||
|
delete [] Line_old;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// --- SECTION FOR COMMAND SETS ---
|
||||||
|
|
||||||
|
CmdSet::CmdSet(){
|
||||||
|
for(unsigned int i=0;i<MAXARGS;i++){
|
||||||
|
arg[i]="";
|
||||||
|
}
|
||||||
|
cmd="";
|
||||||
|
defaultarg="";
|
||||||
|
}
|
||||||
|
|
||||||
|
CmdSet::~CmdSet(){
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CmdSet::Clear(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// --- FUNCTIONS TO PARSE AND EXECUTE A SCRIPT --- PARENT: DefScriptPackage!
|
||||||
|
|
||||||
|
bool DefScriptPackage::RunScriptByID(unsigned int id, CmdSet *pSet, unsigned char p){
|
||||||
|
if(id>GetScripts())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
curIsDebug=GetScript(id).GetDebug();
|
||||||
|
|
||||||
|
for(unsigned int cur_line=0;cur_line<GetScript(id).GetLines();cur_line++){
|
||||||
|
|
||||||
|
std::string line=GetScript(id).GetLine(cur_line);
|
||||||
|
std::string final=ReplaceVars(line,pSet,false,0,GetScript(id).GetName()); // must only parse globals if pSet == NULL
|
||||||
|
CmdSet curSet=SplitLine(final);
|
||||||
|
Interpret(curSet,GetScript(id).GetName(), p);
|
||||||
|
}
|
||||||
|
|
||||||
|
curIsDebug=false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::RunScriptByName(std::string scname, CmdSet *pSet, unsigned char p){
|
||||||
|
if(scname.empty())
|
||||||
|
return false;
|
||||||
|
if(ScriptExists(scname)){
|
||||||
|
RunScriptByID(GetScriptID(scname),pSet,p);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
bool result=LoadByName(scname);
|
||||||
|
if(result){
|
||||||
|
RunScriptByID(GetScriptID(scname),pSet,p);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::RunSingleLine(std::string line, unsigned char p){
|
||||||
|
unsigned int temp=0;
|
||||||
|
std::string final=ReplaceVars(line,NULL,false,temp,"");
|
||||||
|
CmdSet curSet=SplitLine(final);
|
||||||
|
return Interpret(curSet,"",p);
|
||||||
|
}
|
||||||
|
|
||||||
|
CmdSet DefScriptPackage::SplitLine(std::string line){
|
||||||
|
|
||||||
|
unsigned int i=0;
|
||||||
|
unsigned int bracketsOpen=0,curParam=0;
|
||||||
|
bool cmdDefined=false;
|
||||||
|
std::string tempLine;
|
||||||
|
CmdSet outSet;
|
||||||
|
|
||||||
|
// extract cmd+params and txt
|
||||||
|
for(i=0;i<line.length();i++){
|
||||||
|
|
||||||
|
if(line.at(i)=='{')
|
||||||
|
bracketsOpen++;
|
||||||
|
if(line.at(i)=='}')
|
||||||
|
bracketsOpen--;
|
||||||
|
|
||||||
|
if( line.at(i)==',' && !bracketsOpen)
|
||||||
|
{
|
||||||
|
if(!cmdDefined){
|
||||||
|
outSet.cmd=tempLine;
|
||||||
|
cmdDefined=true;
|
||||||
|
} else {
|
||||||
|
outSet.arg[curParam]=tempLine;
|
||||||
|
curParam++;
|
||||||
|
}
|
||||||
|
tempLine.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if( line.at(i)==' ' && !bracketsOpen)
|
||||||
|
{
|
||||||
|
if(!cmdDefined){
|
||||||
|
outSet.cmd=tempLine;
|
||||||
|
cmdDefined=true;
|
||||||
|
} else {
|
||||||
|
outSet.arg[curParam]=tempLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
outSet.defaultarg=line.substr(i,line.length()-i);
|
||||||
|
outSet.defaultarg.erase(0,1);
|
||||||
|
//tempLine.clear();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempLine+=line.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!cmdDefined)
|
||||||
|
outSet.cmd=tempLine;
|
||||||
|
if(cmdDefined && !outSet.cmd.empty() && outSet.defaultarg.empty())
|
||||||
|
outSet.arg[curParam]=tempLine;
|
||||||
|
|
||||||
|
outSet.cmd.assign(strlwr((char*)outSet.cmd.c_str()));
|
||||||
|
return RemoveBrackets(outSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DefScriptPackage::RemoveBracketsFromString(std::string t){
|
||||||
|
if(t.empty())
|
||||||
|
return t;
|
||||||
|
|
||||||
|
if(t.at(0)=='{' && t.at(t.length()-1)=='}')
|
||||||
|
{
|
||||||
|
t.erase(t.length()-1,1);
|
||||||
|
t.erase(0,1);
|
||||||
|
}
|
||||||
|
unsigned int ob=0,bo=0;
|
||||||
|
bool isVar=false;
|
||||||
|
for(unsigned int i=0;i<t.length();i++){
|
||||||
|
|
||||||
|
|
||||||
|
if(t[i]=='{')
|
||||||
|
{
|
||||||
|
if(i>0 && t[i-1]=='$')
|
||||||
|
isVar=true;
|
||||||
|
if(!bo)
|
||||||
|
ob=i;
|
||||||
|
bo++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(t[i]=='}')
|
||||||
|
{
|
||||||
|
bo--;
|
||||||
|
if(!bo)
|
||||||
|
{
|
||||||
|
if(!isVar)
|
||||||
|
{
|
||||||
|
unsigned int blen=i-ob+1;
|
||||||
|
std::string subStr=t.substr(ob,blen);
|
||||||
|
std::string retStr=RemoveBracketsFromString(subStr);
|
||||||
|
t.erase(ob,blen);
|
||||||
|
t.insert(ob,retStr);
|
||||||
|
i=ob-1;
|
||||||
|
|
||||||
|
}
|
||||||
|
isVar=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
CmdSet DefScriptPackage::RemoveBrackets(CmdSet oldSet){
|
||||||
|
CmdSet Set=oldSet;
|
||||||
|
std::string t;
|
||||||
|
for(unsigned int a=0;a<MAXARGS+2;a++){
|
||||||
|
if(a==0)
|
||||||
|
t=Set.defaultarg;
|
||||||
|
else if(a==1)
|
||||||
|
t=Set.cmd;
|
||||||
|
else
|
||||||
|
t=Set.arg[a-2];
|
||||||
|
|
||||||
|
if(t.empty()) // skip empty args
|
||||||
|
continue;
|
||||||
|
|
||||||
|
t=RemoveBracketsFromString(t);
|
||||||
|
|
||||||
|
if(a==0)
|
||||||
|
Set.defaultarg=t;
|
||||||
|
else if(a==1)
|
||||||
|
Set.cmd=t;
|
||||||
|
else
|
||||||
|
Set.arg[a-2]=t;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Set;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string DefScriptPackage::ReplaceVars(std::string str, CmdSet *pSet, bool isVar, unsigned int vardepth, std::string sc_name){
|
||||||
|
//std::cout<<">>ReplaceVars: '"<<str<<"' var="<<isVar<<"\n";
|
||||||
|
unsigned int
|
||||||
|
|
||||||
|
openingBracket=0, // defines the position from where the recursive call should be started
|
||||||
|
closingBracket=0, // the closing bracket
|
||||||
|
bracketsOpen=0,
|
||||||
|
bLen=0; // the lenth of the string in brackets, e.g. ${abc} == 3
|
||||||
|
|
||||||
|
bool nextIsVar=false, hasVar=false;
|
||||||
|
|
||||||
|
|
||||||
|
std::string subStr,retStr;
|
||||||
|
char temp;
|
||||||
|
|
||||||
|
while(str.at(0)==' ' || str.at(0)=='\t')
|
||||||
|
str.erase(0,1); // trim spaces if there are any
|
||||||
|
|
||||||
|
for(unsigned int i=0;i<str.length();i++){
|
||||||
|
temp=str.at(i);
|
||||||
|
|
||||||
|
|
||||||
|
if(str[i]=='{')
|
||||||
|
{
|
||||||
|
if(!bracketsOpen)
|
||||||
|
openingBracket=i; // var starts with $, normal bracket with {
|
||||||
|
if(i>0 && str[i-1]=='$')
|
||||||
|
{
|
||||||
|
hasVar=true;
|
||||||
|
if(!bracketsOpen)
|
||||||
|
nextIsVar=true;
|
||||||
|
}
|
||||||
|
bracketsOpen++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(str[i]=='}')
|
||||||
|
{
|
||||||
|
if(bracketsOpen)
|
||||||
|
bracketsOpen--;
|
||||||
|
if(!bracketsOpen)
|
||||||
|
{
|
||||||
|
closingBracket=i;
|
||||||
|
if(!nextIsVar && isVar && !hasVar) // remove brackets in var names, like ${var{ia}ble}
|
||||||
|
{
|
||||||
|
str.erase(closingBracket,1);
|
||||||
|
str.erase(openingBracket,1);
|
||||||
|
i-=2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bLen=closingBracket-openingBracket-1;
|
||||||
|
subStr=str.substr(openingBracket+1,bLen);
|
||||||
|
retStr=ReplaceVars(subStr,pSet,nextIsVar,vardepth+(nextIsVar?1:0),sc_name);
|
||||||
|
if( hasVar && !nextIsVar && subStr!=retStr )
|
||||||
|
{
|
||||||
|
str.erase(openingBracket+1,subStr.length());
|
||||||
|
str.insert(openingBracket+1,retStr);
|
||||||
|
hasVar=false;
|
||||||
|
nextIsVar=false;
|
||||||
|
i-=(subStr.length()+1);
|
||||||
|
}
|
||||||
|
else if( hasVar && nextIsVar && subStr!=retStr )
|
||||||
|
{
|
||||||
|
str.erase(openingBracket-1,bLen+3); // remove {...
|
||||||
|
i-=(bLen+2); // adjust position
|
||||||
|
str.insert(i,retStr);
|
||||||
|
//i--;
|
||||||
|
hasVar=false;
|
||||||
|
nextIsVar=false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // end if {
|
||||||
|
} // end for
|
||||||
|
if(!bracketsOpen && isVar && vardepth)
|
||||||
|
{
|
||||||
|
std::string vname=_NormalizeVarName(str, sc_name);
|
||||||
|
if(vname[0]=='@')
|
||||||
|
{
|
||||||
|
std::stringstream vns;
|
||||||
|
std::string subs=vname.substr(1,str.length()-1);
|
||||||
|
unsigned int vn=atoi( subs.c_str() );
|
||||||
|
vns << vn;
|
||||||
|
if(pSet && vns.str()==subs)
|
||||||
|
str=pSet->arg[vn];
|
||||||
|
else if(pSet && subs=="def")
|
||||||
|
str=pSet->defaultarg;
|
||||||
|
else if(pSet && subs=="cmd")
|
||||||
|
str=pSet->cmd;
|
||||||
|
//else if(pSet && subs=="parent")
|
||||||
|
// str=pSet->parent;
|
||||||
|
else if(variables.Exists(vname))
|
||||||
|
str=variables.Get(vname);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: call custom macro table
|
||||||
|
//...
|
||||||
|
str.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(variables.Exists(vname))
|
||||||
|
str=variables.Get(vname);
|
||||||
|
else if(!variables.Exists(vname) && !subStr.empty())
|
||||||
|
str="${"+str+"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DefScriptPackage::_NormalizeVarName(std::string vn_in, std::string sn){
|
||||||
|
std::string vn=vn_in;
|
||||||
|
if(sn.empty())
|
||||||
|
return vn;
|
||||||
|
if(vn.at(0)=='#')
|
||||||
|
while(vn.at(0)=='#')
|
||||||
|
vn.erase(0,1);
|
||||||
|
else if(vn.at(0)=='@')
|
||||||
|
;// do nothing for now
|
||||||
|
else
|
||||||
|
vn=sn+"::"+vn;
|
||||||
|
|
||||||
|
return vn;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::Interpret(CmdSet Set, std::string sc_name, unsigned char p){
|
||||||
|
bool result=false;
|
||||||
|
|
||||||
|
for(unsigned int i=0;result==false;i++){
|
||||||
|
if(functionTable[i].func==NULL || functionTable[i].name==NULL){ // reached the end of the table?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(Set.cmd==functionTable[i].name){
|
||||||
|
result=(this->*functionTable[i].func)(Set);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if still nothing has been found its maybe a script command
|
||||||
|
if(!result){
|
||||||
|
unsigned int perm=GetScript(GetScriptID(Set.cmd)).GetPermission();
|
||||||
|
if(p<perm)
|
||||||
|
return false; // permisson level too low
|
||||||
|
|
||||||
|
result=RunScriptByName(Set.cmd,&Set,255); // call the subscript, this time with full privileges
|
||||||
|
if(!result && curIsDebug)
|
||||||
|
std::cout << "Could not execute script command '" << Set.cmd << "'\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: how to get this work?!
|
||||||
|
/*
|
||||||
|
bool DefScriptPackage::CallFunction(bool *func, CmdSet *pSet){
|
||||||
|
//bool result = *func(pSet, this);
|
||||||
|
//return result;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
123
src/Client/DefScript/DefScript.h
Normal file
123
src/Client/DefScript/DefScript.h
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
|
||||||
|
#ifndef __DEFSCRIPT_H
|
||||||
|
#define __DEFSCRIPT_H
|
||||||
|
|
||||||
|
#define MAXARGS 99
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include "VarSet.h"
|
||||||
|
|
||||||
|
class DefScriptPackage;
|
||||||
|
|
||||||
|
class CmdSet {
|
||||||
|
public:
|
||||||
|
CmdSet();
|
||||||
|
~CmdSet();
|
||||||
|
void Clear();
|
||||||
|
std::string cmd;
|
||||||
|
std::string arg[MAXARGS];
|
||||||
|
std::string defaultarg;
|
||||||
|
DefScriptPackage *pack;
|
||||||
|
std::string caller;
|
||||||
|
void *ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DefScriptFunctionTable {
|
||||||
|
char *name;
|
||||||
|
bool (DefScriptPackage::*func)(CmdSet Set);
|
||||||
|
};
|
||||||
|
|
||||||
|
class DefScript {
|
||||||
|
public:
|
||||||
|
DefScript();
|
||||||
|
~DefScript();
|
||||||
|
std::string GetLine(unsigned int);
|
||||||
|
unsigned int GetLines(void);
|
||||||
|
bool AddLine(std::string );
|
||||||
|
std::string GetName(void);
|
||||||
|
void SetName(std::string);
|
||||||
|
void SetPermission(unsigned char);
|
||||||
|
unsigned char GetPermission(void);
|
||||||
|
void Clear(void);
|
||||||
|
void SetDebug(bool);
|
||||||
|
bool GetDebug(void);
|
||||||
|
//DefScriptPackage *GetParent(void);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string *Line;
|
||||||
|
unsigned int lines;
|
||||||
|
std::string scriptname;
|
||||||
|
unsigned char permission;
|
||||||
|
bool debugmode;
|
||||||
|
|
||||||
|
//DefScriptPackage *_parent;
|
||||||
|
//CmdSet _mySet;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DefScriptPackage {
|
||||||
|
public:
|
||||||
|
DefScriptPackage();
|
||||||
|
~DefScriptPackage();
|
||||||
|
void SetParentMethod(void*);
|
||||||
|
void Clear(void);
|
||||||
|
DefScript GetScript(unsigned int);
|
||||||
|
unsigned int GetScripts(void);
|
||||||
|
bool LoadScriptFromFile(std::string,std::string);
|
||||||
|
bool RunScriptByName(std::string,CmdSet*,unsigned char);
|
||||||
|
bool RunScriptByID(unsigned int,CmdSet*,unsigned char);
|
||||||
|
std::string GetScriptName(unsigned int);
|
||||||
|
unsigned int GetScriptID(std::string);
|
||||||
|
bool RunSingleLine(std::string, unsigned char);
|
||||||
|
bool ScriptExists(std::string);
|
||||||
|
VarSet variables;
|
||||||
|
void SetPath(std::string);
|
||||||
|
bool LoadByName(std::string);
|
||||||
|
void SetFunctionTable(DefScriptFunctionTable*);
|
||||||
|
std::string _NormalizeVarName(std::string, std::string);
|
||||||
|
bool DefScriptPackage::CallFunction(bool *func, CmdSet *pSet);
|
||||||
|
|
||||||
|
std::string scPath;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string ReplaceVars(std::string, CmdSet*, bool, unsigned int, std::string); // changes the string directly
|
||||||
|
CmdSet SplitLine(std::string);
|
||||||
|
bool Interpret(CmdSet, std::string, unsigned char);
|
||||||
|
CmdSet RemoveBrackets(CmdSet);
|
||||||
|
std::string RemoveBracketsFromString(std::string);
|
||||||
|
DefScriptFunctionTable *_GetFunctionTable(void) const;
|
||||||
|
|
||||||
|
bool curIsDebug;
|
||||||
|
unsigned int scripts;
|
||||||
|
DefScript *Script;
|
||||||
|
unsigned int recursionLevel;
|
||||||
|
DefScriptFunctionTable *functionTable;
|
||||||
|
unsigned int functions;
|
||||||
|
void *parentMethod;
|
||||||
|
|
||||||
|
std::map<std::string, unsigned int> permissionMap;
|
||||||
|
|
||||||
|
// Usable internal basic functions:
|
||||||
|
bool func_default(CmdSet);
|
||||||
|
bool func_set(CmdSet);
|
||||||
|
bool func_unset(CmdSet);
|
||||||
|
bool func_loaddef(CmdSet);
|
||||||
|
bool func_reloaddef(CmdSet);
|
||||||
|
bool func_out(CmdSet);
|
||||||
|
bool func_eof(CmdSet);
|
||||||
|
bool func_shdn(CmdSet);
|
||||||
|
|
||||||
|
// Useable own internal functions:
|
||||||
|
bool SCpause(CmdSet);
|
||||||
|
bool SCSendChatMessage(CmdSet);
|
||||||
|
bool SCsavecache(CmdSet);
|
||||||
|
bool SCemote(CmdSet);
|
||||||
|
bool SCfollow(CmdSet);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
123
src/Client/DefScript/DefScriptFunctions.cpp
Normal file
123
src/Client/DefScript/DefScriptFunctions.cpp
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include "DefScript.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool DefScriptPackage::func_shdn(CmdSet Set){
|
||||||
|
exit(0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::func_eof(CmdSet Set){
|
||||||
|
// do nothing still
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::func_out(CmdSet Set){
|
||||||
|
printf("%s\n",Set.defaultarg.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::func_loaddef(CmdSet Set){
|
||||||
|
if( ScriptExists(Set.defaultarg) )
|
||||||
|
return true;
|
||||||
|
bool result=false;
|
||||||
|
std::string fn;
|
||||||
|
if(Set.arg[0].empty())
|
||||||
|
result=LoadByName(Set.defaultarg);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string::size_type pos = Set.arg[0].find('/');
|
||||||
|
if(pos == std::string::npos)
|
||||||
|
fn=scPath+Set.arg[0];
|
||||||
|
else
|
||||||
|
fn=Set.arg[0];
|
||||||
|
result=LoadScriptFromFile(fn,Set.defaultarg);
|
||||||
|
}
|
||||||
|
//if(!result && curIsDebug)
|
||||||
|
// std::cout << "Could not load script '" << Set->defaultarg << "' [" << fn << "]\n";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::func_reloaddef(CmdSet Set){
|
||||||
|
bool result=false;
|
||||||
|
std::string fn;
|
||||||
|
if(Set.arg[0].empty())
|
||||||
|
result=LoadByName(Set.defaultarg);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string::size_type pos = Set.arg[0].find('/');
|
||||||
|
if(pos == std::string::npos)
|
||||||
|
fn=scPath+Set.arg[0];
|
||||||
|
else
|
||||||
|
fn=Set.arg[0];
|
||||||
|
result=LoadScriptFromFile(fn,Set.defaultarg);
|
||||||
|
}
|
||||||
|
//if(!result && curIsDebug)
|
||||||
|
// std::cout << "Could not load script '" << Set->defaultarg << "' [" << fn << "]\n";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::func_unset(CmdSet Set){
|
||||||
|
if(Set.defaultarg.empty()){
|
||||||
|
//if(curIsDebug)
|
||||||
|
// printf("Can't unset, no variable name given.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(Set.defaultarg.at(0)=='@'){
|
||||||
|
//if(curIsDebug)
|
||||||
|
// printf("Can't unset macros!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::string vn=_NormalizeVarName(Set.defaultarg, Set.caller);
|
||||||
|
variables.Unset(vn);
|
||||||
|
//std::cout<<"Unset var '"<<Set->defaultarg<<"'\n";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::func_set(CmdSet Set){
|
||||||
|
if(Set.arg[0].empty()){
|
||||||
|
//if(curIsDebug)
|
||||||
|
// printf("Can't assign value, no variable name given.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(Set.arg[0].at(0)=='@'){
|
||||||
|
//if(curIsDebug)
|
||||||
|
// printf("Can't assign value to a macro!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::string vname,vval=Set.defaultarg;
|
||||||
|
vname=_NormalizeVarName(Set.arg[0], Set.caller);
|
||||||
|
|
||||||
|
if(!stricmp(Set.arg[1].c_str(),"onfail") && vval.find("${")!=std::string::npos)
|
||||||
|
vval=Set.arg[2];
|
||||||
|
|
||||||
|
variables.Set(vname,vval);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::func_default(CmdSet Set){
|
||||||
|
if(Set.arg[0].empty()){
|
||||||
|
//if(curIsDebug)
|
||||||
|
// printf("Can't assign value, no variable name given.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(Set.arg[0].at(0)=='@'){
|
||||||
|
//if(curIsDebug)
|
||||||
|
// printf("Can't assign value to a macro!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::string vname,vval=Set.defaultarg;
|
||||||
|
vname=_NormalizeVarName(Set.arg[0], Set.caller);
|
||||||
|
|
||||||
|
if(variables.Get(vname).empty())
|
||||||
|
variables.Set(vname,vval); // set only if it has no value
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
50
src/Client/DefScript/ParsingFunctions.cpp_
Normal file
50
src/Client/DefScript/ParsingFunctions.cpp_
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "ParsingFunctions.h"
|
||||||
|
#include "../GarbageStack.h"
|
||||||
|
|
||||||
|
char *strparse::fgetlabel(char *line){
|
||||||
|
//printf("Extracting label...");
|
||||||
|
char *ret;
|
||||||
|
int i,len;
|
||||||
|
for(i=0;line[i]!='=';i++);
|
||||||
|
len=i;
|
||||||
|
ret=NewTempString(len);
|
||||||
|
for(i=0;i<len;i++)ret[i]=line[i];
|
||||||
|
ret[len]=0;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *strparse::fgetvalue(char *line){
|
||||||
|
int i;
|
||||||
|
char *out;
|
||||||
|
for(i=0;line[i]!='='&&i<strlen(line);i++);
|
||||||
|
out=line+i+1;
|
||||||
|
return out;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
char *strparse::RemoveComments(char *txt){
|
||||||
|
char *ptr;
|
||||||
|
ptr=strchr(txt,(char)'/');
|
||||||
|
if(ptr==NULL)return txt;
|
||||||
|
else {
|
||||||
|
ptr[0]=0; // terminate the string a bit earlier if a comment is found. "blah // crap\0" -> "blah \0/ crap\0" -> "blah \0"
|
||||||
|
}
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *strparse::TrimSpacesLeft(char *txt){
|
||||||
|
int len=strlen(txt);
|
||||||
|
if(len<1)return txt;
|
||||||
|
for(int p=0;p<=len;p++)
|
||||||
|
if(txt[0]==' '||txt[0]==' ')
|
||||||
|
txt++;
|
||||||
|
else
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool strparse::HasEqual(char *in){
|
||||||
|
if(strchr(in,(char)'=')==NULL)return false; else return true;
|
||||||
|
}
|
||||||
10
src/Client/DefScript/ParsingFunctions.h_
Normal file
10
src/Client/DefScript/ParsingFunctions.h_
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
namespace strparse {
|
||||||
|
|
||||||
|
char *fgetlabel(char*);
|
||||||
|
char *fgetvalue(char*);
|
||||||
|
char *RemoveComments(char*);
|
||||||
|
char *TrimSpacesLeft(char*);
|
||||||
|
bool HasEqual(char*);
|
||||||
|
|
||||||
|
}
|
||||||
169
src/Client/DefScript/VarSet.cpp
Normal file
169
src/Client/DefScript/VarSet.cpp
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string>
|
||||||
|
#include <fstream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
|
#include "VarSet.h"
|
||||||
|
|
||||||
|
VarSet::VarSet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
VarSet::~VarSet()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string VarSet::Get(std::string varname)
|
||||||
|
{
|
||||||
|
for(std::list<Var>::iterator i=buffer.begin();i!=buffer.end();i++)
|
||||||
|
if( i->name==varname )
|
||||||
|
return i->value;
|
||||||
|
return ""; // if var has not been set return empty string
|
||||||
|
}
|
||||||
|
|
||||||
|
void VarSet::Set(std::string varname, std::string varvalue)
|
||||||
|
{
|
||||||
|
if(varname.empty())
|
||||||
|
return;
|
||||||
|
for(std::list<Var>::iterator i = buffer.begin();i!=buffer.end();i++)
|
||||||
|
{
|
||||||
|
if( i->name==varname )
|
||||||
|
{
|
||||||
|
i->value=varvalue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Var v;
|
||||||
|
v.name=varname;
|
||||||
|
v.value=varvalue;
|
||||||
|
buffer.push_back(v);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int VarSet::Size(void)
|
||||||
|
{
|
||||||
|
return buffer.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VarSet::Exists(std::string varname)
|
||||||
|
{
|
||||||
|
for(std::list<Var>::iterator i = buffer.begin();i!=buffer.end();i++)
|
||||||
|
if(i->name==varname)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VarSet::Unset(std::string varname)
|
||||||
|
{
|
||||||
|
if ( varname.empty() )
|
||||||
|
return;
|
||||||
|
for(std::list<Var>::iterator i = buffer.begin();i!=buffer.end();i++)
|
||||||
|
{
|
||||||
|
if(i->name==varname)
|
||||||
|
{
|
||||||
|
buffer.erase(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VarSet::Clear(void)
|
||||||
|
{
|
||||||
|
buffer.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VarSet::ReadVarsFromFile(std::string fn)
|
||||||
|
{
|
||||||
|
std::fstream fh;
|
||||||
|
std::string line,prefix,vn,vv;
|
||||||
|
char c;
|
||||||
|
bool upper=false,lower=false;
|
||||||
|
|
||||||
|
fh.open(fn.c_str(),std::ios_base::in);
|
||||||
|
if( !fh.is_open() )
|
||||||
|
return false;
|
||||||
|
while(!fh.eof())
|
||||||
|
{
|
||||||
|
c=fh.get();
|
||||||
|
if(c=='\n')
|
||||||
|
{
|
||||||
|
vn.clear();
|
||||||
|
vv.clear();
|
||||||
|
while(line.at(0)==' ' || line.at(0)=='\t')
|
||||||
|
line.erase(0,1);
|
||||||
|
while(line.at(line.length()-1)==' ' || line.at(line.length()-1)=='\t')
|
||||||
|
line.erase(line.length(),1);
|
||||||
|
if(line.empty() || (line.at(0)=='/' && line.at(0)=='/') )
|
||||||
|
continue;
|
||||||
|
if(line.at(0)=='[' && line.at(line.length()-1)==']')
|
||||||
|
{
|
||||||
|
prefix=line.substr(1,line.length()-2);
|
||||||
|
if(!prefix.empty())
|
||||||
|
{
|
||||||
|
if(prefix.at(0)=='#')
|
||||||
|
prefix=toLower(prefix);
|
||||||
|
if(prefix=="#uppercase")
|
||||||
|
{
|
||||||
|
upper=true;
|
||||||
|
lower=false;
|
||||||
|
}
|
||||||
|
else if(prefix=="#normal")
|
||||||
|
{
|
||||||
|
upper=false;
|
||||||
|
lower=false;
|
||||||
|
}
|
||||||
|
else if(prefix=="#lowercase")
|
||||||
|
{
|
||||||
|
lower=true;
|
||||||
|
upper=false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prefix+="::";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned int pos=line.find("=");
|
||||||
|
if(pos)
|
||||||
|
{
|
||||||
|
std::string v=line.substr(0,pos-1);;
|
||||||
|
|
||||||
|
if(upper)
|
||||||
|
v=toUpper(v);
|
||||||
|
else if(lower)
|
||||||
|
v=toLower(v);
|
||||||
|
|
||||||
|
vn=prefix+v;
|
||||||
|
vv=line.substr(pos+1,line.length()-1);
|
||||||
|
Set(vn,vv);
|
||||||
|
}
|
||||||
|
// else invalid line, must have '='
|
||||||
|
}
|
||||||
|
line.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
line+=c; // fill up line until a newline is reached (see above)
|
||||||
|
}
|
||||||
|
fh.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string VarSet::toLower(std::string s)
|
||||||
|
{
|
||||||
|
std::transform(s.begin(), s.end(), s.begin(), std::tolower);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string VarSet::toUpper(std::string s)
|
||||||
|
{
|
||||||
|
std::transform(s.begin(), s.end(), s.begin(), std::toupper);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
35
src/Client/DefScript/VarSet.h
Normal file
35
src/Client/DefScript/VarSet.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef __VARSET_H
|
||||||
|
#define __VARSET_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
|
||||||
|
struct Var {
|
||||||
|
std::string name, value;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class VarSet {
|
||||||
|
public:
|
||||||
|
void Set(std::string,std::string);
|
||||||
|
std::string Get(std::string);
|
||||||
|
void Clear(void);
|
||||||
|
void Unset(std::string);
|
||||||
|
unsigned int Size(void);
|
||||||
|
bool Exists(std::string);
|
||||||
|
bool ReadVarsFromFile(std::string fn);
|
||||||
|
VarSet();
|
||||||
|
~VarSet();
|
||||||
|
// far future: MergeWith(VarSet,bool overwrite);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::list<Var> buffer;
|
||||||
|
std::string toLower(std::string);
|
||||||
|
std::string toUpper(std::string);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
84
src/Client/DefScriptInterface.cpp
Normal file
84
src/Client/DefScriptInterface.cpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#ifndef __DEFSCRIPTINTERFACE_H
|
||||||
|
#define __DEFSCRIPTINTERFACE_H
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "NameTables.h"
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "CMSGConstructor.h"
|
||||||
|
#include "Opcodes.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
#include "WorldSession.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool DefScriptPackage::SCpause(CmdSet Set){
|
||||||
|
SDL_Delay(atoi(Set.defaultarg.c_str()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::SCSendChatMessage(CmdSet Set){
|
||||||
|
std::stringstream ss;
|
||||||
|
uint32 type=atoi(Set.arg[0].c_str());
|
||||||
|
uint32 lang=atoi(Set.arg[1].c_str());
|
||||||
|
ss << lang;
|
||||||
|
if(ss.str()!=Set.arg[1]) // given lang is NOT a number
|
||||||
|
{
|
||||||
|
for(uint32 i=0;i<=33;i++)
|
||||||
|
{
|
||||||
|
if(!stricmp(Set.arg[1].c_str(),LookupName(i,langNames)))
|
||||||
|
{
|
||||||
|
lang=i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string msg=Set.arg[2];
|
||||||
|
std::string to=Set.arg[3];
|
||||||
|
((PseuInstance*)parentMethod)->GetWSession()->SendChatMessage(type,lang,msg,to);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::SCsavecache(CmdSet Set){
|
||||||
|
((PseuInstance*)parentMethod)->SaveAllCache();
|
||||||
|
std::stringstream tmp;
|
||||||
|
std::string str;
|
||||||
|
tmp << ((PseuInstance*)parentMethod)->GetWSession()->plrNameCache.GetSize();
|
||||||
|
str+="Cache saved. [ "+tmp.str()+ " Playernames ]";
|
||||||
|
((PseuInstance*)parentMethod)->GetWSession()->SendChatMessage(CHAT_MSG_SAY,0,str,"");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::SCemote(CmdSet Set){
|
||||||
|
if(Set.defaultarg.empty())
|
||||||
|
return true;
|
||||||
|
uint32 id=atoi(Set.defaultarg.c_str());
|
||||||
|
((PseuInstance*)parentMethod)->GetWSession()->SendEmote(id);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::SCfollow(CmdSet Set){
|
||||||
|
WorldSession *ws=((PseuInstance*)parentMethod)->GetWSession();
|
||||||
|
if(Set.defaultarg.empty()){
|
||||||
|
ws->SendChatMessage(CHAT_MSG_SAY,0,"Stopping! (Please give me a Playername to follow!)","");
|
||||||
|
ws->SetFollowTarget(0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ws->SetFollowTarget(ws->plrNameCache.GetGuid(Set.defaultarg));
|
||||||
|
std::stringstream ss;
|
||||||
|
if(ws->GetFollowTarget())
|
||||||
|
ss << "Following player '"<<Set.defaultarg<<"'";
|
||||||
|
else
|
||||||
|
ss << "Can't follow player '"<<Set.defaultarg<<"' (not known)";
|
||||||
|
ws->SendChatMessage(CHAT_MSG_SAY,0,ss.str(),"");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
15
src/Client/DefScriptInterface.h
Normal file
15
src/Client/DefScriptInterface.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef __DEFSCRIPTINTERFACE_H
|
||||||
|
#define __DEFSCRIPTINTERFACE_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DefScriptFunctionTable *_GetSCTable(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
42
src/Client/NameTables.h
Normal file
42
src/Client/NameTables.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __NAMETABLES_H
|
||||||
|
#define __NAMETABLES_H
|
||||||
|
|
||||||
|
struct NameTableEntry
|
||||||
|
{
|
||||||
|
uint32 id;
|
||||||
|
const char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const char* LookupName(uint32 id, NameTableEntry *table)
|
||||||
|
{
|
||||||
|
for(uint32 i = 0; table[i].name != 0; i++)
|
||||||
|
{
|
||||||
|
if (table[i].id == id)
|
||||||
|
return table[i].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
|
||||||
|
extern NameTableEntry g_worldOpcodeNames[];
|
||||||
|
extern char *className[],*raceName[];
|
||||||
|
extern NameTableEntry langNames[];
|
||||||
|
#endif
|
||||||
BIN
src/Client/Pseu1.ico
Normal file
BIN
src/Client/Pseu1.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src/Client/PseuWoW.aps
Normal file
BIN
src/Client/PseuWoW.aps
Normal file
Binary file not shown.
303
src/Client/PseuWoW.cpp
Normal file
303
src/Client/PseuWoW.cpp
Normal file
@ -0,0 +1,303 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include <time.h>
|
||||||
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
|
#include "Auth/ByteBuffer.h"
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
#include "DefScriptInterface.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
|
#include "Auth/ByteBuffer.h"
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
#include "Realm/RealmSocket.h"
|
||||||
|
#include "World/WorldSession.h"
|
||||||
|
|
||||||
|
/* TODO:
|
||||||
|
defscriptpackage fix, xchgresult einbauen, CmdSet.caller einbauen, permissionmap einbauen
|
||||||
|
WorldSesssion::Update() rein
|
||||||
|
opcode handler table vervollstädigen + funktionen dafür umschreiben
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
//###### Start of program code #######
|
||||||
|
|
||||||
|
void PseuInstanceRunnable::run(void)
|
||||||
|
{
|
||||||
|
PseuInstance *_i = new PseuInstance();
|
||||||
|
_i->SetConfDir("./conf/");
|
||||||
|
_i->SetScpDir("./scripts/");
|
||||||
|
_i->Init();
|
||||||
|
// more
|
||||||
|
_i->Run();
|
||||||
|
delete _i;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PseuInstance::Init(void) {
|
||||||
|
|
||||||
|
if(_confdir.empty())
|
||||||
|
_confdir="./conf/";
|
||||||
|
if(_scpdir.empty())
|
||||||
|
_scpdir="./scp/";
|
||||||
|
|
||||||
|
srand((unsigned)time(NULL));
|
||||||
|
RAND_set_rand_method(RAND_SSLeay()); // init openssl randomizer
|
||||||
|
|
||||||
|
if(SDL_Init(0)==-1) {
|
||||||
|
printf("SDL_Init: %s\n", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_scp=new DefScriptPackage();
|
||||||
|
_scp->SetParentMethod((void*)this);
|
||||||
|
_conf=new PseuInstanceConf();
|
||||||
|
_rsession=new RealmSocket(_sh);
|
||||||
|
_wsession=new WorldSession(this);
|
||||||
|
|
||||||
|
if(!_scp->variables.ReadVarsFromFile(_confdir + "PseuWoW.conf"))
|
||||||
|
{
|
||||||
|
printf("Error reading conf file [%s]",_confdir.append("PseuoW.conf").c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_conf->ApplyFromVarSet(_scp->variables);
|
||||||
|
|
||||||
|
if(!_scp->variables.ReadVarsFromFile(_confdir + "users.conf"))
|
||||||
|
{
|
||||||
|
//printf("-> Done.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Error reading conf file [%s] - NO PERMISSIONS SET!",_confdir.append("users.conf").c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// //DEBUG1(printf("Main_Init: Setting up DefScripts path '%s'\n",defScpPath.c_str()););
|
||||||
|
_scp->SetPath(_scpdir);
|
||||||
|
|
||||||
|
// //DEBUG1(printf("Main_Init: Setting up custom DefScript function interface...\n"););
|
||||||
|
//_scp->SetFunctionTable(_GetSCTable());
|
||||||
|
|
||||||
|
// //DEBUG1(printf("Main_Init: Setting up predefined DefScript macros...\n"););
|
||||||
|
_scp->variables.Set("@version_short",_ver_short);
|
||||||
|
_scp->variables.Set("@version",_ver);
|
||||||
|
|
||||||
|
|
||||||
|
// //DEBUG1(printf("Main_Init: Loading DefScripts from folder '%s'\n",defScpPath.c_str()););
|
||||||
|
if(!_scp->RunScriptByName("_startup",NULL,255)){
|
||||||
|
printf("Main_Init: Error executing '_startup.def'\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_stop){
|
||||||
|
printf("Errors while initializing, proc halted!!\n");
|
||||||
|
if(GetConf()->exitonerror)
|
||||||
|
exit(0);
|
||||||
|
while(true)SDL_Delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(DEBUG)printf("Main_Init: Init complete.\n");
|
||||||
|
_initialized=true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PseuInstance::SetConfDir(std::string path)
|
||||||
|
{
|
||||||
|
_confdir=path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PseuInstance::SetScpDir(std::string path)
|
||||||
|
{
|
||||||
|
_scpdir=path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PseuInstance::Run(void)
|
||||||
|
{
|
||||||
|
if(!_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
_rsession->SetHost(GetConf()->realmlist);
|
||||||
|
_rsession->SetPort(GetConf()->realmport);
|
||||||
|
_rsession->Start();
|
||||||
|
|
||||||
|
if(_rsession->IsValid())
|
||||||
|
{
|
||||||
|
_sh.Add(_rsession);
|
||||||
|
_rsession->SendLogonChallenge();
|
||||||
|
_sh.Select(1,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(!_stop)
|
||||||
|
{
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
// save all data here
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PseuInstance::Update()
|
||||||
|
{
|
||||||
|
if(_sh.GetCount())
|
||||||
|
_sh.Select(1,0); // update the realmsocket
|
||||||
|
//else
|
||||||
|
// socket invalid
|
||||||
|
|
||||||
|
_wsession->Update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
printf("%s\n",ver);
|
||||||
|
for(unsigned int temp=0;temp<=strlen(ver);temp++)printf("~");printf("\n");
|
||||||
|
printf("[Compiled on: %s , %s]\n\n",__DATE__,__TIME__);
|
||||||
|
if (!initproc()) quitproc_error();
|
||||||
|
|
||||||
|
bool _auth_sent=false;
|
||||||
|
bool _first_wpacket=true;
|
||||||
|
clock_t ping_time=clock()-25000;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
if(something_went_wrong){
|
||||||
|
if(inworld){
|
||||||
|
SendChatMessage(CHAT_MSG_YELL,0,"ERROR! Something went wrong, exiting...","");
|
||||||
|
}
|
||||||
|
printf("!!! Something went wrong, proc halted.!!!\n");
|
||||||
|
ctrlCon.Close();
|
||||||
|
worldCon.Close();
|
||||||
|
realmCon.Close();
|
||||||
|
if(exitonerror)quitproc();
|
||||||
|
while(true)SDL_Delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !realmCon.IsConnected() && !worldCon.IsConnected() && !something_went_wrong){
|
||||||
|
printf("Opening realm TCP connection <%s:%d>\n",realmlist,rs_port);
|
||||||
|
while(!realmCon.ConnectTo(realmlist,rs_port));
|
||||||
|
_auth_sent=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(realmCon.IsConnected() && !worldCon.IsConnected() && !something_went_wrong){
|
||||||
|
if(!_auth_sent){
|
||||||
|
CLIENT_LOGON_CHALLENGE(accname, accpass);
|
||||||
|
_auth_sent=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(realmCon.HasData()){
|
||||||
|
Buf buf;
|
||||||
|
buf=realmCon.GetData();
|
||||||
|
rs_parser(buf.str,buf.len); // TODO: change type to Buf (also the func arg!)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while(worldCon.GetBufferLevel()>1){
|
||||||
|
////DEBUG3(
|
||||||
|
// printf("WS_IN, %d bytes. Buffer Level=%u\n",worldCon.GetKeepData().len,worldCon.GetBufferLevel());
|
||||||
|
// printchex(worldCon.GetKeepData().str,worldCon.GetKeepData().len,true);
|
||||||
|
//)
|
||||||
|
//_first_wpacket=false;
|
||||||
|
ByteBuffer pk2;
|
||||||
|
pk2.append(worldCon.GetDataString());
|
||||||
|
pk2.resize(pk2.size()-1);
|
||||||
|
HandleWorldPacket(pk2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// this covers the first serverseed packet, which get sometimes merged into 1 packet instead of 2
|
||||||
|
if(worldCon.HasData() && _first_wpacket && worldCon.GetKeepData().len==8){
|
||||||
|
_first_wpacket=false;
|
||||||
|
ByteBuffer pk2;
|
||||||
|
pk2.append(worldCon.GetDataString());
|
||||||
|
pk2.resize(pk2.size()-1);
|
||||||
|
HandleWorldPacket(pk2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!worldCon.IsConnected() && inworld){
|
||||||
|
printf("Disconnected from World server!\n");
|
||||||
|
inworld=false;
|
||||||
|
_first_wpacket=true;
|
||||||
|
_auth_sent=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(clock()-ping_time>30000)
|
||||||
|
{
|
||||||
|
ping_time=clock();
|
||||||
|
SendPing(ping_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SDL_Delay(idleSleepTime);
|
||||||
|
if (error)return error;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void _SaveAllCache(void){
|
||||||
|
bool result;
|
||||||
|
result=plrNameCache.SaveToFile();
|
||||||
|
// +++
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
PseuInstance::PseuInstance()
|
||||||
|
{
|
||||||
|
_ver="PseuWoW Alpha Build 12 dev 2" DEBUG_APPENDIX;
|
||||||
|
_ver_short="A12-dev1" DEBUG_APPENDIX;
|
||||||
|
_wsession=NULL;
|
||||||
|
_rsession=NULL;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PseuInstanceConf::PseuInstanceConf()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PseuInstanceConf::ApplyFromVarSet(VarSet &v)
|
||||||
|
{
|
||||||
|
debug=atoi(v.Get("DEBUG").c_str());
|
||||||
|
realmlist=v.Get("REALMLIST");
|
||||||
|
accname=v.Get("ACCNAME");
|
||||||
|
accpass=v.Get("ACCPASS");
|
||||||
|
exitonerror=(bool)atoi(v.Get("EXITONERROR").c_str());
|
||||||
|
realmport=atoi(v.Get("REALMPORT").c_str());
|
||||||
|
clientversion_string=v.Get("CLIENTVERSION");
|
||||||
|
clientbuild=atoi(v.Get("CLIENTBUILD").c_str());
|
||||||
|
clientlang=v.Get("CLIENTLANG");
|
||||||
|
realmname=v.Get("REALMNAME");
|
||||||
|
charname=v.Get("CHARNAME");
|
||||||
|
networksleeptime=atoi(v.Get("NETWORKSLEEPTIME").c_str());
|
||||||
|
|
||||||
|
// clientversion is a bit more complicated to add
|
||||||
|
{
|
||||||
|
std::string opt=clientversion_string + ".";
|
||||||
|
std::string num;
|
||||||
|
uint8 p=0;
|
||||||
|
for(uint8 i=0;i<opt.length();i++)
|
||||||
|
{
|
||||||
|
if(!isdigit(opt.at(i)))
|
||||||
|
{
|
||||||
|
clientversion[p]=(unsigned char)atoi(num.c_str());
|
||||||
|
num.clear();
|
||||||
|
p++;
|
||||||
|
if(p>2)
|
||||||
|
break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
num+=opt.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PseuInstanceConf::~PseuInstanceConf()
|
||||||
|
{
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
148
src/Client/PseuWoW.h
Normal file
148
src/Client/PseuWoW.h
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
|
||||||
|
#ifndef _PSEUWOW_H
|
||||||
|
#define _PSEUWOW_H
|
||||||
|
|
||||||
|
#include "../shared/common.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
#include "../shared/Network/SocketHandler.h"
|
||||||
|
|
||||||
|
|
||||||
|
class RealmSocket;
|
||||||
|
class WorldSession;
|
||||||
|
class Sockethandler;
|
||||||
|
|
||||||
|
class PseuInstanceConf
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
PseuInstanceConf();
|
||||||
|
~PseuInstanceConf();
|
||||||
|
void ApplyFromVarSet(VarSet &v);
|
||||||
|
|
||||||
|
|
||||||
|
uint8 debug;
|
||||||
|
std::string realmlist;
|
||||||
|
std::string accname;
|
||||||
|
std::string accpass;
|
||||||
|
bool exitonerror;
|
||||||
|
uint16 realmport;
|
||||||
|
uint16 worldport;
|
||||||
|
uint8 clientversion[3];
|
||||||
|
std::string clientversion_string;
|
||||||
|
uint16 clientbuild;
|
||||||
|
std::string clientlang;
|
||||||
|
std::string realmname;
|
||||||
|
std::string charname;
|
||||||
|
std::string worldhost;
|
||||||
|
uint16 networksleeptime;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class PseuInstance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
PseuInstance();
|
||||||
|
~PseuInstance();
|
||||||
|
|
||||||
|
|
||||||
|
WorldSession *GetWSession(void);
|
||||||
|
RealmSocket *GetRSession(void);
|
||||||
|
PseuInstanceConf *GetConf(void);
|
||||||
|
DefScriptPackage *GetScripts(void);
|
||||||
|
void SetConfDir(std::string);
|
||||||
|
void SetScpDir(std::string);
|
||||||
|
void SetSessionKey(BigNumber);
|
||||||
|
BigNumber GetSessionKey(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool Init();
|
||||||
|
void SaveAllCache(void);
|
||||||
|
void Stop(void) { _stop = true; }
|
||||||
|
void Quit(void);
|
||||||
|
void Run(void);
|
||||||
|
void Update(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
RealmSocket *_rsession;
|
||||||
|
WorldSession *_wsession;
|
||||||
|
PseuInstanceConf *_conf;
|
||||||
|
DefScriptPackage *_scp;
|
||||||
|
std::string _confdir,_scpdir;
|
||||||
|
bool _initialized;
|
||||||
|
bool _stop;
|
||||||
|
BigNumber _sessionkey;
|
||||||
|
char *_ver,*_ver_short;
|
||||||
|
SocketHandler _sh;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class PseuInstanceRunnable : public ZThread::Runnable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void run();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// OBOELETE
|
||||||
|
/*
|
||||||
|
|
||||||
|
class SDLTCPConnection;
|
||||||
|
class DefScriptPackage;
|
||||||
|
class PlayerNameCache;
|
||||||
|
class VarSet;
|
||||||
|
|
||||||
|
extern char DEBUG;
|
||||||
|
extern char *ver;
|
||||||
|
extern char *realmlist,*accname,*accpass,*realmname;
|
||||||
|
extern bool quit,quitted,exitonerror;
|
||||||
|
extern unsigned char error;
|
||||||
|
extern unsigned char clientversion[3];
|
||||||
|
extern unsigned short clientbuild;
|
||||||
|
extern char clientlang[4];
|
||||||
|
extern bool something_went_wrong;
|
||||||
|
|
||||||
|
extern unsigned int c_port;
|
||||||
|
extern bool allowcontroller;
|
||||||
|
extern char *c_password;
|
||||||
|
|
||||||
|
extern unsigned int rs_port;
|
||||||
|
extern unsigned short clientbuild;
|
||||||
|
extern char clientlang[4];
|
||||||
|
|
||||||
|
extern unsigned int ws_port;
|
||||||
|
extern std::string worldhost, charname;
|
||||||
|
extern SDLTCPConnection worldCon,realmCon,ctrlCon;
|
||||||
|
extern bool inworld;
|
||||||
|
extern unsigned short idleSleepTime;
|
||||||
|
|
||||||
|
extern DefScriptPackage defScp;
|
||||||
|
extern std::string defScpPath;
|
||||||
|
|
||||||
|
extern PlayerNameCache plrNameCache;
|
||||||
|
|
||||||
|
extern VarSet playerPermissions;
|
||||||
|
|
||||||
|
extern uint64 _myGUID, _targetGUID, _followGUID;
|
||||||
|
|
||||||
|
|
||||||
|
// --- Some Functions ---
|
||||||
|
|
||||||
|
void quitproc_error(void);
|
||||||
|
void quitproc(void);
|
||||||
|
void _SaveAllCache(void);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
84
src/Client/PseuWoW.rc
Normal file
84
src/Client/PseuWoW.rc
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource1.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// German (Germany) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
IDI_ICON1 ICON "Pseu1.ico"
|
||||||
|
#endif // German (Germany) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource1.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
BIN
src/Client/RCa00480
Normal file
BIN
src/Client/RCa00480
Normal file
Binary file not shown.
34
src/Client/ReadMe.txt
Normal file
34
src/Client/ReadMe.txt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
========================================================================
|
||||||
|
CONSOLE APPLICATION : PseuWoW
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
|
||||||
|
AppWizard has created this PseuWoW application for you.
|
||||||
|
|
||||||
|
This file contains a summary of what you will find in each of the files that
|
||||||
|
make up your PseuWoW application.
|
||||||
|
|
||||||
|
PseuWoW.dsp
|
||||||
|
This file (the project file) contains information at the project level and
|
||||||
|
is used to build a single project or subproject. Other users can share the
|
||||||
|
project (.dsp) file, but they should export the makefiles locally.
|
||||||
|
|
||||||
|
PseuWoW.cpp
|
||||||
|
This is the main application source file.
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
Other standard files:
|
||||||
|
|
||||||
|
StdAfx.h, StdAfx.cpp
|
||||||
|
These files are used to build a precompiled header (PCH) file
|
||||||
|
named PseuWoW.pch and a precompiled types file named StdAfx.obj.
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
Other notes:
|
||||||
|
|
||||||
|
AppWizard uses "TODO:" to indicate parts of the source code you
|
||||||
|
should add to or customize.
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
150
src/Client/Realm/RealmAuth.cpp_
Normal file
150
src/Client/Realm/RealmAuth.cpp_
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
#include "basics.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "RealmAuth.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
|
#include "Auth/Sha1.h"
|
||||||
|
#include "realmfunc.h"
|
||||||
|
|
||||||
|
#define BNLEN 32 // length of the hard-coded N blizz uses, has been 32 since the first alpha of WoW
|
||||||
|
|
||||||
|
extern BigNumber sessionkey; // defined in WorldPacketHandler.cpp
|
||||||
|
|
||||||
|
void ProcessClientLogonProof(char *pkt){
|
||||||
|
BigNumber N,A,B,a,u,x,v,S,salt,unk1,g,k(3); // init BNs, default k to 3
|
||||||
|
char _auth[128];
|
||||||
|
strcpy(_auth,strupr(accname));
|
||||||
|
strcat(_auth,":");
|
||||||
|
strcat(_auth,strupr(accpass));
|
||||||
|
DEBUG3(printf("Authentication String=\"%s\"\n",_auth);)
|
||||||
|
char N_str[BNLEN+1],g_str[2],salt_str[BNLEN+1],unk1_str[16+1],B_str[BNLEN+1]; // +1 for '\0'
|
||||||
|
|
||||||
|
// extract data from packet
|
||||||
|
memcpy(B_str,&pkt[3],32);B_str[32]=0;
|
||||||
|
memcpy(g_str,&pkt[36],1);g_str[1]=0;
|
||||||
|
memcpy(N_str,&pkt[38],32);N_str[32]=0;
|
||||||
|
memcpy(salt_str,&pkt[70],32);salt_str[32]=0;
|
||||||
|
memcpy(unk1_str,&pkt[102],16);unk1_str[16]=0;
|
||||||
|
|
||||||
|
// debug output
|
||||||
|
DEBUG3(printchex(B_str,BNLEN,true);)
|
||||||
|
DEBUG3(printchex(g_str,1,true);)
|
||||||
|
DEBUG3(printchex(N_str,BNLEN,true);)
|
||||||
|
DEBUG3(printchex(salt_str,BNLEN,true);)
|
||||||
|
DEBUG3(printchex(unk1_str,16,true);)
|
||||||
|
|
||||||
|
// convert into BigNumbers
|
||||||
|
B.SetBinary((const uint8*)B_str,BNLEN);
|
||||||
|
g.SetBinary((const uint8*)g_str,1);
|
||||||
|
N.SetBinary((const uint8*)N_str,BNLEN);
|
||||||
|
salt.SetBinary((const uint8*)salt_str,BNLEN);
|
||||||
|
unk1.SetBinary((const uint8*)unk1_str,16);
|
||||||
|
|
||||||
|
// client-side BN calculations:
|
||||||
|
DEBUG3(printf("--> k=%s\n",k.AsHexStr());)
|
||||||
|
a.SetRand(19*8);
|
||||||
|
Sha1Hash userhash,xhash,uhash;
|
||||||
|
std::string _authstr(_auth);
|
||||||
|
userhash.UpdateData(_authstr);
|
||||||
|
userhash.Finalize();
|
||||||
|
xhash.UpdateData(salt.AsByteArray(),salt.GetNumBytes());
|
||||||
|
xhash.UpdateData(userhash.GetDigest(),userhash.GetLength());
|
||||||
|
xhash.Finalize();
|
||||||
|
x.SetBinary(xhash.GetDigest(),xhash.GetLength());
|
||||||
|
DEBUG3(printf("--> x=%s\n",x.AsHexStr());)
|
||||||
|
v=g.ModExp(x,N);
|
||||||
|
DEBUG3(printf("--> v=%s\n",v.AsHexStr());)
|
||||||
|
A=g.ModExp(a,N);
|
||||||
|
DEBUG3(printf("--> A=%s\n",A.AsHexStr());)
|
||||||
|
uhash.UpdateBigNumbers(&A, &B, NULL);
|
||||||
|
uhash.Finalize();
|
||||||
|
u.SetBinary(uhash.GetDigest(), 20);
|
||||||
|
DEBUG3(printf("--> u=%s\n",u.AsHexStr());)
|
||||||
|
S=(B - k*g.ModExp(x,N) ).ModExp((a + u * x),N);
|
||||||
|
DEBUG3(printf("--> S=%s\n",S.AsHexStr());)
|
||||||
|
|
||||||
|
// calc M1 & M2
|
||||||
|
unsigned int i=0;
|
||||||
|
char S1[16+1],S2[16+1]; // 32/2=16 :) +1 for \0
|
||||||
|
// split it into 2 seperate strings, interleaved
|
||||||
|
|
||||||
|
for(i=0;i<=15;i++){
|
||||||
|
S1[i]=S.AsByteArray()[i*2];
|
||||||
|
S2[i]=S.AsByteArray()[i*2+1];
|
||||||
|
}
|
||||||
|
//printchex(S1);printchex(S2);
|
||||||
|
// hash each one:
|
||||||
|
Sha1Hash S1hash,S2hash;
|
||||||
|
S1hash.UpdateData((const uint8*)S1,16);
|
||||||
|
S1hash.Finalize();
|
||||||
|
S2hash.UpdateData((const uint8*)S2,16);
|
||||||
|
S2hash.Finalize();
|
||||||
|
// Re-combine them
|
||||||
|
char S_hash[40+1]; // 2*Sha1Len+1 for \0
|
||||||
|
for(i=0;i<20;i++){
|
||||||
|
S_hash[i*2]=S1hash.GetDigest()[i];
|
||||||
|
S_hash[i*2+1]=S2hash.GetDigest()[i];
|
||||||
|
}
|
||||||
|
sessionkey.SetBinary((uint8*)S_hash,40); // used later when authing to world
|
||||||
|
//printf("-> S_hash=");printchex(S_hash,40,true);
|
||||||
|
|
||||||
|
char Ng_hash[20+1];
|
||||||
|
Sha1Hash userhash2,Nhash,ghash;
|
||||||
|
userhash2.UpdateData((const uint8*)strupr(accname),strlen(accname));
|
||||||
|
userhash2.Finalize();
|
||||||
|
//printchex((char*)userhash2.GetDigest(),userhash2.GetLength(),true);
|
||||||
|
Nhash.UpdateBigNumbers(&N,NULL);
|
||||||
|
Nhash.Finalize();
|
||||||
|
ghash.UpdateBigNumbers(&g,NULL);
|
||||||
|
ghash.Finalize();
|
||||||
|
for(i=0;i<20;i++)Ng_hash[i] = Nhash.GetDigest()[i]^ghash.GetDigest()[i];
|
||||||
|
//printchex(Ng_hash,20,true);
|
||||||
|
|
||||||
|
BigNumber t_acc,t_Ng_hash;
|
||||||
|
t_acc.SetBinary((const uint8*)userhash2.GetDigest(),userhash2.GetLength());
|
||||||
|
t_Ng_hash.SetBinary((const uint8*)Ng_hash,20);
|
||||||
|
|
||||||
|
|
||||||
|
Sha1Hash M1hash,M2hash;
|
||||||
|
|
||||||
|
M1hash.UpdateBigNumbers(&t_Ng_hash,&t_acc,&salt,&A,&B,NULL);
|
||||||
|
M1hash.UpdateData((const uint8*)S_hash,40);
|
||||||
|
M1hash.Finalize();
|
||||||
|
|
||||||
|
M2hash.UpdateBigNumbers(&A,NULL);
|
||||||
|
M2hash.UpdateData((const uint8*)M1hash.GetDigest(),M1hash.GetLength());
|
||||||
|
M2hash.UpdateData((const uint8*)S_hash,40);
|
||||||
|
M2hash.Finalize();
|
||||||
|
|
||||||
|
|
||||||
|
DEBUG3(
|
||||||
|
printf("--> M1=");printchex((char*)M1hash.GetDigest(),20,true);\
|
||||||
|
printf("--> M2=");printchex((char*)M2hash.GetDigest(),20,true);\
|
||||||
|
)
|
||||||
|
|
||||||
|
// Calc CRC & CRC_hash
|
||||||
|
// i don't know yet how to calc it, so set it to zero
|
||||||
|
char crc_hash[20+1];
|
||||||
|
nullify(crc_hash,20);
|
||||||
|
|
||||||
|
|
||||||
|
// now lets prepare the packet
|
||||||
|
DEBUG2(printf("Calculations finished, preparing packet...\n");)
|
||||||
|
char outpkt[100];
|
||||||
|
memset(outpkt,0,100);
|
||||||
|
outpkt[0]=0x01; // opcode: CLIENT_GOGON_PROOF
|
||||||
|
memcpy(&outpkt[1],A.AsByteArray(),BNLEN);
|
||||||
|
memcpy(&outpkt[33],M1hash.GetDigest(),M1hash.GetLength());
|
||||||
|
memcpy(&outpkt[53],crc_hash,20); // TODO: as soon as crc_hash is calculated, correct this line!
|
||||||
|
outpkt[73]=0; // number_of_keys=0
|
||||||
|
outpkt[74]=0; // unk=0 (added in 1.12.1)
|
||||||
|
DEBUG3(printf("... finished, packet content=");printchex(outpkt,73,true);)
|
||||||
|
memcpy(Auth_M2,M2hash.GetDigest(),M2hash.GetLength()); // save M2 to an extern var to check it later
|
||||||
|
DEBUG2(printf("Sending packet\n");)
|
||||||
|
if(clientbuild>5302)
|
||||||
|
realmCon.Send(outpkt,75); // 1.11.x and upwards
|
||||||
|
else
|
||||||
|
realmCon.Send(outpkt,74); // < 1.11.x compatibility
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/Client/Realm/RealmAuth.h_
Normal file
6
src/Client/Realm/RealmAuth.h_
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef _REALMAUTH_H
|
||||||
|
#define _REALMAUTH_H
|
||||||
|
|
||||||
|
void ProcessClientLogonProof(char*);
|
||||||
|
|
||||||
|
#endif
|
||||||
62
src/Client/Realm/RealmListHandler.cpp_
Normal file
62
src/Client/Realm/RealmListHandler.cpp_
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#include "basics.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "Auth/ByteBuffer.h"
|
||||||
|
#include "RealmListHandler.h"
|
||||||
|
#include "realmfunc.h"
|
||||||
|
|
||||||
|
// process a given realmlist packet
|
||||||
|
|
||||||
|
struct SRealmInfo
|
||||||
|
{
|
||||||
|
uint32 icon; // icon near realm
|
||||||
|
uint8 color; // color of record
|
||||||
|
std::string name; // Text zero terminated name of Realm
|
||||||
|
std::string addr_port; // Text zero terminated address of Realm ("ip:port")
|
||||||
|
float population; // 1.6 -> population value. lower == lower population and vice versa
|
||||||
|
uint8 chars_here; // number of characters on this server
|
||||||
|
uint8 timezone; // timezone
|
||||||
|
uint8 unknown; //
|
||||||
|
} * realms;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool HandleRealmList(ByteBuffer pkt){
|
||||||
|
uint8 PosOfRealm=0;
|
||||||
|
bool FoundRealm=false;
|
||||||
|
uint32 i=0,pktpos=0, unk1=0;
|
||||||
|
uint16 datalen;
|
||||||
|
uint8 count, trash;
|
||||||
|
pkt >> trash >> datalen >> unk1 >> count;
|
||||||
|
DEBUG3(printf("Length of realm data: %d\n",datalen);)
|
||||||
|
DEBUG1(printf("Realms in List: %d\n",count););
|
||||||
|
if(count==0)
|
||||||
|
something_went_wrong=true;
|
||||||
|
realms=new SRealmInfo[count];
|
||||||
|
for(i=0;i<count;i++){
|
||||||
|
pkt >> realms[i].icon >> realms[i].color >> realms[i].name >> realms[i].addr_port >> realms[i].population >> realms[i].chars_here >> realms[i].timezone >> realms[i].unknown;
|
||||||
|
if(stricmp(realmname,realms[i].name.c_str())==0){PosOfRealm=i;FoundRealm=true;}
|
||||||
|
printf("Realm: %s (%s)",realms[i].name.c_str(),realms[i].addr_port.c_str());
|
||||||
|
DEBUG1(printf("[chars:%d][population:%f][timezone:%d]",realms[i].chars_here,realms[i].population,realms[i].timezone););
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
// the rest of the packet is not interesting
|
||||||
|
|
||||||
|
// now setup where the woldserver is and how to login there
|
||||||
|
if(!FoundRealm){
|
||||||
|
printf("Realm \"%s\" was not found on the realmlist!\n",realmname);
|
||||||
|
something_went_wrong=true;
|
||||||
|
realmCon.Close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// transform "hostname:port" into something useful
|
||||||
|
// -> convert the worldserver port from string to int
|
||||||
|
// -> and remove it from the hostname, then write the remains into worldhost
|
||||||
|
|
||||||
|
uint16 colonpos=realms[PosOfRealm].addr_port.find(":");
|
||||||
|
worldhost=realms[PosOfRealm].addr_port.substr(0,colonpos);
|
||||||
|
ws_port=atoi(realms[PosOfRealm].addr_port.substr(colonpos+1,realms[PosOfRealm].addr_port.length()-colonpos-1).c_str());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
6
src/Client/Realm/RealmListHandler.h_
Normal file
6
src/Client/Realm/RealmListHandler.h_
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef _REALMLISTHANDLER_H
|
||||||
|
#define _REALMLISTHANDLER_H
|
||||||
|
|
||||||
|
bool HandleRealmList(ByteBuffer);
|
||||||
|
|
||||||
|
#endif
|
||||||
466
src/Client/Realm/RealmSocket.cpp
Normal file
466
src/Client/Realm/RealmSocket.cpp
Normal file
@ -0,0 +1,466 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "Auth/ByteBuffer.h"
|
||||||
|
#include "Auth/Sha1.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
|
#include "RealmSocket.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum AuthCmd
|
||||||
|
{
|
||||||
|
AUTH_LOGON_CHALLENGE = 0x00,
|
||||||
|
AUTH_LOGON_PROOF = 0x01,
|
||||||
|
REALM_LIST = 0x10,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SRealmHeader
|
||||||
|
{
|
||||||
|
uint8 cmd; // OP code = CMD_REALM_LIST
|
||||||
|
uint16 size; // size of the rest of packet, without this part
|
||||||
|
uint32 unknown; // 0x00 00 00 00
|
||||||
|
uint8 count; // quantity of realms
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SRealmInfo
|
||||||
|
{
|
||||||
|
uint32 icon; // icon near realm
|
||||||
|
uint8 color; // color of record
|
||||||
|
std::string name; // Text zero terminated name of Realm
|
||||||
|
std::string addr_port; // Text zero terminated address of Realm ("ip:port")
|
||||||
|
float population; // 1.6 -> population value. lower == lower population and vice versa
|
||||||
|
uint8 chars_here; // number of characters on this server
|
||||||
|
uint8 timezone; // timezone
|
||||||
|
uint8 unknown; //
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AuthHandler
|
||||||
|
{
|
||||||
|
uint32 cmd;
|
||||||
|
void (RealmSocket::*handler)(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sAuthLogonChallenge_S
|
||||||
|
{
|
||||||
|
uint8 cmd;
|
||||||
|
uint8 error;
|
||||||
|
uint8 unk2;
|
||||||
|
uint8 B[32];
|
||||||
|
uint8 g_len;
|
||||||
|
uint8 g[1];
|
||||||
|
uint8 N_len;
|
||||||
|
uint8 N[32];
|
||||||
|
uint8 salt[32];
|
||||||
|
uint8 unk3[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sAuthLogonProof_S
|
||||||
|
{
|
||||||
|
uint8 cmd;
|
||||||
|
uint8 error;
|
||||||
|
uint8 M2[20];
|
||||||
|
uint32 unk2;
|
||||||
|
};
|
||||||
|
|
||||||
|
const AuthHandler table[]=
|
||||||
|
{
|
||||||
|
{AUTH_LOGON_CHALLENGE,&RealmSocket::_HandleLogonChallenge},
|
||||||
|
{AUTH_LOGON_PROOF,&RealmSocket::_HandleLogonProof},
|
||||||
|
{REALM_LIST,&RealmSocket::_HandleRealmList},
|
||||||
|
{0,NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
RealmSocket::RealmSocket(SocketHandler& h) : TcpSocket(h)
|
||||||
|
{
|
||||||
|
_instance=NULL;
|
||||||
|
_valid=false;
|
||||||
|
_rport=3724;
|
||||||
|
}
|
||||||
|
|
||||||
|
RealmSocket::~RealmSocket()
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RealmSocket::IsValid(void)
|
||||||
|
{
|
||||||
|
return _valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RealmSocket::SetHost(std::string h)
|
||||||
|
{
|
||||||
|
_rhost=h;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RealmSocket::SetPort(uint16 p)
|
||||||
|
{
|
||||||
|
_rport=p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RealmSocket::SetInstance(PseuInstance *pi)
|
||||||
|
{
|
||||||
|
_instance=pi;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RealmSocket::Start(void)
|
||||||
|
{
|
||||||
|
if(this->_rhost.empty() || _rport==0 || !_valid || _instance==NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// _socket.Init()
|
||||||
|
// _socket.SetHost(_host);
|
||||||
|
// _socket.SetPort(_port);
|
||||||
|
Open(_rhost,_rport);
|
||||||
|
//...
|
||||||
|
_valid=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RealmSocket::Stop(void)
|
||||||
|
{
|
||||||
|
_valid=false;
|
||||||
|
this->Close();
|
||||||
|
memset(_m2,0,20);
|
||||||
|
_key=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RealmSocket::_HandleRealmList(void)
|
||||||
|
{
|
||||||
|
SRealmHeader hd;
|
||||||
|
std::string realmAddr;
|
||||||
|
ibuf.Read((char*)&hd, sizeof(SRealmHeader)); // TODO: FIX THIS ITS NOT CORRECT!!!!!
|
||||||
|
|
||||||
|
|
||||||
|
////DEBUG1(printf("Realms in List: %d\n",count););
|
||||||
|
// no realm?!
|
||||||
|
if(hd.count==0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// alloc space for as many realms as needed
|
||||||
|
SRealmInfo *realms=new SRealmInfo[hd.count];
|
||||||
|
|
||||||
|
// readout realms
|
||||||
|
for(uint8 i=0;i<hd.count;i++)
|
||||||
|
ibuf.Read((char*)&realms[i], sizeof(SRealmInfo));
|
||||||
|
// the rest of the packet is not interesting
|
||||||
|
|
||||||
|
for(uint8 i=0;i<hd.count;i++)
|
||||||
|
{
|
||||||
|
if(realms[i].name==GetInstance()->GetConf()->realmname)
|
||||||
|
{
|
||||||
|
realmAddr=realms[i].addr_port;
|
||||||
|
}
|
||||||
|
printf("Realm: %s (%s)",realms[i].name.c_str(),realms[i].addr_port.c_str());
|
||||||
|
printf("[chars:%d][population:%f][timezone:%d]",realms[i].chars_here,realms[i].population,realms[i].timezone);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// now setup where the woldserver is and how to login there
|
||||||
|
if(realmAddr.empty()){
|
||||||
|
printf("Realm \"%s\" was not found on the realmlist!\n",GetInstance()->GetConf()->realmname.c_str());
|
||||||
|
//something_went_wrong=true;
|
||||||
|
//realmCon.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// transform "hostname:port" into something useful
|
||||||
|
// -> convert the worldserver port from string to int
|
||||||
|
// -> write it into the config & set appropriate vars
|
||||||
|
|
||||||
|
uint16 colonpos=realmAddr.find(":");
|
||||||
|
GetInstance()->GetConf()->worldhost=realmAddr.substr(0,colonpos);
|
||||||
|
GetInstance()->GetConf()->worldport=atoi(realmAddr.substr(colonpos+1,realmAddr.length()-colonpos-1).c_str());
|
||||||
|
// set vars
|
||||||
|
GetInstance()->GetScripts()->variables.Set("WORLDHOST",GetInstance()->GetConf()->worldhost);
|
||||||
|
GetInstance()->GetScripts()->variables.Set("WORLDPORT",toString((uint64)(GetInstance()->GetConf()->worldport)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RealmSocket::OnRead(void)
|
||||||
|
{
|
||||||
|
TcpSocket::OnRead();
|
||||||
|
if(!ibuf.GetLength())
|
||||||
|
return;
|
||||||
|
uint8 cmd, i=0;
|
||||||
|
ibuf.SoftRead((char*)&cmd, 1);
|
||||||
|
while(table[i].handler!=NULL)
|
||||||
|
{
|
||||||
|
if(table[i].cmd==cmd)
|
||||||
|
{
|
||||||
|
(*this.*table[i].handler)();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// unk packet
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
switch(rs_state){
|
||||||
|
unsigned int i;
|
||||||
|
case 1:{
|
||||||
|
if(pkt[2]==4){
|
||||||
|
printf("Realm Server did not find account \"%s\"!\n",accname);
|
||||||
|
something_went_wrong=true;
|
||||||
|
realmCon.Close();
|
||||||
|
} else
|
||||||
|
if(pkt[2]==6){
|
||||||
|
printf("Account \"%s\" is already logged in!\n",accname);
|
||||||
|
realmCon.Close();
|
||||||
|
something_went_wrong=true;
|
||||||
|
} else
|
||||||
|
if(pkt[2]!=0){
|
||||||
|
printf("Unknown realm server response! opcode=0x%x\n",(unsigned char)pkt[2]);
|
||||||
|
something_went_wrong=true;
|
||||||
|
realmCon.Close();
|
||||||
|
} else
|
||||||
|
if(pkt[2]==0){
|
||||||
|
//DEBUG1(printf("Login successful, now calculating proof packet...\n"););
|
||||||
|
ProcessClientLogonProof(pkt);
|
||||||
|
rs_state=2; // 2=waiting for server proof
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
|
||||||
|
case 2:{
|
||||||
|
if(pkt[1]==4){
|
||||||
|
printf("Wrong password!\n");
|
||||||
|
something_went_wrong=true;
|
||||||
|
realmCon.Close();
|
||||||
|
} else
|
||||||
|
if(pkt[0]==1 && pkt[1]==0 && memcmp(&pkt[2],Auth_M2,20)!=0){
|
||||||
|
printf("Something with Authenticating went wrong, although the password seems correct!\n");
|
||||||
|
//DEBUG1(printf("-> expected M2=");printchex(Auth_M2,20,true);)
|
||||||
|
//DEBUG1(printf("-> got M2=");printchex(&pkt[2],20,true);)
|
||||||
|
something_went_wrong=true;
|
||||||
|
realmCon.Close();
|
||||||
|
} else
|
||||||
|
if(pkt[0]==1 && pkt[1]==0 && memcmp(&pkt[2],Auth_M2,20)==0){
|
||||||
|
printf("Password is correct!! Requesting Realmlist.\n");
|
||||||
|
rs_state=3; // requesting realmlist
|
||||||
|
// Request Realmlist
|
||||||
|
char realmrequest[]={0x10,0,0,0,0}; // 0x10 is opcode, rest is an uint32, nulled
|
||||||
|
realmCon.Send(realmrequest,5);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("Unknown ErrorID recieved, check the packet hexdump.\n");
|
||||||
|
printf("-> IDs=");printchex(pkt,2,true);
|
||||||
|
something_went_wrong=true;
|
||||||
|
realmCon.Close();
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
|
||||||
|
case 3:{
|
||||||
|
if(pkt[0]!=0x10){
|
||||||
|
printf("Expected a realmlist packet, got something different. opcode=0x%x\n",(unsigned char)pkt[0]);
|
||||||
|
something_went_wrong=true;
|
||||||
|
realmCon.Close();
|
||||||
|
}
|
||||||
|
ByteBuffer bbuf;
|
||||||
|
bbuf.append(pkt,size);
|
||||||
|
if(HandleRealmList(bbuf)==true){
|
||||||
|
printf("Connecting to realm \"%s\" at \"%s\", port %d\n",realmname,worldhost.c_str(),ws_port);
|
||||||
|
while(!worldCon.IsConnected()){
|
||||||
|
worldCon.ConnectTo((char*)worldhost.c_str(),ws_port); // init world server connection, we have all info we need to enter
|
||||||
|
}
|
||||||
|
realmCon.Close(); // close the realm server connection, its no longer needed now
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
// more?
|
||||||
|
default:{
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void RealmSocket::SendLogonChallenge(void)
|
||||||
|
{
|
||||||
|
std::string acc = stringToUpper(GetInstance()->GetConf()->accname);
|
||||||
|
ByteBuffer packet;
|
||||||
|
packet << (uint8)AUTH_LOGON_CHALLENGE;
|
||||||
|
packet << (uint8)2;
|
||||||
|
packet << (uint8)(acc.length()+30); // length of the rest of the packet
|
||||||
|
packet << "WOW"; // game name = World Of Warcraft
|
||||||
|
packet.append(GetInstance()->GetConf()->clientversion,3); // 1.12.2 etc
|
||||||
|
packet << GetInstance()->GetConf()->clientbuild; // (uint16) 5875
|
||||||
|
packet << "68x" << "niW"; // "x86" - platform; "Win" - Operating system; both reversed and zero terminated
|
||||||
|
for(uint8 i=2;i>0;i--)
|
||||||
|
packet << (uint8)GetInstance()->GetConf()->clientlang[i]; // "enUS" -> "SUne" : reversed and NOT zero terminated
|
||||||
|
packet << (uint32)0x3c; // timezone
|
||||||
|
packet << (uint32)GetClientRemoteAddr(); // my IP address
|
||||||
|
packet << (uint8)acc.length(); // length of acc name without \0
|
||||||
|
packet.append(acc.c_str(),acc.length()); // append accname, skip \0
|
||||||
|
|
||||||
|
this->SendBuf((char*)packet.contents(),packet.size());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PseuInstance *RealmSocket::GetInstance(void)
|
||||||
|
{
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RealmSocket::_HandleLogonChallenge(void)
|
||||||
|
{
|
||||||
|
sAuthLogonChallenge_S lc;
|
||||||
|
ibuf.Read((char*)&lc, sizeof(sAuthLogonChallenge_S));
|
||||||
|
|
||||||
|
switch (lc.error)
|
||||||
|
{
|
||||||
|
case 4:
|
||||||
|
printf("Realm Server did not find account \"%s\"!\n",GetInstance()->GetConf()->accname.c_str());
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
printf("Account \"%s\" is already logged in!\n",GetInstance()->GetConf()->accname.c_str());
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
printf("Login successful, now calculating proof packet...\n");
|
||||||
|
|
||||||
|
// now lets start calculating
|
||||||
|
BigNumber N,A,B,a,u,x,v,S,salt,unk1,g,k(3); // init BNs, default k to 3
|
||||||
|
std::string user=stringToUpper( GetInstance()->GetConf()->accname );
|
||||||
|
std::string _authstr=stringToUpper( user +":"+GetInstance()->GetConf()->accpass );
|
||||||
|
|
||||||
|
B.SetBinary(lc.B,32);
|
||||||
|
g.SetBinary(lc.g,lc.g_len);
|
||||||
|
N.SetBinary(lc.N,lc.N_len);
|
||||||
|
salt.SetBinary(lc.salt,32);
|
||||||
|
unk1.SetBinary(lc.unk3,16);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// debug output
|
||||||
|
//DEBUG3(printchex(B_str,BNLEN,true);)
|
||||||
|
//DEBUG3(printchex(g_str,1,true);)
|
||||||
|
//DEBUG3(printchex(N_str,BNLEN,true);)
|
||||||
|
//DEBUG3(printchex(salt_str,BNLEN,true);)
|
||||||
|
//DEBUG3(printchex(unk1_str,16,true);)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// client-side BN calculations:
|
||||||
|
////DEBUG3(printf("--> k=%s\n",k.AsHexStr());)
|
||||||
|
a.SetRand(19*8);
|
||||||
|
Sha1Hash userhash,xhash,uhash;
|
||||||
|
userhash.UpdateData(_authstr);
|
||||||
|
userhash.Finalize();
|
||||||
|
xhash.UpdateData(salt.AsByteArray(),salt.GetNumBytes());
|
||||||
|
xhash.UpdateData(userhash.GetDigest(),userhash.GetLength());
|
||||||
|
xhash.Finalize();
|
||||||
|
x.SetBinary(xhash.GetDigest(),xhash.GetLength());
|
||||||
|
////DEBUG3(printf("--> x=%s\n",x.AsHexStr());)
|
||||||
|
v=g.ModExp(x,N);
|
||||||
|
////DEBUG3(printf("--> v=%s\n",v.AsHexStr());)
|
||||||
|
A=g.ModExp(a,N);
|
||||||
|
////DEBUG3(printf("--> A=%s\n",A.AsHexStr());)
|
||||||
|
uhash.UpdateBigNumbers(&A, &B, NULL);
|
||||||
|
uhash.Finalize();
|
||||||
|
u.SetBinary(uhash.GetDigest(), 20);
|
||||||
|
////DEBUG3(printf("--> u=%s\n",u.AsHexStr());)
|
||||||
|
S=(B - k*g.ModExp(x,N) ).ModExp((a + u * x),N);
|
||||||
|
////DEBUG3(printf("--> S=%s\n",S.AsHexStr());)
|
||||||
|
|
||||||
|
// calc M1 & M2
|
||||||
|
unsigned int i=0;
|
||||||
|
char S1[16+1],S2[16+1]; // 32/2=16 :) +1 for \0
|
||||||
|
// split it into 2 seperate strings, interleaved
|
||||||
|
for(i=0;i<=15;i++){
|
||||||
|
S1[i]=S.AsByteArray()[i*2];
|
||||||
|
S2[i]=S.AsByteArray()[i*2+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// hash each one:
|
||||||
|
Sha1Hash S1hash,S2hash;
|
||||||
|
S1hash.UpdateData((const uint8*)S1,16);
|
||||||
|
S1hash.Finalize();
|
||||||
|
S2hash.UpdateData((const uint8*)S2,16);
|
||||||
|
S2hash.Finalize();
|
||||||
|
// Re-combine them
|
||||||
|
char S_hash[40]; // 2*Sha1Len+1 for \0
|
||||||
|
for(i=0;i<20;i++){
|
||||||
|
S_hash[i*2]=S1hash.GetDigest()[i];
|
||||||
|
S_hash[i*2+1]=S2hash.GetDigest()[i];
|
||||||
|
}
|
||||||
|
_key.SetBinary((uint8*)S_hash,40); // used later when authing to world
|
||||||
|
|
||||||
|
char Ng_hash[20];
|
||||||
|
Sha1Hash userhash2,Nhash,ghash;
|
||||||
|
userhash2.UpdateData((const uint8*)user.c_str(),user.length());
|
||||||
|
userhash2.Finalize();
|
||||||
|
//printchex((char*)userhash2.GetDigest(),userhash2.GetLength(),true);
|
||||||
|
Nhash.UpdateBigNumbers(&N,NULL);
|
||||||
|
Nhash.Finalize();
|
||||||
|
ghash.UpdateBigNumbers(&g,NULL);
|
||||||
|
ghash.Finalize();
|
||||||
|
for(i=0;i<20;i++)Ng_hash[i] = Nhash.GetDigest()[i]^ghash.GetDigest()[i];
|
||||||
|
//printchex(Ng_hash,20,true);
|
||||||
|
|
||||||
|
BigNumber t_acc,t_Ng_hash;
|
||||||
|
t_acc.SetBinary((const uint8*)userhash2.GetDigest(),userhash2.GetLength());
|
||||||
|
t_Ng_hash.SetBinary((const uint8*)Ng_hash,20);
|
||||||
|
|
||||||
|
|
||||||
|
Sha1Hash M1hash,M2hash;
|
||||||
|
|
||||||
|
M1hash.UpdateBigNumbers(&t_Ng_hash,&t_acc,&salt,&A,&B,NULL);
|
||||||
|
M1hash.UpdateData((const uint8*)S_hash,40);
|
||||||
|
M1hash.Finalize();
|
||||||
|
|
||||||
|
M2hash.UpdateBigNumbers(&A,NULL);
|
||||||
|
M2hash.UpdateData((const uint8*)M1hash.GetDigest(),M1hash.GetLength());
|
||||||
|
M2hash.UpdateData((const uint8*)S_hash,40);
|
||||||
|
M2hash.Finalize();
|
||||||
|
|
||||||
|
|
||||||
|
////DEBUG3(
|
||||||
|
// printf("--> M1=");printchex((char*)M1hash.GetDigest(),20,true);\
|
||||||
|
// printf("--> M2=");printchex((char*)M2hash.GetDigest(),20,true);\
|
||||||
|
//)
|
||||||
|
|
||||||
|
// Calc CRC & CRC_hash
|
||||||
|
// i don't know yet how to calc it, so set it to zero
|
||||||
|
char crc_hash[20];
|
||||||
|
memset(crc_hash,0,20);
|
||||||
|
|
||||||
|
|
||||||
|
// now lets prepare the packet
|
||||||
|
ByteBuffer packet;
|
||||||
|
packet << (uint8)AUTH_LOGON_PROOF;
|
||||||
|
packet.append(A.AsByteArray(),A.GetNumBytes());
|
||||||
|
packet.append(M1hash.GetDigest(),M1hash.GetLength());
|
||||||
|
packet.append(crc_hash,20);
|
||||||
|
packet << (uint8)0; // number of keys = 0
|
||||||
|
|
||||||
|
if(GetInstance()->GetConf()->clientbuild > 5302)
|
||||||
|
packet << (uint8)0; // 1.11.x compatibility (needs one more 0)
|
||||||
|
|
||||||
|
GetInstance()->SetSessionKey(_key);
|
||||||
|
memcpy(this->_m2,M2hash.GetDigest(),M2hash.GetLength()); // save M2 to an extern var to check it later
|
||||||
|
|
||||||
|
SendBuf((char*)packet.contents(),packet.size());
|
||||||
|
break;
|
||||||
|
|
||||||
|
//default:
|
||||||
|
// printf("Unknown realm server response! opcode=0x%x\n",(unsigned char)lc.error);
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RealmSocket::_HandleLogonProof(void)
|
||||||
|
{
|
||||||
|
sAuthLogonProof_S lp;
|
||||||
|
ibuf.Read((char*)&lp, sizeof(sAuthLogonProof_S));
|
||||||
|
if(!memcmp(lp.M2,this->_m2,20))
|
||||||
|
{
|
||||||
|
// auth successful
|
||||||
|
ByteBuffer packet;
|
||||||
|
packet << (uint8)REALM_LIST;
|
||||||
|
packet << (uint32)0;
|
||||||
|
SendBuf((char*)packet.contents(),packet.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// auth failed, M2 differs
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
60
src/Client/Realm/RealmSocket.h
Normal file
60
src/Client/Realm/RealmSocket.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _REALMSOCKET_H
|
||||||
|
#define _REALMSOCKET_H
|
||||||
|
|
||||||
|
#include "Network/ResolvSocket.h"
|
||||||
|
|
||||||
|
class RealmSocket : public TcpSocket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RealmSocket(SocketHandler &h);
|
||||||
|
~RealmSocket();
|
||||||
|
PseuInstance *GetInstance(void);
|
||||||
|
bool IsValid(void);
|
||||||
|
void SetInstance(PseuInstance*);
|
||||||
|
|
||||||
|
void SetHost(std::string);
|
||||||
|
void SetPort(uint16);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Start(void);
|
||||||
|
void Stop(void);
|
||||||
|
void Update(void);
|
||||||
|
void SendLogonChallenge(void);
|
||||||
|
|
||||||
|
// dont use from outside!!
|
||||||
|
void _HandleRealmList(void);
|
||||||
|
void _HandleLogonProof(void);
|
||||||
|
void _HandleLogonChallenge(void);
|
||||||
|
|
||||||
|
void OnRead(void);
|
||||||
|
//void OnAccept(void);
|
||||||
|
void OnConnect(void);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint16 _rport;
|
||||||
|
std::string _rhost;
|
||||||
|
uint8 _m2[20];
|
||||||
|
PseuInstance *_instance;
|
||||||
|
BigNumber _key;
|
||||||
|
bool _valid;
|
||||||
|
ByteBuffer _data;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
BIN
src/Client/Script1.aps
Normal file
BIN
src/Client/Script1.aps
Normal file
Binary file not shown.
72
src/Client/Script1.rc
Normal file
72
src/Client/Script1.rc
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
//Microsoft Developer Studio generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// German (Germany) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
IDI_ICON1 ICON DISCARDABLE "Pseu1.ico"
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
#endif // German (Germany) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
68
src/Client/World/CMSGConstructor.cpp
Normal file
68
src/Client/World/CMSGConstructor.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "WorldPacket.h"
|
||||||
|
#include "Opcodes.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "WorldSession.h"
|
||||||
|
|
||||||
|
void WorldSession::SendChatMessage(uint32 type, uint32 lang, std::string msg, std::string to){
|
||||||
|
if((!_logged) || msg.empty())
|
||||||
|
return;
|
||||||
|
WorldPacket packet;
|
||||||
|
packet<<type<<lang;
|
||||||
|
switch(type){
|
||||||
|
case CHAT_MSG_SAY:
|
||||||
|
case CHAT_MSG_YELL:
|
||||||
|
case CHAT_MSG_PARTY:
|
||||||
|
case CHAT_MSG_GUILD:
|
||||||
|
case CHAT_MSG_OFFICER: // not sure about that
|
||||||
|
packet<<msg;
|
||||||
|
//DEBUG2(printf("W:CHAT->: \"%s\"\n",msg.c_str()););
|
||||||
|
break;
|
||||||
|
case CHAT_MSG_WHISPER:
|
||||||
|
if(to.empty())
|
||||||
|
return;
|
||||||
|
packet<<to<<msg;
|
||||||
|
break;
|
||||||
|
case CHAT_MSG_CHANNEL:
|
||||||
|
if(to.empty())
|
||||||
|
return;
|
||||||
|
// TODO: be sure the channel is joined before writing into this channel
|
||||||
|
packet<<to<<msg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
packet.SetOpcode(CMSG_MESSAGECHAT);
|
||||||
|
SendWorldPacket(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::SendQueryPlayerName(uint64 guid){
|
||||||
|
if((!_logged) || guid==0)
|
||||||
|
return;
|
||||||
|
WorldPacket packet;
|
||||||
|
packet << guid;
|
||||||
|
packet.SetOpcode(CMSG_NAME_QUERY);
|
||||||
|
SendWorldPacket(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::SendPing(uint32 ping){
|
||||||
|
if(!_logged)
|
||||||
|
return;
|
||||||
|
WorldPacket packet;
|
||||||
|
packet << ping;
|
||||||
|
packet.SetOpcode(CMSG_PING);
|
||||||
|
SendWorldPacket(packet);
|
||||||
|
//DEBUG2(printf("Sent CMSG_PING, clock=%u\n",ping););
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::SendEmote(uint32 id){
|
||||||
|
if(!_logged)
|
||||||
|
return;
|
||||||
|
WorldPacket packet;
|
||||||
|
packet << id << id << _targetGUID; // TODO: correct this!
|
||||||
|
packet.SetOpcode(CMSG_TEXT_EMOTE);
|
||||||
|
SendWorldPacket(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
817
src/Client/World/Opcodes.cpp
Normal file
817
src/Client/World/Opcodes.cpp
Normal file
@ -0,0 +1,817 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
#include "common.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
#include "Opcodes.h"
|
||||||
|
#include "NameTables.h"
|
||||||
|
|
||||||
|
NameTableEntry g_worldOpcodeNames[] =
|
||||||
|
{
|
||||||
|
|
||||||
|
{ MSG_NULL_ACTION, "MSG_NULL_ACTION"},
|
||||||
|
{ CMSG_BOOTME, "CMSG_BOOTME"},
|
||||||
|
{ CMSG_DBLOOKUP, "CMSG_DBLOOKUP"},
|
||||||
|
{ SMSG_DBLOOKUP, "SMSG_DBLOOKUP"},
|
||||||
|
{ CMSG_QUERY_OBJECT_POSITION, "CMSG_QUERY_OBJECT_POSITION"},
|
||||||
|
{ SMSG_QUERY_OBJECT_POSITION, "SMSG_QUERY_OBJECT_POSITION"},
|
||||||
|
{ CMSG_QUERY_OBJECT_ROTATION, "CMSG_QUERY_OBJECT_ROTATION"},
|
||||||
|
{ SMSG_QUERY_OBJECT_ROTATION, "SMSG_QUERY_OBJECT_ROTATION"},
|
||||||
|
{ CMSG_WORLD_TELEPORT, "CMSG_WORLD_TELEPORT"},
|
||||||
|
{ CMSG_TELEPORT_TO_UNIT, "CMSG_TELEPORT_TO_UNIT"},
|
||||||
|
{ CMSG_ZONE_MAP, "CMSG_ZONE_MAP"},
|
||||||
|
{ SMSG_ZONE_MAP, "SMSG_ZONE_MAP"},
|
||||||
|
{ CMSG_DEBUG_CHANGECELLZONE, "CMSG_DEBUG_CHANGECELLZONE"},
|
||||||
|
{ CMSG_EMBLAZON_TABARD_OBSOLETE, "CMSG_EMBLAZON_TABARD_OBSOLETE"},
|
||||||
|
{ CMSG_UNEMBLAZON_TABARD_OBSOLETE, "CMSG_UNEMBLAZON_TABARD_OBSOLETE"},
|
||||||
|
{ CMSG_RECHARGE, "CMSG_RECHARGE"},
|
||||||
|
{ CMSG_LEARN_SPELL, "CMSG_LEARN_SPELL"},
|
||||||
|
{ CMSG_CREATEMONSTER, "CMSG_CREATEMONSTER"},
|
||||||
|
{ CMSG_DESTROYMONSTER, "CMSG_DESTROYMONSTER"},
|
||||||
|
{ CMSG_CREATEITEM, "CMSG_CREATEITEM"},
|
||||||
|
{ CMSG_CREATEGAMEOBJECT, "CMSG_CREATEGAMEOBJECT"},
|
||||||
|
{ CMSG_MAKEMONSTERATTACKME_OBSOLETE, "CMSG_MAKEMONSTERATTACKME_OBSOLETE"},
|
||||||
|
{ CMSG_MAKEMONSTERATTACKGUID, "CMSG_MAKEMONSTERATTACKGUID"},
|
||||||
|
{ CMSG_ENABLEDEBUGCOMBATLOGGING_OBSOLETE, "CMSG_ENABLEDEBUGCOMBATLOGGING_OBSOLETE"},
|
||||||
|
{ CMSG_FORCEACTION, "CMSG_FORCEACTION"},
|
||||||
|
{ CMSG_FORCEACTIONONOTHER, "CMSG_FORCEACTIONONOTHER"},
|
||||||
|
{ CMSG_FORCEACTIONSHOW, "CMSG_FORCEACTIONSHOW"},
|
||||||
|
{ SMSG_FORCEACTIONSHOW, "SMSG_FORCEACTIONSHOW"},
|
||||||
|
{ SMSG_ATTACKERSTATEUPDATEDEBUGINFO_OBSOLETE, "SMSG_ATTACKERSTATEUPDATEDEBUGINFO_OBSOLETE"},
|
||||||
|
{ SMSG_DEBUGINFOSPELL_OBSOLETE, "SMSG_DEBUGINFOSPELL_OBSOLETE"},
|
||||||
|
{ SMSG_DEBUGINFOSPELLMISS_OBSOLETE, "SMSG_DEBUGINFOSPELLMISS_OBSOLETE"},
|
||||||
|
{ SMSG_DEBUG_PLAYER_RANGE_OBSOLETE, "SMSG_DEBUG_PLAYER_RANGE_OBSOLETE"},
|
||||||
|
{ CMSG_UNDRESSPLAYER, "CMSG_UNDRESSPLAYER"},
|
||||||
|
{ CMSG_BEASTMASTER, "CMSG_BEASTMASTER"},
|
||||||
|
{ CMSG_GODMODE, "CMSG_GODMODE"},
|
||||||
|
{ SMSG_GODMODE, "SMSG_GODMODE"},
|
||||||
|
{ CMSG_CHEAT_SETMONEY, "CMSG_CHEAT_SETMONEY"},
|
||||||
|
{ CMSG_LEVEL_CHEAT, "CMSG_LEVEL_CHEAT"},
|
||||||
|
{ CMSG_PET_LEVEL_CHEAT, "CMSG_PET_LEVEL_CHEAT"},
|
||||||
|
{ CMSG_LEVELUP_CHEAT_OBSOLETE, "CMSG_LEVELUP_CHEAT_OBSOLETE"},
|
||||||
|
{ CMSG_COOLDOWN_CHEAT, "CMSG_COOLDOWN_CHEAT"},
|
||||||
|
{ CMSG_USE_SKILL_CHEAT, "CMSG_USE_SKILL_CHEAT"},
|
||||||
|
{ CMSG_FLAG_QUEST, "CMSG_FLAG_QUEST"},
|
||||||
|
{ CMSG_FLAG_QUEST_FINISH, "CMSG_FLAG_QUEST_FINISH"},
|
||||||
|
{ CMSG_CLEAR_QUEST, "CMSG_CLEAR_QUEST"},
|
||||||
|
{ CMSG_SEND_EVENT, "CMSG_SEND_EVENT"},
|
||||||
|
{ CMSG_DEBUG_AISTATE, "CMSG_DEBUG_AISTATE"},
|
||||||
|
{ SMSG_DEBUG_AISTATE, "SMSG_DEBUG_AISTATE"},
|
||||||
|
{ CMSG_DISABLE_PVP_CHEAT, "CMSG_DISABLE_PVP_CHEAT"},
|
||||||
|
{ CMSG_ADVANCE_SPAWN_TIME, "CMSG_ADVANCE_SPAWN_TIME"},
|
||||||
|
{ CMSG_PVP_PORT_OBSOLETE, "CMSG_PVP_PORT_OBSOLETE"},
|
||||||
|
{ CMSG_AUTH_SRP6_BEGIN, "CMSG_AUTH_SRP6_BEGIN"},
|
||||||
|
{ CMSG_AUTH_SRP6_PROOF, "CMSG_AUTH_SRP6_PROOF"},
|
||||||
|
{ CMSG_AUTH_SRP6_RECODE, "CMSG_AUTH_SRP6_RECODE"},
|
||||||
|
{ CMSG_CHAR_CREATE, "CMSG_CHAR_CREATE"},
|
||||||
|
{ CMSG_CHAR_ENUM, "CMSG_CHAR_ENUM"},
|
||||||
|
{ CMSG_CHAR_DELETE, "CMSG_CHAR_DELETE"},
|
||||||
|
{ SMSG_AUTH_SRP6_RESPONSE, "SMSG_AUTH_SRP6_RESPONSE"},
|
||||||
|
{ SMSG_CHAR_CREATE, "SMSG_CHAR_CREATE"},
|
||||||
|
{ SMSG_CHAR_ENUM, "SMSG_CHAR_ENUM"},
|
||||||
|
{ SMSG_CHAR_DELETE, "SMSG_CHAR_DELETE"},
|
||||||
|
{ CMSG_PLAYER_LOGIN, "CMSG_PLAYER_LOGIN"},
|
||||||
|
{ SMSG_NEW_WORLD, "SMSG_NEW_WORLD"},
|
||||||
|
{ SMSG_TRANSFER_PENDING, "SMSG_TRANSFER_PENDING"},
|
||||||
|
{ SMSG_TRANSFER_ABORTED, "SMSG_TRANSFER_ABORTED"},
|
||||||
|
{ SMSG_CHARACTER_LOGIN_FAILED, "SMSG_CHARACTER_LOGIN_FAILED"},
|
||||||
|
{ SMSG_LOGIN_SETTIMESPEED, "SMSG_LOGIN_SETTIMESPEED"},
|
||||||
|
{ SMSG_GAMETIME_UPDATE, "SMSG_GAMETIME_UPDATE"},
|
||||||
|
{ CMSG_GAMETIME_SET, "CMSG_GAMETIME_SET"},
|
||||||
|
{ SMSG_GAMETIME_SET, "SMSG_GAMETIME_SET"},
|
||||||
|
{ CMSG_GAMESPEED_SET, "CMSG_GAMESPEED_SET"},
|
||||||
|
{ SMSG_GAMESPEED_SET, "SMSG_GAMESPEED_SET"},
|
||||||
|
{ CMSG_SERVERTIME, "CMSG_SERVERTIME"},
|
||||||
|
{ SMSG_SERVERTIME, "SMSG_SERVERTIME"},
|
||||||
|
{ CMSG_PLAYER_LOGOUT, "CMSG_PLAYER_LOGOUT"},
|
||||||
|
{ CMSG_LOGOUT_REQUEST, "CMSG_LOGOUT_REQUEST"},
|
||||||
|
{ SMSG_LOGOUT_RESPONSE, "SMSG_LOGOUT_RESPONSE"},
|
||||||
|
{ SMSG_LOGOUT_COMPLETE, "SMSG_LOGOUT_COMPLETE"},
|
||||||
|
{ CMSG_LOGOUT_CANCEL, "CMSG_LOGOUT_CANCEL"},
|
||||||
|
{ SMSG_LOGOUT_CANCEL_ACK, "SMSG_LOGOUT_CANCEL_ACK"},
|
||||||
|
{ CMSG_NAME_QUERY, "CMSG_NAME_QUERY"},
|
||||||
|
{ SMSG_NAME_QUERY_RESPONSE, "SMSG_NAME_QUERY_RESPONSE"},
|
||||||
|
{ CMSG_PET_NAME_QUERY, "CMSG_PET_NAME_QUERY"},
|
||||||
|
{ SMSG_PET_NAME_QUERY_RESPONSE, "SMSG_PET_NAME_QUERY_RESPONSE"},
|
||||||
|
{ CMSG_GUILD_QUERY, "CMSG_GUILD_QUERY"},
|
||||||
|
{ SMSG_GUILD_QUERY_RESPONSE, "SMSG_GUILD_QUERY_RESPONSE"},
|
||||||
|
{ CMSG_ITEM_QUERY_SINGLE, "CMSG_ITEM_QUERY_SINGLE"},
|
||||||
|
{ CMSG_ITEM_QUERY_MULTIPLE, "CMSG_ITEM_QUERY_MULTIPLE"},
|
||||||
|
{ SMSG_ITEM_QUERY_SINGLE_RESPONSE, "SMSG_ITEM_QUERY_SINGLE_RESPONSE"},
|
||||||
|
{ SMSG_ITEM_QUERY_MULTIPLE_RESPONSE, "SMSG_ITEM_QUERY_MULTIPLE_RESPONSE"},
|
||||||
|
{ CMSG_PAGE_TEXT_QUERY, "CMSG_PAGE_TEXT_QUERY"},
|
||||||
|
{ SMSG_PAGE_TEXT_QUERY_RESPONSE, "SMSG_PAGE_TEXT_QUERY_RESPONSE"},
|
||||||
|
{ CMSG_QUEST_QUERY, "CMSG_QUEST_QUERY"},
|
||||||
|
{ SMSG_QUEST_QUERY_RESPONSE, "SMSG_QUEST_QUERY_RESPONSE"},
|
||||||
|
{ CMSG_GAMEOBJECT_QUERY, "CMSG_GAMEOBJECT_QUERY"},
|
||||||
|
{ SMSG_GAMEOBJECT_QUERY_RESPONSE, "SMSG_GAMEOBJECT_QUERY_RESPONSE"},
|
||||||
|
{ CMSG_CREATURE_QUERY, "CMSG_CREATURE_QUERY"},
|
||||||
|
{ SMSG_CREATURE_QUERY_RESPONSE, "SMSG_CREATURE_QUERY_RESPONSE"},
|
||||||
|
{ CMSG_WHO, "CMSG_WHO"},
|
||||||
|
{ SMSG_WHO, "SMSG_WHO"},
|
||||||
|
{ CMSG_WHOIS, "CMSG_WHOIS"},
|
||||||
|
{ SMSG_WHOIS, "SMSG_WHOIS"},
|
||||||
|
{ CMSG_FRIEND_LIST, "CMSG_FRIEND_LIST"},
|
||||||
|
{ SMSG_FRIEND_LIST, "SMSG_FRIEND_LIST"},
|
||||||
|
{ SMSG_FRIEND_STATUS, "SMSG_FRIEND_STATUS"},
|
||||||
|
{ CMSG_ADD_FRIEND, "CMSG_ADD_FRIEND"},
|
||||||
|
{ CMSG_DEL_FRIEND, "CMSG_DEL_FRIEND"},
|
||||||
|
{ SMSG_IGNORE_LIST, "SMSG_IGNORE_LIST"},
|
||||||
|
{ CMSG_ADD_IGNORE, "CMSG_ADD_IGNORE"},
|
||||||
|
{ CMSG_DEL_IGNORE, "CMSG_DEL_IGNORE"},
|
||||||
|
{ CMSG_GROUP_INVITE, "CMSG_GROUP_INVITE"},
|
||||||
|
{ SMSG_GROUP_INVITE, "SMSG_GROUP_INVITE"},
|
||||||
|
{ CMSG_GROUP_CANCEL, "CMSG_GROUP_CANCEL"},
|
||||||
|
{ SMSG_GROUP_CANCEL, "SMSG_GROUP_CANCEL"},
|
||||||
|
{ CMSG_GROUP_ACCEPT, "CMSG_GROUP_ACCEPT"},
|
||||||
|
{ CMSG_GROUP_DECLINE, "CMSG_GROUP_DECLINE"},
|
||||||
|
{ SMSG_GROUP_DECLINE, "SMSG_GROUP_DECLINE"},
|
||||||
|
{ CMSG_GROUP_UNINVITE, "CMSG_GROUP_UNINVITE"},
|
||||||
|
{ CMSG_GROUP_UNINVITE_GUID, "CMSG_GROUP_UNINVITE_GUID"},
|
||||||
|
{ SMSG_GROUP_UNINVITE, "SMSG_GROUP_UNINVITE"},
|
||||||
|
{ CMSG_GROUP_SET_LEADER, "CMSG_GROUP_SET_LEADER"},
|
||||||
|
{ SMSG_GROUP_SET_LEADER, "SMSG_GROUP_SET_LEADER"},
|
||||||
|
{ CMSG_LOOT_METHOD, "CMSG_LOOT_METHOD"},
|
||||||
|
{ CMSG_GROUP_DISBAND, "CMSG_GROUP_DISBAND"},
|
||||||
|
{ SMSG_GROUP_DESTROYED, "SMSG_GROUP_DESTROYED"},
|
||||||
|
{ SMSG_GROUP_LIST, "SMSG_GROUP_LIST"},
|
||||||
|
{ SMSG_PARTY_MEMBER_STATS, "SMSG_PARTY_MEMBER_STATS"},
|
||||||
|
{ SMSG_PARTY_COMMAND_RESULT, "SMSG_PARTY_COMMAND_RESULT"},
|
||||||
|
{ UMSG_UPDATE_GROUP_MEMBERS, "UMSG_UPDATE_GROUP_MEMBERS"},
|
||||||
|
{ CMSG_GUILD_CREATE, "CMSG_GUILD_CREATE"},
|
||||||
|
{ CMSG_GUILD_INVITE, "CMSG_GUILD_INVITE"},
|
||||||
|
{ SMSG_GUILD_INVITE, "SMSG_GUILD_INVITE"},
|
||||||
|
{ CMSG_GUILD_ACCEPT, "CMSG_GUILD_ACCEPT"},
|
||||||
|
{ CMSG_GUILD_DECLINE, "CMSG_GUILD_DECLINE"},
|
||||||
|
{ SMSG_GUILD_DECLINE, "SMSG_GUILD_DECLINE"},
|
||||||
|
{ CMSG_GUILD_INFO, "CMSG_GUILD_INFO"},
|
||||||
|
{ SMSG_GUILD_INFO, "SMSG_GUILD_INFO"},
|
||||||
|
{ CMSG_GUILD_ROSTER, "CMSG_GUILD_ROSTER"},
|
||||||
|
{ SMSG_GUILD_ROSTER, "SMSG_GUILD_ROSTER"},
|
||||||
|
{ CMSG_GUILD_PROMOTE, "CMSG_GUILD_PROMOTE"},
|
||||||
|
{ CMSG_GUILD_DEMOTE, "CMSG_GUILD_DEMOTE"},
|
||||||
|
{ CMSG_GUILD_LEAVE, "CMSG_GUILD_LEAVE"},
|
||||||
|
{ CMSG_GUILD_REMOVE, "CMSG_GUILD_REMOVE"},
|
||||||
|
{ CMSG_GUILD_DISBAND, "CMSG_GUILD_DISBAND"},
|
||||||
|
{ CMSG_GUILD_LEADER, "CMSG_GUILD_LEADER"},
|
||||||
|
{ CMSG_GUILD_MOTD, "CMSG_GUILD_MOTD"},
|
||||||
|
{ SMSG_GUILD_EVENT, "SMSG_GUILD_EVENT"},
|
||||||
|
{ SMSG_GUILD_COMMAND_RESULT, "SMSG_GUILD_COMMAND_RESULT"},
|
||||||
|
{ UMSG_UPDATE_GUILD, "UMSG_UPDATE_GUILD"},
|
||||||
|
{ CMSG_MESSAGECHAT, "CMSG_MESSAGECHAT"},
|
||||||
|
{ SMSG_MESSAGECHAT, "SMSG_MESSAGECHAT"},
|
||||||
|
{ CMSG_JOIN_CHANNEL, "CMSG_JOIN_CHANNEL"},
|
||||||
|
{ CMSG_LEAVE_CHANNEL, "CMSG_LEAVE_CHANNEL"},
|
||||||
|
{ SMSG_CHANNEL_NOTIFY, "SMSG_CHANNEL_NOTIFY"},
|
||||||
|
{ CMSG_CHANNEL_LIST, "CMSG_CHANNEL_LIST"},
|
||||||
|
{ SMSG_CHANNEL_LIST, "SMSG_CHANNEL_LIST"},
|
||||||
|
{ CMSG_CHANNEL_PASSWORD, "CMSG_CHANNEL_PASSWORD"},
|
||||||
|
{ CMSG_CHANNEL_SET_OWNER, "CMSG_CHANNEL_SET_OWNER"},
|
||||||
|
{ CMSG_CHANNEL_OWNER, "CMSG_CHANNEL_OWNER"},
|
||||||
|
{ CMSG_CHANNEL_MODERATOR, "CMSG_CHANNEL_MODERATOR"},
|
||||||
|
{ CMSG_CHANNEL_UNMODERATOR, "CMSG_CHANNEL_UNMODERATOR"},
|
||||||
|
{ CMSG_CHANNEL_MUTE, "CMSG_CHANNEL_MUTE"},
|
||||||
|
{ CMSG_CHANNEL_UNMUTE, "CMSG_CHANNEL_UNMUTE"},
|
||||||
|
{ CMSG_CHANNEL_INVITE, "CMSG_CHANNEL_INVITE"},
|
||||||
|
{ CMSG_CHANNEL_KICK, "CMSG_CHANNEL_KICK"},
|
||||||
|
{ CMSG_CHANNEL_BAN, "CMSG_CHANNEL_BAN"},
|
||||||
|
{ CMSG_CHANNEL_UNBAN, "CMSG_CHANNEL_UNBAN"},
|
||||||
|
{ CMSG_CHANNEL_ANNOUNCEMENTS, "CMSG_CHANNEL_ANNOUNCEMENTS"},
|
||||||
|
{ CMSG_CHANNEL_MODERATE, "CMSG_CHANNEL_MODERATE"},
|
||||||
|
{ SMSG_UPDATE_OBJECT, "SMSG_UPDATE_OBJECT"},
|
||||||
|
{ SMSG_DESTROY_OBJECT, "SMSG_DESTROY_OBJECT"},
|
||||||
|
{ CMSG_USE_ITEM, "CMSG_USE_ITEM"},
|
||||||
|
{ CMSG_OPEN_ITEM, "CMSG_OPEN_ITEM"},
|
||||||
|
{ CMSG_READ_ITEM, "CMSG_READ_ITEM"},
|
||||||
|
{ SMSG_READ_ITEM_OK, "SMSG_READ_ITEM_OK"},
|
||||||
|
{ SMSG_READ_ITEM_FAILED, "SMSG_READ_ITEM_FAILED"},
|
||||||
|
{ SMSG_ITEM_COOLDOWN, "SMSG_ITEM_COOLDOWN"},
|
||||||
|
{ CMSG_GAMEOBJ_USE, "CMSG_GAMEOBJ_USE"},
|
||||||
|
{ CMSG_GAMEOBJ_CHAIR_USE_OBSOLETE, "CMSG_GAMEOBJ_CHAIR_USE_OBSOLETE"},
|
||||||
|
{ SMSG_GAMEOBJECT_CUSTOM_ANIM, "SMSG_GAMEOBJECT_CUSTOM_ANIM"},
|
||||||
|
{ CMSG_AREATRIGGER, "CMSG_AREATRIGGER"},
|
||||||
|
{ MSG_MOVE_START_FORWARD, "MSG_MOVE_START_FORWARD"},
|
||||||
|
{ MSG_MOVE_START_BACKWARD, "MSG_MOVE_START_BACKWARD"},
|
||||||
|
{ MSG_MOVE_STOP, "MSG_MOVE_STOP"},
|
||||||
|
{ MSG_MOVE_START_STRAFE_LEFT, "MSG_MOVE_START_STRAFE_LEFT"},
|
||||||
|
{ MSG_MOVE_START_STRAFE_RIGHT, "MSG_MOVE_START_STRAFE_RIGHT"},
|
||||||
|
{ MSG_MOVE_STOP_STRAFE, "MSG_MOVE_STOP_STRAFE"},
|
||||||
|
{ MSG_MOVE_JUMP, "MSG_MOVE_JUMP"},
|
||||||
|
{ MSG_MOVE_START_TURN_LEFT, "MSG_MOVE_START_TURN_LEFT"},
|
||||||
|
{ MSG_MOVE_START_TURN_RIGHT, "MSG_MOVE_START_TURN_RIGHT"},
|
||||||
|
{ MSG_MOVE_STOP_TURN, "MSG_MOVE_STOP_TURN"},
|
||||||
|
{ MSG_MOVE_START_PITCH_UP, "MSG_MOVE_START_PITCH_UP"},
|
||||||
|
{ MSG_MOVE_START_PITCH_DOWN, "MSG_MOVE_START_PITCH_DOWN"},
|
||||||
|
{ MSG_MOVE_STOP_PITCH, "MSG_MOVE_STOP_PITCH"},
|
||||||
|
{ MSG_MOVE_SET_RUN_MODE, "MSG_MOVE_SET_RUN_MODE"},
|
||||||
|
{ MSG_MOVE_SET_WALK_MODE, "MSG_MOVE_SET_WALK_MODE"},
|
||||||
|
{ MSG_MOVE_TOGGLE_LOGGING, "MSG_MOVE_TOGGLE_LOGGING"},
|
||||||
|
{ MSG_MOVE_TELEPORT, "MSG_MOVE_TELEPORT"},
|
||||||
|
{ MSG_MOVE_TELEPORT_CHEAT, "MSG_MOVE_TELEPORT_CHEAT"},
|
||||||
|
{ MSG_MOVE_TELEPORT_ACK, "MSG_MOVE_TELEPORT_ACK"},
|
||||||
|
{ MSG_MOVE_TOGGLE_FALL_LOGGING, "MSG_MOVE_TOGGLE_FALL_LOGGING"},
|
||||||
|
{ MSG_MOVE_FALL_LAND, "MSG_MOVE_FALL_LAND"},
|
||||||
|
{ MSG_MOVE_START_SWIM, "MSG_MOVE_START_SWIM"},
|
||||||
|
{ MSG_MOVE_STOP_SWIM, "MSG_MOVE_STOP_SWIM"},
|
||||||
|
{ MSG_MOVE_SET_RUN_SPEED_CHEAT, "MSG_MOVE_SET_RUN_SPEED_CHEAT"},
|
||||||
|
{ MSG_MOVE_SET_RUN_SPEED, "MSG_MOVE_SET_RUN_SPEED"},
|
||||||
|
{ MSG_MOVE_SET_RUN_BACK_SPEED_CHEAT, "MSG_MOVE_SET_RUN_BACK_SPEED_CHEAT"},
|
||||||
|
{ MSG_MOVE_SET_RUN_BACK_SPEED, "MSG_MOVE_SET_RUN_BACK_SPEED"},
|
||||||
|
{ MSG_MOVE_SET_WALK_SPEED_CHEAT, "MSG_MOVE_SET_WALK_SPEED_CHEAT"},
|
||||||
|
{ MSG_MOVE_SET_WALK_SPEED, "MSG_MOVE_SET_WALK_SPEED"},
|
||||||
|
{ MSG_MOVE_SET_SWIM_SPEED_CHEAT, "MSG_MOVE_SET_SWIM_SPEED_CHEAT"},
|
||||||
|
{ MSG_MOVE_SET_SWIM_SPEED, "MSG_MOVE_SET_SWIM_SPEED"},
|
||||||
|
{ MSG_MOVE_SET_SWIM_BACK_SPEED_CHEAT, "MSG_MOVE_SET_SWIM_BACK_SPEED_CHEAT"},
|
||||||
|
{ MSG_MOVE_SET_SWIM_BACK_SPEED, "MSG_MOVE_SET_SWIM_BACK_SPEED"},
|
||||||
|
{ MSG_MOVE_SET_ALL_SPEED_CHEAT, "MSG_MOVE_SET_ALL_SPEED_CHEAT"},
|
||||||
|
{ MSG_MOVE_SET_TURN_RATE_CHEAT, "MSG_MOVE_SET_TURN_RATE_CHEAT"},
|
||||||
|
{ MSG_MOVE_SET_TURN_RATE, "MSG_MOVE_SET_TURN_RATE"},
|
||||||
|
{ MSG_MOVE_TOGGLE_COLLISION_CHEAT, "MSG_MOVE_TOGGLE_COLLISION_CHEAT"},
|
||||||
|
{ MSG_MOVE_SET_FACING, "MSG_MOVE_SET_FACING"},
|
||||||
|
{ MSG_MOVE_SET_PITCH, "MSG_MOVE_SET_PITCH"},
|
||||||
|
{ MSG_MOVE_WORLDPORT_ACK, "MSG_MOVE_WORLDPORT_ACK"},
|
||||||
|
{ SMSG_MONSTER_MOVE, "SMSG_MONSTER_MOVE"},
|
||||||
|
{ SMSG_MOVE_WATER_WALK, "SMSG_MOVE_WATER_WALK"},
|
||||||
|
{ SMSG_MOVE_LAND_WALK, "SMSG_MOVE_LAND_WALK"},
|
||||||
|
{ MSG_MOVE_SET_RAW_POSITION_ACK, "MSG_MOVE_SET_RAW_POSITION_ACK"},
|
||||||
|
{ CMSG_MOVE_SET_RAW_POSITION, "CMSG_MOVE_SET_RAW_POSITION"},
|
||||||
|
{ SMSG_FORCE_RUN_SPEED_CHANGE, "SMSG_FORCE_RUN_SPEED_CHANGE"},
|
||||||
|
{ CMSG_FORCE_RUN_SPEED_CHANGE_ACK, "CMSG_FORCE_RUN_SPEED_CHANGE_ACK"},
|
||||||
|
{ SMSG_FORCE_RUN_BACK_SPEED_CHANGE, "SMSG_FORCE_RUN_BACK_SPEED_CHANGE"},
|
||||||
|
{ CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK, "CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK"},
|
||||||
|
{ SMSG_FORCE_SWIM_SPEED_CHANGE, "SMSG_FORCE_SWIM_SPEED_CHANGE"},
|
||||||
|
{ CMSG_FORCE_SWIM_SPEED_CHANGE_ACK, "CMSG_FORCE_SWIM_SPEED_CHANGE_ACK"},
|
||||||
|
{ SMSG_FORCE_MOVE_ROOT, "SMSG_FORCE_MOVE_ROOT"},
|
||||||
|
{ CMSG_FORCE_MOVE_ROOT_ACK, "CMSG_FORCE_MOVE_ROOT_ACK"},
|
||||||
|
{ SMSG_FORCE_MOVE_UNROOT, "SMSG_FORCE_MOVE_UNROOT"},
|
||||||
|
{ CMSG_FORCE_MOVE_UNROOT_ACK, "CMSG_FORCE_MOVE_UNROOT_ACK"},
|
||||||
|
{ MSG_MOVE_ROOT, "MSG_MOVE_ROOT"},
|
||||||
|
{ MSG_MOVE_UNROOT, "MSG_MOVE_UNROOT"},
|
||||||
|
{ MSG_MOVE_HEARTBEAT, "MSG_MOVE_HEARTBEAT"},
|
||||||
|
{ SMSG_MOVE_KNOCK_BACK, "SMSG_MOVE_KNOCK_BACK"},
|
||||||
|
{ CMSG_MOVE_KNOCK_BACK_ACK, "CMSG_MOVE_KNOCK_BACK_ACK"},
|
||||||
|
{ MSG_MOVE_KNOCK_BACK, "MSG_MOVE_KNOCK_BACK"},
|
||||||
|
{ SMSG_MOVE_FEATHER_FALL, "SMSG_MOVE_FEATHER_FALL"},
|
||||||
|
{ SMSG_MOVE_NORMAL_FALL, "SMSG_MOVE_NORMAL_FALL"},
|
||||||
|
{ SMSG_MOVE_SET_HOVER, "SMSG_MOVE_SET_HOVER"},
|
||||||
|
{ SMSG_MOVE_UNSET_HOVER, "SMSG_MOVE_UNSET_HOVER"},
|
||||||
|
{ CMSG_MOVE_HOVER_ACK, "CMSG_MOVE_HOVER_ACK"},
|
||||||
|
{ MSG_MOVE_HOVER, "MSG_MOVE_HOVER"},
|
||||||
|
{ CMSG_TRIGGER_CINEMATIC_CHEAT, "CMSG_TRIGGER_CINEMATIC_CHEAT"},
|
||||||
|
{ CMSG_OPENING_CINEMATIC, "CMSG_OPENING_CINEMATIC"},
|
||||||
|
{ SMSG_TRIGGER_CINEMATIC, "SMSG_TRIGGER_CINEMATIC"},
|
||||||
|
{ CMSG_NEXT_CINEMATIC_CAMERA, "CMSG_NEXT_CINEMATIC_CAMERA"},
|
||||||
|
{ CMSG_COMPLETE_CINEMATIC, "CMSG_COMPLETE_CINEMATIC"},
|
||||||
|
{ SMSG_TUTORIAL_FLAGS, "SMSG_TUTORIAL_FLAGS"},
|
||||||
|
{ CMSG_TUTORIAL_FLAG, "CMSG_TUTORIAL_FLAG"},
|
||||||
|
{ CMSG_TUTORIAL_CLEAR, "CMSG_TUTORIAL_CLEAR"},
|
||||||
|
{ CMSG_TUTORIAL_RESET, "CMSG_TUTORIAL_RESET"},
|
||||||
|
{ CMSG_STANDSTATECHANGE, "CMSG_STANDSTATECHANGE"},
|
||||||
|
{ CMSG_EMOTE, "CMSG_EMOTE"},
|
||||||
|
{ SMSG_EMOTE, "SMSG_EMOTE"},
|
||||||
|
{ CMSG_TEXT_EMOTE, "CMSG_TEXT_EMOTE"},
|
||||||
|
{ SMSG_TEXT_EMOTE, "SMSG_TEXT_EMOTE"},
|
||||||
|
{ CMSG_AUTOEQUIP_GROUND_ITEM, "CMSG_AUTOEQUIP_GROUND_ITEM"},
|
||||||
|
{ CMSG_AUTOSTORE_GROUND_ITEM, "CMSG_AUTOSTORE_GROUND_ITEM"},
|
||||||
|
{ CMSG_AUTOSTORE_LOOT_ITEM, "CMSG_AUTOSTORE_LOOT_ITEM"},
|
||||||
|
{ CMSG_STORE_LOOT_IN_SLOT, "CMSG_STORE_LOOT_IN_SLOT"},
|
||||||
|
{ CMSG_AUTOEQUIP_ITEM, "CMSG_AUTOEQUIP_ITEM"},
|
||||||
|
{ CMSG_AUTOSTORE_BAG_ITEM, "CMSG_AUTOSTORE_BAG_ITEM"},
|
||||||
|
{ CMSG_SWAP_ITEM, "CMSG_SWAP_ITEM"},
|
||||||
|
{ CMSG_SWAP_INV_ITEM, "CMSG_SWAP_INV_ITEM"},
|
||||||
|
{ CMSG_SPLIT_ITEM, "CMSG_SPLIT_ITEM"},
|
||||||
|
{ CMSG_PICKUP_ITEM, "CMSG_PICKUP_ITEM"},
|
||||||
|
{ CMSG_DROP_ITEM, "CMSG_DROP_ITEM"},
|
||||||
|
{ CMSG_DESTROYITEM, "CMSG_DESTROYITEM"},
|
||||||
|
{ SMSG_INVENTORY_CHANGE_FAILURE, "SMSG_INVENTORY_CHANGE_FAILURE"},
|
||||||
|
{ SMSG_OPEN_CONTAINER, "SMSG_OPEN_CONTAINER"},
|
||||||
|
{ CMSG_INSPECT, "CMSG_INSPECT"},
|
||||||
|
{ SMSG_INSPECT, "SMSG_INSPECT"},
|
||||||
|
{ CMSG_INITIATE_TRADE, "CMSG_INITIATE_TRADE"},
|
||||||
|
{ CMSG_BEGIN_TRADE, "CMSG_BEGIN_TRADE"},
|
||||||
|
{ CMSG_BUSY_TRADE, "CMSG_BUSY_TRADE"},
|
||||||
|
{ CMSG_IGNORE_TRADE, "CMSG_IGNORE_TRADE"},
|
||||||
|
{ CMSG_ACCEPT_TRADE, "CMSG_ACCEPT_TRADE"},
|
||||||
|
{ CMSG_UNACCEPT_TRADE, "CMSG_UNACCEPT_TRADE"},
|
||||||
|
{ CMSG_CANCEL_TRADE, "CMSG_CANCEL_TRADE"},
|
||||||
|
{ CMSG_SET_TRADE_ITEM, "CMSG_SET_TRADE_ITEM"},
|
||||||
|
{ CMSG_CLEAR_TRADE_ITEM, "CMSG_CLEAR_TRADE_ITEM"},
|
||||||
|
{ CMSG_SET_TRADE_GOLD, "CMSG_SET_TRADE_GOLD"},
|
||||||
|
{ SMSG_TRADE_STATUS, "SMSG_TRADE_STATUS"},
|
||||||
|
{ SMSG_TRADE_STATUS_EXTENDED, "SMSG_TRADE_STATUS_EXTENDED"},
|
||||||
|
{ SMSG_INITIALIZE_FACTIONS, "SMSG_INITIALIZE_FACTIONS"},
|
||||||
|
{ SMSG_SET_FACTION_VISIBLE, "SMSG_SET_FACTION_VISIBLE"},
|
||||||
|
{ SMSG_SET_FACTION_STANDING, "SMSG_SET_FACTION_STANDING"},
|
||||||
|
{ CMSG_SET_FACTION_ATWAR, "CMSG_SET_FACTION_ATWAR"},
|
||||||
|
{ CMSG_SET_FACTION_CHEAT, "CMSG_SET_FACTION_CHEAT"},
|
||||||
|
{ SMSG_SET_PROFICIENCY, "SMSG_SET_PROFICIENCY"},
|
||||||
|
{ CMSG_SET_ACTION_BUTTON, "CMSG_SET_ACTION_BUTTON"},
|
||||||
|
{ SMSG_ACTION_BUTTONS, "SMSG_ACTION_BUTTONS"},
|
||||||
|
{ SMSG_INITIAL_SPELLS, "SMSG_INITIAL_SPELLS"},
|
||||||
|
{ SMSG_LEARNED_SPELL, "SMSG_LEARNED_SPELL"},
|
||||||
|
{ SMSG_SUPERCEDED_SPELL, "SMSG_SUPERCEDED_SPELL"},
|
||||||
|
{ CMSG_NEW_SPELL_SLOT, "CMSG_NEW_SPELL_SLOT"},
|
||||||
|
{ CMSG_CAST_SPELL, "CMSG_CAST_SPELL"},
|
||||||
|
{ CMSG_CANCEL_CAST, "CMSG_CANCEL_CAST"},
|
||||||
|
{ SMSG_CAST_RESULT, "SMSG_CAST_RESULT"},
|
||||||
|
{ SMSG_SPELL_START, "SMSG_SPELL_START"},
|
||||||
|
{ SMSG_SPELL_GO, "SMSG_SPELL_GO"},
|
||||||
|
{ SMSG_SPELL_FAILURE, "SMSG_SPELL_FAILURE"},
|
||||||
|
{ SMSG_SPELL_COOLDOWN, "SMSG_SPELL_COOLDOWN"},
|
||||||
|
{ SMSG_COOLDOWN_EVENT, "SMSG_COOLDOWN_EVENT"},
|
||||||
|
{ CMSG_CANCEL_AURA, "CMSG_CANCEL_AURA"},
|
||||||
|
{ SMSG_UPDATE_AURA_DURATION, "SMSG_UPDATE_AURA_DURATION"},
|
||||||
|
{ SMSG_PET_CAST_FAILED, "SMSG_PET_CAST_FAILED"},
|
||||||
|
{ MSG_CHANNEL_START, "MSG_CHANNEL_START"},
|
||||||
|
{ MSG_CHANNEL_UPDATE, "MSG_CHANNEL_UPDATE"},
|
||||||
|
{ CMSG_CANCEL_CHANNELLING, "CMSG_CANCEL_CHANNELLING"},
|
||||||
|
{ SMSG_AI_REACTION, "SMSG_AI_REACTION"},
|
||||||
|
{ CMSG_SET_SELECTION, "CMSG_SET_SELECTION"},
|
||||||
|
{ CMSG_SET_TARGET_OBSOLETE, "CMSG_SET_TARGET_OBSOLETE"},
|
||||||
|
{ CMSG_UNUSED, "CMSG_UNUSED"},
|
||||||
|
{ CMSG_UNUSED2, "CMSG_UNUSED2"},
|
||||||
|
{ CMSG_ATTACKSWING, "CMSG_ATTACKSWING"},
|
||||||
|
{ CMSG_ATTACKSTOP, "CMSG_ATTACKSTOP"},
|
||||||
|
{ SMSG_ATTACKSTART, "SMSG_ATTACKSTART"},
|
||||||
|
{ SMSG_ATTACKSTOP, "SMSG_ATTACKSTOP"},
|
||||||
|
{ SMSG_ATTACKSWING_NOTINRANGE, "SMSG_ATTACKSWING_NOTINRANGE"},
|
||||||
|
{ SMSG_ATTACKSWING_BADFACING, "SMSG_ATTACKSWING_BADFACING"},
|
||||||
|
{ SMSG_ATTACKSWING_NOTSTANDING, "SMSG_ATTACKSWING_NOTSTANDING"},
|
||||||
|
{ SMSG_ATTACKSWING_DEADTARGET, "SMSG_ATTACKSWING_DEADTARGET"},
|
||||||
|
{ SMSG_ATTACKSWING_CANT_ATTACK, "SMSG_ATTACKSWING_CANT_ATTACK"},
|
||||||
|
{ SMSG_ATTACKERSTATEUPDATE, "SMSG_ATTACKERSTATEUPDATE"},
|
||||||
|
{ SMSG_VICTIMSTATEUPDATE_OBSOLETE, "SMSG_VICTIMSTATEUPDATE_OBSOLETE"},
|
||||||
|
{ SMSG_DAMAGE_DONE_OBSOLETE, "SMSG_DAMAGE_DONE_OBSOLETE"},
|
||||||
|
{ SMSG_DAMAGE_TAKEN_OBSOLETE, "SMSG_DAMAGE_TAKEN_OBSOLETE"},
|
||||||
|
{ SMSG_CANCEL_COMBAT, "SMSG_CANCEL_COMBAT"},
|
||||||
|
{ SMSG_PLAYER_COMBAT_XP_GAIN_OBSOLETE, "SMSG_PLAYER_COMBAT_XP_GAIN_OBSOLETE"},
|
||||||
|
{ SMSG_HEALSPELL_ON_PLAYER_OBSOLETE, "SMSG_HEALSPELL_ON_PLAYER_OBSOLETE"},
|
||||||
|
{ SMSG_HEALSPELL_ON_PLAYERS_PET_OBSOLETE, "SMSG_HEALSPELL_ON_PLAYERS_PET_OBSOLETE"},
|
||||||
|
{ CMSG_SHEATHE_OBSOLETE, "CMSG_SHEATHE_OBSOLETE"},
|
||||||
|
{ CMSG_SAVE_PLAYER, "CMSG_SAVE_PLAYER"},
|
||||||
|
{ CMSG_SETDEATHBINDPOINT, "CMSG_SETDEATHBINDPOINT"},
|
||||||
|
{ SMSG_BINDPOINTUPDATE, "SMSG_BINDPOINTUPDATE"},
|
||||||
|
{ CMSG_GETDEATHBINDZONE, "CMSG_GETDEATHBINDZONE"},
|
||||||
|
{ SMSG_BINDZONEREPLY, "SMSG_BINDZONEREPLY"},
|
||||||
|
{ SMSG_PLAYERBOUND, "SMSG_PLAYERBOUND"},
|
||||||
|
{ SMSG_DEATH_NOTIFY_OBSOLETE, "SMSG_DEATH_NOTIFY_OBSOLETE"},
|
||||||
|
{ CMSG_REPOP_REQUEST, "CMSG_REPOP_REQUEST"},
|
||||||
|
{ SMSG_RESURRECT_REQUEST, "SMSG_RESURRECT_REQUEST"},
|
||||||
|
{ CMSG_RESURRECT_RESPONSE, "CMSG_RESURRECT_RESPONSE"},
|
||||||
|
{ CMSG_LOOT, "CMSG_LOOT"},
|
||||||
|
{ CMSG_LOOT_MONEY, "CMSG_LOOT_MONEY"},
|
||||||
|
{ CMSG_LOOT_RELEASE, "CMSG_LOOT_RELEASE"},
|
||||||
|
{ SMSG_LOOT_RESPONSE, "SMSG_LOOT_RESPONSE"},
|
||||||
|
{ SMSG_LOOT_RELEASE_RESPONSE, "SMSG_LOOT_RELEASE_RESPONSE"},
|
||||||
|
{ SMSG_LOOT_REMOVED, "SMSG_LOOT_REMOVED"},
|
||||||
|
{ SMSG_LOOT_MONEY_NOTIFY, "SMSG_LOOT_MONEY_NOTIFY"},
|
||||||
|
{ SMSG_LOOT_ITEM_NOTIFY, "SMSG_LOOT_ITEM_NOTIFY"},
|
||||||
|
{ SMSG_LOOT_CLEAR_MONEY, "SMSG_LOOT_CLEAR_MONEY"},
|
||||||
|
{ SMSG_ITEM_PUSH_RESULT, "SMSG_ITEM_PUSH_RESULT"},
|
||||||
|
{ SMSG_DUEL_REQUESTED, "SMSG_DUEL_REQUESTED"},
|
||||||
|
{ SMSG_DUEL_OUTOFBOUNDS, "SMSG_DUEL_OUTOFBOUNDS"},
|
||||||
|
{ SMSG_DUEL_INBOUNDS, "SMSG_DUEL_INBOUNDS"},
|
||||||
|
{ SMSG_DUEL_COMPLETE, "SMSG_DUEL_COMPLETE"},
|
||||||
|
{ SMSG_DUEL_WINNER, "SMSG_DUEL_WINNER"},
|
||||||
|
{ CMSG_DUEL_ACCEPTED, "CMSG_DUEL_ACCEPTED"},
|
||||||
|
{ CMSG_DUEL_CANCELLED, "CMSG_DUEL_CANCELLED"},
|
||||||
|
{ SMSG_MOUNTRESULT, "SMSG_MOUNTRESULT"},
|
||||||
|
{ SMSG_DISMOUNTRESULT, "SMSG_DISMOUNTRESULT"},
|
||||||
|
{ SMSG_PUREMOUNT_CANCELLED_OBSOLETE, "SMSG_PUREMOUNT_CANCELLED_OBSOLETE"},
|
||||||
|
{ CMSG_MOUNTSPECIAL_ANIM, "CMSG_MOUNTSPECIAL_ANIM"},
|
||||||
|
{ SMSG_MOUNTSPECIAL_ANIM, "SMSG_MOUNTSPECIAL_ANIM"},
|
||||||
|
{ SMSG_PET_TAME_FAILURE, "SMSG_PET_TAME_FAILURE"},
|
||||||
|
{ CMSG_PET_SET_ACTION, "CMSG_PET_SET_ACTION"},
|
||||||
|
{ CMSG_PET_ACTION, "CMSG_PET_ACTION"},
|
||||||
|
{ CMSG_PET_ABANDON, "CMSG_PET_ABANDON"},
|
||||||
|
{ CMSG_PET_RENAME, "CMSG_PET_RENAME"},
|
||||||
|
{ SMSG_PET_NAME_INVALID, "SMSG_PET_NAME_INVALID"},
|
||||||
|
{ SMSG_PET_SPELLS, "SMSG_PET_SPELLS"},
|
||||||
|
{ SMSG_PET_MODE, "SMSG_PET_MODE"},
|
||||||
|
{ CMSG_GOSSIP_HELLO, "CMSG_GOSSIP_HELLO"},
|
||||||
|
{ CMSG_GOSSIP_SELECT_OPTION, "CMSG_GOSSIP_SELECT_OPTION"},
|
||||||
|
{ SMSG_GOSSIP_MESSAGE, "SMSG_GOSSIP_MESSAGE"},
|
||||||
|
{ SMSG_GOSSIP_COMPLETE, "SMSG_GOSSIP_COMPLETE"},
|
||||||
|
{ CMSG_NPC_TEXT_QUERY, "CMSG_NPC_TEXT_QUERY"},
|
||||||
|
{ SMSG_NPC_TEXT_UPDATE, "SMSG_NPC_TEXT_UPDATE"},
|
||||||
|
{ SMSG_NPC_WONT_TALK, "SMSG_NPC_WONT_TALK"},
|
||||||
|
{ CMSG_QUESTGIVER_STATUS_QUERY, "CMSG_QUESTGIVER_STATUS_QUERY"},
|
||||||
|
{ SMSG_QUESTGIVER_STATUS, "SMSG_QUESTGIVER_STATUS"},
|
||||||
|
{ CMSG_QUESTGIVER_HELLO, "CMSG_QUESTGIVER_HELLO"},
|
||||||
|
{ SMSG_QUESTGIVER_QUEST_LIST, "SMSG_QUESTGIVER_QUEST_LIST"},
|
||||||
|
{ CMSG_QUESTGIVER_QUERY_QUEST, "CMSG_QUESTGIVER_QUERY_QUEST"},
|
||||||
|
{ CMSG_QUESTGIVER_QUEST_AUTOLAUNCH, "CMSG_QUESTGIVER_QUEST_AUTOLAUNCH"},
|
||||||
|
{ SMSG_QUESTGIVER_QUEST_DETAILS, "SMSG_QUESTGIVER_QUEST_DETAILS"},
|
||||||
|
{ CMSG_QUESTGIVER_ACCEPT_QUEST, "CMSG_QUESTGIVER_ACCEPT_QUEST"},
|
||||||
|
{ CMSG_QUESTGIVER_COMPLETE_QUEST, "CMSG_QUESTGIVER_COMPLETE_QUEST"},
|
||||||
|
{ SMSG_QUESTGIVER_REQUEST_ITEMS, "SMSG_QUESTGIVER_REQUEST_ITEMS"},
|
||||||
|
{ CMSG_QUESTGIVER_REQUEST_REWARD, "CMSG_QUESTGIVER_REQUEST_REWARD"},
|
||||||
|
{ SMSG_QUESTGIVER_OFFER_REWARD, "SMSG_QUESTGIVER_OFFER_REWARD"},
|
||||||
|
{ CMSG_QUESTGIVER_CHOOSE_REWARD, "CMSG_QUESTGIVER_CHOOSE_REWARD"},
|
||||||
|
{ SMSG_QUESTGIVER_QUEST_INVALID, "SMSG_QUESTGIVER_QUEST_INVALID"},
|
||||||
|
{ CMSG_QUESTGIVER_CANCEL, "CMSG_QUESTGIVER_CANCEL"},
|
||||||
|
{ SMSG_QUESTGIVER_QUEST_COMPLETE, "SMSG_QUESTGIVER_QUEST_COMPLETE"},
|
||||||
|
{ SMSG_QUESTGIVER_QUEST_FAILED, "SMSG_QUESTGIVER_QUEST_FAILED"},
|
||||||
|
{ CMSG_QUESTLOG_SWAP_QUEST, "CMSG_QUESTLOG_SWAP_QUEST"},
|
||||||
|
{ CMSG_QUESTLOG_REMOVE_QUEST, "CMSG_QUESTLOG_REMOVE_QUEST"},
|
||||||
|
{ SMSG_QUESTLOG_FULL, "SMSG_QUESTLOG_FULL"},
|
||||||
|
{ SMSG_QUESTUPDATE_FAILED, "SMSG_QUESTUPDATE_FAILED"},
|
||||||
|
{ SMSG_QUESTUPDATE_FAILEDTIMER, "SMSG_QUESTUPDATE_FAILEDTIMER"},
|
||||||
|
{ SMSG_QUESTUPDATE_COMPLETE, "SMSG_QUESTUPDATE_COMPLETE"},
|
||||||
|
{ SMSG_QUESTUPDATE_ADD_KILL, "SMSG_QUESTUPDATE_ADD_KILL"},
|
||||||
|
{ SMSG_QUESTUPDATE_ADD_ITEM, "SMSG_QUESTUPDATE_ADD_ITEM"},
|
||||||
|
{ CMSG_QUEST_CONFIRM_ACCEPT, "CMSG_QUEST_CONFIRM_ACCEPT"},
|
||||||
|
{ SMSG_QUEST_CONFIRM_ACCEPT, "SMSG_QUEST_CONFIRM_ACCEPT"},
|
||||||
|
{ CMSG_PUSHQUESTTOPARTY, "CMSG_PUSHQUESTTOPARTY"},
|
||||||
|
{ CMSG_LIST_INVENTORY, "CMSG_LIST_INVENTORY"},
|
||||||
|
{ SMSG_LIST_INVENTORY, "SMSG_LIST_INVENTORY"},
|
||||||
|
{ CMSG_SELL_ITEM, "CMSG_SELL_ITEM"},
|
||||||
|
{ SMSG_SELL_ITEM, "SMSG_SELL_ITEM"},
|
||||||
|
{ CMSG_BUY_ITEM, "CMSG_BUY_ITEM"},
|
||||||
|
{ CMSG_BUY_ITEM_IN_SLOT, "CMSG_BUY_ITEM_IN_SLOT"},
|
||||||
|
{ SMSG_BUY_ITEM, "SMSG_BUY_ITEM"},
|
||||||
|
{ SMSG_BUY_FAILED, "SMSG_BUY_FAILED"},
|
||||||
|
{ CMSG_TAXICLEARALLNODES, "CMSG_TAXICLEARALLNODES"},
|
||||||
|
{ CMSG_TAXIENABLEALLNODES, "CMSG_TAXIENABLEALLNODES"},
|
||||||
|
{ CMSG_TAXISHOWNODES, "CMSG_TAXISHOWNODES"},
|
||||||
|
{ SMSG_SHOWTAXINODES, "SMSG_SHOWTAXINODES"},
|
||||||
|
{ CMSG_TAXINODE_STATUS_QUERY, "CMSG_TAXINODE_STATUS_QUERY"},
|
||||||
|
{ SMSG_TAXINODE_STATUS, "SMSG_TAXINODE_STATUS"},
|
||||||
|
{ CMSG_TAXIQUERYAVAILABLENODES, "CMSG_TAXIQUERYAVAILABLENODES"},
|
||||||
|
{ CMSG_ACTIVATETAXI, "CMSG_ACTIVATETAXI"},
|
||||||
|
{ SMSG_ACTIVATETAXIREPLY, "SMSG_ACTIVATETAXIREPLY"},
|
||||||
|
{ CMSG_ACTIVATETAXI_FAR, "CMSG_ACTIVATETAXI_FAR"},
|
||||||
|
{ SMSG_NEW_TAXI_PATH, "SMSG_NEW_TAXI_PATH"},
|
||||||
|
{ CMSG_TRAINER_LIST, "CMSG_TRAINER_LIST"},
|
||||||
|
{ SMSG_TRAINER_LIST, "SMSG_TRAINER_LIST"},
|
||||||
|
{ CMSG_TRAINER_BUY_SPELL, "CMSG_TRAINER_BUY_SPELL"},
|
||||||
|
{ SMSG_TRAINER_BUY_SUCCEEDED, "SMSG_TRAINER_BUY_SUCCEEDED"},
|
||||||
|
{ SMSG_TRAINER_BUY_FAILED, "SMSG_TRAINER_BUY_FAILED"},
|
||||||
|
{ CMSG_BINDER_ACTIVATE, "CMSG_BINDER_ACTIVATE"},
|
||||||
|
{ SMSG_PLAYERBINDERROR, "SMSG_PLAYERBINDERROR"},
|
||||||
|
{ CMSG_BANKER_ACTIVATE, "CMSG_BANKER_ACTIVATE"},
|
||||||
|
{ SMSG_SHOW_BANK, "SMSG_SHOW_BANK"},
|
||||||
|
{ CMSG_BUY_BANK_SLOT, "CMSG_BUY_BANK_SLOT"},
|
||||||
|
{ SMSG_BUY_BANK_SLOT_RESULT, "SMSG_BUY_BANK_SLOT_RESULT"},
|
||||||
|
{ CMSG_PETITION_SHOWLIST, "CMSG_PETITION_SHOWLIST"},
|
||||||
|
{ SMSG_PETITION_SHOWLIST, "SMSG_PETITION_SHOWLIST"},
|
||||||
|
{ CMSG_PETITION_BUY, "CMSG_PETITION_BUY"},
|
||||||
|
{ CMSG_PETITION_SHOW_SIGNATURES, "CMSG_PETITION_SHOW_SIGNATURES"},
|
||||||
|
{ SMSG_PETITION_SHOW_SIGNATURES, "SMSG_PETITION_SHOW_SIGNATURES"},
|
||||||
|
{ CMSG_PETITION_SIGN, "CMSG_PETITION_SIGN"},
|
||||||
|
{ SMSG_PETITION_SIGN_RESULTS, "SMSG_PETITION_SIGN_RESULTS"},
|
||||||
|
{ MSG_PETITION_DECLINE, "MSG_PETITION_DECLINE"},
|
||||||
|
{ CMSG_OFFER_PETITION, "CMSG_OFFER_PETITION"},
|
||||||
|
{ CMSG_TURN_IN_PETITION, "CMSG_TURN_IN_PETITION"},
|
||||||
|
{ SMSG_TURN_IN_PETITION_RESULTS, "SMSG_TURN_IN_PETITION_RESULTS"},
|
||||||
|
{ CMSG_PETITION_QUERY, "CMSG_PETITION_QUERY"},
|
||||||
|
{ SMSG_PETITION_QUERY_RESPONSE, "SMSG_PETITION_QUERY_RESPONSE"},
|
||||||
|
{ SMSG_FISH_NOT_HOOKED, "SMSG_FISH_NOT_HOOKED"},
|
||||||
|
{ SMSG_FISH_ESCAPED, "SMSG_FISH_ESCAPED"},
|
||||||
|
{ CMSG_BUG, "CMSG_BUG"},
|
||||||
|
{ SMSG_NOTIFICATION, "SMSG_NOTIFICATION"},
|
||||||
|
{ CMSG_PLAYED_TIME, "CMSG_PLAYED_TIME"},
|
||||||
|
{ SMSG_PLAYED_TIME, "SMSG_PLAYED_TIME"},
|
||||||
|
{ CMSG_QUERY_TIME, "CMSG_QUERY_TIME"},
|
||||||
|
{ SMSG_QUERY_TIME_RESPONSE, "SMSG_QUERY_TIME_RESPONSE"},
|
||||||
|
{ SMSG_LOG_XPGAIN, "SMSG_LOG_XPGAIN"},
|
||||||
|
{ MSG_SPLIT_MONEY, "MSG_SPLIT_MONEY"},
|
||||||
|
{ CMSG_RECLAIM_CORPSE, "CMSG_RECLAIM_CORPSE"},
|
||||||
|
{ CMSG_WRAP_ITEM, "CMSG_WRAP_ITEM"},
|
||||||
|
{ SMSG_LEVELUP_INFO, "SMSG_LEVELUP_INFO"},
|
||||||
|
{ MSG_MINIMAP_PING, "MSG_MINIMAP_PING"},
|
||||||
|
{ SMSG_RESISTLOG, "SMSG_RESISTLOG"},
|
||||||
|
{ SMSG_ENCHANTMENTLOG, "SMSG_ENCHANTMENTLOG"},
|
||||||
|
{ CMSG_SET_SKILL_CHEAT, "CMSG_SET_SKILL_CHEAT"},
|
||||||
|
{ SMSG_START_MIRROR_TIMER, "SMSG_START_MIRROR_TIMER"},
|
||||||
|
{ SMSG_PAUSE_MIRROR_TIMER, "SMSG_PAUSE_MIRROR_TIMER"},
|
||||||
|
{ SMSG_STOP_MIRROR_TIMER, "SMSG_STOP_MIRROR_TIMER"},
|
||||||
|
{ CMSG_PING, "CMSG_PING"},
|
||||||
|
{ SMSG_PONG, "SMSG_PONG"},
|
||||||
|
{ SMSG_CLEAR_COOLDOWN, "SMSG_CLEAR_COOLDOWN"},
|
||||||
|
{ SMSG_GAMEOBJECT_PAGETEXT, "SMSG_GAMEOBJECT_PAGETEXT"},
|
||||||
|
{ CMSG_SETSHEATHED, "CMSG_SETSHEATHED"},
|
||||||
|
{ SMSG_COOLDOWN_CHEAT, "SMSG_COOLDOWN_CHEAT"},
|
||||||
|
{ SMSG_SPELL_DELAYED, "SMSG_SPELL_DELAYED"},
|
||||||
|
{ CMSG_PLAYER_MACRO_OBSOLETE, "CMSG_PLAYER_MACRO_OBSOLETE"},
|
||||||
|
{ SMSG_PLAYER_MACRO_OBSOLETE, "SMSG_PLAYER_MACRO_OBSOLETE"},
|
||||||
|
{ CMSG_GHOST, "CMSG_GHOST"},
|
||||||
|
{ CMSG_GM_INVIS, "CMSG_GM_INVIS"},
|
||||||
|
{ SMSG_INVALID_PROMOTION_CODE, "SMSG_INVALID_PROMOTION_CODE"},
|
||||||
|
{ MSG_GM_BIND_OTHER, "MSG_GM_BIND_OTHER"},
|
||||||
|
{ MSG_GM_SUMMON, "MSG_GM_SUMMON"},
|
||||||
|
{ SMSG_ITEM_TIME_UPDATE, "SMSG_ITEM_TIME_UPDATE"},
|
||||||
|
{ SMSG_ITEM_ENCHANT_TIME_UPDATE, "SMSG_ITEM_ENCHANT_TIME_UPDATE"},
|
||||||
|
{ SMSG_AUTH_CHALLENGE, "SMSG_AUTH_CHALLENGE"},
|
||||||
|
{ CMSG_AUTH_SESSION, "CMSG_AUTH_SESSION"},
|
||||||
|
{ SMSG_AUTH_RESPONSE, "SMSG_AUTH_RESPONSE"},
|
||||||
|
{ MSG_GM_SHOWLABEL, "MSG_GM_SHOWLABEL"},
|
||||||
|
{ MSG_ADD_DYNAMIC_TARGET_OBSOLETE, "MSG_ADD_DYNAMIC_TARGET_OBSOLETE"},
|
||||||
|
{ MSG_SAVE_GUILD_EMBLEM, "MSG_SAVE_GUILD_EMBLEM"},
|
||||||
|
{ MSG_TABARDVENDOR_ACTIVATE, "MSG_TABARDVENDOR_ACTIVATE"},
|
||||||
|
{ SMSG_PLAY_SPELL_VISUAL, "SMSG_PLAY_SPELL_VISUAL"},
|
||||||
|
{ CMSG_ZONEUPDATE, "CMSG_ZONEUPDATE"},
|
||||||
|
{ SMSG_PARTYKILLLOG, "SMSG_PARTYKILLLOG"},
|
||||||
|
{ SMSG_COMPRESSED_UPDATE_OBJECT, "SMSG_COMPRESSED_UPDATE_OBJECT"},
|
||||||
|
{ SMSG_OBSOLETE, "SMSG_OBSOLETE"},
|
||||||
|
{ SMSG_EXPLORATION_EXPERIENCE, "SMSG_EXPLORATION_EXPERIENCE"},
|
||||||
|
{ CMSG_GM_SET_SECURITY_GROUP, "CMSG_GM_SET_SECURITY_GROUP"},
|
||||||
|
{ CMSG_GM_NUKE, "CMSG_GM_NUKE"},
|
||||||
|
{ MSG_RANDOM_ROLL, "MSG_RANDOM_ROLL"},
|
||||||
|
{ SMSG_ENVIRONMENTALDAMAGELOG, "SMSG_ENVIRONMENTALDAMAGELOG"},
|
||||||
|
{ CMSG_RWHOIS, "CMSG_RWHOIS"},
|
||||||
|
{ SMSG_RWHOIS, "SMSG_RWHOIS"},
|
||||||
|
{ MSG_LOOKING_FOR_GROUP, "MSG_LOOKING_FOR_GROUP"},
|
||||||
|
{ CMSG_SET_LOOKING_FOR_GROUP, "CMSG_SET_LOOKING_FOR_GROUP"},
|
||||||
|
{ CMSG_UNLEARN_SPELL, "CMSG_UNLEARN_SPELL"},
|
||||||
|
{ CMSG_UNLEARN_SKILL, "CMSG_UNLEARN_SKILL"},
|
||||||
|
{ SMSG_REMOVED_SPELL, "SMSG_REMOVED_SPELL"},
|
||||||
|
{ CMSG_DECHARGE, "CMSG_DECHARGE"},
|
||||||
|
{ CMSG_GMTICKET_CREATE, "CMSG_GMTICKET_CREATE"},
|
||||||
|
{ SMSG_GMTICKET_CREATE, "SMSG_GMTICKET_CREATE"},
|
||||||
|
{ CMSG_GMTICKET_UPDATETEXT, "CMSG_GMTICKET_UPDATETEXT"},
|
||||||
|
{ SMSG_GMTICKET_UPDATETEXT, "SMSG_GMTICKET_UPDATETEXT"},
|
||||||
|
{ SMSG_ACCOUNT_DATA_MD5, "SMSG_ACCOUNT_DATA_MD5"},
|
||||||
|
{ CMSG_REQUEST_ACCOUNT_DATA, "CMSG_REQUEST_ACCOUNT_DATA"},
|
||||||
|
{ CMSG_UPDATE_ACCOUNT_DATA, "CMSG_UPDATE_ACCOUNT_DATA"},
|
||||||
|
{ SMSG_UPDATE_ACCOUNT_DATA, "SMSG_UPDATE_ACCOUNT_DATA"},
|
||||||
|
{ SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, "SMSG_CLEAR_FAR_SIGHT_IMMEDIATE"},
|
||||||
|
{ SMSG_POWERGAINLOG_OBSOLETE, "SMSG_POWERGAINLOG_OBSOLETE"},
|
||||||
|
{ CMSG_GM_TEACH, "CMSG_GM_TEACH"},
|
||||||
|
{ CMSG_GM_CREATE_ITEM_TARGET, "CMSG_GM_CREATE_ITEM_TARGET"},
|
||||||
|
{ CMSG_GMTICKET_GETTICKET, "CMSG_GMTICKET_GETTICKET"},
|
||||||
|
{ SMSG_GMTICKET_GETTICKET, "SMSG_GMTICKET_GETTICKET"},
|
||||||
|
{ CMSG_UNLEARN_TALENTS, "CMSG_UNLEARN_TALENTS"},
|
||||||
|
{ SMSG_GAMEOBJECT_SPAWN_ANIM, "SMSG_GAMEOBJECT_SPAWN_ANIM"},
|
||||||
|
{ SMSG_GAMEOBJECT_DESPAWN_ANIM, "SMSG_GAMEOBJECT_DESPAWN_ANIM"},
|
||||||
|
{ MSG_CORPSE_QUERY, "MSG_CORPSE_QUERY"},
|
||||||
|
{ CMSG_GMTICKET_DELETETICKET, "CMSG_GMTICKET_DELETETICKET"},
|
||||||
|
{ SMSG_GMTICKET_DELETETICKET, "SMSG_GMTICKET_DELETETICKET"},
|
||||||
|
{ SMSG_CHAT_WRONG_FACTION, "SMSG_CHAT_WRONG_FACTION"},
|
||||||
|
{ CMSG_GMTICKET_SYSTEMSTATUS, "CMSG_GMTICKET_SYSTEMSTATUS"},
|
||||||
|
{ SMSG_GMTICKET_SYSTEMSTATUS, "SMSG_GMTICKET_SYSTEMSTATUS"},
|
||||||
|
{ CMSG_SPIRIT_HEALER_ACTIVATE, "CMSG_SPIRIT_HEALER_ACTIVATE"},
|
||||||
|
{ CMSG_SET_STAT_CHEAT, "CMSG_SET_STAT_CHEAT"},
|
||||||
|
{ SMSG_SET_REST_START, "SMSG_SET_REST_START"},
|
||||||
|
{ CMSG_SKILL_BUY_STEP, "CMSG_SKILL_BUY_STEP"},
|
||||||
|
{ CMSG_SKILL_BUY_RANK, "CMSG_SKILL_BUY_RANK"},
|
||||||
|
{ CMSG_XP_CHEAT, "CMSG_XP_CHEAT"},
|
||||||
|
{ SMSG_SPIRIT_HEALER_CONFIRM, "SMSG_SPIRIT_HEALER_CONFIRM"},
|
||||||
|
{ CMSG_CHARACTER_POINT_CHEAT, "CMSG_CHARACTER_POINT_CHEAT"},
|
||||||
|
{ SMSG_GOSSIP_POI, "SMSG_GOSSIP_POI"},
|
||||||
|
{ CMSG_CHAT_IGNORED, "CMSG_CHAT_IGNORED"},
|
||||||
|
{ CMSG_GM_VISION, "CMSG_GM_VISION"},
|
||||||
|
{ CMSG_SERVER_COMMAND, "CMSG_SERVER_COMMAND"},
|
||||||
|
{ CMSG_GM_SILENCE, "CMSG_GM_SILENCE"},
|
||||||
|
{ CMSG_GM_REVEALTO, "CMSG_GM_REVEALTO"},
|
||||||
|
{ CMSG_GM_RESURRECT, "CMSG_GM_RESURRECT"},
|
||||||
|
{ CMSG_GM_SUMMONMOB, "CMSG_GM_SUMMONMOB"},
|
||||||
|
{ CMSG_GM_MOVECORPSE, "CMSG_GM_MOVECORPSE"},
|
||||||
|
{ CMSG_GM_FREEZE, "CMSG_GM_FREEZE"},
|
||||||
|
{ CMSG_GM_UBERINVIS, "CMSG_GM_UBERINVIS"},
|
||||||
|
{ CMSG_GM_REQUEST_PLAYER_INFO, "CMSG_GM_REQUEST_PLAYER_INFO"},
|
||||||
|
{ SMSG_GM_PLAYER_INFO, "SMSG_GM_PLAYER_INFO"},
|
||||||
|
{ CMSG_GUILD_RANK, "CMSG_GUILD_RANK"},
|
||||||
|
{ CMSG_GUILD_ADD_RANK, "CMSG_GUILD_ADD_RANK"},
|
||||||
|
{ CMSG_GUILD_DEL_RANK, "CMSG_GUILD_DEL_RANK"},
|
||||||
|
{ CMSG_GUILD_SET_PUBLIC_NOTE, "CMSG_GUILD_SET_PUBLIC_NOTE"},
|
||||||
|
{ CMSG_GUILD_SET_OFFICER_NOTE, "CMSG_GUILD_SET_OFFICER_NOTE"},
|
||||||
|
{ SMSG_LOGIN_VERIFY_WORLD, "SMSG_LOGIN_VERIFY_WORLD"},
|
||||||
|
{ CMSG_CLEAR_EXPLORATION, "CMSG_CLEAR_EXPLORATION"},
|
||||||
|
{ CMSG_SEND_MAIL, "CMSG_SEND_MAIL"},
|
||||||
|
{ SMSG_SEND_MAIL_RESULT, "SMSG_SEND_MAIL_RESULT"},
|
||||||
|
{ CMSG_GET_MAIL_LIST, "CMSG_GET_MAIL_LIST"},
|
||||||
|
{ SMSG_MAIL_LIST_RESULT, "SMSG_MAIL_LIST_RESULT"},
|
||||||
|
{ CMSG_BATTLEFIELD_LIST, "CMSG_BATTLEFIELD_LIST"},
|
||||||
|
{ SMSG_BATTLEFIELD_LIST, "SMSG_BATTLEFIELD_LIST"},
|
||||||
|
{ CMSG_BATTLEFIELD_JOIN, "CMSG_BATTLEFIELD_JOIN"},
|
||||||
|
{ SMSG_BATTLEFIELD_WIN, "SMSG_BATTLEFIELD_WIN"},
|
||||||
|
{ SMSG_BATTLEFIELD_LOSE, "SMSG_BATTLEFIELD_LOSE"},
|
||||||
|
{ CMSG_TAXICLEARNODE, "CMSG_TAXICLEARNODE"},
|
||||||
|
{ CMSG_TAXIENABLENODE, "CMSG_TAXIENABLENODE"},
|
||||||
|
{ CMSG_ITEM_TEXT_QUERY, "CMSG_ITEM_TEXT_QUERY"},
|
||||||
|
{ SMSG_ITEM_TEXT_QUERY_RESPONSE, "SMSG_ITEM_TEXT_QUERY_RESPONSE"},
|
||||||
|
{ CMSG_MAIL_TAKE_MONEY, "CMSG_MAIL_TAKE_MONEY"},
|
||||||
|
{ CMSG_MAIL_TAKE_ITEM, "CMSG_MAIL_TAKE_ITEM"},
|
||||||
|
{ CMSG_MAIL_MARK_AS_READ, "CMSG_MAIL_MARK_AS_READ"},
|
||||||
|
{ CMSG_MAIL_RETURN_TO_SENDER, "CMSG_MAIL_RETURN_TO_SENDER"},
|
||||||
|
{ CMSG_MAIL_DELETE, "CMSG_MAIL_DELETE"},
|
||||||
|
{ CMSG_MAIL_CREATE_TEXT_ITEM, "CMSG_MAIL_CREATE_TEXT_ITEM"},
|
||||||
|
{ SMSG_SPELLLOGMISS, "SMSG_SPELLLOGMISS"},
|
||||||
|
{ SMSG_SPELLLOGEXECUTE, "SMSG_SPELLLOGEXECUTE"},
|
||||||
|
{ SMSG_DEBUGAURAPROC, "SMSG_DEBUGAURAPROC"},
|
||||||
|
{ SMSG_PERIODICAURALOG, "SMSG_PERIODICAURALOG"},
|
||||||
|
{ SMSG_SPELLDAMAGESHIELD, "SMSG_SPELLDAMAGESHIELD"},
|
||||||
|
{ SMSG_SPELLNONMELEEDAMAGELOG, "SMSG_SPELLNONMELEEDAMAGELOG"},
|
||||||
|
{ CMSG_LEARN_TALENT, "CMSG_LEARN_TALENT"},
|
||||||
|
{ SMSG_RESURRECT_FAILED, "SMSG_RESURRECT_FAILED"},
|
||||||
|
{ CMSG_TOGGLE_PVP, "CMSG_TOGGLE_PVP"},
|
||||||
|
{ SMSG_ZONE_UNDER_ATTACK, "SMSG_ZONE_UNDER_ATTACK"},
|
||||||
|
{ MSG_AUCTION_HELLO, "MSG_AUCTION_HELLO"},
|
||||||
|
{ CMSG_AUCTION_SELL_ITEM, "CMSG_AUCTION_SELL_ITEM"},
|
||||||
|
{ CMSG_AUCTION_REMOVE_ITEM, "CMSG_AUCTION_REMOVE_ITEM"},
|
||||||
|
{ CMSG_AUCTION_LIST_ITEMS, "CMSG_AUCTION_LIST_ITEMS"},
|
||||||
|
{ CMSG_AUCTION_LIST_OWNER_ITEMS, "CMSG_AUCTION_LIST_OWNER_ITEMS"},
|
||||||
|
{ CMSG_AUCTION_PLACE_BID, "CMSG_AUCTION_PLACE_BID"},
|
||||||
|
{ SMSG_AUCTION_COMMAND_RESULT, "SMSG_AUCTION_COMMAND_RESULT"},
|
||||||
|
{ SMSG_AUCTION_LIST_RESULT, "SMSG_AUCTION_LIST_RESULT"},
|
||||||
|
{ SMSG_AUCTION_OWNER_LIST_RESULT, "SMSG_AUCTION_OWNER_LIST_RESULT"},
|
||||||
|
{ SMSG_AUCTION_BIDDER_NOTIFICATION, "SMSG_AUCTION_BIDDER_NOTIFICATION"},
|
||||||
|
{ SMSG_AUCTION_OWNER_NOTIFICATION, "SMSG_AUCTION_OWNER_NOTIFICATION"},
|
||||||
|
{ SMSG_PROCRESIST, "SMSG_PROCRESIST"},
|
||||||
|
{ SMSG_STANDSTATE_CHANGE_FAILURE, "SMSG_STANDSTATE_CHANGE_FAILURE"},
|
||||||
|
{ SMSG_DISPEL_FAILED, "SMSG_DISPEL_FAILED"},
|
||||||
|
{ SMSG_SPELLORDAMAGE_IMMUNE, "SMSG_SPELLORDAMAGE_IMMUNE"},
|
||||||
|
{ CMSG_AUCTION_LIST_BIDDER_ITEMS, "CMSG_AUCTION_LIST_BIDDER_ITEMS"},
|
||||||
|
{ SMSG_AUCTION_BIDDER_LIST_RESULT, "SMSG_AUCTION_BIDDER_LIST_RESULT"},
|
||||||
|
{ SMSG_SET_FLAT_SPELL_MODIFIER, "SMSG_SET_FLAT_SPELL_MODIFIER"},
|
||||||
|
{ SMSG_SET_PCT_SPELL_MODIFIER, "SMSG_SET_PCT_SPELL_MODIFIER"},
|
||||||
|
{ CMSG_SET_AMMO, "CMSG_SET_AMMO"},
|
||||||
|
{ SMSG_CORPSE_RECLAIM_DELAY, "SMSG_CORPSE_RECLAIM_DELAY"},
|
||||||
|
{ CMSG_SET_ACTIVE_MOVER, "CMSG_SET_ACTIVE_MOVER"},
|
||||||
|
{ CMSG_PET_CANCEL_AURA, "CMSG_PET_CANCEL_AURA"},
|
||||||
|
{ CMSG_PLAYER_AI_CHEAT, "CMSG_PLAYER_AI_CHEAT"},
|
||||||
|
{ CMSG_CANCEL_AUTO_REPEAT_SPELL, "CMSG_CANCEL_AUTO_REPEAT_SPELL"},
|
||||||
|
{ MSG_GM_ACCOUNT_ONLINE, "MSG_GM_ACCOUNT_ONLINE"},
|
||||||
|
{ MSG_LIST_STABLED_PETS, "MSG_LIST_STABLED_PETS"},
|
||||||
|
{ CMSG_STABLE_PET, "CMSG_STABLE_PET"},
|
||||||
|
{ CMSG_UNSTABLE_PET, "CMSG_UNSTABLE_PET"},
|
||||||
|
{ CMSG_BUY_STABLE_SLOT, "CMSG_BUY_STABLE_SLOT"},
|
||||||
|
{ SMSG_STABLE_RESULT, "SMSG_STABLE_RESULT"},
|
||||||
|
{ CMSG_STABLE_REVIVE_PET, "CMSG_STABLE_REVIVE_PET"},
|
||||||
|
{ CMSG_STABLE_SWAP_PET, "CMSG_STABLE_SWAP_PET"},
|
||||||
|
{ MSG_QUEST_PUSH_RESULT, "MSG_QUEST_PUSH_RESULT"},
|
||||||
|
{ SMSG_PLAY_MUSIC, "SMSG_PLAY_MUSIC"},
|
||||||
|
{ SMSG_PLAY_OBJECT_SOUND, "SMSG_PLAY_OBJECT_SOUND"},
|
||||||
|
{ CMSG_REQUEST_PET_INFO, "CMSG_REQUEST_PET_INFO"},
|
||||||
|
{ CMSG_FAR_SIGHT, "CMSG_FAR_SIGHT"},
|
||||||
|
{ SMSG_SPELLDISPELLOG, "SMSG_SPELLDISPELLOG"},
|
||||||
|
{ SMSG_DAMAGE_CALC_LOG, "SMSG_DAMAGE_CALC_LOG"},
|
||||||
|
{ CMSG_ENABLE_DAMAGE_LOG, "CMSG_ENABLE_DAMAGE_LOG"},
|
||||||
|
{ CMSG_GROUP_CHANGE_SUB_GROUP, "CMSG_GROUP_CHANGE_SUB_GROUP"},
|
||||||
|
{ CMSG_REQUEST_PARTY_MEMBER_STATS, "CMSG_REQUEST_PARTY_MEMBER_STATS"},
|
||||||
|
{ CMSG_GROUP_SWAP_SUB_GROUP, "CMSG_GROUP_SWAP_SUB_GROUP"},
|
||||||
|
{ CMSG_RESET_FACTION_CHEAT, "CMSG_RESET_FACTION_CHEAT"},
|
||||||
|
{ CMSG_AUTOSTORE_BANK_ITEM, "CMSG_AUTOSTORE_BANK_ITEM"},
|
||||||
|
{ CMSG_AUTOBANK_ITEM, "CMSG_AUTOBANK_ITEM"},
|
||||||
|
{ MSG_QUERY_NEXT_MAIL_TIME, "MSG_QUERY_NEXT_MAIL_TIME"},
|
||||||
|
{ SMSG_RECEIVED_MAIL, "SMSG_RECEIVED_MAIL"},
|
||||||
|
{ SMSG_RAID_GROUP_ONLY, "SMSG_RAID_GROUP_ONLY"},
|
||||||
|
{ CMSG_SET_DURABILITY_CHEAT, "CMSG_SET_DURABILITY_CHEAT"},
|
||||||
|
{ CMSG_SET_PVP_RANK_CHEAT, "CMSG_SET_PVP_RANK_CHEAT"},
|
||||||
|
{ CMSG_ADD_PVP_MEDAL_CHEAT, "CMSG_ADD_PVP_MEDAL_CHEAT"},
|
||||||
|
{ CMSG_DEL_PVP_MEDAL_CHEAT, "CMSG_DEL_PVP_MEDAL_CHEAT"},
|
||||||
|
{ CMSG_SET_PVP_TITLE, "CMSG_SET_PVP_TITLE"},
|
||||||
|
{ SMSG_PVP_CREDIT, "SMSG_PVP_CREDIT"},
|
||||||
|
{ SMSG_AUCTION_REMOVED_NOTIFICATION, "SMSG_AUCTION_REMOVED_NOTIFICATION"},
|
||||||
|
{ CMSG_GROUP_RAID_CONVERT, "CMSG_GROUP_RAID_CONVERT"},
|
||||||
|
{ CMSG_GROUP_ASSISTANT_LEADER, "CMSG_GROUP_ASSISTANT_LEADER"},
|
||||||
|
{ CMSG_BUYBACK_ITEM, "CMSG_BUYBACK_ITEM"},
|
||||||
|
{ SMSG_SERVER_MESSAGE, "SMSG_SERVER_MESSAGE"},
|
||||||
|
{ CMSG_MEETINGSTONE_JOIN, "CMSG_MEETINGSTONE_JOIN"},
|
||||||
|
{ CMSG_MEETINGSTONE_LEAVE, "CMSG_MEETINGSTONE_LEAVE"},
|
||||||
|
{ CMSG_MEETINGSTONE_CHEAT, "CMSG_MEETINGSTONE_CHEAT"},
|
||||||
|
{ SMSG_MEETINGSTONE_SETQUEUE, "SMSG_MEETINGSTONE_SETQUEUE"},
|
||||||
|
{ CMSG_MEETINGSTONE_INFO, "CMSG_MEETINGSTONE_INFO"},
|
||||||
|
{ SMSG_MEETINGSTONE_COMPLETE, "SMSG_MEETINGSTONE_COMPLETE"},
|
||||||
|
{ SMSG_MEETINGSTONE_IN_PROGRESS, "SMSG_MEETINGSTONE_IN_PROGRESS"},
|
||||||
|
{ SMSG_MEETINGSTONE_MEMBER_ADDED, "SMSG_MEETINGSTONE_MEMBER_ADDED"},
|
||||||
|
{ CMSG_GMTICKETSYSTEM_TOGGLE, "CMSG_GMTICKETSYSTEM_TOGGLE"},
|
||||||
|
{ CMSG_CANCEL_GROWTH_AURA, "CMSG_CANCEL_GROWTH_AURA"},
|
||||||
|
{ SMSG_CANCEL_AUTO_REPEAT, "SMSG_CANCEL_AUTO_REPEAT"},
|
||||||
|
{ SMSG_STANDSTATE_CHANGE_ACK, "SMSG_STANDSTATE_CHANGE_ACK"},
|
||||||
|
{ SMSG_LOOT_ALL_PASSED, "SMSG_LOOT_ALL_PASSED"},
|
||||||
|
{ SMSG_LOOT_ROLL_WON, "SMSG_LOOT_ROLL_WON"},
|
||||||
|
{ CMSG_LOOT_ROLL, "CMSG_LOOT_ROLL"},
|
||||||
|
{ SMSG_LOOT_START_ROLL, "SMSG_LOOT_START_ROLL"},
|
||||||
|
{ SMSG_LOOT_ROLL, "SMSG_LOOT_ROLL"},
|
||||||
|
{ CMSG_LOOT_MASTER_GIVE, "CMSG_LOOT_MASTER_GIVE"},
|
||||||
|
{ SMSG_LOOT_MASTER_LIST, "SMSG_LOOT_MASTER_LIST"},
|
||||||
|
{ SMSG_SET_FORCED_REACTIONS, "SMSG_SET_FORCED_REACTIONS"},
|
||||||
|
{ SMSG_SPELL_FAILED_OTHER, "SMSG_SPELL_FAILED_OTHER"},
|
||||||
|
{ SMSG_GAMEOBJECT_RESET_STATE, "SMSG_GAMEOBJECT_RESET_STATE"},
|
||||||
|
{ CMSG_REPAIR_ITEM, "CMSG_REPAIR_ITEM"},
|
||||||
|
{ SMSG_CHAT_PLAYER_NOT_FOUND, "SMSG_CHAT_PLAYER_NOT_FOUND"},
|
||||||
|
{ MSG_TALENT_WIPE_CONFIRM, "MSG_TALENT_WIPE_CONFIRM"},
|
||||||
|
{ SMSG_SUMMON_REQUEST, "SMSG_SUMMON_REQUEST"},
|
||||||
|
{ CMSG_SUMMON_RESPONSE, "CMSG_SUMMON_RESPONSE"},
|
||||||
|
{ MSG_MOVE_TOGGLE_GRAVITY_CHEAT, "MSG_MOVE_TOGGLE_GRAVITY_CHEAT"},
|
||||||
|
{ SMSG_MONSTER_MOVE_TRANSPORT, "SMSG_MONSTER_MOVE_TRANSPORT"},
|
||||||
|
{ SMSG_PET_BROKEN, "SMSG_PET_BROKEN"},
|
||||||
|
{ MSG_MOVE_FEATHER_FALL, "MSG_MOVE_FEATHER_FALL"},
|
||||||
|
{ MSG_MOVE_WATER_WALK, "MSG_MOVE_WATER_WALK"},
|
||||||
|
{ CMSG_SERVER_BROADCAST, "CMSG_SERVER_BROADCAST"},
|
||||||
|
{ CMSG_SELF_RES, "CMSG_SELF_RES"},
|
||||||
|
{ SMSG_FEIGN_DEATH_RESISTED, "SMSG_FEIGN_DEATH_RESISTED"},
|
||||||
|
{ CMSG_RUN_SCRIPT, "CMSG_RUN_SCRIPT"},
|
||||||
|
{ SMSG_SCRIPT_MESSAGE, "SMSG_SCRIPT_MESSAGE"},
|
||||||
|
{ SMSG_DUEL_COUNTDOWN, "SMSG_DUEL_COUNTDOWN"},
|
||||||
|
{ SMSG_AREA_TRIGGER_MESSAGE, "SMSG_AREA_TRIGGER_MESSAGE"},
|
||||||
|
{ CMSG_TOGGLE_HELM, "CMSG_TOGGLE_HELM"},
|
||||||
|
{ CMSG_TOGGLE_CLOAK, "CMSG_TOGGLE_CLOAK"},
|
||||||
|
{ SMSG_MEETINGSTONE_JOINFAILED, "SMSG_MEETINGSTONE_JOINFAILED"},
|
||||||
|
{ SMSG_PLAYER_SKINNED, "SMSG_PLAYER_SKINNED"},
|
||||||
|
{ SMSG_DURABILITY_DAMAGE_DEATH, "SMSG_DURABILITY_DAMAGE_DEATH"},
|
||||||
|
{ CMSG_SET_EXPLORATION, "CMSG_SET_EXPLORATION"},
|
||||||
|
{ CMSG_SET_ACTIONBAR_TOGGLES, "CMSG_SET_ACTIONBAR_TOGGLES"},
|
||||||
|
{ UMSG_DELETE_GUILD_CHARTER, "UMSG_DELETE_GUILD_CHARTER"},
|
||||||
|
{ MSG_PETITION_RENAME, "MSG_PETITION_RENAME"},
|
||||||
|
{ SMSG_INIT_WORLD_STATES, "SMSG_INIT_WORLD_STATES"},
|
||||||
|
{ SMSG_UPDATE_WORLD_STATE, "SMSG_UPDATE_WORLD_STATE"},
|
||||||
|
{ CMSG_ITEM_NAME_QUERY, "CMSG_ITEM_NAME_QUERY"},
|
||||||
|
{ SMSG_ITEM_NAME_QUERY_RESPONSE, "SMSG_ITEM_NAME_QUERY_RESPONSE"},
|
||||||
|
{ SMSG_PET_ACTION_FEEDBACK, "SMSG_PET_ACTION_FEEDBACK"},
|
||||||
|
{ CMSG_CHAR_RENAME, "CMSG_CHAR_RENAME"},
|
||||||
|
{ SMSG_CHAR_RENAME, "SMSG_CHAR_RENAME"},
|
||||||
|
{ CMSG_MOVE_SPLINE_DONE, "CMSG_MOVE_SPLINE_DONE"},
|
||||||
|
{ CMSG_MOVE_FALL_RESET, "CMSG_MOVE_FALL_RESET"},
|
||||||
|
{ SMSG_INSTANCE_SAVE_CREATED, "SMSG_INSTANCE_SAVE_CREATED"},
|
||||||
|
{ SMSG_RAID_INSTANCE_INFO, "SMSG_RAID_INSTANCE_INFO"},
|
||||||
|
{ CMSG_REQUEST_RAID_INFO, "CMSG_REQUEST_RAID_INFO"},
|
||||||
|
{ CMSG_MOVE_TIME_SKIPPED, "CMSG_MOVE_TIME_SKIPPED"},
|
||||||
|
{ CMSG_MOVE_FEATHER_FALL_ACK, "CMSG_MOVE_FEATHER_FALL_ACK"},
|
||||||
|
{ CMSG_MOVE_WATER_WALK_ACK, "CMSG_MOVE_WATER_WALK_ACK"},
|
||||||
|
{ CMSG_MOVE_NOT_ACTIVE_MOVER, "CMSG_MOVE_NOT_ACTIVE_MOVER"},
|
||||||
|
{ SMSG_PLAY_SOUND, "SMSG_PLAY_SOUND"},
|
||||||
|
{ CMSG_BATTLEFIELD_STATUS, "CMSG_BATTLEFIELD_STATUS"},
|
||||||
|
{ SMSG_BATTLEFIELD_STATUS, "SMSG_BATTLEFIELD_STATUS"},
|
||||||
|
{ CMSG_BATTLEFIELD_PORT, "CMSG_BATTLEFIELD_PORT"},
|
||||||
|
{ MSG_INSPECT_HONOR_STATS, "MSG_INSPECT_HONOR_STATS"},
|
||||||
|
{ CMSG_BATTLEMASTER_HELLO, "CMSG_BATTLEMASTER_HELLO"},
|
||||||
|
{ CMSG_MOVE_START_SWIM_CHEAT, "CMSG_MOVE_START_SWIM_CHEAT"},
|
||||||
|
{ CMSG_MOVE_STOP_SWIM_CHEAT, "CMSG_MOVE_STOP_SWIM_CHEAT"},
|
||||||
|
{ SMSG_FORCE_WALK_SPEED_CHANGE, "SMSG_FORCE_WALK_SPEED_CHANGE"},
|
||||||
|
{ CMSG_FORCE_WALK_SPEED_CHANGE_ACK, "CMSG_FORCE_WALK_SPEED_CHANGE_ACK"},
|
||||||
|
{ SMSG_FORCE_SWIM_BACK_SPEED_CHANGE, "SMSG_FORCE_SWIM_BACK_SPEED_CHANGE"},
|
||||||
|
{ CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK, "CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK"},
|
||||||
|
{ SMSG_FORCE_TURN_RATE_CHANGE, "SMSG_FORCE_TURN_RATE_CHANGE"},
|
||||||
|
{ CMSG_FORCE_TURN_RATE_CHANGE_ACK, "CMSG_FORCE_TURN_RATE_CHANGE_ACK"},
|
||||||
|
{ MSG_PVP_LOG_DATA, "MSG_PVP_LOG_DATA"},
|
||||||
|
{ CMSG_LEAVE_BATTLEFIELD, "CMSG_LEAVE_BATTLEFIELD"},
|
||||||
|
{ CMSG_AREA_SPIRIT_HEALER_QUERY, "CMSG_AREA_SPIRIT_HEALER_QUERY"},
|
||||||
|
{ CMSG_AREA_SPIRIT_HEALER_QUEUE, "CMSG_AREA_SPIRIT_HEALER_QUEUE"},
|
||||||
|
{ SMSG_AREA_SPIRIT_HEALER_TIME, "SMSG_AREA_SPIRIT_HEALER_TIME"},
|
||||||
|
{ CMSG_GM_UNTEACH, "CMSG_GM_UNTEACH"},
|
||||||
|
{ SMSG_HARDWARE_SURVEY_REQUEST, "SMSG_HARDWARE_SURVEY_REQUEST"},
|
||||||
|
{ CMSG_HARDWARE_SURVEY_RESULTS, "CMSG_HARDWARE_SURVEY_RESULTS"},
|
||||||
|
{ SMSG_WARDEN_DATA, "SMSG_WARDEN_DATA"},
|
||||||
|
{ CMSG_WARDEN_DATA, "CMSG_WARDEN_DATA"},
|
||||||
|
{ SMSG_GROUP_JOINED_BATTLEGROUND, "SMSG_GROUP_JOINED_BATTLEGROUND"},
|
||||||
|
{ MSG_BATTLEGROUND_PLAYER_POSITIONS, "MSG_BATTLEGROUND_PLAYER_POSITIONS"},
|
||||||
|
{ CMSG_PET_STOP_ATTACK, "CMSG_PET_STOP_ATTACK"},
|
||||||
|
{ SMSG_BINDER_CONFIRM, "SMSG_BINDER_CONFIRM"},
|
||||||
|
{ SMSG_BATTLEGROUND_PLAYER_JOINED, "SMSG_BATTLEGROUND_PLAYER_JOINED"},
|
||||||
|
{ SMSG_BATTLEGROUND_PLAYER_LEFT, "SMSG_BATTLEGROUND_PLAYER_LEFT"},
|
||||||
|
{ CMSG_BATTLEMASTER_JOIN, "CMSG_BATTLEMASTER_JOIN"},
|
||||||
|
{ SMSG_ADDON_INFO, "SMSG_ADDON_INFO"},
|
||||||
|
{ CMSG_PET_UNLEARN, "CMSG_PET_UNLEARN"},
|
||||||
|
{ SMSG_PET_UNLEARN_CONFIRM, "SMSG_PET_UNLEARN_CONFIRM"},
|
||||||
|
{ SMSG_PARTY_MEMBER_STATS_FULL, "SMSG_PARTY_MEMBER_STATS_FULL"},
|
||||||
|
{ CMSG_PET_SPELL_AUTOCAST, "CMSG_PET_SPELL_AUTOCAST"},
|
||||||
|
{ SMSG_WEATHER, "SMSG_WEATHER"},
|
||||||
|
{ SMSG_PLAY_TIME_WARNING, "SMSG_PLAY_TIME_WARNING"},
|
||||||
|
{ SMSG_MINIGAME_SETUP, "SMSG_MINIGAME_SETUP"},
|
||||||
|
{ SMSG_MINIGAME_STATE, "SMSG_MINIGAME_STATE"},
|
||||||
|
{ CMSG_MINIGAME_MOVE, "CMSG_MINIGAME_MOVE"},
|
||||||
|
{ SMSG_MINIGAME_MOVE_FAILED, "SMSG_MINIGAME_MOVE_FAILED"},
|
||||||
|
{ CMSG_GUILD_CHANGEINFO, "CMSG_GUILD_CHANGEINFO"},
|
||||||
|
{ SMSG_OUTDOORPVP_NOTIFY, "SMSG_OUTDOORPVP_NOTIFY"}, // unofficial - first appeared in 1.12
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
char *className[]={"ERROR","Warrior","Paladin","Hunter","Rogue","Priest","FUTURE_1","Shaman","Mage","Warlock","FUTURE_2","Druid"};
|
||||||
|
char *raceName[]={"ERROR","Human","Orc","Dwarf","Nightelf","Undead","Tauren","Gnome","Troll"};
|
||||||
|
|
||||||
|
NameTableEntry langNames[] = {
|
||||||
|
{ LANG_GLOBAL, "Universal"},
|
||||||
|
{ LANG_UNIVERSAL, "Universal"},
|
||||||
|
{ LANG_ORCISH, "Orcish"},
|
||||||
|
{ LANG_DARNASSIAN, "Darnassian"},
|
||||||
|
{ LANG_TAURAHE, "Taurahe"},
|
||||||
|
{ LANG_DWARVISH, "Dwarvish"},
|
||||||
|
{ LANG_COMMON, "Common"},
|
||||||
|
{ LANG_DEMONIC, "Demonic"},
|
||||||
|
{ LANG_TITAN, "Titan"},
|
||||||
|
{ LANG_THELASSIAN, "Thelassian"},
|
||||||
|
{ LANG_DRACONIC, "Draconic"},
|
||||||
|
{ LANG_KALIMAG, "Kalimag"},
|
||||||
|
{ LANG_GNOMISH, "Gnomish"},
|
||||||
|
{ LANG_TROLL, "Troll"},
|
||||||
|
{ LANG_GUTTERSPEAK, "Gutterspeak"},
|
||||||
|
{0,0}
|
||||||
|
};
|
||||||
|
|
||||||
872
src/Client/World/Opcodes.h
Normal file
872
src/Client/World/Opcodes.h
Normal file
@ -0,0 +1,872 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OPCODES_H
|
||||||
|
#define _OPCODES_H
|
||||||
|
|
||||||
|
enum OpCodes
|
||||||
|
{
|
||||||
|
MSG_NULL_ACTION = 0,
|
||||||
|
CMSG_BOOTME = 1,
|
||||||
|
CMSG_DBLOOKUP = 2,
|
||||||
|
SMSG_DBLOOKUP = 3,
|
||||||
|
CMSG_QUERY_OBJECT_POSITION = 4,
|
||||||
|
SMSG_QUERY_OBJECT_POSITION = 5,
|
||||||
|
CMSG_QUERY_OBJECT_ROTATION = 6,
|
||||||
|
SMSG_QUERY_OBJECT_ROTATION = 7,
|
||||||
|
CMSG_WORLD_TELEPORT = 8,
|
||||||
|
CMSG_TELEPORT_TO_UNIT = 9,
|
||||||
|
CMSG_ZONE_MAP = 10,
|
||||||
|
SMSG_ZONE_MAP = 11,
|
||||||
|
CMSG_DEBUG_CHANGECELLZONE = 12,
|
||||||
|
CMSG_EMBLAZON_TABARD_OBSOLETE = 13,
|
||||||
|
CMSG_UNEMBLAZON_TABARD_OBSOLETE = 14,
|
||||||
|
CMSG_RECHARGE = 15,
|
||||||
|
CMSG_LEARN_SPELL = 16,
|
||||||
|
CMSG_CREATEMONSTER = 17,
|
||||||
|
CMSG_DESTROYMONSTER = 18,
|
||||||
|
CMSG_CREATEITEM = 19,
|
||||||
|
CMSG_CREATEGAMEOBJECT = 20,
|
||||||
|
|
||||||
|
//CMSG_MAKEMONSTERATTACKME = 21, //OBSOLETE
|
||||||
|
CMSG_MAKEMONSTERATTACKME_OBSOLETE = 21,
|
||||||
|
CMSG_MAKEMONSTERATTACKGUID = 22,
|
||||||
|
CMSG_ENABLEDEBUGCOMBATLOGGING_OBSOLETE = 23,
|
||||||
|
CMSG_FORCEACTION = 24,
|
||||||
|
CMSG_FORCEACTIONONOTHER = 25,
|
||||||
|
CMSG_FORCEACTIONSHOW = 26,
|
||||||
|
SMSG_FORCEACTIONSHOW = 27,
|
||||||
|
SMSG_ATTACKERSTATEUPDATEDEBUGINFO_OBSOLETE = 28,
|
||||||
|
SMSG_DEBUGINFOSPELL_OBSOLETE = 29,
|
||||||
|
SMSG_DEBUGINFOSPELLMISS_OBSOLETE = 30,
|
||||||
|
SMSG_DEBUG_PLAYER_RANGE_OBSOLETE = 31,
|
||||||
|
CMSG_UNDRESSPLAYER = 32,
|
||||||
|
CMSG_BEASTMASTER = 33,
|
||||||
|
CMSG_GODMODE = 34,
|
||||||
|
SMSG_GODMODE = 35,
|
||||||
|
CMSG_CHEAT_SETMONEY = 36,
|
||||||
|
CMSG_LEVEL_CHEAT = 37,
|
||||||
|
CMSG_PET_LEVEL_CHEAT = 38,
|
||||||
|
CMSG_LEVELUP_CHEAT_OBSOLETE = 39,
|
||||||
|
CMSG_COOLDOWN_CHEAT = 40,
|
||||||
|
CMSG_USE_SKILL_CHEAT = 41,
|
||||||
|
CMSG_FLAG_QUEST = 42,
|
||||||
|
CMSG_FLAG_QUEST_FINISH = 43,
|
||||||
|
CMSG_CLEAR_QUEST = 44,
|
||||||
|
CMSG_SEND_EVENT = 45,
|
||||||
|
CMSG_DEBUG_AISTATE = 46,
|
||||||
|
SMSG_DEBUG_AISTATE = 47,
|
||||||
|
CMSG_DISABLE_PVP_CHEAT = 48,
|
||||||
|
CMSG_ADVANCE_SPAWN_TIME = 49,
|
||||||
|
CMSG_PVP_PORT_OBSOLETE = 50,
|
||||||
|
CMSG_AUTH_SRP6_BEGIN = 51,
|
||||||
|
CMSG_AUTH_SRP6_PROOF = 52,
|
||||||
|
CMSG_AUTH_SRP6_RECODE = 53,
|
||||||
|
CMSG_CHAR_CREATE = 54,
|
||||||
|
CMSG_CHAR_ENUM = 55,
|
||||||
|
CMSG_CHAR_DELETE = 56,
|
||||||
|
SMSG_AUTH_SRP6_RESPONSE = 57,
|
||||||
|
SMSG_CHAR_CREATE = 58,
|
||||||
|
SMSG_CHAR_ENUM = 59,
|
||||||
|
SMSG_CHAR_DELETE = 60,
|
||||||
|
CMSG_PLAYER_LOGIN = 61,
|
||||||
|
SMSG_NEW_WORLD = 62,
|
||||||
|
SMSG_TRANSFER_PENDING = 63,
|
||||||
|
SMSG_TRANSFER_ABORTED = 64,
|
||||||
|
SMSG_CHARACTER_LOGIN_FAILED = 65,
|
||||||
|
SMSG_LOGIN_SETTIMESPEED = 66,
|
||||||
|
SMSG_GAMETIME_UPDATE = 67,
|
||||||
|
CMSG_GAMETIME_SET = 68,
|
||||||
|
SMSG_GAMETIME_SET = 69,
|
||||||
|
CMSG_GAMESPEED_SET = 70,
|
||||||
|
SMSG_GAMESPEED_SET = 71,
|
||||||
|
CMSG_SERVERTIME = 72,
|
||||||
|
SMSG_SERVERTIME = 73,
|
||||||
|
CMSG_PLAYER_LOGOUT = 74,
|
||||||
|
CMSG_LOGOUT_REQUEST = 75,
|
||||||
|
SMSG_LOGOUT_RESPONSE = 76,
|
||||||
|
SMSG_LOGOUT_COMPLETE = 77,
|
||||||
|
CMSG_LOGOUT_CANCEL = 78,
|
||||||
|
SMSG_LOGOUT_CANCEL_ACK = 79,
|
||||||
|
CMSG_NAME_QUERY = 80,
|
||||||
|
SMSG_NAME_QUERY_RESPONSE = 81,
|
||||||
|
CMSG_PET_NAME_QUERY = 82,
|
||||||
|
SMSG_PET_NAME_QUERY_RESPONSE = 83,
|
||||||
|
CMSG_GUILD_QUERY = 84,
|
||||||
|
SMSG_GUILD_QUERY_RESPONSE = 85,
|
||||||
|
CMSG_ITEM_QUERY_SINGLE = 86,
|
||||||
|
CMSG_ITEM_QUERY_MULTIPLE = 87,
|
||||||
|
SMSG_ITEM_QUERY_SINGLE_RESPONSE = 88,
|
||||||
|
SMSG_ITEM_QUERY_MULTIPLE_RESPONSE = 89,
|
||||||
|
CMSG_PAGE_TEXT_QUERY = 90,
|
||||||
|
SMSG_PAGE_TEXT_QUERY_RESPONSE = 91,
|
||||||
|
CMSG_QUEST_QUERY = 92,
|
||||||
|
SMSG_QUEST_QUERY_RESPONSE = 93,
|
||||||
|
CMSG_GAMEOBJECT_QUERY = 94,
|
||||||
|
SMSG_GAMEOBJECT_QUERY_RESPONSE = 95,
|
||||||
|
CMSG_CREATURE_QUERY = 96,
|
||||||
|
SMSG_CREATURE_QUERY_RESPONSE = 97,
|
||||||
|
CMSG_WHO = 98,
|
||||||
|
SMSG_WHO = 99,
|
||||||
|
CMSG_WHOIS = 100,
|
||||||
|
SMSG_WHOIS = 101,
|
||||||
|
CMSG_FRIEND_LIST = 102,
|
||||||
|
SMSG_FRIEND_LIST = 103,
|
||||||
|
SMSG_FRIEND_STATUS = 104,
|
||||||
|
CMSG_ADD_FRIEND = 105,
|
||||||
|
CMSG_DEL_FRIEND = 106,
|
||||||
|
SMSG_IGNORE_LIST = 107,
|
||||||
|
CMSG_ADD_IGNORE = 108,
|
||||||
|
CMSG_DEL_IGNORE = 109,
|
||||||
|
CMSG_GROUP_INVITE = 110,
|
||||||
|
SMSG_GROUP_INVITE = 111,
|
||||||
|
CMSG_GROUP_CANCEL = 112,
|
||||||
|
SMSG_GROUP_CANCEL = 113,
|
||||||
|
CMSG_GROUP_ACCEPT = 114,
|
||||||
|
CMSG_GROUP_DECLINE = 115,
|
||||||
|
SMSG_GROUP_DECLINE = 116,
|
||||||
|
CMSG_GROUP_UNINVITE = 117,
|
||||||
|
CMSG_GROUP_UNINVITE_GUID = 118,
|
||||||
|
SMSG_GROUP_UNINVITE = 119,
|
||||||
|
CMSG_GROUP_SET_LEADER = 120,
|
||||||
|
SMSG_GROUP_SET_LEADER = 121,
|
||||||
|
CMSG_LOOT_METHOD = 122,
|
||||||
|
CMSG_GROUP_DISBAND = 123,
|
||||||
|
SMSG_GROUP_DESTROYED = 124,
|
||||||
|
SMSG_GROUP_LIST = 125,
|
||||||
|
SMSG_PARTY_MEMBER_STATS = 126,
|
||||||
|
SMSG_PARTY_COMMAND_RESULT = 127,
|
||||||
|
UMSG_UPDATE_GROUP_MEMBERS = 128,
|
||||||
|
CMSG_GUILD_CREATE = 129,
|
||||||
|
CMSG_GUILD_INVITE = 130,
|
||||||
|
SMSG_GUILD_INVITE = 131,
|
||||||
|
CMSG_GUILD_ACCEPT = 132,
|
||||||
|
CMSG_GUILD_DECLINE = 133,
|
||||||
|
SMSG_GUILD_DECLINE = 134,
|
||||||
|
CMSG_GUILD_INFO = 135,
|
||||||
|
SMSG_GUILD_INFO = 136,
|
||||||
|
CMSG_GUILD_ROSTER = 137,
|
||||||
|
SMSG_GUILD_ROSTER = 138,
|
||||||
|
CMSG_GUILD_PROMOTE = 139,
|
||||||
|
CMSG_GUILD_DEMOTE = 140,
|
||||||
|
CMSG_GUILD_LEAVE = 141,
|
||||||
|
CMSG_GUILD_REMOVE = 142,
|
||||||
|
CMSG_GUILD_DISBAND = 143,
|
||||||
|
CMSG_GUILD_LEADER = 144,
|
||||||
|
CMSG_GUILD_MOTD = 145,
|
||||||
|
SMSG_GUILD_EVENT = 146,
|
||||||
|
SMSG_GUILD_COMMAND_RESULT = 147,
|
||||||
|
UMSG_UPDATE_GUILD = 148,
|
||||||
|
CMSG_MESSAGECHAT = 149,
|
||||||
|
SMSG_MESSAGECHAT = 150,
|
||||||
|
CMSG_JOIN_CHANNEL = 151,
|
||||||
|
CMSG_LEAVE_CHANNEL = 152,
|
||||||
|
SMSG_CHANNEL_NOTIFY = 153,
|
||||||
|
CMSG_CHANNEL_LIST = 154,
|
||||||
|
SMSG_CHANNEL_LIST = 155,
|
||||||
|
CMSG_CHANNEL_PASSWORD = 156,
|
||||||
|
CMSG_CHANNEL_SET_OWNER = 157,
|
||||||
|
CMSG_CHANNEL_OWNER = 158,
|
||||||
|
CMSG_CHANNEL_MODERATOR = 159,
|
||||||
|
CMSG_CHANNEL_UNMODERATOR = 160,
|
||||||
|
CMSG_CHANNEL_MUTE = 161,
|
||||||
|
CMSG_CHANNEL_UNMUTE = 162,
|
||||||
|
CMSG_CHANNEL_INVITE = 163,
|
||||||
|
CMSG_CHANNEL_KICK = 164,
|
||||||
|
CMSG_CHANNEL_BAN = 165,
|
||||||
|
CMSG_CHANNEL_UNBAN = 166,
|
||||||
|
CMSG_CHANNEL_ANNOUNCEMENTS = 167,
|
||||||
|
CMSG_CHANNEL_MODERATE = 168,
|
||||||
|
SMSG_UPDATE_OBJECT = 169,
|
||||||
|
SMSG_DESTROY_OBJECT = 170,
|
||||||
|
CMSG_USE_ITEM = 171,
|
||||||
|
CMSG_OPEN_ITEM = 172,
|
||||||
|
CMSG_READ_ITEM = 173,
|
||||||
|
SMSG_READ_ITEM_OK = 174,
|
||||||
|
SMSG_READ_ITEM_FAILED = 175,
|
||||||
|
SMSG_ITEM_COOLDOWN = 176,
|
||||||
|
CMSG_GAMEOBJ_USE = 177,
|
||||||
|
CMSG_GAMEOBJ_CHAIR_USE_OBSOLETE = 178,
|
||||||
|
SMSG_GAMEOBJECT_CUSTOM_ANIM = 179,
|
||||||
|
CMSG_AREATRIGGER = 180,
|
||||||
|
MSG_MOVE_START_FORWARD = 181,
|
||||||
|
MSG_MOVE_START_BACKWARD = 182,
|
||||||
|
MSG_MOVE_STOP = 183,
|
||||||
|
MSG_MOVE_START_STRAFE_LEFT = 184,
|
||||||
|
MSG_MOVE_START_STRAFE_RIGHT = 185,
|
||||||
|
MSG_MOVE_STOP_STRAFE = 186,
|
||||||
|
MSG_MOVE_JUMP = 187,
|
||||||
|
MSG_MOVE_START_TURN_LEFT = 188,
|
||||||
|
MSG_MOVE_START_TURN_RIGHT = 189,
|
||||||
|
MSG_MOVE_STOP_TURN = 190,
|
||||||
|
MSG_MOVE_START_PITCH_UP = 191,
|
||||||
|
MSG_MOVE_START_PITCH_DOWN = 192,
|
||||||
|
MSG_MOVE_STOP_PITCH = 193,
|
||||||
|
MSG_MOVE_SET_RUN_MODE = 194,
|
||||||
|
MSG_MOVE_SET_WALK_MODE = 195,
|
||||||
|
MSG_MOVE_TOGGLE_LOGGING = 196,
|
||||||
|
MSG_MOVE_TELEPORT = 197,
|
||||||
|
MSG_MOVE_TELEPORT_CHEAT = 198,
|
||||||
|
MSG_MOVE_TELEPORT_ACK = 199,
|
||||||
|
MSG_MOVE_TOGGLE_FALL_LOGGING = 200,
|
||||||
|
MSG_MOVE_FALL_LAND = 201,
|
||||||
|
MSG_MOVE_START_SWIM = 202,
|
||||||
|
MSG_MOVE_STOP_SWIM = 203,
|
||||||
|
MSG_MOVE_SET_RUN_SPEED_CHEAT = 204,
|
||||||
|
MSG_MOVE_SET_RUN_SPEED = 205,
|
||||||
|
MSG_MOVE_SET_RUN_BACK_SPEED_CHEAT = 206,
|
||||||
|
MSG_MOVE_SET_RUN_BACK_SPEED = 207,
|
||||||
|
MSG_MOVE_SET_WALK_SPEED_CHEAT = 208,
|
||||||
|
MSG_MOVE_SET_WALK_SPEED = 209,
|
||||||
|
MSG_MOVE_SET_SWIM_SPEED_CHEAT = 210,
|
||||||
|
MSG_MOVE_SET_SWIM_SPEED = 211,
|
||||||
|
MSG_MOVE_SET_SWIM_BACK_SPEED_CHEAT = 212,
|
||||||
|
MSG_MOVE_SET_SWIM_BACK_SPEED = 213,
|
||||||
|
MSG_MOVE_SET_ALL_SPEED_CHEAT = 214,
|
||||||
|
MSG_MOVE_SET_TURN_RATE_CHEAT = 215,
|
||||||
|
MSG_MOVE_SET_TURN_RATE = 216,
|
||||||
|
MSG_MOVE_TOGGLE_COLLISION_CHEAT = 217,
|
||||||
|
MSG_MOVE_SET_FACING = 218,
|
||||||
|
MSG_MOVE_SET_PITCH = 219,
|
||||||
|
MSG_MOVE_WORLDPORT_ACK = 220,
|
||||||
|
SMSG_MONSTER_MOVE = 221,
|
||||||
|
SMSG_MOVE_WATER_WALK = 222,
|
||||||
|
SMSG_MOVE_LAND_WALK = 223,
|
||||||
|
MSG_MOVE_SET_RAW_POSITION_ACK = 224,
|
||||||
|
CMSG_MOVE_SET_RAW_POSITION = 225,
|
||||||
|
SMSG_FORCE_RUN_SPEED_CHANGE = 226,
|
||||||
|
CMSG_FORCE_RUN_SPEED_CHANGE_ACK = 227,
|
||||||
|
SMSG_FORCE_RUN_BACK_SPEED_CHANGE = 228,
|
||||||
|
CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK = 229,
|
||||||
|
SMSG_FORCE_SWIM_SPEED_CHANGE = 230,
|
||||||
|
CMSG_FORCE_SWIM_SPEED_CHANGE_ACK = 231,
|
||||||
|
SMSG_FORCE_MOVE_ROOT = 232,
|
||||||
|
CMSG_FORCE_MOVE_ROOT_ACK = 233,
|
||||||
|
SMSG_FORCE_MOVE_UNROOT = 234,
|
||||||
|
CMSG_FORCE_MOVE_UNROOT_ACK = 235,
|
||||||
|
MSG_MOVE_ROOT = 236,
|
||||||
|
MSG_MOVE_UNROOT = 237,
|
||||||
|
MSG_MOVE_HEARTBEAT = 238,
|
||||||
|
SMSG_MOVE_KNOCK_BACK = 239,
|
||||||
|
CMSG_MOVE_KNOCK_BACK_ACK = 240,
|
||||||
|
MSG_MOVE_KNOCK_BACK = 241,
|
||||||
|
SMSG_MOVE_FEATHER_FALL = 242,
|
||||||
|
SMSG_MOVE_NORMAL_FALL = 243,
|
||||||
|
SMSG_MOVE_SET_HOVER = 244,
|
||||||
|
SMSG_MOVE_UNSET_HOVER = 245,
|
||||||
|
CMSG_MOVE_HOVER_ACK = 246,
|
||||||
|
MSG_MOVE_HOVER = 247,
|
||||||
|
CMSG_TRIGGER_CINEMATIC_CHEAT = 248,
|
||||||
|
CMSG_OPENING_CINEMATIC = 249,
|
||||||
|
SMSG_TRIGGER_CINEMATIC = 250,
|
||||||
|
CMSG_NEXT_CINEMATIC_CAMERA = 251,
|
||||||
|
CMSG_COMPLETE_CINEMATIC = 252,
|
||||||
|
SMSG_TUTORIAL_FLAGS = 253,
|
||||||
|
CMSG_TUTORIAL_FLAG = 254,
|
||||||
|
CMSG_TUTORIAL_CLEAR = 255,
|
||||||
|
CMSG_TUTORIAL_RESET = 256,
|
||||||
|
CMSG_STANDSTATECHANGE = 257,
|
||||||
|
CMSG_EMOTE = 258,
|
||||||
|
SMSG_EMOTE = 259,
|
||||||
|
CMSG_TEXT_EMOTE = 260,
|
||||||
|
SMSG_TEXT_EMOTE = 261,
|
||||||
|
CMSG_AUTOEQUIP_GROUND_ITEM = 262,
|
||||||
|
CMSG_AUTOSTORE_GROUND_ITEM = 263,
|
||||||
|
CMSG_AUTOSTORE_LOOT_ITEM = 264,
|
||||||
|
CMSG_STORE_LOOT_IN_SLOT = 265,
|
||||||
|
CMSG_AUTOEQUIP_ITEM = 266,
|
||||||
|
CMSG_AUTOSTORE_BAG_ITEM = 267,
|
||||||
|
CMSG_SWAP_ITEM = 268,
|
||||||
|
CMSG_SWAP_INV_ITEM = 269,
|
||||||
|
CMSG_SPLIT_ITEM = 270,
|
||||||
|
CMSG_PICKUP_ITEM = 271,
|
||||||
|
CMSG_DROP_ITEM = 272,
|
||||||
|
CMSG_DESTROYITEM = 273,
|
||||||
|
SMSG_INVENTORY_CHANGE_FAILURE = 274,
|
||||||
|
SMSG_OPEN_CONTAINER = 275,
|
||||||
|
CMSG_INSPECT = 276,
|
||||||
|
SMSG_INSPECT = 277,
|
||||||
|
CMSG_INITIATE_TRADE = 278,
|
||||||
|
CMSG_BEGIN_TRADE = 279,
|
||||||
|
CMSG_BUSY_TRADE = 280,
|
||||||
|
CMSG_IGNORE_TRADE = 281,
|
||||||
|
CMSG_ACCEPT_TRADE = 282,
|
||||||
|
CMSG_UNACCEPT_TRADE = 283,
|
||||||
|
CMSG_CANCEL_TRADE = 284,
|
||||||
|
CMSG_SET_TRADE_ITEM = 285,
|
||||||
|
CMSG_CLEAR_TRADE_ITEM = 286,
|
||||||
|
CMSG_SET_TRADE_GOLD = 287,
|
||||||
|
SMSG_TRADE_STATUS = 288,
|
||||||
|
SMSG_TRADE_STATUS_EXTENDED = 289,
|
||||||
|
SMSG_INITIALIZE_FACTIONS = 290,
|
||||||
|
SMSG_SET_FACTION_VISIBLE = 291,
|
||||||
|
SMSG_SET_FACTION_STANDING = 292,
|
||||||
|
CMSG_SET_FACTION_ATWAR = 293,
|
||||||
|
CMSG_SET_FACTION_CHEAT = 294,
|
||||||
|
SMSG_SET_PROFICIENCY = 295,
|
||||||
|
CMSG_SET_ACTION_BUTTON = 296,
|
||||||
|
SMSG_ACTION_BUTTONS = 297,
|
||||||
|
SMSG_INITIAL_SPELLS = 298,
|
||||||
|
SMSG_LEARNED_SPELL = 299,
|
||||||
|
SMSG_SUPERCEDED_SPELL = 300,
|
||||||
|
CMSG_NEW_SPELL_SLOT = 301,
|
||||||
|
CMSG_CAST_SPELL = 302,
|
||||||
|
CMSG_CANCEL_CAST = 303,
|
||||||
|
SMSG_CAST_RESULT = 304,
|
||||||
|
SMSG_SPELL_START = 305,
|
||||||
|
SMSG_SPELL_GO = 306,
|
||||||
|
SMSG_SPELL_FAILURE = 307,
|
||||||
|
SMSG_SPELL_COOLDOWN = 308,
|
||||||
|
SMSG_COOLDOWN_EVENT = 309,
|
||||||
|
CMSG_CANCEL_AURA = 310,
|
||||||
|
SMSG_UPDATE_AURA_DURATION = 311,
|
||||||
|
SMSG_PET_CAST_FAILED = 312,
|
||||||
|
MSG_CHANNEL_START = 313,
|
||||||
|
MSG_CHANNEL_UPDATE = 314,
|
||||||
|
CMSG_CANCEL_CHANNELLING = 315,
|
||||||
|
SMSG_AI_REACTION = 316,
|
||||||
|
CMSG_SET_SELECTION = 317,
|
||||||
|
|
||||||
|
//CMSG_SET_TARGET = 318, //OBSOLETE
|
||||||
|
CMSG_SET_TARGET_OBSOLETE = 318,
|
||||||
|
CMSG_UNUSED = 319,
|
||||||
|
CMSG_UNUSED2 = 320,
|
||||||
|
CMSG_ATTACKSWING = 321,
|
||||||
|
CMSG_ATTACKSTOP = 322,
|
||||||
|
SMSG_ATTACKSTART = 323,
|
||||||
|
SMSG_ATTACKSTOP = 324,
|
||||||
|
SMSG_ATTACKSWING_NOTINRANGE = 325,
|
||||||
|
SMSG_ATTACKSWING_BADFACING = 326,
|
||||||
|
SMSG_ATTACKSWING_NOTSTANDING = 327,
|
||||||
|
SMSG_ATTACKSWING_DEADTARGET = 328,
|
||||||
|
SMSG_ATTACKSWING_CANT_ATTACK = 329,
|
||||||
|
SMSG_ATTACKERSTATEUPDATE = 330,
|
||||||
|
SMSG_VICTIMSTATEUPDATE_OBSOLETE = 331,
|
||||||
|
SMSG_DAMAGE_DONE_OBSOLETE = 332,
|
||||||
|
SMSG_DAMAGE_TAKEN_OBSOLETE = 333,
|
||||||
|
SMSG_CANCEL_COMBAT = 334,
|
||||||
|
SMSG_PLAYER_COMBAT_XP_GAIN_OBSOLETE = 335,
|
||||||
|
SMSG_HEALSPELL_ON_PLAYER_OBSOLETE = 336,
|
||||||
|
SMSG_HEALSPELL_ON_PLAYERS_PET_OBSOLETE = 337,
|
||||||
|
CMSG_SHEATHE_OBSOLETE = 338,
|
||||||
|
CMSG_SAVE_PLAYER = 339,
|
||||||
|
CMSG_SETDEATHBINDPOINT = 340,
|
||||||
|
SMSG_BINDPOINTUPDATE = 341,
|
||||||
|
CMSG_GETDEATHBINDZONE = 342,
|
||||||
|
SMSG_BINDZONEREPLY = 343,
|
||||||
|
SMSG_PLAYERBOUND = 344,
|
||||||
|
SMSG_DEATH_NOTIFY_OBSOLETE = 345,
|
||||||
|
CMSG_REPOP_REQUEST = 346,
|
||||||
|
SMSG_RESURRECT_REQUEST = 347,
|
||||||
|
CMSG_RESURRECT_RESPONSE = 348,
|
||||||
|
CMSG_LOOT = 349,
|
||||||
|
CMSG_LOOT_MONEY = 350,
|
||||||
|
CMSG_LOOT_RELEASE = 351,
|
||||||
|
SMSG_LOOT_RESPONSE = 352,
|
||||||
|
SMSG_LOOT_RELEASE_RESPONSE = 353,
|
||||||
|
SMSG_LOOT_REMOVED = 354,
|
||||||
|
SMSG_LOOT_MONEY_NOTIFY = 355,
|
||||||
|
SMSG_LOOT_ITEM_NOTIFY = 356,
|
||||||
|
SMSG_LOOT_CLEAR_MONEY = 357,
|
||||||
|
SMSG_ITEM_PUSH_RESULT = 358,
|
||||||
|
SMSG_DUEL_REQUESTED = 359,
|
||||||
|
SMSG_DUEL_OUTOFBOUNDS = 360,
|
||||||
|
SMSG_DUEL_INBOUNDS = 361,
|
||||||
|
SMSG_DUEL_COMPLETE = 362,
|
||||||
|
SMSG_DUEL_WINNER = 363,
|
||||||
|
CMSG_DUEL_ACCEPTED = 364,
|
||||||
|
CMSG_DUEL_CANCELLED = 365,
|
||||||
|
SMSG_MOUNTRESULT = 366,
|
||||||
|
SMSG_DISMOUNTRESULT = 367,
|
||||||
|
SMSG_PUREMOUNT_CANCELLED_OBSOLETE = 368,
|
||||||
|
CMSG_MOUNTSPECIAL_ANIM = 369,
|
||||||
|
SMSG_MOUNTSPECIAL_ANIM = 370,
|
||||||
|
SMSG_PET_TAME_FAILURE = 371,
|
||||||
|
CMSG_PET_SET_ACTION = 372,
|
||||||
|
CMSG_PET_ACTION = 373,
|
||||||
|
CMSG_PET_ABANDON = 374,
|
||||||
|
CMSG_PET_RENAME = 375,
|
||||||
|
SMSG_PET_NAME_INVALID = 376,
|
||||||
|
SMSG_PET_SPELLS = 377,
|
||||||
|
|
||||||
|
//CMSG_PET_CAST_SPELL_OBSOLETE = 378, //OBSOLETE
|
||||||
|
SMSG_PET_MODE = 378,
|
||||||
|
CMSG_GOSSIP_HELLO = 379,
|
||||||
|
CMSG_GOSSIP_SELECT_OPTION = 380,
|
||||||
|
SMSG_GOSSIP_MESSAGE = 381,
|
||||||
|
SMSG_GOSSIP_COMPLETE = 382,
|
||||||
|
CMSG_NPC_TEXT_QUERY = 383,
|
||||||
|
SMSG_NPC_TEXT_UPDATE = 384,
|
||||||
|
SMSG_NPC_WONT_TALK = 385,
|
||||||
|
CMSG_QUESTGIVER_STATUS_QUERY = 386,
|
||||||
|
SMSG_QUESTGIVER_STATUS = 387,
|
||||||
|
CMSG_QUESTGIVER_HELLO = 388,
|
||||||
|
SMSG_QUESTGIVER_QUEST_LIST = 389,
|
||||||
|
CMSG_QUESTGIVER_QUERY_QUEST = 390,
|
||||||
|
CMSG_QUESTGIVER_QUEST_AUTOLAUNCH = 391,
|
||||||
|
SMSG_QUESTGIVER_QUEST_DETAILS = 392,
|
||||||
|
CMSG_QUESTGIVER_ACCEPT_QUEST = 393,
|
||||||
|
CMSG_QUESTGIVER_COMPLETE_QUEST = 394,
|
||||||
|
SMSG_QUESTGIVER_REQUEST_ITEMS = 395,
|
||||||
|
CMSG_QUESTGIVER_REQUEST_REWARD = 396,
|
||||||
|
SMSG_QUESTGIVER_OFFER_REWARD = 397,
|
||||||
|
CMSG_QUESTGIVER_CHOOSE_REWARD = 398,
|
||||||
|
SMSG_QUESTGIVER_QUEST_INVALID = 399,
|
||||||
|
CMSG_QUESTGIVER_CANCEL = 400,
|
||||||
|
SMSG_QUESTGIVER_QUEST_COMPLETE = 401,
|
||||||
|
SMSG_QUESTGIVER_QUEST_FAILED = 402,
|
||||||
|
CMSG_QUESTLOG_SWAP_QUEST = 403,
|
||||||
|
CMSG_QUESTLOG_REMOVE_QUEST = 404,
|
||||||
|
SMSG_QUESTLOG_FULL = 405,
|
||||||
|
SMSG_QUESTUPDATE_FAILED = 406,
|
||||||
|
SMSG_QUESTUPDATE_FAILEDTIMER = 407,
|
||||||
|
SMSG_QUESTUPDATE_COMPLETE = 408,
|
||||||
|
SMSG_QUESTUPDATE_ADD_KILL = 409,
|
||||||
|
SMSG_QUESTUPDATE_ADD_ITEM = 410,
|
||||||
|
CMSG_QUEST_CONFIRM_ACCEPT = 411,
|
||||||
|
SMSG_QUEST_CONFIRM_ACCEPT = 412,
|
||||||
|
CMSG_PUSHQUESTTOPARTY = 413,
|
||||||
|
CMSG_LIST_INVENTORY = 414,
|
||||||
|
SMSG_LIST_INVENTORY = 415,
|
||||||
|
CMSG_SELL_ITEM = 416,
|
||||||
|
SMSG_SELL_ITEM = 417,
|
||||||
|
CMSG_BUY_ITEM = 418,
|
||||||
|
CMSG_BUY_ITEM_IN_SLOT = 419,
|
||||||
|
SMSG_BUY_ITEM = 420,
|
||||||
|
SMSG_BUY_FAILED = 421,
|
||||||
|
CMSG_TAXICLEARALLNODES = 422,
|
||||||
|
CMSG_TAXIENABLEALLNODES = 423,
|
||||||
|
CMSG_TAXISHOWNODES = 424,
|
||||||
|
SMSG_SHOWTAXINODES = 425,
|
||||||
|
CMSG_TAXINODE_STATUS_QUERY = 426,
|
||||||
|
SMSG_TAXINODE_STATUS = 427,
|
||||||
|
CMSG_TAXIQUERYAVAILABLENODES = 428,
|
||||||
|
CMSG_ACTIVATETAXI = 429,
|
||||||
|
SMSG_ACTIVATETAXIREPLY = 430,
|
||||||
|
SMSG_NEW_TAXI_PATH = 431,
|
||||||
|
CMSG_TRAINER_LIST = 432,
|
||||||
|
SMSG_TRAINER_LIST = 433,
|
||||||
|
CMSG_TRAINER_BUY_SPELL = 434,
|
||||||
|
SMSG_TRAINER_BUY_SUCCEEDED = 435,
|
||||||
|
SMSG_TRAINER_BUY_FAILED = 436,
|
||||||
|
CMSG_BINDER_ACTIVATE = 437,
|
||||||
|
SMSG_PLAYERBINDERROR = 438,
|
||||||
|
CMSG_BANKER_ACTIVATE = 439,
|
||||||
|
SMSG_SHOW_BANK = 440,
|
||||||
|
CMSG_BUY_BANK_SLOT = 441,
|
||||||
|
SMSG_BUY_BANK_SLOT_RESULT = 442,
|
||||||
|
CMSG_PETITION_SHOWLIST = 443,
|
||||||
|
SMSG_PETITION_SHOWLIST = 444,
|
||||||
|
CMSG_PETITION_BUY = 445,
|
||||||
|
CMSG_PETITION_SHOW_SIGNATURES = 446,
|
||||||
|
SMSG_PETITION_SHOW_SIGNATURES = 447,
|
||||||
|
CMSG_PETITION_SIGN = 448,
|
||||||
|
SMSG_PETITION_SIGN_RESULTS = 449,
|
||||||
|
MSG_PETITION_DECLINE = 450,
|
||||||
|
CMSG_OFFER_PETITION = 451,
|
||||||
|
CMSG_TURN_IN_PETITION = 452,
|
||||||
|
SMSG_TURN_IN_PETITION_RESULTS = 453,
|
||||||
|
CMSG_PETITION_QUERY = 454,
|
||||||
|
SMSG_PETITION_QUERY_RESPONSE = 455,
|
||||||
|
SMSG_FISH_NOT_HOOKED = 456,
|
||||||
|
SMSG_FISH_ESCAPED = 457,
|
||||||
|
CMSG_BUG = 458,
|
||||||
|
SMSG_NOTIFICATION = 459,
|
||||||
|
CMSG_PLAYED_TIME = 460,
|
||||||
|
SMSG_PLAYED_TIME = 461,
|
||||||
|
CMSG_QUERY_TIME = 462,
|
||||||
|
SMSG_QUERY_TIME_RESPONSE = 463,
|
||||||
|
SMSG_LOG_XPGAIN = 464,
|
||||||
|
MSG_SPLIT_MONEY = 465,
|
||||||
|
CMSG_RECLAIM_CORPSE = 466,
|
||||||
|
CMSG_WRAP_ITEM = 467,
|
||||||
|
SMSG_LEVELUP_INFO = 468,
|
||||||
|
MSG_MINIMAP_PING = 469,
|
||||||
|
SMSG_RESISTLOG = 470,
|
||||||
|
SMSG_ENCHANTMENTLOG = 471,
|
||||||
|
CMSG_SET_SKILL_CHEAT = 472,
|
||||||
|
SMSG_START_MIRROR_TIMER = 473,
|
||||||
|
SMSG_PAUSE_MIRROR_TIMER = 474,
|
||||||
|
SMSG_STOP_MIRROR_TIMER = 475,
|
||||||
|
CMSG_PING = 476,
|
||||||
|
SMSG_PONG = 477,
|
||||||
|
SMSG_CLEAR_COOLDOWN = 478,
|
||||||
|
SMSG_GAMEOBJECT_PAGETEXT = 479,
|
||||||
|
CMSG_SETSHEATHED = 480,
|
||||||
|
SMSG_COOLDOWN_CHEAT = 481,
|
||||||
|
SMSG_SPELL_DELAYED = 482,
|
||||||
|
CMSG_PLAYER_MACRO_OBSOLETE = 483,
|
||||||
|
SMSG_PLAYER_MACRO_OBSOLETE = 484,
|
||||||
|
CMSG_GHOST = 485,
|
||||||
|
CMSG_GM_INVIS = 486,
|
||||||
|
|
||||||
|
//CMSG_SCREENSHOT = 487, //OBSOLETE
|
||||||
|
SMSG_INVALID_PROMOTION_CODE = 487,
|
||||||
|
MSG_GM_BIND_OTHER = 488,
|
||||||
|
MSG_GM_SUMMON = 489,
|
||||||
|
SMSG_ITEM_TIME_UPDATE = 490,
|
||||||
|
SMSG_ITEM_ENCHANT_TIME_UPDATE = 491,
|
||||||
|
SMSG_AUTH_CHALLENGE = 492,
|
||||||
|
CMSG_AUTH_SESSION = 493,
|
||||||
|
SMSG_AUTH_RESPONSE = 494,
|
||||||
|
MSG_GM_SHOWLABEL = 495,
|
||||||
|
|
||||||
|
//MSG_ADD_DYNAMIC_TARGET = 496, //OBSOLETE
|
||||||
|
MSG_ADD_DYNAMIC_TARGET_OBSOLETE = 496,
|
||||||
|
MSG_SAVE_GUILD_EMBLEM = 497,
|
||||||
|
MSG_TABARDVENDOR_ACTIVATE = 498,
|
||||||
|
SMSG_PLAY_SPELL_VISUAL = 499,
|
||||||
|
CMSG_ZONEUPDATE = 500,
|
||||||
|
SMSG_PARTYKILLLOG = 501,
|
||||||
|
SMSG_COMPRESSED_UPDATE_OBJECT = 502,
|
||||||
|
SMSG_OBSOLETE = 503,
|
||||||
|
SMSG_EXPLORATION_EXPERIENCE = 504,
|
||||||
|
CMSG_GM_SET_SECURITY_GROUP = 505,
|
||||||
|
CMSG_GM_NUKE = 506,
|
||||||
|
MSG_RANDOM_ROLL = 507,
|
||||||
|
SMSG_ENVIRONMENTALDAMAGELOG = 508,
|
||||||
|
CMSG_RWHOIS = 509,
|
||||||
|
SMSG_RWHOIS = 510,
|
||||||
|
MSG_LOOKING_FOR_GROUP = 511,
|
||||||
|
CMSG_SET_LOOKING_FOR_GROUP = 512,
|
||||||
|
CMSG_UNLEARN_SPELL = 513,
|
||||||
|
CMSG_UNLEARN_SKILL = 514,
|
||||||
|
SMSG_REMOVED_SPELL = 515,
|
||||||
|
CMSG_DECHARGE = 516,
|
||||||
|
CMSG_GMTICKET_CREATE = 517,
|
||||||
|
SMSG_GMTICKET_CREATE = 518,
|
||||||
|
CMSG_GMTICKET_UPDATETEXT = 519,
|
||||||
|
SMSG_GMTICKET_UPDATETEXT = 520,
|
||||||
|
SMSG_ACCOUNT_DATA_MD5 = 521,
|
||||||
|
CMSG_REQUEST_ACCOUNT_DATA = 522,
|
||||||
|
CMSG_UPDATE_ACCOUNT_DATA = 523,
|
||||||
|
SMSG_UPDATE_ACCOUNT_DATA = 524,
|
||||||
|
SMSG_CLEAR_FAR_SIGHT_IMMEDIATE = 525,
|
||||||
|
SMSG_POWERGAINLOG_OBSOLETE = 526,
|
||||||
|
CMSG_GM_TEACH = 527,
|
||||||
|
CMSG_GM_CREATE_ITEM_TARGET = 528,
|
||||||
|
CMSG_GMTICKET_GETTICKET = 529,
|
||||||
|
SMSG_GMTICKET_GETTICKET = 530,
|
||||||
|
CMSG_UNLEARN_TALENTS = 531,
|
||||||
|
SMSG_GAMEOBJECT_SPAWN_ANIM = 532,
|
||||||
|
SMSG_GAMEOBJECT_DESPAWN_ANIM = 533,
|
||||||
|
MSG_CORPSE_QUERY = 534,
|
||||||
|
CMSG_GMTICKET_DELETETICKET = 535,
|
||||||
|
SMSG_GMTICKET_DELETETICKET = 536,
|
||||||
|
SMSG_CHAT_WRONG_FACTION = 537,
|
||||||
|
CMSG_GMTICKET_SYSTEMSTATUS = 538,
|
||||||
|
SMSG_GMTICKET_SYSTEMSTATUS = 539,
|
||||||
|
CMSG_SPIRIT_HEALER_ACTIVATE = 540,
|
||||||
|
CMSG_SET_STAT_CHEAT = 541,
|
||||||
|
SMSG_SET_REST_START = 542,
|
||||||
|
CMSG_SKILL_BUY_STEP = 543,
|
||||||
|
CMSG_SKILL_BUY_RANK = 544,
|
||||||
|
CMSG_XP_CHEAT = 545,
|
||||||
|
SMSG_SPIRIT_HEALER_CONFIRM = 546,
|
||||||
|
CMSG_CHARACTER_POINT_CHEAT = 547,
|
||||||
|
SMSG_GOSSIP_POI = 548,
|
||||||
|
CMSG_CHAT_IGNORED = 549,
|
||||||
|
CMSG_GM_VISION = 550,
|
||||||
|
CMSG_SERVER_COMMAND = 551,
|
||||||
|
CMSG_GM_SILENCE = 552,
|
||||||
|
CMSG_GM_REVEALTO = 553,
|
||||||
|
CMSG_GM_RESURRECT = 554,
|
||||||
|
CMSG_GM_SUMMONMOB = 555,
|
||||||
|
CMSG_GM_MOVECORPSE = 556,
|
||||||
|
CMSG_GM_FREEZE = 557,
|
||||||
|
CMSG_GM_UBERINVIS = 558,
|
||||||
|
CMSG_GM_REQUEST_PLAYER_INFO = 559,
|
||||||
|
SMSG_GM_PLAYER_INFO = 560,
|
||||||
|
CMSG_GUILD_RANK = 561,
|
||||||
|
CMSG_GUILD_ADD_RANK = 562,
|
||||||
|
CMSG_GUILD_DEL_RANK = 563,
|
||||||
|
CMSG_GUILD_SET_PUBLIC_NOTE = 564,
|
||||||
|
CMSG_GUILD_SET_OFFICER_NOTE = 565,
|
||||||
|
SMSG_LOGIN_VERIFY_WORLD = 566,
|
||||||
|
CMSG_CLEAR_EXPLORATION = 567,
|
||||||
|
CMSG_SEND_MAIL = 568,
|
||||||
|
SMSG_SEND_MAIL_RESULT = 569,
|
||||||
|
CMSG_GET_MAIL_LIST = 570,
|
||||||
|
SMSG_MAIL_LIST_RESULT = 571,
|
||||||
|
CMSG_BATTLEFIELD_LIST = 572,
|
||||||
|
SMSG_BATTLEFIELD_LIST = 573,
|
||||||
|
CMSG_BATTLEFIELD_JOIN = 574,
|
||||||
|
SMSG_BATTLEFIELD_WIN = 575,
|
||||||
|
SMSG_BATTLEFIELD_LOSE = 576,
|
||||||
|
CMSG_TAXICLEARNODE = 577,
|
||||||
|
CMSG_TAXIENABLENODE = 578,
|
||||||
|
CMSG_ITEM_TEXT_QUERY = 579,
|
||||||
|
SMSG_ITEM_TEXT_QUERY_RESPONSE = 580,
|
||||||
|
CMSG_MAIL_TAKE_MONEY = 581,
|
||||||
|
CMSG_MAIL_TAKE_ITEM = 582,
|
||||||
|
CMSG_MAIL_MARK_AS_READ = 583,
|
||||||
|
CMSG_MAIL_RETURN_TO_SENDER = 584,
|
||||||
|
CMSG_MAIL_DELETE = 585,
|
||||||
|
CMSG_MAIL_CREATE_TEXT_ITEM = 586,
|
||||||
|
SMSG_SPELLLOGMISS = 587,
|
||||||
|
SMSG_SPELLLOGEXECUTE = 588,
|
||||||
|
SMSG_DEBUGAURAPROC = 589,
|
||||||
|
SMSG_PERIODICAURALOG = 590,
|
||||||
|
SMSG_SPELLDAMAGESHIELD = 591,
|
||||||
|
SMSG_SPELLNONMELEEDAMAGELOG = 592,
|
||||||
|
CMSG_LEARN_TALENT = 593,
|
||||||
|
SMSG_RESURRECT_FAILED = 594,
|
||||||
|
|
||||||
|
//CMSG_ENABLE_PVP = 595, //OBSOLETE
|
||||||
|
CMSG_TOGGLE_PVP = 595,
|
||||||
|
SMSG_ZONE_UNDER_ATTACK = 596,
|
||||||
|
MSG_AUCTION_HELLO = 597,
|
||||||
|
CMSG_AUCTION_SELL_ITEM = 598,
|
||||||
|
CMSG_AUCTION_REMOVE_ITEM = 599,
|
||||||
|
CMSG_AUCTION_LIST_ITEMS = 600,
|
||||||
|
CMSG_AUCTION_LIST_OWNER_ITEMS = 601,
|
||||||
|
CMSG_AUCTION_PLACE_BID = 602,
|
||||||
|
SMSG_AUCTION_COMMAND_RESULT = 603,
|
||||||
|
SMSG_AUCTION_LIST_RESULT = 604,
|
||||||
|
SMSG_AUCTION_OWNER_LIST_RESULT = 605,
|
||||||
|
SMSG_AUCTION_BIDDER_NOTIFICATION = 606,
|
||||||
|
SMSG_AUCTION_OWNER_NOTIFICATION = 607,
|
||||||
|
SMSG_PROCRESIST = 608,
|
||||||
|
SMSG_STANDSTATE_CHANGE_FAILURE = 609,
|
||||||
|
SMSG_DISPEL_FAILED = 610,
|
||||||
|
SMSG_SPELLORDAMAGE_IMMUNE = 611,
|
||||||
|
CMSG_AUCTION_LIST_BIDDER_ITEMS = 612,
|
||||||
|
SMSG_AUCTION_BIDDER_LIST_RESULT = 613,
|
||||||
|
SMSG_SET_FLAT_SPELL_MODIFIER = 614,
|
||||||
|
SMSG_SET_PCT_SPELL_MODIFIER = 615,
|
||||||
|
CMSG_SET_AMMO = 616,
|
||||||
|
SMSG_CORPSE_RECLAIM_DELAY = 617,
|
||||||
|
CMSG_SET_ACTIVE_MOVER = 618,
|
||||||
|
CMSG_PET_CANCEL_AURA = 619,
|
||||||
|
CMSG_PLAYER_AI_CHEAT = 620,
|
||||||
|
CMSG_CANCEL_AUTO_REPEAT_SPELL = 621,
|
||||||
|
MSG_GM_ACCOUNT_ONLINE = 622,
|
||||||
|
MSG_LIST_STABLED_PETS = 623,
|
||||||
|
CMSG_STABLE_PET = 624,
|
||||||
|
CMSG_UNSTABLE_PET = 625,
|
||||||
|
CMSG_BUY_STABLE_SLOT = 626,
|
||||||
|
SMSG_STABLE_RESULT = 627,
|
||||||
|
CMSG_STABLE_REVIVE_PET = 628,
|
||||||
|
CMSG_STABLE_SWAP_PET = 629,
|
||||||
|
MSG_QUEST_PUSH_RESULT = 630,
|
||||||
|
SMSG_PLAY_MUSIC = 631,
|
||||||
|
SMSG_PLAY_OBJECT_SOUND = 632,
|
||||||
|
CMSG_REQUEST_PET_INFO = 633,
|
||||||
|
CMSG_FAR_SIGHT = 634,
|
||||||
|
SMSG_SPELLDISPELLOG = 635,
|
||||||
|
SMSG_DAMAGE_CALC_LOG = 636,
|
||||||
|
CMSG_ENABLE_DAMAGE_LOG = 637,
|
||||||
|
CMSG_GROUP_CHANGE_SUB_GROUP = 638,
|
||||||
|
|
||||||
|
//SMSG_RAID_MEMBER_STATS = 639, //OBSOLETE
|
||||||
|
CMSG_REQUEST_PARTY_MEMBER_STATS = 639,
|
||||||
|
CMSG_GROUP_SWAP_SUB_GROUP = 640,
|
||||||
|
CMSG_RESET_FACTION_CHEAT = 641,
|
||||||
|
CMSG_AUTOSTORE_BANK_ITEM = 642,
|
||||||
|
CMSG_AUTOBANK_ITEM = 643,
|
||||||
|
MSG_QUERY_NEXT_MAIL_TIME = 644,
|
||||||
|
SMSG_RECEIVED_MAIL = 645,
|
||||||
|
SMSG_RAID_GROUP_ONLY = 646,
|
||||||
|
CMSG_SET_DURABILITY_CHEAT = 647,
|
||||||
|
CMSG_SET_PVP_RANK_CHEAT = 648,
|
||||||
|
CMSG_ADD_PVP_MEDAL_CHEAT = 649,
|
||||||
|
CMSG_DEL_PVP_MEDAL_CHEAT = 650,
|
||||||
|
CMSG_SET_PVP_TITLE = 651,
|
||||||
|
SMSG_PVP_CREDIT = 652,
|
||||||
|
SMSG_AUCTION_REMOVED_NOTIFICATION = 653,
|
||||||
|
CMSG_GROUP_RAID_CONVERT = 654,
|
||||||
|
CMSG_GROUP_ASSISTANT_LEADER = 655,
|
||||||
|
CMSG_BUYBACK_ITEM = 656,
|
||||||
|
SMSG_SERVER_MESSAGE = 657,
|
||||||
|
CMSG_MEETINGSTONE_JOIN = 658,
|
||||||
|
CMSG_MEETINGSTONE_LEAVE = 659,
|
||||||
|
CMSG_MEETINGSTONE_CHEAT = 660,
|
||||||
|
SMSG_MEETINGSTONE_SETQUEUE = 661,
|
||||||
|
CMSG_MEETINGSTONE_INFO = 662,
|
||||||
|
SMSG_MEETINGSTONE_COMPLETE = 663,
|
||||||
|
SMSG_MEETINGSTONE_IN_PROGRESS = 664,
|
||||||
|
SMSG_MEETINGSTONE_MEMBER_ADDED = 665,
|
||||||
|
CMSG_GMTICKETSYSTEM_TOGGLE = 666,
|
||||||
|
CMSG_CANCEL_GROWTH_AURA = 667,
|
||||||
|
SMSG_CANCEL_AUTO_REPEAT = 668,
|
||||||
|
SMSG_STANDSTATE_CHANGE_ACK = 669,
|
||||||
|
SMSG_LOOT_ALL_PASSED = 670,
|
||||||
|
SMSG_LOOT_ROLL_WON = 671,
|
||||||
|
CMSG_LOOT_ROLL = 672,
|
||||||
|
SMSG_LOOT_START_ROLL = 673,
|
||||||
|
SMSG_LOOT_ROLL = 674,
|
||||||
|
CMSG_LOOT_MASTER_GIVE = 675,
|
||||||
|
SMSG_LOOT_MASTER_LIST = 676,
|
||||||
|
SMSG_SET_FORCED_REACTIONS = 677,
|
||||||
|
SMSG_SPELL_FAILED_OTHER = 678,
|
||||||
|
SMSG_GAMEOBJECT_RESET_STATE = 679,
|
||||||
|
CMSG_REPAIR_ITEM = 680,
|
||||||
|
SMSG_CHAT_PLAYER_NOT_FOUND = 681,
|
||||||
|
MSG_TALENT_WIPE_CONFIRM = 682,
|
||||||
|
SMSG_SUMMON_REQUEST = 683,
|
||||||
|
CMSG_SUMMON_RESPONSE = 684,
|
||||||
|
MSG_MOVE_TOGGLE_GRAVITY_CHEAT = 685,
|
||||||
|
SMSG_MONSTER_MOVE_TRANSPORT = 686,
|
||||||
|
SMSG_PET_BROKEN = 687,
|
||||||
|
MSG_MOVE_FEATHER_FALL = 688,
|
||||||
|
MSG_MOVE_WATER_WALK = 689,
|
||||||
|
CMSG_SERVER_BROADCAST = 690,
|
||||||
|
CMSG_SELF_RES = 691,
|
||||||
|
SMSG_FEIGN_DEATH_RESISTED = 692,
|
||||||
|
CMSG_RUN_SCRIPT = 693,
|
||||||
|
SMSG_SCRIPT_MESSAGE = 694,
|
||||||
|
SMSG_DUEL_COUNTDOWN = 695,
|
||||||
|
SMSG_AREA_TRIGGER_MESSAGE = 696,
|
||||||
|
CMSG_TOGGLE_HELM = 697,
|
||||||
|
CMSG_TOGGLE_CLOAK = 698,
|
||||||
|
|
||||||
|
//SMSG_SPELL_REFLECTED = 699, //OBSOLETE
|
||||||
|
SMSG_MEETINGSTONE_JOINFAILED = 699,
|
||||||
|
SMSG_PLAYER_SKINNED = 700,
|
||||||
|
SMSG_DURABILITY_DAMAGE_DEATH = 701,
|
||||||
|
CMSG_SET_EXPLORATION = 702,
|
||||||
|
CMSG_SET_ACTIONBAR_TOGGLES = 703,
|
||||||
|
UMSG_DELETE_GUILD_CHARTER = 704,
|
||||||
|
MSG_PETITION_RENAME = 705,
|
||||||
|
SMSG_INIT_WORLD_STATES = 706,
|
||||||
|
SMSG_UPDATE_WORLD_STATE = 707,
|
||||||
|
CMSG_ITEM_NAME_QUERY = 708,
|
||||||
|
SMSG_ITEM_NAME_QUERY_RESPONSE = 709,
|
||||||
|
SMSG_PET_ACTION_FEEDBACK = 710,
|
||||||
|
CMSG_CHAR_RENAME = 711,
|
||||||
|
SMSG_CHAR_RENAME = 712,
|
||||||
|
CMSG_MOVE_SPLINE_DONE = 713,
|
||||||
|
CMSG_MOVE_FALL_RESET = 714,
|
||||||
|
SMSG_INSTANCE_SAVE_CREATED = 715,
|
||||||
|
SMSG_RAID_INSTANCE_INFO = 716,
|
||||||
|
CMSG_REQUEST_RAID_INFO = 717,
|
||||||
|
CMSG_MOVE_TIME_SKIPPED = 718,
|
||||||
|
CMSG_MOVE_FEATHER_FALL_ACK = 719,
|
||||||
|
CMSG_MOVE_WATER_WALK_ACK = 720,
|
||||||
|
CMSG_MOVE_NOT_ACTIVE_MOVER = 721,
|
||||||
|
SMSG_PLAY_SOUND = 722,
|
||||||
|
CMSG_BATTLEFIELD_STATUS = 723,
|
||||||
|
SMSG_BATTLEFIELD_STATUS = 724,
|
||||||
|
CMSG_BATTLEFIELD_PORT = 725,
|
||||||
|
MSG_INSPECT_HONOR_STATS = 726,
|
||||||
|
CMSG_BATTLEMASTER_HELLO = 727,
|
||||||
|
CMSG_MOVE_START_SWIM_CHEAT = 728,
|
||||||
|
CMSG_MOVE_STOP_SWIM_CHEAT = 729,
|
||||||
|
SMSG_FORCE_WALK_SPEED_CHANGE = 730,
|
||||||
|
CMSG_FORCE_WALK_SPEED_CHANGE_ACK = 731,
|
||||||
|
SMSG_FORCE_SWIM_BACK_SPEED_CHANGE = 732,
|
||||||
|
CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK = 733,
|
||||||
|
SMSG_FORCE_TURN_RATE_CHANGE = 734,
|
||||||
|
CMSG_FORCE_TURN_RATE_CHANGE_ACK = 735,
|
||||||
|
MSG_PVP_LOG_DATA = 736,
|
||||||
|
CMSG_LEAVE_BATTLEFIELD = 737,
|
||||||
|
CMSG_AREA_SPIRIT_HEALER_QUERY = 738,
|
||||||
|
CMSG_AREA_SPIRIT_HEALER_QUEUE = 739,
|
||||||
|
SMSG_AREA_SPIRIT_HEALER_TIME = 740,
|
||||||
|
CMSG_GM_UNTEACH = 739,
|
||||||
|
SMSG_HARDWARE_SURVEY_REQUEST = 740,
|
||||||
|
CMSG_HARDWARE_SURVEY_RESULTS = 741,
|
||||||
|
SMSG_WARDEN_DATA = 742,
|
||||||
|
CMSG_WARDEN_DATA = 743,
|
||||||
|
SMSG_GROUP_JOINED_BATTLEGROUND = 744,
|
||||||
|
MSG_BATTLEGROUND_PLAYER_POSITIONS = 745,
|
||||||
|
|
||||||
|
//strange!!
|
||||||
|
//MSG_BINDPOINT_CONFIRM = SMSG_BINDER_CONFIRM,
|
||||||
|
|
||||||
|
//TODO Check double check if the -2 is correct
|
||||||
|
CMSG_PET_STOP_ATTACK = 746,
|
||||||
|
SMSG_BINDER_CONFIRM = 747,
|
||||||
|
SMSG_BATTLEGROUND_PLAYER_JOINED = 748,
|
||||||
|
SMSG_BATTLEGROUND_PLAYER_LEFT = 749,
|
||||||
|
CMSG_BATTLEMASTER_JOIN = 750,
|
||||||
|
|
||||||
|
SMSG_ADDON_INFO = 753-2,
|
||||||
|
CMSG_PET_UNLEARN = 754-2,
|
||||||
|
SMSG_PET_UNLEARN_CONFIRM = 755-2,
|
||||||
|
SMSG_PARTY_MEMBER_STATS_FULL = 756-2,
|
||||||
|
CMSG_PET_SPELL_AUTOCAST = 757-2,
|
||||||
|
SMSG_WEATHER = 758-2,
|
||||||
|
SMSG_PLAY_TIME_WARNING = 759-2,
|
||||||
|
SMSG_MINIGAME_SETUP = 760-2,
|
||||||
|
SMSG_MINIGAME_STATE = 761-2,
|
||||||
|
CMSG_MINIGAME_MOVE = 762-2,
|
||||||
|
SMSG_MINIGAME_MOVE_FAILED = 763-2,
|
||||||
|
CMSG_GUILD_CHANGEINFO = 764-2,
|
||||||
|
|
||||||
|
CMSG_ACTIVATETAXI_FAR = 786,
|
||||||
|
//griphon related = 786
|
||||||
|
|
||||||
|
CMSG_FIELD_WATCHED_FACTION_INACTIVE = 791,
|
||||||
|
CMSG_FIELD_WATCHED_FACTION_SHOW_BAR = 792,
|
||||||
|
|
||||||
|
// unofficial opcodes:
|
||||||
|
SMSG_OUTDOORPVP_NOTIFY = 0x33b, // 827
|
||||||
|
};
|
||||||
|
|
||||||
|
enum FriendsResult
|
||||||
|
{
|
||||||
|
FRIEND_DB_ERROR = 0x00,
|
||||||
|
FRIEND_LIST_FULL = 0x01,
|
||||||
|
FRIEND_ONLINE = 0x02,
|
||||||
|
FRIEND_OFFLINE = 0x03,
|
||||||
|
FRIEND_NOT_FOUND = 0x04,
|
||||||
|
FRIEND_REMOVED = 0x05,
|
||||||
|
FRIEND_ADDED_ONLINE = 0x06,
|
||||||
|
FRIEND_ADDED_OFFLINE = 0x07,
|
||||||
|
FRIEND_ALREADY = 0x08,
|
||||||
|
FRIEND_SELF = 0x09,
|
||||||
|
FRIEND_ENEMY = 0x0A,
|
||||||
|
FRIEND_IGNORE_FULL = 0x0B,
|
||||||
|
FRIEND_IGNORE_SELF = 0x0C,
|
||||||
|
FRIEND_IGNORE_NOT_FOUND = 0x0D,
|
||||||
|
FRIEND_IGNORE_ALREADY = 0x0E,
|
||||||
|
FRIEND_IGNORE_ADDED = 0x0F,
|
||||||
|
FRIEND_IGNORE_REMOVED = 0x10
|
||||||
|
};
|
||||||
|
|
||||||
|
enum NPCFlags
|
||||||
|
{
|
||||||
|
UNIT_NPC_FLAG_NONE = 0,
|
||||||
|
UNIT_NPC_FLAG_GOSSIP = 1,
|
||||||
|
UNIT_NPC_FLAG_QUESTGIVER = 2,
|
||||||
|
UNIT_NPC_FLAG_VENDOR = 4,
|
||||||
|
UNIT_NPC_FLAG_TAXIVENDOR = 8,
|
||||||
|
UNIT_NPC_FLAG_TRAINER = 16,
|
||||||
|
UNIT_NPC_FLAG_SPIRITHEALER = 32,
|
||||||
|
UNIT_NPC_FLAG_GUARD = 64, //UQ1: ??? We can use as guard flag?
|
||||||
|
UNIT_NPC_FLAG_INNKEEPER = 128,
|
||||||
|
UNIT_NPC_FLAG_BANKER = 256,
|
||||||
|
UNIT_NPC_FLAG_PETITIONER = 512,
|
||||||
|
UNIT_NPC_FLAG_TABARDVENDOR = 1024,
|
||||||
|
UNIT_NPC_FLAG_BATTLEFIELDPERSON = 2048,
|
||||||
|
UNIT_NPC_FLAG_AUCTIONEER = 4096,
|
||||||
|
UNIT_NPC_FLAG_STABLE = 8192,
|
||||||
|
UNIT_NPC_FLAG_ARMORER = 16384,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint64 PlayerGUID;
|
||||||
|
unsigned char Status;
|
||||||
|
|
||||||
|
uint32 Area;
|
||||||
|
uint32 Level;
|
||||||
|
uint32 Class;
|
||||||
|
} FriendStr ;
|
||||||
|
#endif
|
||||||
117
src/Client/World/Player.cpp
Normal file
117
src/Client/World/Player.cpp
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
#include "common.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "Opcodes.h"
|
||||||
|
#include "WorldPacketHandler.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "NameTables.h"
|
||||||
|
#include "CMSGConstructor.h"
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
|
||||||
|
bool PlayerNameCache::AddInfo(uint64 guid, std::string name){
|
||||||
|
PlayerNameCacheItem *cacheItem=new PlayerNameCacheItem;
|
||||||
|
cacheItem->_name=name;
|
||||||
|
cacheItem->_guid=guid;
|
||||||
|
return AddInfo(cacheItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlayerNameCache::AddInfo(PlayerNameCacheItem* cacheItem){
|
||||||
|
for(std::vector<PlayerNameCacheItem*>::iterator i=_cache.begin(); i!=_cache.end(); i++)
|
||||||
|
if(cacheItem->_guid==(*i)->_guid)
|
||||||
|
return false;
|
||||||
|
_cache.push_back(cacheItem);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string PlayerNameCache::GetName(uint64 guid){
|
||||||
|
for(std::vector<PlayerNameCacheItem*>::iterator i=_cache.begin(); i!=_cache.end(); i++)
|
||||||
|
if(guid==(*i)->_guid)
|
||||||
|
return (*i)->_name;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64 PlayerNameCache::GetGuid(std::string name){
|
||||||
|
for(std::vector<PlayerNameCacheItem*>::iterator i=_cache.begin(); i!=_cache.end(); i++)
|
||||||
|
if(name==(*i)->_name)
|
||||||
|
return (*i)->_guid;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlayerNameCache::SaveToFile(void){
|
||||||
|
printf("Saving PlayerNameCache...\n");
|
||||||
|
char *fn="./cache/playernames.cache";
|
||||||
|
std::fstream fh;
|
||||||
|
fh.open(fn, std::ios_base::out | std::ios_base::binary);
|
||||||
|
if(!fh)
|
||||||
|
{
|
||||||
|
printf("ERROR: could not open file '%s'!\n",fn);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
uint32 size=_cache.size();
|
||||||
|
if(size==0)
|
||||||
|
return false;
|
||||||
|
uint8 len;
|
||||||
|
fh.write((char*)&size,sizeof(uint32));
|
||||||
|
|
||||||
|
for(std::vector<PlayerNameCacheItem*>::iterator i=_cache.begin(); i!=_cache.end(); i++)
|
||||||
|
{
|
||||||
|
fh.write( (char*)&((*i)->_guid),sizeof(uint64) );
|
||||||
|
len=(*i)->_name.length();
|
||||||
|
fh.write( (char*)&len,sizeof(uint8) );
|
||||||
|
fh.write( (char*)(*i)->_name.c_str(),len );
|
||||||
|
DEB(printf( "PlayerNameCache << " I64FMT " -> %s\n", (*i)->_guid, (*i)->_name.c_str()););
|
||||||
|
}
|
||||||
|
fh.close();
|
||||||
|
printf("PlayerNameCache saved successfully.\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlayerNameCache::ReadFromFile(void){
|
||||||
|
char *fn="./cache/playernames.cache";
|
||||||
|
printf("Loading PlayerNameCache...\n");
|
||||||
|
bool success=true;
|
||||||
|
std::fstream fh;
|
||||||
|
fh.open(fn, std::ios_base::in | std::ios_base::binary);
|
||||||
|
if(!fh)
|
||||||
|
{
|
||||||
|
printf("ERROR: could not open file '%s'!\n",fn);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
uint32 size;
|
||||||
|
fh.read((char*)&size,sizeof(uint32));
|
||||||
|
std::string tmp;
|
||||||
|
uint8 len;
|
||||||
|
char *nameptr=new char[13];
|
||||||
|
for(unsigned int i=0;i<size;i++)
|
||||||
|
{
|
||||||
|
len=255;
|
||||||
|
memset(nameptr,0,13);
|
||||||
|
PlayerNameCacheItem *cacheItem=new PlayerNameCacheItem;
|
||||||
|
fh.read((char*)&(cacheItem->_guid),sizeof(uint64));
|
||||||
|
fh.read((char*)&len,sizeof(uint8));
|
||||||
|
if(len>12 || len<2){
|
||||||
|
printf("\nERROR: PlayerNameCache data seem corrupt [namelength=%d, should be <=12}]\n",len);
|
||||||
|
printf("-> Clearing cache, creating new.\n");
|
||||||
|
_cache.clear();
|
||||||
|
success=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fh.read(nameptr,len);
|
||||||
|
cacheItem->_name=nameptr;
|
||||||
|
AddInfo(cacheItem);
|
||||||
|
printf("\rPlayerNameCache [ %u / %u ] items loaded",i+1,size);
|
||||||
|
DEB(printf( " >> " I64FMT " -> %s\n", cacheItem->_guid, nameptr););
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
delete nameptr;
|
||||||
|
fh.close();
|
||||||
|
if(success)
|
||||||
|
printf("PlayerNameCache successfully loaded.\n");
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 PlayerNameCache::GetSize(void){
|
||||||
|
return _cache.size();
|
||||||
|
}
|
||||||
69
src/Client/World/Player.h
Normal file
69
src/Client/World/Player.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#ifndef _PLAYER_H
|
||||||
|
#define _PLAYER_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
struct PlayerNameCacheItem {
|
||||||
|
uint64 _guid;
|
||||||
|
std::string _name;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PlayerNameCache {
|
||||||
|
public:
|
||||||
|
std::string GetName(uint64);
|
||||||
|
uint64 GetGuid(std::string);
|
||||||
|
bool AddInfo(uint64 guid, std::string name);
|
||||||
|
bool AddInfo(PlayerNameCacheItem*);
|
||||||
|
bool SaveToFile(void);
|
||||||
|
bool ReadFromFile(void);
|
||||||
|
uint32 GetSize(void);
|
||||||
|
private:
|
||||||
|
std::vector<PlayerNameCacheItem*> _cache;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PlayerEnum {
|
||||||
|
public:
|
||||||
|
uint64 _guid;
|
||||||
|
std::string _name;
|
||||||
|
uint8 _race;
|
||||||
|
uint8 _class;
|
||||||
|
uint8 _gender;
|
||||||
|
uint8 _bytes1;
|
||||||
|
uint8 _bytes2;
|
||||||
|
uint8 _bytes3;
|
||||||
|
uint8 _bytes4;
|
||||||
|
uint8 _bytesx;
|
||||||
|
uint8 _level;
|
||||||
|
uint32 _zoneId;
|
||||||
|
uint32 _mapId;
|
||||||
|
float _x;
|
||||||
|
float _y;
|
||||||
|
float _z;
|
||||||
|
uint32 _guildId;
|
||||||
|
uint8 _flags;
|
||||||
|
uint32 _petInfoId;
|
||||||
|
uint32 _petLevel;
|
||||||
|
uint32 _petFamilyId;
|
||||||
|
// more to come...[items]
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
class PlayerCache {
|
||||||
|
public:
|
||||||
|
void Add(Player*);
|
||||||
|
void Remove(Player*);
|
||||||
|
void Remove(uint64);
|
||||||
|
uint32 GetCount(void) { return _players.size(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<Player*> _players;
|
||||||
|
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
991
src/Client/World/SharedDefines.h
Normal file
991
src/Client/World/SharedDefines.h
Normal file
@ -0,0 +1,991 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MANGOS_SHAREDDEFINES_H
|
||||||
|
#define MANGOS_SHAREDDEFINES_H
|
||||||
|
|
||||||
|
#define GENDER_MALE 0
|
||||||
|
#define GENDER_FEMALE 1
|
||||||
|
#define GENDER_NONE 2
|
||||||
|
|
||||||
|
#define RACE_HUMAN 1
|
||||||
|
#define RACE_ORC 2
|
||||||
|
#define RACE_DWARF 3
|
||||||
|
#define RACE_NIGHT_ELF 4
|
||||||
|
#define RACE_UNDEAD 5
|
||||||
|
#define RACE_TAUREN 6
|
||||||
|
#define RACE_GNOME 7
|
||||||
|
#define RACE_TROLL 8
|
||||||
|
|
||||||
|
#define CLASS_WARRIOR 1
|
||||||
|
#define CLASS_PALADIN 2
|
||||||
|
#define CLASS_HUNTER 3
|
||||||
|
#define CLASS_ROGUE 4
|
||||||
|
#define CLASS_PRIEST 5
|
||||||
|
#define CLASS_UNK1 6
|
||||||
|
#define CLASS_SHAMAN 7
|
||||||
|
#define CLASS_MAGE 8
|
||||||
|
#define CLASS_WARLOCK 9
|
||||||
|
#define CLASS_UNK2 10
|
||||||
|
#define CLASS_DRUID 11
|
||||||
|
|
||||||
|
enum Stats
|
||||||
|
{
|
||||||
|
STAT_STRENGTH = 0,
|
||||||
|
STAT_AGILITY = 1,
|
||||||
|
STAT_STAMINA = 2,
|
||||||
|
STAT_INTELLECT = 3,
|
||||||
|
STAT_SPIRIT = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Powers
|
||||||
|
{
|
||||||
|
POWER_MANA = 0,
|
||||||
|
POWER_RAGE = 1,
|
||||||
|
POWER_FOCUS = 2,
|
||||||
|
POWER_ENERGY = 3,
|
||||||
|
POWER_HAPPINESS = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SpellSchools
|
||||||
|
{
|
||||||
|
SPELL_SCHOOL_NORMAL = 0,
|
||||||
|
SPELL_SCHOOL_HOLY = 1,
|
||||||
|
SPELL_SCHOOL_FIRE = 2,
|
||||||
|
SPELL_SCHOOL_NATURE = 3,
|
||||||
|
SPELL_SCHOOL_FROST = 4,
|
||||||
|
SPELL_SCHOOL_SHADOW = 5,
|
||||||
|
SPELL_SCHOOL_ARCANE = 6
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ITEM_QUALITY_POOR 0 //GREY
|
||||||
|
#define ITEM_QUALITY_NORMAL 1 //WHITE
|
||||||
|
#define ITEM_QUALITY_UNCOMMON 2 //GREEN
|
||||||
|
#define ITEM_QUALITY_RARE 3 //BLUE
|
||||||
|
#define ITEM_QUALITY_EPIC 4 //PURPLE
|
||||||
|
#define ITEM_QUALITY_LEGENDARY 5 //ORANGE
|
||||||
|
#define ITEM_QUALITY_ARTIFACT 6 //LIGHT YELLOW
|
||||||
|
|
||||||
|
#define SHEATHETYPE_NONE 0
|
||||||
|
#define SHEATHETYPE_MAINHAND 1
|
||||||
|
#define SHEATHETYPE_OFFHAND 2
|
||||||
|
#define SHEATHETYPE_LARGEWEAPONLEFT 3
|
||||||
|
#define SHEATHETYPE_LARGEWEAPONRIGHT 4
|
||||||
|
#define SHEATHETYPE_HIPWEAPONLEFT 5
|
||||||
|
#define SHEATHETYPE_HIPWEAPONRIGHT 6
|
||||||
|
#define SHEATHETYPE_SHIELD 7
|
||||||
|
|
||||||
|
#define SLOT_HEAD 0
|
||||||
|
#define SLOT_NECK 1
|
||||||
|
#define SLOT_SHOULDERS 2
|
||||||
|
#define SLOT_SHIRT 3
|
||||||
|
#define SLOT_CHEST 4
|
||||||
|
#define SLOT_WAIST 5
|
||||||
|
#define SLOT_LEGS 6
|
||||||
|
#define SLOT_FEET 7
|
||||||
|
#define SLOT_WRISTS 8
|
||||||
|
#define SLOT_HANDS 9
|
||||||
|
#define SLOT_FINGER1 10
|
||||||
|
#define SLOT_FINGER2 11
|
||||||
|
#define SLOT_TRINKET1 12
|
||||||
|
#define SLOT_TRINKET2 13
|
||||||
|
#define SLOT_BACK 14
|
||||||
|
#define SLOT_MAIN_HAND 15
|
||||||
|
#define SLOT_OFF_HAND 16
|
||||||
|
#define SLOT_RANGED 17
|
||||||
|
#define SLOT_TABARD 18
|
||||||
|
#define SLOT_EMPTY 19
|
||||||
|
|
||||||
|
#define LANG_GLOBAL 0
|
||||||
|
#define LANG_UNIVERSAL 0
|
||||||
|
#define LANG_ORCISH 1
|
||||||
|
#define LANG_DARNASSIAN 2
|
||||||
|
#define LANG_TAURAHE 3
|
||||||
|
#define LANG_DWARVISH 6
|
||||||
|
#define LANG_COMMON 7
|
||||||
|
#define LANG_DEMONIC 8
|
||||||
|
#define LANG_TITAN 9
|
||||||
|
#define LANG_THELASSIAN 10
|
||||||
|
#define LANG_DRACONIC 11
|
||||||
|
#define LANG_KALIMAG 12
|
||||||
|
#define LANG_GNOMISH 13
|
||||||
|
#define LANG_TROLL 14
|
||||||
|
#define LANG_GUTTERSPEAK 33
|
||||||
|
|
||||||
|
// Spell Effects
|
||||||
|
|
||||||
|
#define SPELL_EFFECT_INSTAKILL 1
|
||||||
|
#define SPELL_EFFECT_SCHOOL_DAMAGE 2
|
||||||
|
#define SPELL_EFFECT_DUMMY 3
|
||||||
|
#define SPELL_EFFECT_PORTAL_TELEPORT 4
|
||||||
|
#define SPELL_EFFECT_TELEPORT_UNITS 5
|
||||||
|
#define SPELL_EFFECT_APPLY_AURA 6
|
||||||
|
#define SPELL_EFFECT_ENVIRONMENTAL_DAMAGE 7
|
||||||
|
#define SPELL_EFFECT_MANA_DRAIN 8
|
||||||
|
#define SPELL_EFFECT_HEALTH_LEECH 9
|
||||||
|
#define SPELL_EFFECT_HEAL 10
|
||||||
|
#define SPELL_EFFECT_BIND 11
|
||||||
|
#define SPELL_EFFECT_PORTAL 12
|
||||||
|
#define SPELL_EFFECT_RITUAL_BASE 13
|
||||||
|
#define SPELL_EFFECT_RITUAL_SPECIALIZE 14
|
||||||
|
#define SPELL_EFFECT_RITUAL_ACTIVATE_PORTAL 15
|
||||||
|
#define SPELL_EFFECT_QUEST_COMPLETE 16
|
||||||
|
#define SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL 17
|
||||||
|
#define SPELL_EFFECT_RESURRECT 18
|
||||||
|
#define SPELL_EFFECT_ADD_EXTRA_ATTACKS 19
|
||||||
|
#define SPELL_EFFECT_DODGE 20
|
||||||
|
#define SPELL_EFFECT_EVADE 21
|
||||||
|
#define SPELL_EFFECT_PARRY 22
|
||||||
|
#define SPELL_EFFECT_BLOCK 23
|
||||||
|
#define SPELL_EFFECT_CREATE_ITEM 24
|
||||||
|
#define SPELL_EFFECT_WEAPON 25
|
||||||
|
#define SPELL_EFFECT_DEFENSE 26
|
||||||
|
#define SPELL_EFFECT_PERSISTENT_AREA_AURA 27
|
||||||
|
#define SPELL_EFFECT_SUMMON 28
|
||||||
|
#define SPELL_EFFECT_LEAP 29
|
||||||
|
#define SPELL_EFFECT_ENERGIZE 30
|
||||||
|
#define SPELL_EFFECT_WEAPON_PERCENT_DAMAGE 31
|
||||||
|
#define SPELL_EFFECT_TRIGGER_MISSILE 32
|
||||||
|
#define SPELL_EFFECT_OPEN_LOCK 33
|
||||||
|
#define SPELL_EFFECT_SUMMON_CHANGE_ITEM 34
|
||||||
|
#define SPELL_EFFECT_APPLY_AREA_AURA 35
|
||||||
|
#define SPELL_EFFECT_LEARN_SPELL 36
|
||||||
|
#define SPELL_EFFECT_SPELL_DEFENSE 37
|
||||||
|
#define SPELL_EFFECT_DISPEL 38
|
||||||
|
#define SPELL_EFFECT_LANGUAGE 39
|
||||||
|
#define SPELL_EFFECT_DUAL_WIELD 40
|
||||||
|
#define SPELL_EFFECT_SUMMON_WILD 41
|
||||||
|
#define SPELL_EFFECT_SUMMON_GUARDIAN 42
|
||||||
|
#define SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER 43
|
||||||
|
#define SPELL_EFFECT_SKILL_STEP 44
|
||||||
|
#define SPELL_EFFECT_UNDEFINED_45 45
|
||||||
|
#define SPELL_EFFECT_SPAWN 46
|
||||||
|
#define SPELL_EFFECT_TRADE_SKILL 47
|
||||||
|
#define SPELL_EFFECT_STEALTH 48
|
||||||
|
#define SPELL_EFFECT_DETECT 49
|
||||||
|
//#define SPELL_EFFECT_SUMMON_OBJECT 50
|
||||||
|
#define SPELL_EFFECT_TRANS_DOOR 50
|
||||||
|
#define SPELL_EFFECT_FORCE_CRITICAL_HIT 51
|
||||||
|
#define SPELL_EFFECT_GUARANTEE_HIT 52
|
||||||
|
#define SPELL_EFFECT_ENCHANT_ITEM 53
|
||||||
|
#define SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY 54
|
||||||
|
#define SPELL_EFFECT_TAMECREATURE 55
|
||||||
|
#define SPELL_EFFECT_SUMMON_PET 56
|
||||||
|
#define SPELL_EFFECT_LEARN_PET_SPELL 57
|
||||||
|
#define SPELL_EFFECT_WEAPON_DAMAGE 58
|
||||||
|
#define SPELL_EFFECT_OPEN_LOCK_ITEM 59
|
||||||
|
#define SPELL_EFFECT_PROFICIENCY 60
|
||||||
|
#define SPELL_EFFECT_SEND_EVENT 61
|
||||||
|
#define SPELL_EFFECT_POWER_BURN 62
|
||||||
|
#define SPELL_EFFECT_THREAT 63
|
||||||
|
#define SPELL_EFFECT_TRIGGER_SPELL 64
|
||||||
|
#define SPELL_EFFECT_HEALTH_FUNNEL 65
|
||||||
|
#define SPELL_EFFECT_POWER_FUNNEL 66
|
||||||
|
#define SPELL_EFFECT_HEAL_MAX_HEALTH 67
|
||||||
|
#define SPELL_EFFECT_INTERRUPT_CAST 68
|
||||||
|
#define SPELL_EFFECT_DISTRACT 69
|
||||||
|
#define SPELL_EFFECT_PULL 70
|
||||||
|
#define SPELL_EFFECT_PICKPOCKET 71
|
||||||
|
#define SPELL_EFFECT_ADD_FARSIGHT 72
|
||||||
|
#define SPELL_EFFECT_SUMMON_POSSESSED 73
|
||||||
|
#define SPELL_EFFECT_SUMMON_TOTEM 74
|
||||||
|
#define SPELL_EFFECT_HEAL_MECHANICAL 75
|
||||||
|
#define SPELL_EFFECT_SUMMON_OBJECT_WILD 76
|
||||||
|
#define SPELL_EFFECT_SCRIPT_EFFECT 77
|
||||||
|
#define SPELL_EFFECT_ATTACK 78
|
||||||
|
#define SPELL_EFFECT_SANCTUARY 79
|
||||||
|
#define SPELL_EFFECT_ADD_COMBO_POINTS 80
|
||||||
|
#define SPELL_EFFECT_CREATE_HOUSE 81
|
||||||
|
#define SPELL_EFFECT_BIND_SIGHT 82
|
||||||
|
#define SPELL_EFFECT_DUEL 83
|
||||||
|
#define SPELL_EFFECT_STUCK 84
|
||||||
|
#define SPELL_EFFECT_SUMMON_PLAYER 85
|
||||||
|
#define SPELL_EFFECT_ACTIVATE_OBJECT 86
|
||||||
|
#define SPELL_EFFECT_SUMMON_TOTEM_SLOT1 87
|
||||||
|
#define SPELL_EFFECT_SUMMON_TOTEM_SLOT2 88
|
||||||
|
#define SPELL_EFFECT_SUMMON_TOTEM_SLOT3 89
|
||||||
|
#define SPELL_EFFECT_SUMMON_TOTEM_SLOT4 90
|
||||||
|
#define SPELL_EFFECT_THREAT_ALL 91
|
||||||
|
#define SPELL_EFFECT_ENCHANT_HELD_ITEM 92
|
||||||
|
#define SPELL_EFFECT_SUMMON_PHANTASM 93
|
||||||
|
#define SPELL_EFFECT_SELF_RESURRECT 94
|
||||||
|
#define SPELL_EFFECT_SKINNING 95
|
||||||
|
#define SPELL_EFFECT_CHARGE 96
|
||||||
|
#define SPELL_EFFECT_SUMMON_CRITTER 97
|
||||||
|
#define SPELL_EFFECT_KNOCK_BACK 98
|
||||||
|
#define SPELL_EFFECT_DISENCHANT 99
|
||||||
|
#define SPELL_EFFECT_INEBRIATE 100
|
||||||
|
#define SPELL_EFFECT_FEED_PET 101
|
||||||
|
#define SPELL_EFFECT_DISMISS_PET 102
|
||||||
|
#define SPELL_EFFECT_REPUTATION 103
|
||||||
|
#define SPELL_EFFECT_SUMMON_OBJECT_SLOT1 104
|
||||||
|
#define SPELL_EFFECT_SUMMON_OBJECT_SLOT2 105
|
||||||
|
#define SPELL_EFFECT_SUMMON_OBJECT_SLOT3 106
|
||||||
|
#define SPELL_EFFECT_SUMMON_OBJECT_SLOT4 107
|
||||||
|
#define SPELL_EFFECT_DISPEL_MECHANIC 108
|
||||||
|
#define SPELL_EFFECT_SUMMON_DEAD_PET 109
|
||||||
|
#define SPELL_EFFECT_DESTROY_ALL_TOTEMS 110
|
||||||
|
#define SPELL_EFFECT_DURABILITY_DAMAGE 111
|
||||||
|
#define SPELL_EFFECT_SUMMON_DEMON 112
|
||||||
|
#define SPELL_EFFECT_RESURRECT_NEW 113
|
||||||
|
#define SPELL_EFFECT_ATTACK_ME 114
|
||||||
|
#define SPELL_EFFECT_DURABILITY_DAMAGE_PCT 115
|
||||||
|
#define SPELL_EFFECT_SKIN_PLAYER_CORPSE 116
|
||||||
|
#define SPELL_EFFECT_SPIRIT_HEAL 117
|
||||||
|
#define SPELL_EFFECT_SKILL 118
|
||||||
|
#define SPELL_EFFECT_APPLY_AURA_NEW 119
|
||||||
|
#define SPELL_EFFECT_TELEPORT_GRAVEYARD 120
|
||||||
|
#define SPELL_EFFECT_NORMALIZED_WEAPON_DMG 121
|
||||||
|
#define TOTAL_SPELL_EFFECTS 122
|
||||||
|
|
||||||
|
#define STATE_STANDING 0
|
||||||
|
#define STATE_SITTING 1
|
||||||
|
#define STATE_SITTINGCHAIR 2
|
||||||
|
#define STATE_SLEEPING 3
|
||||||
|
#define STATE_SITTINGCHAIRLOW 4
|
||||||
|
#define STATE_SITTINGCHAIRMEDIUM 5
|
||||||
|
#define STATE_SITTINGCHAIRHIGH 6
|
||||||
|
#define STATE_DEAD 7
|
||||||
|
#define STATE_KNEEL 8
|
||||||
|
|
||||||
|
#define GAMEOBJECT_TYPE_DOOR 0
|
||||||
|
#define GAMEOBJECT_TYPE_BUTTON 1
|
||||||
|
#define GAMEOBJECT_TYPE_QUESTGIVER 2
|
||||||
|
#define GAMEOBJECT_TYPE_CHEST 3
|
||||||
|
#define GAMEOBJECT_TYPE_BINDER 4
|
||||||
|
#define GAMEOBJECT_TYPE_GENERIC 5
|
||||||
|
#define GAMEOBJECT_TYPE_TRAP 6
|
||||||
|
#define GAMEOBJECT_TYPE_CHAIR 7
|
||||||
|
#define GAMEOBJECT_TYPE_SPELL_FOCUS 8
|
||||||
|
#define GAMEOBJECT_TYPE_TEXT 9
|
||||||
|
#define GAMEOBJECT_TYPE_GOOBER 10
|
||||||
|
#define GAMEOBJECT_TYPE_TRANSPORT 11
|
||||||
|
#define GAMEOBJECT_TYPE_AREADAMAGE 12
|
||||||
|
#define GAMEOBJECT_TYPE_CAMERA 13
|
||||||
|
#define GAMEOBJECT_TYPE_MAP_OBJECT 14
|
||||||
|
#define GAMEOBJECT_TYPE_MO_TRANSPORT 15
|
||||||
|
#define GAMEOBJECT_TYPE_DUEL_ARBITER 16
|
||||||
|
#define GAMEOBJECT_TYPE_FISHINGNODE 17
|
||||||
|
#define GAMEOBJECT_TYPE_RITUAL 18
|
||||||
|
#define GAMEOBJECT_TYPE_MAILBOX 19
|
||||||
|
#define GAMEOBJECT_TYPE_AUCTIONHOUSE 20
|
||||||
|
#define GAMEOBJECT_TYPE_GUARDPOST 21
|
||||||
|
#define GAMEOBJECT_TYPE_SPELLCASTER 22
|
||||||
|
#define GAMEOBJECT_TYPE_MEETINGSTONE 23
|
||||||
|
#define GAMEOBJECT_TYPE_FLAGSTAND 24
|
||||||
|
#define GAMEOBJECT_TYPE_FISHINGHOLE 25
|
||||||
|
#define GAMEOBJECT_TYPE_FLAGDROP 26
|
||||||
|
// Custom gametypes, can create problems at sending to client
|
||||||
|
#define GAMEOBJECT_TYPE_CUSTOM_TELEPORTER 27
|
||||||
|
|
||||||
|
#define TEXTEMOTE_AGREE 1
|
||||||
|
#define TEXTEMOTE_AMAZE 2
|
||||||
|
#define TEXTEMOTE_ANGRY 3
|
||||||
|
#define TEXTEMOTE_APOLOGIZE 4
|
||||||
|
#define TEXTEMOTE_APPLAUD 5
|
||||||
|
#define TEXTEMOTE_BASHFUL 6
|
||||||
|
#define TEXTEMOTE_BECKON 7
|
||||||
|
#define TEXTEMOTE_BEG 8
|
||||||
|
#define TEXTEMOTE_BITE 9
|
||||||
|
#define TEXTEMOTE_BLEED 10
|
||||||
|
#define TEXTEMOTE_BLINK 11
|
||||||
|
#define TEXTEMOTE_BLUSH 12
|
||||||
|
#define TEXTEMOTE_BONK 13
|
||||||
|
#define TEXTEMOTE_BORED 14
|
||||||
|
#define TEXTEMOTE_BOUNCE 15
|
||||||
|
#define TEXTEMOTE_BRB 16
|
||||||
|
#define TEXTEMOTE_BOW 17
|
||||||
|
#define TEXTEMOTE_BURP 18
|
||||||
|
#define TEXTEMOTE_BYE 19
|
||||||
|
#define TEXTEMOTE_CACKLE 20
|
||||||
|
#define TEXTEMOTE_CHEER 21
|
||||||
|
#define TEXTEMOTE_CHICKEN 22
|
||||||
|
#define TEXTEMOTE_CHUCKLE 23
|
||||||
|
#define TEXTEMOTE_CLAP 24
|
||||||
|
#define TEXTEMOTE_CONFUSED 25
|
||||||
|
#define TEXTEMOTE_CONGRATULATE 26
|
||||||
|
#define TEXTEMOTE_COUGH 27
|
||||||
|
#define TEXTEMOTE_COWER 28
|
||||||
|
#define TEXTEMOTE_CRACK 29
|
||||||
|
#define TEXTEMOTE_CRINGE 30
|
||||||
|
#define TEXTEMOTE_CRY 31
|
||||||
|
#define TEXTEMOTE_CURIOUS 32
|
||||||
|
#define TEXTEMOTE_CURTSEY 33
|
||||||
|
#define TEXTEMOTE_DANCE 34
|
||||||
|
#define TEXTEMOTE_DRINK 35
|
||||||
|
#define TEXTEMOTE_DROOL 36
|
||||||
|
#define TEXTEMOTE_EAT 37
|
||||||
|
#define TEXTEMOTE_EYE 38
|
||||||
|
#define TEXTEMOTE_FART 39
|
||||||
|
#define TEXTEMOTE_FIDGET 40
|
||||||
|
#define TEXTEMOTE_FLEX 41
|
||||||
|
#define TEXTEMOTE_FROWN 42
|
||||||
|
#define TEXTEMOTE_GASP 43
|
||||||
|
#define TEXTEMOTE_GAZE 44
|
||||||
|
#define TEXTEMOTE_GIGGLE 45
|
||||||
|
#define TEXTEMOTE_GLARE 46
|
||||||
|
#define TEXTEMOTE_GLOAT 47
|
||||||
|
#define TEXTEMOTE_GREET 48
|
||||||
|
#define TEXTEMOTE_GRIN 49
|
||||||
|
#define TEXTEMOTE_GROAN 50
|
||||||
|
#define TEXTEMOTE_GROVEL 51
|
||||||
|
#define TEXTEMOTE_GUFFAW 52
|
||||||
|
#define TEXTEMOTE_HAIL 53
|
||||||
|
#define TEXTEMOTE_HAPPY 54
|
||||||
|
#define TEXTEMOTE_HELLO 55
|
||||||
|
#define TEXTEMOTE_HUG 56
|
||||||
|
#define TEXTEMOTE_HUNGRY 57
|
||||||
|
#define TEXTEMOTE_KISS 58
|
||||||
|
#define TEXTEMOTE_KNEEL 59
|
||||||
|
#define TEXTEMOTE_LAUGH 60
|
||||||
|
#define TEXTEMOTE_LAYDOWN 61
|
||||||
|
#define TEXTEMOTE_MESSAGE 62
|
||||||
|
#define TEXTEMOTE_MOAN 63
|
||||||
|
#define TEXTEMOTE_MOON 64
|
||||||
|
#define TEXTEMOTE_MOURN 65
|
||||||
|
#define TEXTEMOTE_NO 66
|
||||||
|
#define TEXTEMOTE_NOD 67
|
||||||
|
#define TEXTEMOTE_NOSEPICK 68
|
||||||
|
#define TEXTEMOTE_PANIC 69
|
||||||
|
#define TEXTEMOTE_PEER 70
|
||||||
|
#define TEXTEMOTE_PLEAD 71
|
||||||
|
#define TEXTEMOTE_POINT 72
|
||||||
|
#define TEXTEMOTE_POKE 73
|
||||||
|
#define TEXTEMOTE_PRAY 74
|
||||||
|
#define TEXTEMOTE_ROAR 75
|
||||||
|
#define TEXTEMOTE_ROFL 76
|
||||||
|
#define TEXTEMOTE_RUDE 77
|
||||||
|
#define TEXTEMOTE_SALUTE 78
|
||||||
|
#define TEXTEMOTE_SCRATCH 79
|
||||||
|
#define TEXTEMOTE_SEXY 80
|
||||||
|
#define TEXTEMOTE_SHAKE 81
|
||||||
|
#define TEXTEMOTE_SHOUT 82
|
||||||
|
#define TEXTEMOTE_SHRUG 83
|
||||||
|
#define TEXTEMOTE_SHY 84
|
||||||
|
#define TEXTEMOTE_SIGH 85
|
||||||
|
#define TEXTEMOTE_SIT 86
|
||||||
|
#define TEXTEMOTE_SLEEP 87
|
||||||
|
#define TEXTEMOTE_SNARL 88
|
||||||
|
#define TEXTEMOTE_SPIT 89
|
||||||
|
#define TEXTEMOTE_STARE 90
|
||||||
|
#define TEXTEMOTE_SURPRISED 91
|
||||||
|
#define TEXTEMOTE_SURRENDER 92
|
||||||
|
#define TEXTEMOTE_TALK 93
|
||||||
|
#define TEXTEMOTE_TALKEX 94
|
||||||
|
#define TEXTEMOTE_TALKQ 95
|
||||||
|
#define TEXTEMOTE_TAP 96
|
||||||
|
#define TEXTEMOTE_THANK 97
|
||||||
|
#define TEXTEMOTE_THREATEN 98
|
||||||
|
#define TEXTEMOTE_TIRED 99
|
||||||
|
#define TEXTEMOTE_VICTORY 100
|
||||||
|
#define TEXTEMOTE_WAVE 101
|
||||||
|
#define TEXTEMOTE_WELCOME 102
|
||||||
|
#define TEXTEMOTE_WHINE 103
|
||||||
|
#define TEXTEMOTE_WHISTLE 104
|
||||||
|
#define TEXTEMOTE_WORK 105
|
||||||
|
#define TEXTEMOTE_YAWN 106
|
||||||
|
#define TEXTEMOTE_BOGGLE 107
|
||||||
|
#define TEXTEMOTE_CALM 108
|
||||||
|
#define TEXTEMOTE_COLD 109
|
||||||
|
#define TEXTEMOTE_COMFORT 110
|
||||||
|
#define TEXTEMOTE_CUDDLE 111
|
||||||
|
#define TEXTEMOTE_DUCK 112
|
||||||
|
#define TEXTEMOTE_INSULT 113
|
||||||
|
#define TEXTEMOTE_INTRODUCE 114
|
||||||
|
#define TEXTEMOTE_JK 115
|
||||||
|
#define TEXTEMOTE_LICK 116
|
||||||
|
#define TEXTEMOTE_LISTEN 117
|
||||||
|
#define TEXTEMOTE_LOST 118
|
||||||
|
#define TEXTEMOTE_MOCK 119
|
||||||
|
#define TEXTEMOTE_PONDER 120
|
||||||
|
#define TEXTEMOTE_POUNCE 121
|
||||||
|
#define TEXTEMOTE_PRAISE 122
|
||||||
|
#define TEXTEMOTE_PURR 123
|
||||||
|
#define TEXTEMOTE_PUZZLE 124
|
||||||
|
#define TEXTEMOTE_RAISE 125
|
||||||
|
#define TEXTEMOTE_READY 126
|
||||||
|
#define TEXTEMOTE_SHIMMY 127
|
||||||
|
#define TEXTEMOTE_SHIVER 128
|
||||||
|
#define TEXTEMOTE_SHOO 129
|
||||||
|
#define TEXTEMOTE_SLAP 130
|
||||||
|
#define TEXTEMOTE_SMIRK 131
|
||||||
|
#define TEXTEMOTE_SNIFF 132
|
||||||
|
#define TEXTEMOTE_SNUB 133
|
||||||
|
#define TEXTEMOTE_SOOTHE 134
|
||||||
|
#define TEXTEMOTE_STINK 135
|
||||||
|
#define TEXTEMOTE_TAUNT 136
|
||||||
|
#define TEXTEMOTE_TEASE 137
|
||||||
|
#define TEXTEMOTE_THIRSTY 138
|
||||||
|
#define TEXTEMOTE_VETO 139
|
||||||
|
#define TEXTEMOTE_SNICKER 140
|
||||||
|
#define TEXTEMOTE_STAND 141
|
||||||
|
#define TEXTEMOTE_TICKLE 142
|
||||||
|
#define TEXTEMOTE_VIOLIN 143
|
||||||
|
#define TEXTEMOTE_SMILE 163
|
||||||
|
#define TEXTEMOTE_RASP 183
|
||||||
|
#define TEXTEMOTE_PITY 203
|
||||||
|
#define TEXTEMOTE_GROWL 204
|
||||||
|
#define TEXTEMOTE_BARK 205
|
||||||
|
#define TEXTEMOTE_SCARED 223
|
||||||
|
#define TEXTEMOTE_FLOP 224
|
||||||
|
#define TEXTEMOTE_LOVE 225
|
||||||
|
#define TEXTEMOTE_MOO 226
|
||||||
|
#define TEXTEMOTE_COMMEND 243
|
||||||
|
#define TEXTEMOTE_JOKE 329
|
||||||
|
|
||||||
|
#define EMOTE_ONESHOT_NONE 0
|
||||||
|
#define EMOTE_ONESHOT_TALK 1
|
||||||
|
#define EMOTE_ONESHOT_BOW 2
|
||||||
|
#define EMOTE_ONESHOT_WAVE 3
|
||||||
|
#define EMOTE_ONESHOT_CHEER 4
|
||||||
|
#define EMOTE_ONESHOT_EXCLAMATION 5
|
||||||
|
#define EMOTE_ONESHOT_QUESTION 6
|
||||||
|
#define EMOTE_ONESHOT_EAT 7
|
||||||
|
#define EMOTE_STATE_DANCE 10
|
||||||
|
#define EMOTE_ONESHOT_LAUGH 11
|
||||||
|
#define EMOTE_STATE_SLEEP 12
|
||||||
|
#define EMOTE_STATE_SIT 13
|
||||||
|
#define EMOTE_ONESHOT_RUDE 14
|
||||||
|
#define EMOTE_ONESHOT_ROAR 15
|
||||||
|
#define EMOTE_ONESHOT_KNEEL 16
|
||||||
|
#define EMOTE_ONESHOT_KISS 17
|
||||||
|
#define EMOTE_ONESHOT_CRY 18
|
||||||
|
#define EMOTE_ONESHOT_CHICKEN 19
|
||||||
|
#define EMOTE_ONESHOT_BEG 20
|
||||||
|
#define EMOTE_ONESHOT_APPLAUD 21
|
||||||
|
#define EMOTE_ONESHOT_SHOUT 22
|
||||||
|
#define EMOTE_ONESHOT_FLEX 23
|
||||||
|
#define EMOTE_ONESHOT_SHY 24
|
||||||
|
#define EMOTE_ONESHOT_POINT 25
|
||||||
|
#define EMOTE_STATE_STAND 26
|
||||||
|
#define EMOTE_STATE_READYUNARMED 27
|
||||||
|
#define EMOTE_STATE_WORK 28
|
||||||
|
#define EMOTE_STATE_POINT 29
|
||||||
|
#define EMOTE_STATE_NONE 30
|
||||||
|
#define EMOTE_ONESHOT_WOUND 33
|
||||||
|
#define EMOTE_ONESHOT_WOUNDCRITICAL 34
|
||||||
|
#define EMOTE_ONESHOT_ATTACKUNARMED 35
|
||||||
|
#define EMOTE_ONESHOT_ATTACK1H 36
|
||||||
|
#define EMOTE_ONESHOT_ATTACK2HTIGHT 37
|
||||||
|
#define EMOTE_ONESHOT_ATTACK2HLOOSE 38
|
||||||
|
#define EMOTE_ONESHOT_PARRYUNARMED 39
|
||||||
|
#define EMOTE_ONESHOT_PARRYSHIELD 43
|
||||||
|
#define EMOTE_ONESHOT_READYUNARMED 44
|
||||||
|
#define EMOTE_ONESHOT_READY1H 45
|
||||||
|
#define EMOTE_ONESHOT_READYBOW 48
|
||||||
|
#define EMOTE_ONESHOT_SPELLPRECAST 50
|
||||||
|
#define EMOTE_ONESHOT_SPELLCAST 51
|
||||||
|
#define EMOTE_ONESHOT_BATTLEROAR 53
|
||||||
|
#define EMOTE_ONESHOT_SPECIALATTACK1H 54
|
||||||
|
#define EMOTE_ONESHOT_KICK 60
|
||||||
|
#define EMOTE_ONESHOT_ATTACKTHROWN 61
|
||||||
|
#define EMOTE_STATE_STUN 64
|
||||||
|
#define EMOTE_STATE_DEAD 65
|
||||||
|
#define EMOTE_ONESHOT_SALUTE 66
|
||||||
|
#define EMOTE_STATE_KNEEL 68
|
||||||
|
#define EMOTE_STATE_USESTANDING 69
|
||||||
|
#define EMOTE_ONESHOT_WAVE_NOSHEATHE 70
|
||||||
|
#define EMOTE_ONESHOT_CHEER_NOSHEATHE 71
|
||||||
|
#define EMOTE_ONESHOT_EAT_NOSHEATHE 92
|
||||||
|
#define EMOTE_STATE_STUN_NOSHEATHE 93
|
||||||
|
#define EMOTE_ONESHOT_DANCE 94
|
||||||
|
#define EMOTE_ONESHOT_SALUTE_NOSHEATH 113
|
||||||
|
#define EMOTE_STATE_USESTANDING_NOSHEATHE 133
|
||||||
|
#define EMOTE_ONESHOT_LAUGH_NOSHEATHE 153
|
||||||
|
#define EMOTE_STATE_WORK_NOSHEATHE 173
|
||||||
|
#define EMOTE_STATE_SPELLPRECAST 193
|
||||||
|
#define EMOTE_ONESHOT_READYRIFLE 213
|
||||||
|
#define EMOTE_STATE_READYRIFLE 214
|
||||||
|
#define EMOTE_STATE_WORK_NOSHEATHE_MINING 233
|
||||||
|
#define EMOTE_STATE_WORK_NOSHEATHE_CHOPWOOD 234
|
||||||
|
#define EMOTE_zzOLDONESHOT_LIFTOFF 253
|
||||||
|
#define EMOTE_ONESHOT_LIFTOFF 254
|
||||||
|
#define EMOTE_ONESHOT_YES 273
|
||||||
|
#define EMOTE_ONESHOT_NO 274
|
||||||
|
#define EMOTE_ONESHOT_TRAIN 275
|
||||||
|
#define EMOTE_ONESHOT_LAND 293
|
||||||
|
#define EMOTE_STATE_READY1H 333
|
||||||
|
#define EMOTE_STATE_AT_EASE 313
|
||||||
|
#define EMOTE_STATE_SPELLKNEELSTART 353
|
||||||
|
#define EMOTE_STATE_SUBMERGED 373
|
||||||
|
#define EMOTE_ONESHOT_SUBMERGE 374
|
||||||
|
|
||||||
|
#define ANIM_STAND 0x0
|
||||||
|
#define ANIM_DEATH 0x1
|
||||||
|
#define ANIM_SPELL 0x2
|
||||||
|
#define ANIM_STOP 0x3
|
||||||
|
#define ANIM_WALK 0x4
|
||||||
|
#define ANIM_RUN 0x5
|
||||||
|
#define ANIM_DEAD 0x6
|
||||||
|
#define ANIM_RISE 0x7
|
||||||
|
#define ANIM_STANDWOUND 0x8
|
||||||
|
#define ANIM_COMBATWOUND 0x9
|
||||||
|
#define ANIM_COMBATCRITICAL 0xA
|
||||||
|
#define ANIM_SHUFFLE_LEFT 0xB
|
||||||
|
#define ANIM_SHUFFLE_RIGHT 0xC
|
||||||
|
#define ANIM_WALK_BACKWARDS 0xD
|
||||||
|
#define ANIM_STUN 0xE
|
||||||
|
#define ANIM_HANDS_CLOSED 0xF
|
||||||
|
#define ANIM_ATTACKUNARMED 0x10
|
||||||
|
#define ANIM_ATTACK1H 0x11
|
||||||
|
#define ANIM_ATTACK2HTIGHT 0x12
|
||||||
|
#define ANIM_ATTACK2HLOOSE 0x13
|
||||||
|
#define ANIM_PARRYUNARMED 0x14
|
||||||
|
#define ANIM_PARRY1H 0x15
|
||||||
|
#define ANIM_PARRY2HTIGHT 0x16
|
||||||
|
#define ANIM_PARRY2HLOOSE 0x17
|
||||||
|
#define ANIM_PARRYSHIELD 0x18
|
||||||
|
#define ANIM_READYUNARMED 0x19
|
||||||
|
#define ANIM_READY1H 0x1A
|
||||||
|
#define ANIM_READY2HTIGHT 0x1B
|
||||||
|
#define ANIM_READY2HLOOSE 0x1C
|
||||||
|
#define ANIM_READYBOW 0x1D
|
||||||
|
#define ANIM_DODGE 0x1E
|
||||||
|
#define ANIM_SPELLPRECAST 0x1F
|
||||||
|
#define ANIM_SPELLCAST 0x20
|
||||||
|
#define ANIM_SPELLCASTAREA 0x21
|
||||||
|
#define ANIM_NPCWELCOME 0x22
|
||||||
|
#define ANIM_NPCGOODBYE 0x23
|
||||||
|
#define ANIM_BLOCK 0x24
|
||||||
|
#define ANIM_JUMPSTART 0x25
|
||||||
|
#define ANIM_JUMP 0x26
|
||||||
|
#define ANIM_JUMPEND 0x27
|
||||||
|
#define ANIM_FALL 0x28
|
||||||
|
#define ANIM_SWIMIDLE 0x29
|
||||||
|
#define ANIM_SWIM 0x2A
|
||||||
|
#define ANIM_SWIM_LEFT 0x2B
|
||||||
|
#define ANIM_SWIM_RIGHT 0x2C
|
||||||
|
#define ANIM_SWIM_BACKWARDS 0x2D
|
||||||
|
#define ANIM_ATTACKBOW 0x2E
|
||||||
|
#define ANIM_FIREBOW 0x2F
|
||||||
|
#define ANIM_READYRIFLE 0x30
|
||||||
|
#define ANIM_ATTACKRIFLE 0x31
|
||||||
|
#define ANIM_LOOT 0x32
|
||||||
|
#define ANIM_SPELL_PRECAST_DIRECTED 0x33
|
||||||
|
#define ANIM_SPELL_PRECAST_OMNI 0x34
|
||||||
|
#define ANIM_SPELL_CAST_DIRECTED 0x35
|
||||||
|
#define ANIM_SPELL_CAST_OMNI 0x36
|
||||||
|
#define ANIM_SPELL_BATTLEROAR 0x37
|
||||||
|
#define ANIM_SPELL_READYABILITY 0x38
|
||||||
|
#define ANIM_SPELL_SPECIAL1H 0x39
|
||||||
|
#define ANIM_SPELL_SPECIAL2H 0x3A
|
||||||
|
#define ANIM_SPELL_SHIELDBASH 0x3B
|
||||||
|
#define ANIM_EMOTE_TALK 0x3C
|
||||||
|
#define ANIM_EMOTE_EAT 0x3D
|
||||||
|
#define ANIM_EMOTE_WORK 0x3E
|
||||||
|
#define ANIM_EMOTE_USE_STANDING 0x3F
|
||||||
|
#define ANIM_EMOTE_EXCLAMATION 0x40
|
||||||
|
#define ANIM_EMOTE_QUESTION 0x41
|
||||||
|
#define ANIM_EMOTE_BOW 0x42
|
||||||
|
#define ANIM_EMOTE_WAVE 0x43
|
||||||
|
#define ANIM_EMOTE_CHEER 0x44
|
||||||
|
#define ANIM_EMOTE_DANCE 0x45
|
||||||
|
#define ANIM_EMOTE_LAUGH 0x46
|
||||||
|
#define ANIM_EMOTE_SLEEP 0x47
|
||||||
|
#define ANIM_EMOTE_SIT_GROUND 0x48
|
||||||
|
#define ANIM_EMOTE_RUDE 0x49
|
||||||
|
#define ANIM_EMOTE_ROAR 0x4A
|
||||||
|
#define ANIM_EMOTE_KNEEL 0x4B
|
||||||
|
#define ANIM_EMOTE_KISS 0x4C
|
||||||
|
#define ANIM_EMOTE_CRY 0x4D
|
||||||
|
#define ANIM_EMOTE_CHICKEN 0x4E
|
||||||
|
#define ANIM_EMOTE_BEG 0x4F
|
||||||
|
#define ANIM_EMOTE_APPLAUD 0x50
|
||||||
|
#define ANIM_EMOTE_SHOUT 0x51
|
||||||
|
#define ANIM_EMOTE_FLEX 0x52
|
||||||
|
#define ANIM_EMOTE_SHY 0x53
|
||||||
|
#define ANIM_EMOTE_POINT 0x54
|
||||||
|
#define ANIM_ATTACK1HPIERCE 0x55
|
||||||
|
#define ANIM_ATTACK2HLOOSEPIERCE 0x56
|
||||||
|
#define ANIM_ATTACKOFF 0x57
|
||||||
|
#define ANIM_ATTACKOFFPIERCE 0x58
|
||||||
|
#define ANIM_SHEATHE 0x59
|
||||||
|
#define ANIM_HIPSHEATHE 0x5A
|
||||||
|
#define ANIM_MOUNT 0x5B
|
||||||
|
#define ANIM_RUN_LEANRIGHT 0x5C
|
||||||
|
#define ANIM_RUN_LEANLEFT 0x5D
|
||||||
|
#define ANIM_MOUNT_SPECIAL 0x5E
|
||||||
|
#define ANIM_KICK 0x5F
|
||||||
|
#define ANIM_SITDOWN 0x60
|
||||||
|
#define ANIM_SITTING 0x61
|
||||||
|
#define ANIM_SITUP 0x62
|
||||||
|
#define ANIM_SLEEPDOWN 0x63
|
||||||
|
#define ANIM_SLEEPING 0x64
|
||||||
|
#define ANIM_SLEEPUP 0x65
|
||||||
|
#define ANIM_SITCHAIRLOW 0x66
|
||||||
|
#define ANIM_SITCHAIRMEDIUM 0x67
|
||||||
|
#define ANIM_SITCHAIRHIGH 0x68
|
||||||
|
#define ANIM_LOADBOW 0x69
|
||||||
|
#define ANIM_LOADRIFLE 0x6A
|
||||||
|
#define ANIM_ATTACKTHROWN 0x6B
|
||||||
|
#define ANIM_READYTHROWN 0x6C
|
||||||
|
#define ANIM_HOLDBOW 0x6D
|
||||||
|
#define ANIM_HOLDRIFLE 0x6E
|
||||||
|
#define ANIM_HOLDTHROWN 0x6F
|
||||||
|
#define ANIM_LOADTHROWN 0x70
|
||||||
|
#define ANIM_EMOTE_SALUTE 0x71
|
||||||
|
#define ANIM_KNEELDOWN 0x72
|
||||||
|
#define ANIM_KNEELING 0x73
|
||||||
|
#define ANIM_KNEELUP 0x74
|
||||||
|
#define ANIM_ATTACKUNARMEDOFF 0x75
|
||||||
|
#define ANIM_SPECIALUNARMED 0x76
|
||||||
|
#define ANIM_STEALTHWALK 0x77
|
||||||
|
#define ANIM_STEALTHSTAND 0x78
|
||||||
|
#define ANIM_KNOCKDOWN 0x79
|
||||||
|
#define ANIM_EATING 0x7A
|
||||||
|
#define ANIM_USESTANDINGLOOP 0x7B
|
||||||
|
#define ANIM_CHANNELCASTDIRECTED 0x7C
|
||||||
|
#define ANIM_CHANNELCASTOMNI 0x7D
|
||||||
|
#define ANIM_WHIRLWIND 0x7E
|
||||||
|
#define ANIM_BIRTH 0x7F
|
||||||
|
#define ANIM_USESTANDINGSTART 0x80
|
||||||
|
#define ANIM_USESTANDINGEND 0x81
|
||||||
|
#define ANIM_HOWL 0x82
|
||||||
|
#define ANIM_DROWN 0x83
|
||||||
|
#define ANIM_DROWNED 0x84
|
||||||
|
#define ANIM_FISHINGCAST 0x85
|
||||||
|
#define ANIM_FISHINGLOOP 0x86
|
||||||
|
|
||||||
|
#define FIRST_GAMEOBJECTANIMATION 0x87
|
||||||
|
#define ANIM_GAMEOBJ_STAND 0
|
||||||
|
#define ANIM_GAMEOBJ_CLOSED 1
|
||||||
|
#define ANIM_GAMEOBJ_OPEN 2
|
||||||
|
#define ANIM_GAMEOBJ_OPENED 3
|
||||||
|
#define ANIM_GAMEOBJ_CLOSE 4
|
||||||
|
#define ANIM_GAMEOBJ_DESTROY 5
|
||||||
|
#define ANIM_GAMEOBJ_DESTROYED 6
|
||||||
|
#define ANIM_GAMEOBJ_REBUILD 7
|
||||||
|
#define ANIM_GAMEOBJ_CUSTOM0 8
|
||||||
|
#define ANIM_GAMEOBJ_CUSTOM1 9
|
||||||
|
#define ANIM_GAMEOBJ_CUSTOM2 10
|
||||||
|
#define ANIM_GAMEOBJ_CUSTOM3 11
|
||||||
|
|
||||||
|
#define FIRST_EFFECTANIMATION 0x93
|
||||||
|
#define ANIM_EFFECT_STAND 0
|
||||||
|
#define ANIM_EFFECT_HOLD 1
|
||||||
|
#define ANIM_EFFECT_DECAY 2
|
||||||
|
|
||||||
|
#define FIRST_ITEMANIMATION 0x96
|
||||||
|
#define ANIM_ITEM_STAND 0
|
||||||
|
#define ANIM_ITEM_INFLIGHT 1
|
||||||
|
#define ANIM_ITEM_BOWPULL 2
|
||||||
|
#define ANIM_ITEM_BOWRELEASE 3
|
||||||
|
|
||||||
|
#define LOCKTYPE_PICKLOCK 1
|
||||||
|
#define LOCKTYPE_HERBALISM 2
|
||||||
|
#define LOCKTYPE_MINING 3
|
||||||
|
#define LOCKTYPE_DISARM_TRAP 4
|
||||||
|
#define LOCKTYPE_OPEN 5
|
||||||
|
#define LOCKTYPE_TREASURE 6
|
||||||
|
#define LOCKTYPE_CALCIFIED_ELVEN_GEMS 7
|
||||||
|
#define LOCKTYPE_CLOSE 8
|
||||||
|
#define LOCKTYPE_ARM_TRAP 9
|
||||||
|
#define LOCKTYPE_QUICK_OPEN 10
|
||||||
|
#define LOCKTYPE_QUICK_CLOSE 11
|
||||||
|
#define LOCKTYPE_OPEN_TINKERING 12
|
||||||
|
#define LOCKTYPE_OPEN_KNEELING 13
|
||||||
|
#define LOCKTYPE_OPEN_ATTACKING 14
|
||||||
|
#define LOCKTYPE_GAHZRIDIAN 15
|
||||||
|
#define LOCKTYPE_BLASTING 16
|
||||||
|
#define LOCKTYPE_SLOW_OPEN 17
|
||||||
|
#define LOCKTYPE_SLOW_CLOSE 18
|
||||||
|
|
||||||
|
#define TRAINER_TYPE_CLASS 0
|
||||||
|
#define TRAINER_TYPE_MOUNTS 1
|
||||||
|
#define TRAINER_TYPE_TRADESKILLS 2
|
||||||
|
#define TRAINER_TYPE_PETS 3
|
||||||
|
|
||||||
|
#define SHAPESHIFT_FORM_CAT 1
|
||||||
|
#define SHAPESHIFT_FORM_TREE 2
|
||||||
|
#define SHAPESHIFT_FORM_TRAVEL 3
|
||||||
|
#define SHAPESHIFT_FORM_AQUATIC 4
|
||||||
|
#define SHAPESHIFT_FORM_BEAR 5
|
||||||
|
#define SHAPESHIFT_AMBIENT 6
|
||||||
|
#define SHAPESHIFT_GHOUL 7
|
||||||
|
#define SHAPESHIFT_FORM_DIRE_BEAR 8
|
||||||
|
#define SHAPESHIFT_CREATURE_BEAR 14
|
||||||
|
#define SHAPESHIFT_GHOST_WOLF 16
|
||||||
|
#define SHAPESHIFT_BATTLE_STANCE 17
|
||||||
|
#define SHAPESHIFT_DEFENSIVE_STANCE 18
|
||||||
|
#define SHAPESHIFT_BERSERKER_STANCE 19
|
||||||
|
#define SHAPESHIFT_FORM_SHADOW 28
|
||||||
|
#define SHAPESHIFT_STEALTH 30
|
||||||
|
#define SHAPESHIFT_MOONKIN 31
|
||||||
|
|
||||||
|
#define CREATURE_TYPE_BEAST 1
|
||||||
|
#define CREATURE_TYPE_DRAGON 2
|
||||||
|
#define CREATURE_TYPE_DEMON 3
|
||||||
|
#define CREATURE_TYPE_ELEMENTAL 4
|
||||||
|
#define CREATURE_TYPE_GIANT 5
|
||||||
|
#define CREATURE_TYPE_UNDEAD 6
|
||||||
|
#define CREATURE_TYPE_HUMANOID 7
|
||||||
|
#define CREATURE_TYPE_CRITTER 8
|
||||||
|
#define CREATURE_TYPE_MECHANICAL 9
|
||||||
|
#define CREATURE_TYPE_UNKNOWN 10
|
||||||
|
|
||||||
|
#define CREATURE_FAMILY_WOLF 1
|
||||||
|
#define CREATURE_FAMILY_CAT 2
|
||||||
|
#define CREATURE_FAMILY_SPIDER 3
|
||||||
|
#define CREATURE_FAMILY_BEAR 4
|
||||||
|
#define CREATURE_FAMILY_BOAR 5
|
||||||
|
#define CREATURE_FAMILY_CROCILISK 6
|
||||||
|
#define CREATURE_FAMILY_CARRION_BIRD 7
|
||||||
|
#define CREATURE_FAMILY_CRAB 8
|
||||||
|
#define CREATURE_FAMILY_GORILLA 9
|
||||||
|
#define CREATURE_FAMILY_RAPTOR 11
|
||||||
|
#define CREATURE_FAMILY_TALLSTRIDER 12
|
||||||
|
#define CREATURE_FAMILY_FELHUNTER 15
|
||||||
|
#define CREATURE_FAMILY_VOIDWALKER 16
|
||||||
|
#define CREATURE_FAMILY_SUCCUBUS 17
|
||||||
|
#define CREATURE_FAMILY_DOOMGUARD 19
|
||||||
|
#define CREATURE_FAMILY_SCORPID 20
|
||||||
|
#define CREATURE_FAMILY_TURTLE 21
|
||||||
|
#define CREATURE_FAMILY_IMP 23
|
||||||
|
#define CREATURE_FAMILY_BAT 24
|
||||||
|
#define CREATURE_FAMILY_HYENA 25
|
||||||
|
#define CREATURE_FAMILY_OWL 26
|
||||||
|
#define CREATURE_FAMILY_WIND_SERPENT 27
|
||||||
|
|
||||||
|
#define CREATURE_ELITE_NORMAL 0
|
||||||
|
#define CREATURE_ELITE_ELITE 1
|
||||||
|
#define CREATURE_ELITE_RAREELITE 2
|
||||||
|
#define CREATURE_ELITE_WORLDBOSS 3
|
||||||
|
#define CREATURE_ELITE_RARE 4
|
||||||
|
|
||||||
|
#define QUEST_TYPE_ELITE 1
|
||||||
|
#define QUEST_TYPE_LIFE 21
|
||||||
|
#define QUEST_TYPE_PVP 41
|
||||||
|
#define QUEST_TYPE_RAID 62
|
||||||
|
#define QUEST_TYPE_DUNGEON 81
|
||||||
|
|
||||||
|
#define QUEST_SORT_EPIC 1
|
||||||
|
#define QUEST_SORT_WAILING_CAVERNS_OLD 21
|
||||||
|
#define QUEST_SORT_SEASONAL 22
|
||||||
|
#define QUEST_SORT_UNDERCITY_OLD 23
|
||||||
|
#define QUEST_SORT_HERBALISM 24
|
||||||
|
#define QUEST_SORT_SCARLET_MONASTERY_OLD 25
|
||||||
|
#define QUEST_SORT_ULDAMN_OLD 41
|
||||||
|
#define QUEST_SORT_WARLOCK 61
|
||||||
|
#define QUEST_SORT_WARRIOR 81
|
||||||
|
#define QUEST_SORT_SHAMAN 82
|
||||||
|
#define QUEST_SORT_FISHING 101
|
||||||
|
#define QUEST_SORT_BLACKSMITHING 121
|
||||||
|
#define QUEST_SORT_PALADIN 141
|
||||||
|
#define QUEST_SORT_MAGE 161
|
||||||
|
#define QUEST_SORT_ROGUE 162
|
||||||
|
#define QUEST_SORT_ALCHEMY 181
|
||||||
|
#define QUEST_SORT_LEATHERWORKING 182
|
||||||
|
#define QUEST_SORT_ENGINERING 201
|
||||||
|
#define QUEST_SORT_TREASURE_MAP 221
|
||||||
|
#define QUEST_SORT_SUNKEN_TEMPLE_OLD 241
|
||||||
|
#define QUEST_SORT_HUNTER 261
|
||||||
|
#define QUEST_SORT_PRIEST 262
|
||||||
|
#define QUEST_SORT_DRUID 263
|
||||||
|
#define QUEST_SORT_TAILORING 264
|
||||||
|
#define QUEST_SORT_SPECIAL 284
|
||||||
|
#define QUEST_SORT_COOKING 304
|
||||||
|
#define QUEST_SORT_FIRST_AID 324
|
||||||
|
|
||||||
|
#define SKILL_FROST 6
|
||||||
|
#define SKILL_FIRE 8
|
||||||
|
#define SKILL_ARMS 26
|
||||||
|
#define SKILL_COMBAT 38
|
||||||
|
#define SKILL_SUBTLETY 39
|
||||||
|
#define SKILL_POISONS 40
|
||||||
|
#define SKILL_SWORDS 43
|
||||||
|
#define SKILL_AXES 44
|
||||||
|
#define SKILL_BOWS 45
|
||||||
|
#define SKILL_GUNS 46
|
||||||
|
#define SKILL_BEAST_MASTERY 50
|
||||||
|
#define SKILL_SURVIVAL 51
|
||||||
|
#define SKILL_MACES 54
|
||||||
|
#define SKILL_HOLY 56
|
||||||
|
#define SKILL_2H_SWORDS 55
|
||||||
|
#define SKILL_SHADOW 78
|
||||||
|
#define SKILL_DEFENSE 95
|
||||||
|
#define SKILL_LANG_COMMON 98
|
||||||
|
#define SKILL_RACIAL_DWARVEN 101
|
||||||
|
#define SKILL_LANG_ORCISH 109
|
||||||
|
#define SKILL_LANG_DWARVEN 111
|
||||||
|
#define SKILL_LANG_DARNASSIAN 113
|
||||||
|
#define SKILL_LANG_TAURAHE 115
|
||||||
|
#define SKILL_DUAL_WIELD 118
|
||||||
|
#define SKILL_RACIAL_TAUREN 124
|
||||||
|
#define SKILL_ORC_RACIAL 125
|
||||||
|
#define SKILL_RACIAL_NIGHT_ELF 126
|
||||||
|
#define SKILL_FIRST_AID 129
|
||||||
|
#define SKILL_FERAL_COMBAT 134
|
||||||
|
#define SKILL_LANG_THALASSIAN 137
|
||||||
|
#define SKILL_STAVES 136
|
||||||
|
#define SKILL_LANG_DRACONIC 138
|
||||||
|
#define SKILL_LANG_DEMON_TONGUE 139
|
||||||
|
#define SKILL_LANG_TITAN 140
|
||||||
|
#define SKILL_LANG_OLD_TONGUE 141
|
||||||
|
#define SKILL_SURVIVAL2 142
|
||||||
|
#define SKILL_RIDING_HORSE 148
|
||||||
|
#define SKILL_RIDING_WOLF 149
|
||||||
|
#define SKILL_RIDING_RAM 152
|
||||||
|
#define SKILL_RIDING_TIGER 150
|
||||||
|
#define SKILL_SWIMING 155
|
||||||
|
#define SKILL_2H_MACES 160
|
||||||
|
#define SKILL_UNARMED 162
|
||||||
|
#define SKILL_MARKSMANSHIP 163
|
||||||
|
#define SKILL_BLACKSMITHING 164
|
||||||
|
#define SKILL_LEATHERWORKING 165
|
||||||
|
#define SKILL_ALCHEMY 171
|
||||||
|
#define SKILL_2H_AXES 172
|
||||||
|
#define SKILL_DAGGERS 173
|
||||||
|
#define SKILL_THROWN 176
|
||||||
|
#define SKILL_HERBALISM 182
|
||||||
|
#define SKILL_GENERIC_DND 183
|
||||||
|
#define SKILL_RETRIBUTION 184
|
||||||
|
#define SKILL_COOKING 185
|
||||||
|
#define SKILL_MINING 186
|
||||||
|
#define SKILL_PET_IMP 188
|
||||||
|
#define SKILL_PET_FELHUNTER 189
|
||||||
|
#define SKILL_TAILORING 197
|
||||||
|
#define SKILL_ENGINERING 202
|
||||||
|
#define SKILL_PET_SPIDER 203
|
||||||
|
#define SKILL_PET_VOIDWALKER 204
|
||||||
|
#define SKILL_PET_SUCCUBUS 205
|
||||||
|
#define SKILL_PET_INFERNAL 206
|
||||||
|
#define SKILL_PET_DOOMGUARD 207
|
||||||
|
#define SKILL_PET_WOLF 208
|
||||||
|
#define SKILL_PET_CAT 209
|
||||||
|
#define SKILL_PET_BEAR 210
|
||||||
|
#define SKILL_PET_BOAR 211
|
||||||
|
#define SKILL_PET_CROCILISK 212
|
||||||
|
#define SKILL_PET_CARRION_BIRD 213
|
||||||
|
#define SKILL_PET_GORILLA 215
|
||||||
|
#define SKILL_PET_CRAB 214
|
||||||
|
#define SKILL_PET_RAPTOR 217
|
||||||
|
#define SKILL_PET_TALLSTRIDER 218
|
||||||
|
#define SKILL_RACIAL_UNDED 220
|
||||||
|
#define SKILL_WEAPON_TALENTS 222
|
||||||
|
#define SKILL_CROSSBOWS 226
|
||||||
|
#define SKILL_SPEARS 227
|
||||||
|
#define SKILL_WANDS 228
|
||||||
|
#define SKILL_POLEARMS 229
|
||||||
|
#define SKILL_ATTRIBUTE_ENCHANCEMENTS 230
|
||||||
|
#define SKILL_SLAYER_TALENTS 231
|
||||||
|
#define SKILL_MAGIC_TALENTS 233
|
||||||
|
#define SKILL_DEFENSIVE_TALENTS 234
|
||||||
|
#define SKILL_PET_SCORPID 236
|
||||||
|
#define SKILL_ARCANE 237
|
||||||
|
#define SKILL_OPEN_LOCK 242
|
||||||
|
#define SKILL_PET_TURTLE 251
|
||||||
|
#define SKILL_FURY 256
|
||||||
|
#define SKILL_PROTECTION 257
|
||||||
|
#define SKILL_BEAST_TRAINING 261
|
||||||
|
#define SKILL_PROTECTION2 267
|
||||||
|
#define SKILL_PET_TALENTS 270
|
||||||
|
#define SKILL_PLATE_MAIL 293
|
||||||
|
#define SKILL_ASSASSINATION 253
|
||||||
|
#define SKILL_LANG_GNOMISH 313
|
||||||
|
#define SKILL_LANG_TROLL 315
|
||||||
|
#define SKILL_ENCHANTING 333
|
||||||
|
#define SKILL_DEMONOLOGY 354
|
||||||
|
#define SKILL_AFFLICTION 355
|
||||||
|
#define SKILL_FISHING 356
|
||||||
|
#define SKILL_ENHANCEMENT 373
|
||||||
|
#define SKILL_RESTORATION 374
|
||||||
|
#define SKILL_ELEMENTAL_COMBAT 375
|
||||||
|
#define SKILL_SKINNING 393
|
||||||
|
#define SKILL_LEATHER 414
|
||||||
|
#define SKILL_CLOTH 415
|
||||||
|
#define SKILL_MAIL 413
|
||||||
|
#define SKILL_SHIELD 433
|
||||||
|
#define SKILL_FIST_WEAPONS 473
|
||||||
|
#define SKILL_TRACKING_BEAST 513
|
||||||
|
#define SKILL_TRACKING_HUMANOID 514
|
||||||
|
#define SKILL_TRACKING_DEMON 516
|
||||||
|
#define SKILL_TRACKING_UNDEAD 517
|
||||||
|
#define SKILL_TRACKING_DRAGON 518
|
||||||
|
#define SKILL_TRACKING_ELEMENTAL 519
|
||||||
|
#define SKILL_RIDING_RAPTOR 533
|
||||||
|
#define SKILL_RIDING_MECHANOSTRIDER 553
|
||||||
|
#define SKILL_RIDING_UNDEAD_HORSE 554
|
||||||
|
#define SKILL_RESTORATION2 573
|
||||||
|
#define SKILL_BALANCE 574
|
||||||
|
#define SKILL_DESTRUCTION 593
|
||||||
|
#define SKILL_HOLY2 594
|
||||||
|
#define SKILL_DISCIPLINE 613
|
||||||
|
#define SKILL_LOCKPICKING 633
|
||||||
|
#define SKILL_PET_BAT 653
|
||||||
|
#define SKILL_PET_HYENA 654
|
||||||
|
#define SKILL_PET_OWL 655
|
||||||
|
#define SKILL_PET_WIND_SERPENT 656
|
||||||
|
#define SKILL_LANG_GUTTERSPEAK 673
|
||||||
|
#define SKILL_RIDING_KODO 713
|
||||||
|
#define SKILL_RACIAL_TROLL 733
|
||||||
|
#define SKILL_RACIAL_GNOME 753
|
||||||
|
#define SKILL_RACIAL_HUMAN 754
|
||||||
|
|
||||||
|
#define UNIT_DYNFLAG_LOOTABLE 0x0001
|
||||||
|
|
||||||
|
#define UNIT_DYNFLAG_TRACK_UNIT 0x0002
|
||||||
|
|
||||||
|
#define UNIT_DYNFLAG_OTHER_TAGGER 0x0004
|
||||||
|
|
||||||
|
#define UNIT_DYNFLAG_ROOTED 0x0008
|
||||||
|
|
||||||
|
#define UNIT_DYNFLAG_SPECIALINFO 0x0010
|
||||||
|
|
||||||
|
#define UNIT_DYNFLAG_DEAD 0x0020
|
||||||
|
|
||||||
|
#define UNIT_FLAG_NOT_ATTACKABLE 0x0002
|
||||||
|
|
||||||
|
#define UNIT_FLAG_ATTACKABLE 0x0008
|
||||||
|
|
||||||
|
#define UNIT_FLAG_NOT_ATTACKABLE_1 0x0080
|
||||||
|
|
||||||
|
#define UNIT_FLAG_NON_PVP_PLAYER (UNIT_FLAG_ATTACKABLE + UNIT_FLAG_NOT_ATTACKABLE_1)
|
||||||
|
|
||||||
|
#define UNIT_FLAG_ANIMATION_FROZEN 0x0400
|
||||||
|
#define UNIT_FLAG_WAR_PLAYER 0x1000
|
||||||
|
|
||||||
|
enum ChatMsg
|
||||||
|
{
|
||||||
|
CHAT_MSG_SAY = 0x00,
|
||||||
|
CHAT_MSG_PARTY = 0x01,
|
||||||
|
CHAT_MSG_RAID = 0x02,
|
||||||
|
CHAT_MSG_GUILD = 0x03,
|
||||||
|
CHAT_MSG_OFFICER = 0x04,
|
||||||
|
CHAT_MSG_YELL = 0x05,
|
||||||
|
CHAT_MSG_WHISPER = 0x06,
|
||||||
|
CHAT_MSG_WHISPER_INFORM = 0x07,
|
||||||
|
CHAT_MSG_EMOTE = 0x08,
|
||||||
|
CHAT_MSG_TEXT_EMOTE = 0x09,
|
||||||
|
CHAT_MSG_SYSTEM = 0x0A,
|
||||||
|
CHAT_MSG_MONSTER_SAY = 0x0B,
|
||||||
|
CHAT_MSG_MONSTER_YELL = 0x0C,
|
||||||
|
CHAT_MSG_MONSTER_EMOTE = 0x0D,
|
||||||
|
CHAT_MSG_CHANNEL = 0x0E,
|
||||||
|
CHAT_MSG_CHANNEL_JOIN = 0x0F,
|
||||||
|
CHAT_MSG_CHANNEL_LEAVE = 0x10,
|
||||||
|
CHAT_MSG_CHANNEL_LIST = 0x11,
|
||||||
|
CHAT_MSG_CHANNEL_NOTICE = 0x12,
|
||||||
|
CHAT_MSG_CHANNEL_NOTICE_USER = 0x13,
|
||||||
|
CHAT_MSG_AFK = 0x14,
|
||||||
|
CHAT_MSG_DND = 0x15,
|
||||||
|
CHAT_MSG_IGNORED = 0x16,
|
||||||
|
CHAT_MSG_SKILL = 0x17,
|
||||||
|
CHAT_MSG_LOOT = 0x18,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
19
src/Client/World/WorldPacket.cpp
Normal file
19
src/Client/World/WorldPacket.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
#include "WorldPacket.h"
|
||||||
|
|
||||||
|
|
||||||
|
uint64 WorldPacket::GetPackedGuid(void)
|
||||||
|
{
|
||||||
|
uint8 mask;
|
||||||
|
*this >> mask;
|
||||||
|
uint64 guid=0;
|
||||||
|
for(uint8 i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
if(mask & (1<<i) )
|
||||||
|
{
|
||||||
|
*this >> ((uint8*)&guid)[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return guid;
|
||||||
|
}
|
||||||
|
|
||||||
25
src/Client/World/WorldPacket.h
Normal file
25
src/Client/World/WorldPacket.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef _WORLDPACKET_H
|
||||||
|
#define _WORLDPACKET_H
|
||||||
|
|
||||||
|
#include "SysDefs.h"
|
||||||
|
#include "Auth/ByteBuffer.h"
|
||||||
|
|
||||||
|
class WorldPacket : public ByteBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WorldPacket() { ByteBuffer(10); _opcode=0; }
|
||||||
|
WorldPacket(uint32 r) { reserve(r); _opcode=0; }
|
||||||
|
WorldPacket(uint16 opcode, uint32 r) { _opcode=opcode; reserve(r); }
|
||||||
|
WorldPacket(uint16 opcode) { _opcode=opcode; reserve(10); }
|
||||||
|
inline void SetOpcode(uint16 opcode) { _opcode=opcode; }
|
||||||
|
inline uint16 GetOpcode(void) { return _opcode; }
|
||||||
|
uint64 GetPackedGuid(void);
|
||||||
|
~WorldPacket();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16 _opcode;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
463
src/Client/World/WorldPacketHandler.cpp_
Normal file
463
src/Client/World/WorldPacketHandler.cpp_
Normal file
@ -0,0 +1,463 @@
|
|||||||
|
#include <winsock.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include "zlib/zlib.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "Auth/AuthCrypt.h"
|
||||||
|
#include "../shared/CircularBuffer.h" // to have the Buf data structure
|
||||||
|
#include "../shared/SDLTCPConnection.h"
|
||||||
|
#include "Auth/ByteBuffer.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
|
#include "Auth/Sha1.h"
|
||||||
|
#include "Opcodes.h"
|
||||||
|
#include "WorldPacketHandler.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "NameTables.h"
|
||||||
|
#include "CMSGConstructor.h"
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct ClientPktHeader
|
||||||
|
{
|
||||||
|
uint16 size;
|
||||||
|
uint16 cmd;
|
||||||
|
uint16 nil;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ServerPktHeader
|
||||||
|
{
|
||||||
|
uint16 size;
|
||||||
|
uint16 cmd;
|
||||||
|
};
|
||||||
|
|
||||||
|
AuthCrypt _crypt;
|
||||||
|
BigNumber sessionkey;
|
||||||
|
|
||||||
|
uint8 GetCompressedGuidSize(uint8 mask){
|
||||||
|
uint8 size=0;
|
||||||
|
for(unsigned int i=0;i<8;i++){
|
||||||
|
if(mask>>i){
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64 DecompressGuid(uint8 *z, uint8 mask){
|
||||||
|
uint64 guid=0;
|
||||||
|
for(uint8 i=0;i<8;i++){
|
||||||
|
if(mask>>i){
|
||||||
|
((uint8*)&guid)[i]=*z;
|
||||||
|
z++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SendWorldPacket(uint16 opcode, ByteBuffer *pkt){
|
||||||
|
ClientPktHeader hdr={0,0,0};
|
||||||
|
ByteBuffer buf;
|
||||||
|
if(pkt!=NULL)buf.append(*pkt);
|
||||||
|
hdr.cmd=opcode;
|
||||||
|
hdr.size=ntohs(buf.size()+4);
|
||||||
|
_crypt.EncryptSend((uint8*)&hdr, 6);
|
||||||
|
ByteBuffer final;
|
||||||
|
final.append((uint8*)&hdr,6);
|
||||||
|
if(buf.size()){
|
||||||
|
final.append(buf);
|
||||||
|
}
|
||||||
|
worldCon.Send((char*)final.contents(), final.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HandleWorldPacket(ByteBuffer pkt){
|
||||||
|
|
||||||
|
static uint16 _last_cmd,_last_remaining;
|
||||||
|
static bool _last_pkt_wrong;
|
||||||
|
ServerPktHeader hdr;
|
||||||
|
uint16 _remaining, _cmd;
|
||||||
|
ByteBuffer wdata;
|
||||||
|
pkt >> hdr.size >> hdr.cmd;
|
||||||
|
_crypt.DecryptRecv((uint8*)&hdr, 4);
|
||||||
|
_remaining=ntohs(hdr.size)-2;
|
||||||
|
_cmd=hdr.cmd;
|
||||||
|
//DEBUG3(printf("DECRYPT: rest=%d, opcode=%d\n",_remaining,_cmd);)
|
||||||
|
if(_cmd>800){
|
||||||
|
DEBUG3(printf("Recieved weird opcode [%u] pktsize=%u remaining=%u(corrupted header?)\n",_cmd,pkt.size(),_remaining);)
|
||||||
|
DEBUG3(pkt.hexlike();)
|
||||||
|
//if(pkt.size()==_last_remaining){
|
||||||
|
// DEBUG3(printf("Trying to attach packet to last recieved opcode [%s], size=%u\n",LookupName(_last_cmd,g_worldOpcodeNames),_last_remaining);)
|
||||||
|
// wdata.append(pkt.contents(),_last_remaining);
|
||||||
|
// HandleOpcode(_last_cmd,wdata); // lets hope it wont crash :/
|
||||||
|
//} else
|
||||||
|
//DEBUG1(printf("Packet rescue failed, dropping. size=%u opcode=%u\n",_remaining,_cmd);)
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(pkt.size()>4 && _remaining+4==pkt.size()){
|
||||||
|
DEBUG3(printf("Rcvd pkt hdr is too big (%u)! Assuming {header+data}, opcode=%d [%s]\n",pkt.size(),_cmd,LookupName(_cmd,g_worldOpcodeNames));)
|
||||||
|
wdata.append(&pkt.contents()[4],4);
|
||||||
|
//wdata.hexlike();
|
||||||
|
_last_cmd=_cmd;
|
||||||
|
_last_remaining=_remaining;
|
||||||
|
HandleOpcode(_cmd,wdata);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(!_remaining){
|
||||||
|
ByteBuffer dummy;
|
||||||
|
HandleOpcode(_cmd,dummy);
|
||||||
|
}
|
||||||
|
if(_remaining){
|
||||||
|
ByteBuffer content;
|
||||||
|
content.append(worldCon.GetDataString()); // fetch the next packet
|
||||||
|
content.resize(content.size()-1); // remove the \0
|
||||||
|
if(content.size()<_remaining ){ // packet is smaller then expected
|
||||||
|
//content.hexlike();
|
||||||
|
DEBUG3(printf("Packet was smaller then expected! (expected: %u, recvd: %u)\n",_remaining,content.size());)
|
||||||
|
//if(content.size()==_last_remaining){
|
||||||
|
// DEBUG3(printf("Trying to attach packet to last recieved opcode [%s], size=%u\n",LookupName(_last_cmd,g_worldOpcodeNames),_last_remaining);)
|
||||||
|
// wdata.append(pkt.contents(),_last_remaining);
|
||||||
|
// HandleOpcode(_last_cmd,wdata); // lets hope it wont crash :/
|
||||||
|
// //something_went_wrong=true;
|
||||||
|
//} else
|
||||||
|
// printf("Packet rescue failed, dropping. size=%u opcode=%u\n",_remaining,_cmd);
|
||||||
|
return;
|
||||||
|
} else { // packet seems ok, use the full packet that came in
|
||||||
|
//content.hexlike();
|
||||||
|
wdata.append(content.contents(),_remaining);
|
||||||
|
_last_cmd=_cmd;
|
||||||
|
_last_remaining=_remaining;
|
||||||
|
HandleOpcode(_cmd,wdata);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleOpcode(uint16 opcode, ByteBuffer &data){
|
||||||
|
|
||||||
|
//DEBUG3(printf("W: opcode=0x%X | %d , datasize=%d [%s]\n",opcode,opcode,data.size(),LookupName(opcode,g_worldOpcodeNames));)
|
||||||
|
switch(opcode){
|
||||||
|
case SMSG_AUTH_CHALLENGE:{
|
||||||
|
std::string acc(strupr(accname));
|
||||||
|
uint32 serverseed;
|
||||||
|
data>>serverseed;
|
||||||
|
DEBUG3(printf("W:auth: serverseed=0x%X\n",serverseed);)
|
||||||
|
Sha1Hash digest;
|
||||||
|
digest.UpdateData(acc);
|
||||||
|
uint32 unk=0;
|
||||||
|
digest.UpdateData((uint8*)&unk,sizeof(uint32));
|
||||||
|
BigNumber clientseed;
|
||||||
|
clientseed.SetRand(8*4);
|
||||||
|
unsigned int clientseed_uint32=clientseed.AsDword();
|
||||||
|
digest.UpdateData((uint8*)&clientseed_uint32,sizeof(uint32));
|
||||||
|
digest.UpdateData((uint8*)&serverseed,sizeof(uint32));
|
||||||
|
digest.UpdateBigNumbers(&sessionkey,NULL);
|
||||||
|
digest.Finalize();
|
||||||
|
ByteBuffer outpkt;
|
||||||
|
outpkt<<(uint32)clientbuild<<unk<<acc<<clientseed_uint32;
|
||||||
|
outpkt.append(digest.GetDigest(),20);
|
||||||
|
// recvPacket << real_size
|
||||||
|
// recvPacket << ziped_UI_Plugins_Info
|
||||||
|
// TODO: add addon data, simulate no addons.
|
||||||
|
outpkt<<(uint32)0; // no addons? no idea, but seems to work. MaNGOS doesnt accept without this.
|
||||||
|
|
||||||
|
DEBUG3(
|
||||||
|
printf("CMSG_AUTH_SESSION=");
|
||||||
|
printchex((char*)outpkt.contents(),outpkt.size(),true);
|
||||||
|
)
|
||||||
|
SendWorldPacket(CMSG_AUTH_SESSION,&outpkt);
|
||||||
|
_crypt.SetKey(sessionkey.AsByteArray(), 40);
|
||||||
|
_crypt.Init();
|
||||||
|
}break;
|
||||||
|
|
||||||
|
case SMSG_AUTH_RESPONSE:{
|
||||||
|
uint8 errcode;
|
||||||
|
data>>errcode;
|
||||||
|
if(errcode==0xC){
|
||||||
|
DEBUG1(printf("World Authentication successful, preparing for char list request...\n"););
|
||||||
|
SendWorldPacket(CMSG_CHAR_ENUM,NULL);
|
||||||
|
} else {
|
||||||
|
printf("World Authentication failed, errcode=0x%X\n",(unsigned char)errcode);
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
|
||||||
|
case SMSG_CHAR_ENUM:{
|
||||||
|
uint8 num;
|
||||||
|
Player plr[10];
|
||||||
|
uint8 dummy8;
|
||||||
|
uint32 dummy32;
|
||||||
|
|
||||||
|
data >> num;
|
||||||
|
if(num==0){
|
||||||
|
printf("W:No chars found!\n");
|
||||||
|
something_went_wrong=true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printf("W: Chars in list: %u\n",num);
|
||||||
|
for(unsigned int i=0;i<num;i++){
|
||||||
|
data >> plr[i]._guid;
|
||||||
|
data >> plr[i]._name;
|
||||||
|
data >> plr[i]._race;
|
||||||
|
data >> plr[i]._class;
|
||||||
|
data >> plr[i]._gender;
|
||||||
|
data >> plr[i]._bytes1;
|
||||||
|
data >> plr[i]._bytes2;
|
||||||
|
data >> plr[i]._bytes3;
|
||||||
|
data >> plr[i]._bytes4;
|
||||||
|
data >> plr[i]._bytesx;
|
||||||
|
data >> plr[i]._level;
|
||||||
|
data >> plr[i]._zoneId;
|
||||||
|
data >> plr[i]._mapId;
|
||||||
|
data >> plr[i]._x;
|
||||||
|
data >> plr[i]._y;
|
||||||
|
data >> plr[i]._z;
|
||||||
|
data >> plr[i]._guildId;
|
||||||
|
data >> dummy8;
|
||||||
|
data >> plr[i]._flags;
|
||||||
|
data >> dummy8 >> dummy8 >> dummy8;
|
||||||
|
data >> plr[i]._petInfoId;
|
||||||
|
data >> plr[i]._petLevel;
|
||||||
|
data >> plr[i]._petFamilyId;
|
||||||
|
for(unsigned int inv=0;inv<20;inv++){
|
||||||
|
data >> dummy32 >> dummy8; // item data are not relevant yet ( (uint32)itemID , (uint8)inventorytype )
|
||||||
|
}
|
||||||
|
plrNameCache.AddInfo(plr[i]._guid, plr[i]._name);
|
||||||
|
}
|
||||||
|
bool char_found=false;
|
||||||
|
uint64 login_guid;
|
||||||
|
for(unsigned int i=0;i<num;i++){
|
||||||
|
printf("## %s (%u) [%s/%s]\n",
|
||||||
|
plr[i]._name.c_str(),plr[i]._level,raceName[plr[i]._race],className[plr[i]._class]);
|
||||||
|
DEBUG1(printf("-> coords: map=%u zone=%u x=%f y=%f z=%f\n",
|
||||||
|
plr[i]._mapId,plr[i]._zoneId,plr[i]._x,plr[i]._y,plr[i]._z);)
|
||||||
|
if(plr[i]._name==charname){
|
||||||
|
char_found=true;
|
||||||
|
login_guid=plr[i]._guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(!char_found){
|
||||||
|
printf("W: Character \"%s\" was not found on char list!\n",charname.c_str());
|
||||||
|
something_went_wrong=true;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
printf("W: Entering World with Character \"%s\"...\n",charname.c_str());
|
||||||
|
ByteBuffer pkt;
|
||||||
|
pkt << login_guid;
|
||||||
|
_myGUID=login_guid;
|
||||||
|
_targetGUID=0;
|
||||||
|
SendWorldPacket(CMSG_PLAYER_LOGIN,&pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}break;
|
||||||
|
|
||||||
|
case SMSG_ACCOUNT_DATA_MD5:
|
||||||
|
case SMSG_SET_PROFICIENCY:
|
||||||
|
case SMSG_CAST_RESULT:
|
||||||
|
case SMSG_LOGIN_SETTIMESPEED: //those opcodes are sent on login
|
||||||
|
{
|
||||||
|
if(!inworld){
|
||||||
|
inworld=true;
|
||||||
|
defScp.RunScriptByName("_enterworld",NULL,255);
|
||||||
|
}
|
||||||
|
// o_O
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case SMSG_MESSAGECHAT:{
|
||||||
|
uint8 type=0;
|
||||||
|
uint32 lang=0;
|
||||||
|
uint64 target_guid=0;
|
||||||
|
uint32 msglen=0;
|
||||||
|
std::string msg,ext;
|
||||||
|
bool isCmd=false;
|
||||||
|
|
||||||
|
data >> type >> lang;
|
||||||
|
|
||||||
|
if (type == CHAT_MSG_CHANNEL)
|
||||||
|
data >> ext; // extract channel name
|
||||||
|
|
||||||
|
data >> target_guid;
|
||||||
|
std::string plrname;
|
||||||
|
if(target_guid){
|
||||||
|
plrname=plrNameCache.GetName(target_guid);
|
||||||
|
if(plrname.empty())
|
||||||
|
{
|
||||||
|
QueryPlayerName(target_guid);
|
||||||
|
plrname="Unknown Entity";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defScp.variables.Set("@lastmsg_name",defScp.variables.Get("@thismsg_name"));
|
||||||
|
defScp.variables.Set("@lastmsg",defScp.variables.Get("@lastmsg"));
|
||||||
|
defScp.variables.Set("@thismsg_name",plrname);
|
||||||
|
defScp.variables.Set("@thismsg",toString(target_guid));
|
||||||
|
|
||||||
|
|
||||||
|
if(type == CHAT_MSG_SAY || type == CHAT_MSG_YELL || type == CHAT_MSG_PARTY)
|
||||||
|
data >> target_guid;
|
||||||
|
|
||||||
|
data >> msglen >> msg;
|
||||||
|
if (type == CHAT_MSG_SYSTEM){
|
||||||
|
printf("W:SYSMSG: \"%s\"\n",msg.c_str());
|
||||||
|
} else if (type==CHAT_MSG_WHISPER ){
|
||||||
|
printf("W:WHISP: %s [%s]: %s\n",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
|
} else {
|
||||||
|
printf("W:CHAT: %s [%s]: %s\n",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(target_guid!=_myGUID && msg.length()>1 && msg.at(0)=='-')
|
||||||
|
isCmd=true;
|
||||||
|
|
||||||
|
// some fun code :P
|
||||||
|
if(type==CHAT_MSG_SAY && target_guid!=_myGUID && !isCmd)
|
||||||
|
{
|
||||||
|
if(msg=="lol")
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"say \"lol\" if you have nothing else to say... lol xD","");
|
||||||
|
else if(msg.length()>4 && msg.find("you?")!=std::string::npos)
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,std::string(ver).append(" -- i am a bot, made by False.Genesis, my master."),"");
|
||||||
|
else if(msg=="hi")
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"Hi, wadup?","");
|
||||||
|
else if(msg.length()<12 && msg.find("wtf")!=std::string::npos)
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"Yeah, WTF is a good way to say you dont understand anything... :P","");
|
||||||
|
else if(msg.length()<15 && (msg.find("omg")!=std::string::npos || msg.find("omfg")!=std::string::npos) )
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"OMG a bot logged in, you don't believe it :O","");
|
||||||
|
else if(msg.find("from")!=std::string::npos || msg.find("download")!=std::string::npos)
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"you can dl me from http://my.opera.com/PseuWoW","");
|
||||||
|
else if(msg.find("Genesis")!=std::string::npos || msg.find("genesis")!=std::string::npos)
|
||||||
|
SendChatMessage(CHAT_MSG_YELL,lang,"False.Genesis, they are calling you!! Come here, master xD","");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isCmd){
|
||||||
|
defScp.variables.Set("@lastcmd_name",defScp.variables.Get("@thiscmd_name"));
|
||||||
|
defScp.variables.Set("@lastcmd",defScp.variables.Get("@lastcmd"));
|
||||||
|
defScp.variables.Set("@thiscmd_name",plrname);
|
||||||
|
defScp.variables.Set("@thiscmd",toString(target_guid));
|
||||||
|
std::string lin=msg.substr(1,msg.length()-1);
|
||||||
|
uint8 perm=atoi(playerPermissions.Get(plrname).c_str());
|
||||||
|
try{
|
||||||
|
if(!defScp.RunSingleLine(lin,perm))
|
||||||
|
defScp.RunScriptByName("_nopermission",NULL,255);
|
||||||
|
} catch (...) {
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,0,"Exception while trying to execute: [ "+lin+" ]","");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(type==CHAT_MSG_WHISPER && !isCmd){
|
||||||
|
defScp.variables.Set("@lastwhisper_name",defScp.variables.Get("@thiswhisper_name"));
|
||||||
|
defScp.variables.Set("@lastwhisper",defScp.variables.Get("@thiswhisper"));
|
||||||
|
defScp.variables.Set("@lastwhisper_lang",defScp.variables.Get("@thiswhisper_lang"));
|
||||||
|
defScp.variables.Set("@thiswhisper_name",plrname);
|
||||||
|
defScp.variables.Set("@thiswhisper",toString(target_guid));
|
||||||
|
defScp.variables.Set("@thiswhisper_lang",toString((uint64)lang));
|
||||||
|
defScp.RunScriptByName("_onwhisper",NULL,255);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case SMSG_MONSTER_MOVE:{
|
||||||
|
// register moving mobs, etc
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case SMSG_STOP_MIRROR_TIMER:{
|
||||||
|
// mangos spams u with that if you are dead (bug)
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case SMSG_NAME_QUERY_RESPONSE:{
|
||||||
|
uint64 pguid;
|
||||||
|
std::string pname;
|
||||||
|
data >> pguid >> pname;
|
||||||
|
if(pname.length()>12 || pname.length()<2)
|
||||||
|
break; // playernames maxlen=12
|
||||||
|
// rest of the packet is not interesting for now
|
||||||
|
if(plrNameCache.AddInfo(pguid,pname))
|
||||||
|
{
|
||||||
|
printf("CACHE: Assigned new player name: '%s'",pname.c_str());
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,0,"Player "+pname+" added to cache.","");
|
||||||
|
DEBUG2(printf(" to guid "I64FMTD,pguid););
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case MSG_MOVE_SET_FACING:
|
||||||
|
case MSG_MOVE_START_FORWARD:
|
||||||
|
case MSG_MOVE_START_BACKWARD:
|
||||||
|
case MSG_MOVE_STOP:
|
||||||
|
case MSG_MOVE_START_STRAFE_LEFT:
|
||||||
|
case MSG_MOVE_START_STRAFE_RIGHT:
|
||||||
|
case MSG_MOVE_STOP_STRAFE:
|
||||||
|
case MSG_MOVE_JUMP:
|
||||||
|
case MSG_MOVE_START_TURN_LEFT:
|
||||||
|
case MSG_MOVE_START_TURN_RIGHT:
|
||||||
|
case MSG_MOVE_STOP_TURN:
|
||||||
|
case MSG_MOVE_START_SWIM:
|
||||||
|
case MSG_MOVE_STOP_SWIM:
|
||||||
|
case MSG_MOVE_HEARTBEAT:
|
||||||
|
case MSG_MOVE_FALL_LAND:
|
||||||
|
{
|
||||||
|
uint32 flags, time;
|
||||||
|
float x, y, z, o;
|
||||||
|
uint64 guid;
|
||||||
|
uint8 mask,guidlen,*zguid;
|
||||||
|
std::string plrname;
|
||||||
|
data >> mask;
|
||||||
|
guidlen=GetCompressedGuidSize(mask);
|
||||||
|
zguid=new uint8[guidlen];
|
||||||
|
data.read(zguid,guidlen);
|
||||||
|
guid=DecompressGuid(zguid,mask);
|
||||||
|
delete zguid;
|
||||||
|
data >> flags >> time >> x >> y >> z >> o;
|
||||||
|
if(guid){
|
||||||
|
plrname=plrNameCache.GetName(guid);
|
||||||
|
if(plrname.empty())
|
||||||
|
{
|
||||||
|
QueryPlayerName(guid);
|
||||||
|
plrname="Unknown Entity";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// for follow:
|
||||||
|
if(_followGUID==guid){
|
||||||
|
ByteBuffer bb;
|
||||||
|
bb << time << flags << x << y << z << o;
|
||||||
|
SendWorldPacket(opcode,&bb);
|
||||||
|
}
|
||||||
|
// more to come
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case SMSG_PONG:{
|
||||||
|
uint32 pong;
|
||||||
|
data >> pong;
|
||||||
|
printf("Recieved Ping reply: %u ms latency, including %u ms fetch delay.\n",clock()-pong,idleSleepTime);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case SMSG_TRADE_STATUS:{
|
||||||
|
data.hexlike();
|
||||||
|
uint8 unk;
|
||||||
|
data >> unk;
|
||||||
|
if(unk==1){
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,0,"It has no sense trying to trade with me, that feature is not yet implemented!","");
|
||||||
|
SendWorldPacket(CMSG_CANCEL_TRADE,NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case SMSG_GROUP_INVITE:{
|
||||||
|
data.hexlike();
|
||||||
|
SendWorldPacket(CMSG_GROUP_DECLINE,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//...
|
||||||
|
|
||||||
|
default: {
|
||||||
|
DEBUG1(printf("Recieved unknown opcode=%u [%s] pktlen=%u\n",opcode,LookupName(opcode,g_worldOpcodeNames),data.size()););
|
||||||
|
} break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
10
src/Client/World/WorldPacketHandler.h_
Normal file
10
src/Client/World/WorldPacketHandler.h_
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef _WORLDPACKETHANDLER_H
|
||||||
|
#define _WORLDPACKETHANDLER_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "Auth/ByteBuffer.h"
|
||||||
|
void HandleWorldPacket(ByteBuffer);
|
||||||
|
void HandleOpcode(uint16,ByteBuffer&);
|
||||||
|
void SendWorldPacket(uint16, ByteBuffer*);
|
||||||
|
|
||||||
|
#endif
|
||||||
457
src/Client/World/WorldSession.cpp
Normal file
457
src/Client/World/WorldSession.cpp
Normal file
@ -0,0 +1,457 @@
|
|||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "Auth/Sha1.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
|
#include "Auth/AuthCrypt.h"
|
||||||
|
#include "Opcodes.h"
|
||||||
|
#include "WorldPacket.h"
|
||||||
|
#include "WorldSocket.h"
|
||||||
|
#include "WorldSession.h"
|
||||||
|
#include "NameTables.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct ClientPktHeader
|
||||||
|
{
|
||||||
|
uint16 size;
|
||||||
|
uint16 cmd;
|
||||||
|
uint16 nil;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ServerPktHeader
|
||||||
|
{
|
||||||
|
uint16 size;
|
||||||
|
uint16 cmd;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
WorldSession::WorldSession(PseuInstance *in)
|
||||||
|
{
|
||||||
|
_instance = in;
|
||||||
|
_valid=_authed=_logged=false;
|
||||||
|
_socket=new WorldSocket(_sh,this);
|
||||||
|
_sh.Add(_socket);
|
||||||
|
_targetGUID=0; // no target
|
||||||
|
_followGUID=0; // dont follow anything
|
||||||
|
plrNameCache.ReadFromFile(); // load names/guids of known players
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldSession::~WorldSession()
|
||||||
|
{
|
||||||
|
delete _socket;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::AddToDataQueue(uint8 *data, uint32 len)
|
||||||
|
{
|
||||||
|
for (uint32 i=0;i<len;i++)
|
||||||
|
pktQueue.push_back(data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::SendWorldPacket(WorldPacket &pkt)
|
||||||
|
{
|
||||||
|
ClientPktHeader hdr;
|
||||||
|
memset(&hdr,0,sizeof(ClientPktHeader));
|
||||||
|
hdr.size = ntohs(pkt.size()+4);
|
||||||
|
hdr.cmd = pkt.GetOpcode();
|
||||||
|
_crypt.EncryptSend((uint8*)&hdr, 6);
|
||||||
|
ByteBuffer final(pkt.size()+6);
|
||||||
|
final.append((uint8*)&hdr,sizeof(ClientPktHeader));
|
||||||
|
final.append(pkt.contents(),pkt.size());
|
||||||
|
_socket->SendBuf((char*)final.contents(),final.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::Update(void)
|
||||||
|
{
|
||||||
|
WorldPacket packet;
|
||||||
|
OpcodeHandler *table = _GetOpcodeHandlerTable();
|
||||||
|
while(pktQueue.size()>5)
|
||||||
|
{
|
||||||
|
packet = BuildWorldPacket();
|
||||||
|
|
||||||
|
for (uint16 i = 0; table[i].handler != NULL; i++)
|
||||||
|
if (table[i].opcode == packet.GetOpcode())
|
||||||
|
(this->*table[i].handler)(packet);
|
||||||
|
|
||||||
|
packet.clear();
|
||||||
|
}
|
||||||
|
// do more stuff here
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldPacket WorldSession::BuildWorldPacket(void)
|
||||||
|
{
|
||||||
|
ServerPktHeader hdr;
|
||||||
|
WorldPacket wp;
|
||||||
|
uint16 _remaining;
|
||||||
|
for (uint8 i=0;i<sizeof(ServerPktHeader);i++)
|
||||||
|
{
|
||||||
|
((uint8*)&hdr)[i] = pktQueue.front();
|
||||||
|
pktQueue.pop_front();
|
||||||
|
}
|
||||||
|
_crypt.DecryptRecv((uint8*)&hdr,sizeof(ServerPktHeader));
|
||||||
|
_remaining = ntohs(hdr.size)-2;
|
||||||
|
wp.SetOpcode(hdr.cmd);
|
||||||
|
for (uint16 i=0;i<_remaining;i++)
|
||||||
|
{
|
||||||
|
wp << pktQueue.front();
|
||||||
|
pktQueue.pop_front();
|
||||||
|
}
|
||||||
|
return wp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
OpcodeHandler *WorldSession::_GetOpcodeHandlerTable() const
|
||||||
|
{
|
||||||
|
static OpcodeHandler table[] =
|
||||||
|
{
|
||||||
|
{ SMSG_AUTH_CHALLENGE, &WorldSession::_HandleAuthChallengeOpcode },
|
||||||
|
{ SMSG_AUTH_RESPONSE, &WorldSession::_HandleAuthResponseOpcode },
|
||||||
|
{SMSG_CHAR_ENUM, &WorldSession::_HandleCharEnumOpcode},
|
||||||
|
{SMSG_SET_PROFICIENCY, &WorldSession::_HandleSetProficiencyOpcode},
|
||||||
|
{SMSG_ACCOUNT_DATA_MD5, &WorldSession::_HandleAccountDataMD5Opcode},
|
||||||
|
{SMSG_MESSAGECHAT, &WorldSession::_HandleMessageChatOpcode},
|
||||||
|
{SMSG_NAME_QUERY_RESPONSE, &WorldSession::_HandleNameQueryResponseOpcode},
|
||||||
|
{SMSG_PONG, &WorldSession::_HandlePongOpcode},
|
||||||
|
{SMSG_TRADE_STATUS, &WorldSession::_HandleTradeStatusOpcode},
|
||||||
|
{SMSG_GROUP_INVITE, &WorldSession::_HandleGroupInviteOpcode},
|
||||||
|
|
||||||
|
// movement opcodes
|
||||||
|
{MSG_MOVE_SET_FACING, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_START_FORWARD, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_START_BACKWARD, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_STOP, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_START_STRAFE_LEFT, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_START_STRAFE_RIGHT, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_STOP_STRAFE, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_JUMP, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_START_TURN_LEFT, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_START_TURN_RIGHT, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_STOP_TURN, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_START_SWIM, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_STOP_SWIM, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_HEARTBEAT, &WorldSession::_HandleMovementOpcode},
|
||||||
|
{MSG_MOVE_FALL_LAND, &WorldSession::_HandleMovementOpcode},
|
||||||
|
|
||||||
|
// table termination
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::SetTarget(uint64 guid)
|
||||||
|
{
|
||||||
|
_targetGUID=guid;
|
||||||
|
// TODO: update the UpdateFields once implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::SetFollowTarget(uint64 guid)
|
||||||
|
{
|
||||||
|
_followGUID=guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::OnEnterWorld(void)
|
||||||
|
{
|
||||||
|
if(!_logged)
|
||||||
|
{
|
||||||
|
_logged=true;
|
||||||
|
GetInstance()->GetScripts()->RunScriptByName("_enterworld",NULL,255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Opcode Handlers
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void WorldSession::_HandleAuthChallengeOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
std::string acc = stringToUpper(GetInstance()->GetConf()->accname);
|
||||||
|
uint32 serverseed;
|
||||||
|
recvPacket >> serverseed;
|
||||||
|
//DEBUG3(printf("W:auth: serverseed=0x%X\n",serverseed);)
|
||||||
|
Sha1Hash digest;
|
||||||
|
digest.UpdateData(acc);
|
||||||
|
uint32 unk=0;
|
||||||
|
digest.UpdateData((uint8*)&unk,sizeof(uint32));
|
||||||
|
BigNumber clientseed;
|
||||||
|
clientseed.SetRand(8*4);
|
||||||
|
uint32 clientseed_uint32=clientseed.AsDword();
|
||||||
|
digest.UpdateData((uint8*)&clientseed_uint32,sizeof(uint32));
|
||||||
|
digest.UpdateData((uint8*)&serverseed,sizeof(uint32));
|
||||||
|
digest.UpdateBigNumbers(&(GetInstance()->GetSessionKey()),NULL);
|
||||||
|
digest.Finalize();
|
||||||
|
WorldPacket auth;
|
||||||
|
auth<<(uint32)(GetInstance()->GetConf()->clientbuild)<<unk<<acc<<clientseed_uint32;
|
||||||
|
auth.append(digest.GetDigest(),20);
|
||||||
|
// recvPacket << real_size
|
||||||
|
// recvPacket << ziped_UI_Plugins_Info
|
||||||
|
// TODO: add addon data, simulate no addons.
|
||||||
|
auth<<(uint32)0; // no addons? no idea, but seems to work. MaNGOS doesnt accept without this.
|
||||||
|
auth.SetOpcode(CMSG_AUTH_SESSION);
|
||||||
|
|
||||||
|
//DEBUG3(
|
||||||
|
// printf("CMSG_AUTH_SESSION=");
|
||||||
|
// printchex((char*)outpkt.contents(),outpkt.size(),true);
|
||||||
|
//)
|
||||||
|
SendWorldPacket(auth);
|
||||||
|
_crypt.SetKey(GetInstance()->GetSessionKey().AsByteArray(), 40);
|
||||||
|
_crypt.Init();
|
||||||
|
_authed=true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::_HandleAuthResponseOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
uint8 errcode;
|
||||||
|
recvPacket >> errcode;
|
||||||
|
if(errcode==0xC){
|
||||||
|
//DEBUG1(printf("World Authentication successful, preparing for char list request...\n"););
|
||||||
|
WorldPacket pkt;
|
||||||
|
pkt.SetOpcode(CMSG_CHAR_ENUM);
|
||||||
|
SendWorldPacket(pkt);
|
||||||
|
} else {
|
||||||
|
printf("World Authentication failed, errcode=0x%X\n",(unsigned char)errcode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::_HandleCharEnumOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
uint8 num;
|
||||||
|
PlayerEnum plr[10]; // max characters per realm is 10
|
||||||
|
uint8 dummy8;
|
||||||
|
uint32 dummy32;
|
||||||
|
|
||||||
|
recvPacket >> num;
|
||||||
|
if(num==0){
|
||||||
|
printf("W:No chars found!\n");
|
||||||
|
GetInstance()->Stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printf("W: Chars in list: %u\n",num);
|
||||||
|
for(unsigned int i=0;i<num;i++){
|
||||||
|
recvPacket >> plr[i]._guid;
|
||||||
|
recvPacket >> plr[i]._name;
|
||||||
|
recvPacket >> plr[i]._race;
|
||||||
|
recvPacket >> plr[i]._class;
|
||||||
|
recvPacket >> plr[i]._gender;
|
||||||
|
recvPacket >> plr[i]._bytes1;
|
||||||
|
recvPacket >> plr[i]._bytes2;
|
||||||
|
recvPacket >> plr[i]._bytes3;
|
||||||
|
recvPacket >> plr[i]._bytes4;
|
||||||
|
recvPacket >> plr[i]._bytesx;
|
||||||
|
recvPacket >> plr[i]._level;
|
||||||
|
recvPacket >> plr[i]._zoneId;
|
||||||
|
recvPacket >> plr[i]._mapId;
|
||||||
|
recvPacket >> plr[i]._x;
|
||||||
|
recvPacket >> plr[i]._y;
|
||||||
|
recvPacket >> plr[i]._z;
|
||||||
|
recvPacket >> plr[i]._guildId;
|
||||||
|
recvPacket >> dummy8;
|
||||||
|
recvPacket >> plr[i]._flags;
|
||||||
|
recvPacket >> dummy8 >> dummy8 >> dummy8;
|
||||||
|
recvPacket >> plr[i]._petInfoId;
|
||||||
|
recvPacket >> plr[i]._petLevel;
|
||||||
|
recvPacket >> plr[i]._petFamilyId;
|
||||||
|
for(unsigned int inv=0;inv<20;inv++){
|
||||||
|
recvPacket >> dummy32 >> dummy8; // item data are not relevant yet ( (uint32)itemID , (uint8)inventorytype )
|
||||||
|
}
|
||||||
|
plrNameCache.AddInfo(plr[i]._guid, plr[i]._name);
|
||||||
|
}
|
||||||
|
bool char_found=false;
|
||||||
|
for(unsigned int i=0;i<num;i++){
|
||||||
|
printf("## %s (%u) [%s/%s]\n",
|
||||||
|
plr[i]._name.c_str(),plr[i]._level,raceName[plr[i]._race],className[plr[i]._class]);
|
||||||
|
//DEBUG1(printf("-> coords: map=%u zone=%u x=%f y=%f z=%f\n",
|
||||||
|
// plr[i]._mapId,plr[i]._zoneId,plr[i]._x,plr[i]._y,plr[i]._z);)
|
||||||
|
if(plr[i]._name==GetInstance()->GetConf()->charname){
|
||||||
|
char_found=true;
|
||||||
|
_myGUID=plr[i]._guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(!char_found){
|
||||||
|
printf("W: Character \"%s\" was not found on char list!\n",GetInstance()->GetConf()->charname.c_str());
|
||||||
|
GetInstance()->Stop();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
printf("W: Entering World with Character \"%s\"...\n",GetInstance()->GetConf()->charname.c_str());
|
||||||
|
WorldPacket pkt;
|
||||||
|
pkt.SetOpcode(CMSG_PLAYER_LOGIN);
|
||||||
|
pkt << _myGUID;
|
||||||
|
_targetGUID=0;
|
||||||
|
_followGUID=0;
|
||||||
|
SendWorldPacket(pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WorldSession::_HandleSetProficiencyOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
OnEnterWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::_HandleAccountDataMD5Opcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
OnEnterWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
uint8 type=0;
|
||||||
|
uint32 lang=0;
|
||||||
|
uint64 target_guid=0;
|
||||||
|
uint32 msglen=0;
|
||||||
|
std::string msg,ext;
|
||||||
|
bool isCmd=false;
|
||||||
|
|
||||||
|
recvPacket >> type >> lang;
|
||||||
|
|
||||||
|
if (type == CHAT_MSG_CHANNEL)
|
||||||
|
recvPacket >> ext; // extract channel name
|
||||||
|
|
||||||
|
recvPacket >> target_guid;
|
||||||
|
std::string plrname;
|
||||||
|
if(target_guid){
|
||||||
|
plrname=plrNameCache.GetName(target_guid);
|
||||||
|
if(plrname.empty())
|
||||||
|
{
|
||||||
|
SendQueryPlayerName(target_guid);
|
||||||
|
plrname="Unknown Entity";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*defScp.variables.Set("@lastmsg_name",defScp.variables.Get("@thismsg_name"));
|
||||||
|
defScp.variables.Set("@lastmsg",defScp.variables.Get("@lastmsg"));
|
||||||
|
defScp.variables.Set("@thismsg_name",plrname);
|
||||||
|
defScp.variables.Set("@thismsg",toString(target_guid));*/
|
||||||
|
|
||||||
|
|
||||||
|
if(type == CHAT_MSG_SAY || type == CHAT_MSG_YELL || type == CHAT_MSG_PARTY)
|
||||||
|
recvPacket >> target_guid;
|
||||||
|
|
||||||
|
recvPacket >> msglen >> msg;
|
||||||
|
if (type == CHAT_MSG_SYSTEM){
|
||||||
|
printf("W:SYSMSG: \"%s\"\n",msg.c_str());
|
||||||
|
} else if (type==CHAT_MSG_WHISPER ){
|
||||||
|
printf("W:WHISP: %s [%s]: %s\n",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
|
} else {
|
||||||
|
printf("W:CHAT: %s [%s]: %s\n",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(target_guid!=_myGUID && msg.length()>1 && msg.at(0)=='-')
|
||||||
|
isCmd=true;
|
||||||
|
|
||||||
|
// some fun code :P
|
||||||
|
if(type==CHAT_MSG_SAY && target_guid!=_myGUID && !isCmd)
|
||||||
|
{
|
||||||
|
/*if(msg=="lol")
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"say \"lol\" if you have nothing else to say... lol xD","");
|
||||||
|
else if(msg.length()>4 && msg.find("you?")!=std::string::npos)
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,std::string(ver).append(" -- i am a bot, made by False.Genesis, my master."),"");
|
||||||
|
else if(msg=="hi")
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"Hi, wadup?","");
|
||||||
|
else if(msg.length()<12 && msg.find("wtf")!=std::string::npos)
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"Yeah, WTF is a good way to say you dont understand anything... :P","");
|
||||||
|
else if(msg.length()<15 && (msg.find("omg")!=std::string::npos || msg.find("omfg")!=std::string::npos) )
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"OMG a bot logged in, you don't believe it :O","");
|
||||||
|
else if(msg.find("from")!=std::string::npos || msg.find("download")!=std::string::npos)
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,lang,"you can dl me from http://my.opera.com/PseuWoW","");
|
||||||
|
else if(msg.find("Genesis")!=std::string::npos || msg.find("genesis")!=std::string::npos)
|
||||||
|
SendChatMessage(CHAT_MSG_YELL,lang,"False.Genesis, they are calling you!! Come here, master xD","");*/
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isCmd)
|
||||||
|
{
|
||||||
|
/*defScp.variables.Set("@lastcmd_name",defScp.variables.Get("@thiscmd_name"));
|
||||||
|
defScp.variables.Set("@lastcmd",defScp.variables.Get("@lastcmd"));
|
||||||
|
defScp.variables.Set("@thiscmd_name",plrname);
|
||||||
|
defScp.variables.Set("@thiscmd",toString(target_guid));
|
||||||
|
std::string lin=msg.substr(1,msg.length()-1);
|
||||||
|
uint8 perm=atoi(playerPermissions.Get(plrname).c_str());
|
||||||
|
try{
|
||||||
|
if(!defScp.RunSingleLine(lin,perm))
|
||||||
|
defScp.RunScriptByName("_nopermission",NULL,255);
|
||||||
|
} catch (...) {
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,0,"Exception while trying to execute: [ "+lin+" ]","");
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
if(type==CHAT_MSG_WHISPER && !isCmd)
|
||||||
|
{
|
||||||
|
/*defScp.variables.Set("@lastwhisper_name",defScp.variables.Get("@thiswhisper_name"));
|
||||||
|
defScp.variables.Set("@lastwhisper",defScp.variables.Get("@thiswhisper"));
|
||||||
|
defScp.variables.Set("@lastwhisper_lang",defScp.variables.Get("@thiswhisper_lang"));
|
||||||
|
defScp.variables.Set("@thiswhisper_name",plrname);
|
||||||
|
defScp.variables.Set("@thiswhisper",toString(target_guid));
|
||||||
|
defScp.variables.Set("@thiswhisper_lang",toString((uint64)lang));
|
||||||
|
defScp.RunScriptByName("_onwhisper",NULL,255);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void WorldSession::_HandleNameQueryResponseOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
uint64 pguid;
|
||||||
|
std::string pname;
|
||||||
|
recvPacket >> pguid >> pname;
|
||||||
|
if(pname.length()>12 || pname.length()<2)
|
||||||
|
return; // playernames maxlen=12, minlen=2
|
||||||
|
// rest of the packet is not interesting for now
|
||||||
|
if(plrNameCache.AddInfo(pguid,pname))
|
||||||
|
{
|
||||||
|
printf("CACHE: Assigned new player name: '%s'",pname.c_str());
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,0,"Player "+pname+" added to cache.","");
|
||||||
|
//DEBUG2(printf(" to guid "I64FMTD,pguid););
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::_HandlePongOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
uint32 pong;
|
||||||
|
recvPacket >> pong;
|
||||||
|
printf("Recieved Ping reply: %u ms latency.\n",clock()-pong);
|
||||||
|
}
|
||||||
|
void WorldSession::_HandleTradeStatusOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
recvPacket.hexlike();
|
||||||
|
uint8 unk;
|
||||||
|
recvPacket >> unk;
|
||||||
|
if(unk==1)
|
||||||
|
{
|
||||||
|
SendChatMessage(CHAT_MSG_SAY,0,"It has no sense trying to trade with me, that feature is not yet implemented!","");
|
||||||
|
WorldPacket pkt;
|
||||||
|
pkt.SetOpcode(CMSG_CANCEL_TRADE);
|
||||||
|
SendWorldPacket(pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::_HandleGroupInviteOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
recvPacket.hexlike();
|
||||||
|
WorldPacket pkt;
|
||||||
|
pkt.SetOpcode(CMSG_GROUP_DECLINE);
|
||||||
|
SendWorldPacket(pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::_HandleMovementOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
uint32 flags, time;
|
||||||
|
float x, y, z, o;
|
||||||
|
uint64 guid;
|
||||||
|
std::string plrname;
|
||||||
|
guid = recvPacket.GetPackedGuid();
|
||||||
|
recvPacket >> flags >> time >> x >> y >> z >> o;
|
||||||
|
if(guid){
|
||||||
|
plrname=plrNameCache.GetName(guid);
|
||||||
|
if(plrname.empty())
|
||||||
|
{
|
||||||
|
SendQueryPlayerName(guid);
|
||||||
|
plrname="Unknown Entity";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// for follow:
|
||||||
|
//if(_followGUID==guid){
|
||||||
|
// ByteBuffer bb;
|
||||||
|
// bb << time << flags << x << y << z << o;
|
||||||
|
// SendWorldPacket(opcode,&bb);
|
||||||
|
//}
|
||||||
|
// more to come
|
||||||
|
}
|
||||||
83
src/Client/World/WorldSession.h
Normal file
83
src/Client/World/WorldSession.h
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#ifndef _WORLDSESSION_H
|
||||||
|
#define _WORLDSESSION_H
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "Network/SocketHandler.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "../Auth/AuthCrypt.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
|
class WorldSocket;
|
||||||
|
class WorldPacket;
|
||||||
|
|
||||||
|
struct OpcodeHandler
|
||||||
|
{
|
||||||
|
uint16 opcode;
|
||||||
|
void (WorldSession::*handler)(WorldPacket& recvPacket);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WorldSession
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WorldSession(PseuInstance *i);
|
||||||
|
~WorldSession();
|
||||||
|
void Init(void);
|
||||||
|
|
||||||
|
PseuInstance *GetInstance(void) { return _instance; }
|
||||||
|
|
||||||
|
OpcodeHandler *_GetOpcodeHandlerTable(void) const;
|
||||||
|
|
||||||
|
void AddToDataQueue(uint8*, uint32);
|
||||||
|
void Connect(std::string addr,uint16 port);
|
||||||
|
WorldPacket BuildWorldPacket(void);
|
||||||
|
void Update(void);
|
||||||
|
void SendWorldPacket(WorldPacket&);
|
||||||
|
|
||||||
|
void SetTarget(uint64 guid);
|
||||||
|
uint64 GetTarget(void) { return _targetGUID; }
|
||||||
|
void SetFollowTarget(uint64 guid);
|
||||||
|
uint64 GetFollowTarget(void) { return _followGUID; }
|
||||||
|
uint64 GetGuid(void) { return _myGUID; }
|
||||||
|
|
||||||
|
|
||||||
|
// CMSGConstructor
|
||||||
|
void SendChatMessage(uint32 type, uint32 lang, std::string msg, std::string to);
|
||||||
|
void SendQueryPlayerName(uint64 guid);
|
||||||
|
void SendPing(uint32);
|
||||||
|
void SendEmote(uint32);
|
||||||
|
|
||||||
|
PlayerNameCache plrNameCache;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Helpers
|
||||||
|
void OnEnterWorld(void);
|
||||||
|
|
||||||
|
// Opcode Handlers
|
||||||
|
void _HandleAuthChallengeOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleAuthResponseOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleCharEnumOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleSetProficiencyOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleAccountDataMD5Opcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleMessageChatOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleNameQueryResponseOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleMovementOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandlePongOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleTradeStatusOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleGroupInviteOpcode(WorldPacket& recvPacket);
|
||||||
|
|
||||||
|
|
||||||
|
PseuInstance *_instance;
|
||||||
|
AuthCrypt _crypt;
|
||||||
|
WorldSocket *_socket;
|
||||||
|
std::deque<uint8> pktQueue;
|
||||||
|
bool _valid,_authed,_logged; // world status
|
||||||
|
SocketHandler _sh; // handles the WorldSocket
|
||||||
|
uint64 _targetGUID,_followGUID,_myGUID;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
20
src/Client/World/WorldSocket.cpp
Normal file
20
src/Client/World/WorldSocket.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
#include "WorldPacket.h"
|
||||||
|
#include "WorldSession.h"
|
||||||
|
#include "WorldSocket.h"
|
||||||
|
|
||||||
|
void WorldSocket::OnConnect()
|
||||||
|
{
|
||||||
|
printf("Connected to world server.\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSocket::OnRead()
|
||||||
|
{
|
||||||
|
TcpSocket::OnRead();
|
||||||
|
if(!ibuf.GetLength())
|
||||||
|
return;
|
||||||
|
uint8 *buf=new uint8[ibuf.GetLength()];
|
||||||
|
ibuf.Read((char*)buf,ibuf.GetLength());
|
||||||
|
GetSession()->AddToDataQueue(buf,ibuf.GetLength());
|
||||||
|
delete buf; // UNSURE: delete or delete[]
|
||||||
|
}
|
||||||
23
src/Client/World/WorldSocket.h
Normal file
23
src/Client/World/WorldSocket.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef _WORLDSOCKET_H
|
||||||
|
#define _WORLDSOCKET_H
|
||||||
|
|
||||||
|
#include "Network/ResolvSocket.h"
|
||||||
|
#include "SysDefs.h"
|
||||||
|
|
||||||
|
class WorldSession;
|
||||||
|
|
||||||
|
class WorldSocket : public TcpSocket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WorldSocket(SocketHandler &h, WorldSession *s);
|
||||||
|
WorldSession *GetSession(void) { return _session; }
|
||||||
|
|
||||||
|
void OnRead();
|
||||||
|
void OnConnect();
|
||||||
|
|
||||||
|
private:
|
||||||
|
WorldSession *_session;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
36
src/Client/basics.h_
Normal file
36
src/Client/basics.h_
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// --- Defines ---
|
||||||
|
//...
|
||||||
|
|
||||||
|
// --- Includes ---
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
//#include <SDL/SDL.h>
|
||||||
|
|
||||||
|
#include "../shared/OurDefs.h"
|
||||||
|
#include "../shared/common.h"
|
||||||
|
#include "../shared/DebugStuff.h"
|
||||||
|
|
||||||
|
// --- platform stuff ---
|
||||||
|
#if COMPILER == COMPILER_MICROSOFT
|
||||||
|
#define I64FMT "%016I64X"
|
||||||
|
#define I64FMTD "%I64u"
|
||||||
|
#define SI64FMTD "%I64d"
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#define atoll __atoi64
|
||||||
|
#define vsnprintf _vsnprintf
|
||||||
|
#define strdup _strdup
|
||||||
|
#else
|
||||||
|
#define stricmp strcasecmp
|
||||||
|
#define strnicmp strncasecmp
|
||||||
|
#define I64FMT "%016llX"
|
||||||
|
#define I64FMTD "%llu"
|
||||||
|
#define SI64FMTD "%lld"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
16
src/Client/controller.h_
Normal file
16
src/Client/controller.h_
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef CONTROLLER_H
|
||||||
|
#define CONTROLLER_H
|
||||||
|
|
||||||
|
void c_send(char,char*);
|
||||||
|
int c_closeconnection(void*);
|
||||||
|
int c_recieve(void*);
|
||||||
|
int c_cmdhandler(void*);
|
||||||
|
int c_create_listener(void*);
|
||||||
|
void c_quit(void);
|
||||||
|
void c_init(void);
|
||||||
|
|
||||||
|
extern unsigned int c_port;
|
||||||
|
extern bool allowcontroller;
|
||||||
|
extern char *c_password;
|
||||||
|
|
||||||
|
#endif
|
||||||
61
src/Client/doc/Ludmilla_1.8.0_LogonCodes.h.txt
Normal file
61
src/Client/doc/Ludmilla_1.8.0_LogonCodes.h.txt
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
//******************************************************************************
|
||||||
|
// Here are all codes used in Logon Server.
|
||||||
|
//==============================================================================
|
||||||
|
#ifndef _LOGONCODES_H
|
||||||
|
#define _LOGONCODES_H
|
||||||
|
//==============================================================================
|
||||||
|
//#include "OurDefs.h"
|
||||||
|
//==============================================================================
|
||||||
|
// wow's codes:
|
||||||
|
enum EClientCommand
|
||||||
|
// dumped from wow.exe 1.8.0
|
||||||
|
// 0x007F86A8: table of
|
||||||
|
// <int32 code, int32 pstr, int32 pproc, int32 0>
|
||||||
|
// switch: 005999A7 cmp byte ptr [ecx],dl
|
||||||
|
{
|
||||||
|
CMD_AUTH_LOGON_CHALLENGE = 0x00, // client
|
||||||
|
CMD_AUTH_LOGON_PROOF = 0x01, // client
|
||||||
|
CMD_AUTH_RECONNECT_CHALLENGE = 0x02, // client
|
||||||
|
CMD_AUTH_RECONNECT_PROOF = 0x03, // client
|
||||||
|
CMD_REALM_LIST = 0x10, // client
|
||||||
|
CMD_XFER_INITIATE = 0x30, // client? from server
|
||||||
|
CMD_XFER_DATA = 0x31, // client? from server
|
||||||
|
CMD_XFER_ACCEPT = 0x32, // not official name, from client
|
||||||
|
CMD_XFER_RESUME = 0x33, // not official name, from client
|
||||||
|
CMD_XFER_CANCEL = 0x34, // not official name, from client
|
||||||
|
|
||||||
|
// unknown:
|
||||||
|
CMD_GRUNT_AUTH_CHALLENGE = 0x00, // server
|
||||||
|
CMD_GRUNT_AUTH_VERIFY = 0x02, // server
|
||||||
|
CMD_GRUNT_CONN_PING = 0x10, // server
|
||||||
|
CMD_GRUNT_CONN_PONG = 0x11, // server
|
||||||
|
CMD_GRUNT_HELLO = 0x20, // server
|
||||||
|
CMD_GRUNT_PROVESESSION = 0x21, // server
|
||||||
|
CMD_GRUNT_KICK = 0x24, // server
|
||||||
|
};
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
enum ELoginErrorCode
|
||||||
|
// dumped from wow.exe 1.8.0
|
||||||
|
// 00591E9D mov eax,dword ptr [ebp+8]
|
||||||
|
// eax - code, name in stack after exiting from current funk
|
||||||
|
{
|
||||||
|
// LOGIN_STATE_FAILED:
|
||||||
|
|
||||||
|
LOGIN_FAILED = 1, // 2, B, C, D // "Unable to connect"
|
||||||
|
LOGIN_BANNED = 3, // "This World of Warcraft account has been closed and is no longer in service -- Please check the registered email address of this account for further information."; -- This is the error message players get when trying to log in with a banned account.
|
||||||
|
LOGIN_UNKNOWN_ACCOUNT = 4, // 5 // "The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password and account, see www.worldofwarcraft.com for more information.";
|
||||||
|
LOGIN_ALREADYONLINE = 6, // "This account is already logged into World of Warcraft. Please check the spelling and try again.";
|
||||||
|
LOGIN_NOTIME = 7, // "You have used up your prepaid time for this account. Please purchase more to continue playing";
|
||||||
|
LOGIN_DBBUSY = 8, // "Could not log in to World of Warcraft at this time. Please try again later.";
|
||||||
|
LOGIN_BADVERSION = 9, // "Unable to validate game version. This may be caused by file corruption or the interference of another program. Please visit www.blizzard.com/support/wow/ for more information and possible solutions to this issue.";
|
||||||
|
LOGIN_PARENTALCONTROL = 0xF, // "17"="LOGIN_PARENTALCONTROL" // "Access to this account has been blocked by parental controls. Your settings may be changed in your account preferences at http://www.worldofwarcraft.com.";
|
||||||
|
|
||||||
|
// LOGIN_STATE_AUTHENTICATED:
|
||||||
|
LOGIN_OK = 0, // E
|
||||||
|
|
||||||
|
// LOGIN_STATE_DOWNLOADFILE, LOGIN_OK
|
||||||
|
LOGIN_DOWNLOADFILE = 0xA, // not official name
|
||||||
|
};
|
||||||
|
//==============================================================================
|
||||||
|
#endif // _LOGONCODES_H
|
||||||
|
//******************************************************************************
|
||||||
193
src/Client/doc/Ludmilla_1.8.0_LogonPackets.h.txt
Normal file
193
src/Client/doc/Ludmilla_1.8.0_LogonPackets.h.txt
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
//******************************************************************************
|
||||||
|
// Here are all packets to and from Logon Server.
|
||||||
|
//==============================================================================
|
||||||
|
#ifndef _LOGONPACKETS_H
|
||||||
|
#define _LOGONPACKETS_H
|
||||||
|
//==============================================================================
|
||||||
|
#include "../Shared/OurDefs.h"
|
||||||
|
#include <openssl/md5.h>
|
||||||
|
//==============================================================================
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
//==============================================================================
|
||||||
|
// Challenge:
|
||||||
|
struct SClientLogonChallenge
|
||||||
|
{
|
||||||
|
uint8 cmd; // OP code = CMD_AUTH_LOGON_CHALLENGE
|
||||||
|
uint8 error0x02; // 0x02
|
||||||
|
uint16 size; // size of the rest of packet, without this part
|
||||||
|
uint8 gamename[4]; // "WoW"
|
||||||
|
uint8 version[2]; // 0x01 08 00 -> (1.8.0)
|
||||||
|
uint16 build; // 0x7F12 -> 4735
|
||||||
|
uint8 platform[3]; // 68x\0 -> "x86"
|
||||||
|
uint8 os[3]; // niW\0 -> "Win"
|
||||||
|
uint8 localization[4];// BGne -> 'enGB'
|
||||||
|
uint32 timezone_bias; // 0x78 00 00 00
|
||||||
|
uint8 ip[4]; // client ip: 0x7F 00 00 01
|
||||||
|
uint8 acclen; // length of account name (without zero-char)
|
||||||
|
uint8 *acc; // upcased account name (without zero-char)
|
||||||
|
};
|
||||||
|
struct SClientLogonChallenge_Header // just for usability
|
||||||
|
{
|
||||||
|
uint8 cmd; // OP code = CMD_AUTH_LOGON_CHALLENGE
|
||||||
|
uint8 error; // 0x02
|
||||||
|
uint16 size; // size of the rest of packet, without this part
|
||||||
|
};
|
||||||
|
struct SClientReconnectChallenge // == SClientChallenge
|
||||||
|
{
|
||||||
|
uint8 cmd; // OP code = 02 = CMD_AUTH_RECONNECT_CHALLENGE
|
||||||
|
uint8 error; // 0x02
|
||||||
|
uint16 size; // size of the rest of packet, without this part
|
||||||
|
uint8 gamename[4]; // "WoW"
|
||||||
|
uint8 version[2]; // 0x01 08 00 -> (1.8.0)
|
||||||
|
uint16 build; // 0x7F12 -> 4735
|
||||||
|
uint8 platform[4]; // 68x\0 -> "x86"
|
||||||
|
uint8 os[4]; // niW\0 -> "Win"
|
||||||
|
uint8 country[4]; // BGne -> 'enGB'
|
||||||
|
uint32 timezone_bias; // 0x78 00 00 00
|
||||||
|
uint8 ip[4]; // client ip: 0x7F 00 00 01
|
||||||
|
uint8 acclen; // length of account name (without zero-char)
|
||||||
|
uint8 *acc; // upcased account name (without zero-char)
|
||||||
|
};
|
||||||
|
struct SServerLogonChallenge_Err
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x00 -> OPcode = CMD_AUTH_LOGON_CHALLENGE ? CMD_GRUNT_AUTH_CHALLENGE
|
||||||
|
uint8 error; // one of SServerChallenge_ErrorCodes codes
|
||||||
|
};
|
||||||
|
struct SServerLogonChallenge_Ok
|
||||||
|
// Variables:
|
||||||
|
// X := SHA1( salt || SHA1(upper(acc:pass)) )
|
||||||
|
// b[20] := random server's secret
|
||||||
|
// K := 3
|
||||||
|
// salt[32] := random
|
||||||
|
// N := 89 4B 64 5E - 89 E1 53 5B - BD AD 5B 8B - 29 06 50 53
|
||||||
|
// 08 01 B1 8E - BF BF 5E 8F - AB 3C 82 87 - 2A 3E 9B B7
|
||||||
|
// g[1] := 7
|
||||||
|
//
|
||||||
|
// Calculations:
|
||||||
|
// Verifier := g^(~x) mod ~N
|
||||||
|
// B := ~( K*V + g^(~b) mod ~N )
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x00 -> OPcode = CMD_AUTH_LOGON_CHALLENGE ? CMD_GRUNT_AUTH_CHALLENGE
|
||||||
|
uint8 error; // 0 -> ok = LOGIN_OK
|
||||||
|
uint8 unk1; // 0x00
|
||||||
|
|
||||||
|
uint8 B[32]; // calculated by server
|
||||||
|
|
||||||
|
uint8 g_len; // 0x01
|
||||||
|
uint8 g[1]; // 0x07 (const)
|
||||||
|
|
||||||
|
uint8 N_len; // 0x20
|
||||||
|
uint8 N[32]; // const
|
||||||
|
|
||||||
|
uint8 salt[32]; // random
|
||||||
|
uint8 unk2[16]; //1: BA 79 D4 8D - BF FC BF AD - 8C B4 EC B3 - 75 C5 96 05
|
||||||
|
//2: 0F EB C2 82 - 28 C2 BC E4 - A6 31 30 C7 - 9F 6D 72 76
|
||||||
|
};
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Proof:
|
||||||
|
struct SClientLogonProof
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF
|
||||||
|
uint8 A[32]; // calculated by client
|
||||||
|
uint8 M1[20]; //
|
||||||
|
uint8 crc_hash[20]; //
|
||||||
|
uint8 number_of_keys; // 0x00
|
||||||
|
};
|
||||||
|
struct SClientReconnectProof // == SClientProof
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_RECONNECT_PROOF
|
||||||
|
uint8 A[32]; // calculated by client
|
||||||
|
uint8 M1[20]; //
|
||||||
|
uint8 crc_hash[20]; //
|
||||||
|
uint8 number_of_keys; // 0x00
|
||||||
|
};
|
||||||
|
struct SServerLogonProof_Err
|
||||||
|
// Variables:
|
||||||
|
// U := SHA1(A || B)
|
||||||
|
//
|
||||||
|
// Calculations:
|
||||||
|
// S := ~( ( (V^(~U))*(~A) ) ^ (~b) mod ~N )
|
||||||
|
// hS0 := SHA1 ( S[0] || S[2] || ... || S[20] )
|
||||||
|
// hS1 := SHA1 ( S[1] || S[3] || ... || S[19] )
|
||||||
|
// SS := hS0[0] || hS1[0] || hS0[1] || ... || hS1[10]
|
||||||
|
// M1 := SHA1( (SHA1(N) xor SHA1(G)) || SHA1(upper(acc)) || salt || A || B || SS )
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF
|
||||||
|
uint8 error; // 0x04 -> password is incorrect = LOGIN_UNKNOWN_ACCOUNT
|
||||||
|
};
|
||||||
|
struct SServerLogonProof_Ok
|
||||||
|
// M2 := SHA1(A || M1 || SS)
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF
|
||||||
|
uint8 error; // 0x00 -> ok
|
||||||
|
uint8 M2[20]; // calculated by server
|
||||||
|
uint32 unk; // 0x00 00 00 00
|
||||||
|
};
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Realm:
|
||||||
|
struct SClientRealmList
|
||||||
|
{
|
||||||
|
uint8 cmd; // OP code = CMD_REALM_LIST
|
||||||
|
uint32 unknown; // 0x00 00 00 00
|
||||||
|
};
|
||||||
|
struct SServerRealmList // for info only - variable size
|
||||||
|
{
|
||||||
|
uint8 cmd; // OP code = CMD_REALM_LIST
|
||||||
|
uint16 size; // size of the rest of packet, without this part
|
||||||
|
uint32 unknown; // 0x00 00 00 00
|
||||||
|
uint8 count; // quantity of realms
|
||||||
|
struct SRealmInfo
|
||||||
|
{
|
||||||
|
uint32 icon; // icon near realm
|
||||||
|
uint8 color; // color of record
|
||||||
|
char *name; // Text zero terminated name of Realm
|
||||||
|
char *addr_port; // Text zero terminated address of Realm ("ip:port")
|
||||||
|
float population; // 1.6 -> population value. lower == lower population and vice versa
|
||||||
|
uint8 chars_here; // number of characters on this server
|
||||||
|
uint8 timezone; // timezone
|
||||||
|
uint8 unknown; //
|
||||||
|
} * realms;
|
||||||
|
uint8 unknown1; // 0x2A unknown
|
||||||
|
uint8 unknown2; // 0x00 unknown
|
||||||
|
};
|
||||||
|
struct SServerRealmList_Header
|
||||||
|
{
|
||||||
|
uint8 cmd; // OP code = CMD_REALM_LIST
|
||||||
|
uint16 size; // size of the rest of packet, without this part
|
||||||
|
};
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Xref:
|
||||||
|
struct SServerXferInitiate
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x30 -> OPcode = CMD_XFER_INITIATE
|
||||||
|
uint8 typelen; // 0x05 -> sizeof(Patch)
|
||||||
|
uint8 typestr[5]; // 'Patch'
|
||||||
|
uint32 size; // 0x34 C4 0D 00 = 902,196 byte (180->181 enGB)
|
||||||
|
uint32 unk; // 0x0 always
|
||||||
|
uint8 md5[MD5_DIGEST_LENGTH]; // md5 checksum of file
|
||||||
|
};
|
||||||
|
struct SServerXferData
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x31 -> OPcode = CMD_XFER_DATA
|
||||||
|
uint16 blocksize; // 0xDC 05 -> 1500 (max block)
|
||||||
|
uint8 buf[1500]; // block
|
||||||
|
};
|
||||||
|
struct SClientXferAccept
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x32 -> OPcode = CMD_XFER_ACCEPT
|
||||||
|
};
|
||||||
|
struct SClientXferResume
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x33 -> OPcode = CMD_XFER_RESUME
|
||||||
|
uint32 start; // will continue at
|
||||||
|
uint32 unknown; //
|
||||||
|
};
|
||||||
|
struct SClientXferCancel
|
||||||
|
{
|
||||||
|
uint8 cmd; // 0x34 -> OPcode = CMD_XFER_CANCEL
|
||||||
|
};
|
||||||
|
//==============================================================================
|
||||||
|
#pragma pack(pop)
|
||||||
|
//==============================================================================
|
||||||
|
#endif // _LOGONPACKETS_H
|
||||||
|
//******************************************************************************
|
||||||
257
src/Client/doc/RS Connection.html
Normal file
257
src/Client/doc/RS Connection.html
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
<BODY BGCOLOR=BLACK TEXT=WHITE>
|
||||||
|
<FONT COLOR=AQUA>
|
||||||
|
<b>Notes by Biasha:</b><br>
|
||||||
|
Structure (fields, size) and sequence of the packets is valid for 1.8.0<br>
|
||||||
|
Algorithm is not checked for 1.8.0 yet<br>
|
||||||
|
Original URL: http://www.shockerz.net/wowresource/forum/index.php?showtopic=42<br>
|
||||||
|
SRP algorithm: RFC2945<br>
|
||||||
|
Information about SRP6: http://srp.stanford.edu/doc.html<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</FONT>
|
||||||
|
|
||||||
|
[quote=Zam,Feb 11 2005, 09:26 PM]
|
||||||
|
<br>[Version 1.03]
|
||||||
|
<br>
|
||||||
|
<br>Ok, this only covers the first handshacking packets. :-) I haven't had time to disect any other packets.
|
||||||
|
<br>
|
||||||
|
<br><b>[size=18]If you are having problems; please verify your math with my math; there is a reason I supply the output to every function. This will allow you to see if there is typo's or any problem on either side.
|
||||||
|
<br>
|
||||||
|
<br>Please note that some libraries may have bugs with Big Numbers; hense the reason I used openssl, as it has been used by crypto products for years. :)
|
||||||
|
<br>
|
||||||
|
<br>[/size] </b>
|
||||||
|
<br><FONT COLOR=yellow>Changes:
|
||||||
|
<br>V1.00 - Initial Release
|
||||||
|
<br>V1.01 - Removal of the Second phase and adding where I forgot to up that B (Public) is reveresed before it is stored for use later.
|
||||||
|
<br>V1.02 - Added Temp variables results to S calc
|
||||||
|
<br> - Fixed the missing UPPERCASE in M1 calculation (Username)
|
||||||
|
<br> - Fixed colors. :o
|
||||||
|
<br> - Added some more notes.
|
||||||
|
<br>V1.03 - Update Warning, and added a couple more intermediate numbers in the M1 Calcs.
|
||||||
|
<br></FONT>
|
||||||
|
<br>
|
||||||
|
<br> <FONT COLOR=red>I have been informed that only the first 4 packets are needed and then the client should ask for the realm list</FONT>
|
||||||
|
<br>
|
||||||
|
<br>This is for version 1.1.1. I do not know if anything changed srp wise in 1.2.1; but I will be confirming and diferences between 111 and 121 once I have some spare time. <FONT COLOR=red>According to several people; srp has NOT changed between 1.1.1 and 1.2.1</FONT>
|
||||||
|
<br>
|
||||||
|
<br>Kudo's to those who have shared there knowledge. Those who have selfishly held onto most or all of their hard work so as not to advance the community; well just disappear -- you are selfish losers and the community would be better off without you...
|
||||||
|
<br>-------------------------------------------------------------
|
||||||
|
<br>
|
||||||
|
<br>Packets as shared by sYkez on this topic (http://www.blizzhackers.com/viewtopic.php?t=21457)
|
||||||
|
<br>
|
||||||
|
<br>Kudo's to Amso for publically sharing his attempts at decoding srp; he actually was the one to inspire me to do this.
|
||||||
|
<br><b><FONT COLOR=red>Notes:</FONT></b>
|
||||||
|
<br><b>Reverse</b> means reverse the String. DO NOT USE strrev --
|
||||||
|
<br>Treat this string as an array of numbers. 0 is a valid number; strrev will stop reversing when it incounters an NULL(0) character. My reverse routine is passed the length that it needs to reverse. In fact all of these variables are strored in a simple structure {char *data; int len;} and I pass this structure around.
|
||||||
|
<br><b>uppercase</b> means upper case all letters in string.
|
||||||
|
<br>All values are in hex.
|
||||||
|
<br><b> & </b> means concatanate the string valuse. "HI" & "THERE" = "HITHERE"
|
||||||
|
<br><b><FONT COLOR=red>Common Q & A:</FONT></b>
|
||||||
|
<br>Yes, Username and Password are Uppercased.
|
||||||
|
<br>Yes, there are reversed string used in certain snippits of code. Don't ask my why; I don't know why Bliz deviated from the standard -- but it works. I assume the reason why is endian-ness of the machines. There server might be a main-frame...
|
||||||
|
<br>I am using an UNMODIFIED openssl (latest version) library.
|
||||||
|
<br>And I am using the wrapper functions in the t_math.c file that comes from the srp demo page. They just make the names of the functions much more readable. :-)
|
||||||
|
<br>
|
||||||
|
<br>Each Calculation assumes the byte order is in the initial stored state. So N=894B...
|
||||||
|
<br>When I reverse it in a routine N is only reversed for that Routine. When you get to the next routine, N is again equal to 894B... Some routines work with a reversed version of the calculation and some don't. Exception to this rule is B, it is reveresed before it is stored for use in later calculations.
|
||||||
|
<br><b>Lets Go at it:</b>
|
||||||
|
<br>
|
||||||
|
<br> The Client Connects and sends the <b>Client_Challenge</b> packet. (Pretty self explanitory)
|
||||||
|
<br><i><code>
|
||||||
|
<br>struct {
|
||||||
|
<br> uint8 opcode; // 0x00
|
||||||
|
<br> uint8 error; // 0x02
|
||||||
|
<br> uint16 size; // 0x0023 (size of the rest of packet)
|
||||||
|
<br> char gameid[4]; //gameid[4]=0; // 'WoW'
|
||||||
|
<br> uint8 version1; // 0x00
|
||||||
|
<br> uint8 version2; // 0x12 build version(0.12.0)
|
||||||
|
<br> uint8 version3; // 0x00
|
||||||
|
<br> uint16 build; // 3988
|
||||||
|
<br> char platform[4]; // platform[4]=0; // 'x86'
|
||||||
|
<br> char os[4]; // os[4]=0; // 'Win'
|
||||||
|
<br> char language[4]; // language[4]=0; // 'enUS'
|
||||||
|
<br> uint32 timezone_bias; // -419
|
||||||
|
<br> uint32 ip; // client ip
|
||||||
|
<br> uint8 acclen; // length of account name
|
||||||
|
<br> char *AccountName;
|
||||||
|
<br>} Client_Challenge;
|
||||||
|
<br></code></i>
|
||||||
|
<br>The Server Generates the Following Packet:
|
||||||
|
<br><i><code>
|
||||||
|
<br>struct {
|
||||||
|
<br> uint8 opcode; // 0x00
|
||||||
|
<br> uint8 error; //no error
|
||||||
|
<br> uint8 ukn1;
|
||||||
|
<br> char B[32];
|
||||||
|
<br> uint8 g_length; //1
|
||||||
|
<br> char g;
|
||||||
|
<br>
|
||||||
|
<br> uint8 n_len; // 32; //N_len
|
||||||
|
<br> char N[32];
|
||||||
|
<br> char salt[32];
|
||||||
|
<br> char unk3[16];
|
||||||
|
<br>} Server_Challenge;
|
||||||
|
<br></code></i>
|
||||||
|
<br>Ok, N is is hard coded in hex as:
|
||||||
|
<br><i><code>894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7</code></i>
|
||||||
|
<br>G Length = 1
|
||||||
|
<br>G = 7
|
||||||
|
<br>K = 3
|
||||||
|
<br>salt = randomly generated 32 characters.
|
||||||
|
<br>Server also internally generates a random generated "b" 20 characters
|
||||||
|
<br>
|
||||||
|
<br>We are going to assume some values to make it easier to duplicate:
|
||||||
|
<br><i><code>Username = "TEST"
|
||||||
|
<br>Password = "TEST"
|
||||||
|
<br>salt = 33f140d46cb66e631fdbbbc9f029ad8898e05ee533876118185e56dde843674f
|
||||||
|
<br>b = 8692E3A6BA48B5B1004CEF76825127B7EB7D1AEF
|
||||||
|
<br></code></i>
|
||||||
|
<br>Ok, Now for the calculations:
|
||||||
|
<br>
|
||||||
|
<br>To Generate x:
|
||||||
|
<br><i><code>Temp = "Username" (Supplied in the client challenge) & ":" & "Password" (Supplied to whatever user registration script).
|
||||||
|
<br>TempHash = SHA1(uppercase(Temp))
|
||||||
|
<br>x = sha1(Salt & TempHash)
|
||||||
|
<br>
|
||||||
|
<br>Your x should equal: 1b70dd2ad03c1ed140223f8f8741c00ec3a4ce73
|
||||||
|
<br></code></i>
|
||||||
|
<br>To Generate v (Verifier):
|
||||||
|
<br><i><code>N = Reverse(N) // 32 Characters
|
||||||
|
<br>x = Reverse(x) // 20 Characters
|
||||||
|
<br>v = g ^ x mod (N)
|
||||||
|
<br>// Exact call I Use: BN_mod_exp_mont(v, g, x, N, ctx, NULL);
|
||||||
|
<br>Your v Should equal: 996ec7b349d5827043ecd0e6efba3daea5590f944d0184fee1b83ff4f59ecfa8
|
||||||
|
<br></code></i>
|
||||||
|
<br>
|
||||||
|
<br>To Generate B (public B, not private B):
|
||||||
|
<br><i><code> /* B = kv + g^b mod n */
|
||||||
|
<br>b = Reverse(b)
|
||||||
|
<br>N = Reverse(N)
|
||||||
|
<br>
|
||||||
|
<br>Temp1 = K * v
|
||||||
|
<br>Temp2 = g ^ b mod (N)
|
||||||
|
<br>Temp3 = Temp1 + Temp2
|
||||||
|
<br>B = Temp3 mod (N)
|
||||||
|
<br>B = Reverse(B) // Store this one PERMANATLY Reversed!!!
|
||||||
|
<br>
|
||||||
|
<br>// code I use is:
|
||||||
|
<br>//------------------------------
|
||||||
|
<br> BigIntegerMul(B, k, v, NULL);
|
||||||
|
<br> BigIntegerModExp(k, g, b, N, NULL, NULL);
|
||||||
|
<br> BigIntegerAdd(k, k, B);
|
||||||
|
<br> BigIntegerMod(B, k, N, NULL);
|
||||||
|
<br>//------------------------------
|
||||||
|
<br>Your B should equal: 645d1f78973073701e12bc98aa38ea99b4bc435c32e8447c73ab077ae4d75964
|
||||||
|
<br></code></i>
|
||||||
|
<br>
|
||||||
|
<br>Stuff B, g, N, and Salt in the packet and send it.
|
||||||
|
<br>
|
||||||
|
<br>The client will respond with the following:
|
||||||
|
<br><i><code>struct {
|
||||||
|
<br> uint8 opcode; // 0x01
|
||||||
|
<br> uint8 A[32];
|
||||||
|
<br> uint8 M1[20];
|
||||||
|
<br> uint8 crc_hash[20];
|
||||||
|
<br> uint8 number_of_keys;
|
||||||
|
<br>} Client_Proof;
|
||||||
|
<br>
|
||||||
|
<br>Were going to assume A came over as follows:
|
||||||
|
<br>232fb1b88529643d95b8dce78f2750c75b2df37acba873eb31073839eda0738d
|
||||||
|
<br>And M1 came over as:
|
||||||
|
<br>eeb4adca80f4de02f9a9fe8d000d682e3ddfad6f
|
||||||
|
<br></code></i>
|
||||||
|
<br>A is generated by the client by its secret (a). You will never know what the secret (a) is, so you don't need to worry about how to calc A. (See SRP demo page if you really need to generate an A because you are working on a client program.
|
||||||
|
<br>
|
||||||
|
<br>M1 however is quite important, this will be used to detect if the user is authenticly loging on.
|
||||||
|
<br>
|
||||||
|
<br>crc_hash, appears to be unimportant in 1.1.1 (Anybody have any info?)
|
||||||
|
<br>number_of_keys = 0
|
||||||
|
<br>
|
||||||
|
<br>Server will respond with:
|
||||||
|
<br><i><code>struct {
|
||||||
|
<br> uint8 opcode; // 0x01
|
||||||
|
<br> uint8 error; // 0;//error
|
||||||
|
<br> uint8 M2[20]; //M2
|
||||||
|
<br> uint8 ukn1; // 0;
|
||||||
|
<br> uint8 ukn2; // 0;
|
||||||
|
<br> uint8 ukn3; // 0;
|
||||||
|
<br> uint8 ukn4; // 0;
|
||||||
|
<br>} Server_Proof;
|
||||||
|
<br></code></i>
|
||||||
|
<br>To Generate M1 & M2, we need to generate some other values:
|
||||||
|
<br>Generate U:
|
||||||
|
<br><i><code>U = SHA1(A & B)
|
||||||
|
<br>Your U should equal: 2f4969ac9f387fd672236f9491a516777cdde1c1
|
||||||
|
<br></code></i>
|
||||||
|
<br>
|
||||||
|
<br>Generate S: // S=(Av^u) ^ b (mod N)
|
||||||
|
<br><i><code>U = Reverse(U)
|
||||||
|
<br>N = Reverse(N)
|
||||||
|
<br>A = Reverse(A)
|
||||||
|
<br>b = Reverse(b) // Private b
|
||||||
|
<br>
|
||||||
|
<br>Temp1 = v ^ U mod (n) // Result: 84DC9E9F96AE7A2D9B05CD264A75EB5671EA02FD067B243848543E2713C8D91
|
||||||
|
<br>
|
||||||
|
<br>Temp2 = Temp1 * A // Result: 496985FE28C394E7B8FB881105E4CD02F7DF4F378736332BC2F4733ABDEF0903F5BE9084C42B32E3615DF28B069A9D275A8A31DE7FBFD0DA76870B2B285F9D3
|
||||||
|
<br>
|
||||||
|
<br>S = Temp2 ^ b mod (n)
|
||||||
|
<br>
|
||||||
|
<br>Code I use:
|
||||||
|
<br>//------------------------------
|
||||||
|
<br> prod = BigIntegerFromInt(0);
|
||||||
|
<br> BigIntegerModExp(prod, v, U, N, NULL, NULL);
|
||||||
|
<br> S = BigIntegerFromInt(0);
|
||||||
|
<br> BigIntegerMul(prod, prod, A, NULL);
|
||||||
|
<br> BigIntegerModExp(S, prod, b, N, NULL, NULL);
|
||||||
|
<br> BigIntegerToBytes(S, Buffer, 20);
|
||||||
|
<br>//------------------------------
|
||||||
|
<br>
|
||||||
|
<br>Your S should equal: 7666dc8a226dd0e3de093dddf6bc2b7929df2936a8cf15a972de4042766380ba
|
||||||
|
<br></code></i>
|
||||||
|
<br>
|
||||||
|
<br>Next we Take S and Split it into Two Hashes. Even / Odd
|
||||||
|
<br><i><code>
|
||||||
|
<br>S = reverse(S) // Yup we revsere the prior result.
|
||||||
|
<br>Then We take only Odd digits
|
||||||
|
<br>So S1 Should equal:
|
||||||
|
<br>ba63..[other hex digits]..8a66
|
||||||
|
<br>And S2 Should Equal:
|
||||||
|
<br>8076..[other hex digits]..dc76
|
||||||
|
<br>
|
||||||
|
<br>Then We Hash Each One:
|
||||||
|
<br>S1_Hash = SHA(S1) // Should Equal: 02f448b61a6e79d8b714387c0d2f22cc83f2877f
|
||||||
|
<br>S2_Hash = SHA(S2) // Should Equal: 61eb916a82b72864ea54dbfd3dc0ce4679c07814
|
||||||
|
<br>
|
||||||
|
<br>And then we Re-combine them into S_Hash interleaving them togetner.
|
||||||
|
<br>SS_Hash = S1_Hash[0] & S2_Hash[0] & S1_Hash[1] & S2_Hash[1]....
|
||||||
|
<br>// SS_Hash should equal: 0261f4eb4891b66a1a826eb77928d864b7ea145438db7cfd0d3d2fc022cecc468379f2c087787f14
|
||||||
|
<br>
|
||||||
|
<br></code></i>
|
||||||
|
<br>
|
||||||
|
<br>Ok, now lets calculate M1: You need to Calc M1 to verify it matches the M1 supplied by the client. This VERIFIES the username, password is correct.
|
||||||
|
<br><i><code>
|
||||||
|
<br>N_Hash = SHA1(N) // Nothing is Reversed in this routine
|
||||||
|
<br>G_Hash = SHA1(G)
|
||||||
|
<br>
|
||||||
|
<br>User_Hash = SHA1(uppercase(Username))
|
||||||
|
<br>// User Hash = 984816fd329622876e14907634264e6f332e9fb3
|
||||||
|
<br>// XOr them
|
||||||
|
<br>for(i=0;i<20;i++) NG_Hash = N_Hash[i] ^ G_Hash[i];
|
||||||
|
<br>// NG_Hash = 1C76CF5659F68836A628404C431C1855E84D555B
|
||||||
|
<br>
|
||||||
|
<br>Temp = NG_Hash & User_Hash & Salt & A & B & SS_Hash
|
||||||
|
<br>// As you might Guess Temp is a really long string. :)
|
||||||
|
<br>
|
||||||
|
<br>M1 = SHA1(Temp) // Should = eeb4adca80f4de02f9a9fe8d000d682e3ddfad6f
|
||||||
|
<br></code></i>
|
||||||
|
<br>To Calculate M2:
|
||||||
|
<br><i><code>
|
||||||
|
<br>Temp = A & M1 & SS_Hash
|
||||||
|
<br>M2 = SHA1(Temp) // Should equal: 3a92ed0b783597be95654d6c66442046f9d389ae
|
||||||
|
<br></code></i>
|
||||||
|
<br>Now you stuff the server packets M2 with the above M2, and unknowns are all Zero.
|
||||||
|
<br>
|
||||||
|
<br>The client should request the realmlist packets at this time. You are logged IN!!! :-D
|
||||||
|
<br>P.S. I would also like to see the Header Encryption Documented. I've seen some people have decoded it but they are being quite selfish with the knowledge, which sets everyone back. I mean how many development hours does it set everyone back attempting to re-inventing srp6? It has taken me a huge number of hours to get to this point... :o
|
||||||
|
<br>[/quote]
|
||||||
|
</BODY>
|
||||||
61
src/Client/main.cpp
Normal file
61
src/Client/main.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#include "../shared/common.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
|
||||||
|
#ifndef SIGQUIT
|
||||||
|
#define SIGQUIT 3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void _HookSignals(void)
|
||||||
|
{
|
||||||
|
signal(SIGINT, _OnSignal);
|
||||||
|
signal(SIGQUIT, _OnSignal);
|
||||||
|
signal(SIGTERM, _OnSignal);
|
||||||
|
signal(SIGABRT, _OnSignal);
|
||||||
|
#ifdef _WIN32
|
||||||
|
signal(SIGBREAK, _OnSignal);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void _OnSignal(int s)
|
||||||
|
{
|
||||||
|
switch (s)
|
||||||
|
{
|
||||||
|
case SIGINT:
|
||||||
|
case SIGQUIT:
|
||||||
|
case SIGTERM:
|
||||||
|
case SIGABRT:
|
||||||
|
quitproc();
|
||||||
|
break;
|
||||||
|
#ifdef _WIN32
|
||||||
|
case SIGBREAK:
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
signal(s, _OnSignal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void quitproc(void){
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_HookSignals();
|
||||||
|
ZThread::Thread t(new PseuInstanceRunnable);
|
||||||
|
t.setPriority((ZThread::Priority)2);
|
||||||
|
//...
|
||||||
|
t.wait();
|
||||||
|
//...
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
printf("ERROR: Unhandled exception in main thread!\n");
|
||||||
|
raise(SIGABRT);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/Client/main.h
Normal file
11
src/Client/main.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef _MAIN_H
|
||||||
|
#define _MAIN_H
|
||||||
|
|
||||||
|
void _HookSignals(void);
|
||||||
|
void _OnSignal(int);
|
||||||
|
void quitproc(void);
|
||||||
|
int main(int,char**);
|
||||||
|
|
||||||
|
// TODO: ZTHread additional includes machen, dass #include <...> möglich ist
|
||||||
|
|
||||||
|
#endif
|
||||||
16
src/Client/resource.h
Normal file
16
src/Client/resource.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Developer Studio generated include file.
|
||||||
|
// Used by Script1.rc
|
||||||
|
//
|
||||||
|
#define IDI_ICON1 101
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 104
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
16
src/Client/resource1.h
Normal file
16
src/Client/resource1.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by PseuWoW.rc
|
||||||
|
//
|
||||||
|
#define IDI_ICON1 103
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 104
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
158
src/Controller.vcproj
Normal file
158
src/Controller.vcproj
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="7.10"
|
||||||
|
Name="PseuWoW_Controller"
|
||||||
|
RootNamespace="PseuWoW_Controller"
|
||||||
|
SccProjectName=""
|
||||||
|
SccLocalPath="">
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"/>
|
||||||
|
</Platforms>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)/bin"
|
||||||
|
IntermediateDirectory="$(SolutionDir)/temp/$(ProjectName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
PrecompiledHeaderFile=".\Debug/PseuWoW_Controller.pch"
|
||||||
|
AssemblerListingLocation=".\Debug/"
|
||||||
|
ObjectFile=".\Debug/"
|
||||||
|
ProgramDataBaseFileName=".\Debug/"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
DebugInformationFormat="4"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="odbc32.lib odbccp32.lib sdl.lib sdl_net.lib sdlmain.lib"
|
||||||
|
OutputFile="$(OutDir)/$(InputName).exe"
|
||||||
|
LinkIncremental="1"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
GenerateDebugInformation="TRUE"
|
||||||
|
ProgramDatabaseFile=".\Debug/PseuWoW_Controller.pdb"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TypeLibraryName=".\Debug/PseuWoW_Controller.tlb"
|
||||||
|
HeaderFileName=""/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1031"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)/bin"
|
||||||
|
IntermediateDirectory="$(SolutionDir)/temp/$(ProjectName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="1"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
|
StringPooling="TRUE"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="TRUE"
|
||||||
|
PrecompiledHeaderFile=".\Release/PseuWoW_Controller.pch"
|
||||||
|
AssemblerListingLocation=".\Release/"
|
||||||
|
ObjectFile=".\Release/"
|
||||||
|
ProgramDataBaseFileName=".\Release/"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="TRUE"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="odbc32.lib odbccp32.lib sdl.lib sdl_net.lib sdlmain.lib"
|
||||||
|
OutputFile="$(OutDir)/$(InputName).exe"
|
||||||
|
LinkIncremental="2"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
ProgramDatabaseFile=".\Release/PseuWoW_Controller.pdb"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TypeLibraryName=".\Release/PseuWoW_Controller.tlb"
|
||||||
|
HeaderFileName=""/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1031"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||||
|
<File
|
||||||
|
RelativePath=".\Controller\Controller.cpp">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl">
|
||||||
|
<File
|
||||||
|
RelativePath=".\shared\controllercodes.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||||
|
</Filter>
|
||||||
|
<File
|
||||||
|
RelativePath="ReadMe.txt">
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
319
src/Controller/Controller.cpp
Normal file
319
src/Controller/Controller.cpp
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
// PseuWoW_Controller.cpp : Defines the entry point for the console application.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include <SDL/SDL_net.h>
|
||||||
|
#include <SDL/SDL_thread.h>
|
||||||
|
|
||||||
|
#include "../shared/controllercodes.h"
|
||||||
|
|
||||||
|
#define gets(c) Gets(c)
|
||||||
|
|
||||||
|
#define MAXLEN 1024
|
||||||
|
|
||||||
|
bool DEBUG=true;
|
||||||
|
|
||||||
|
char *ver="PseuWoW Controlling Unit Build 1";
|
||||||
|
int error=0,port=10024;
|
||||||
|
SDL_Thread *connect_thread,*recieve_thread,*cmdhandler_thread,*quitproc_thread,*input_thread;
|
||||||
|
char *hostname="localhost";
|
||||||
|
bool ready=false,connected=false,authenticated=false,nopassword=true,quit=false,waitforinput;
|
||||||
|
TCPsocket tcpsock;
|
||||||
|
char *incomingtext;
|
||||||
|
unsigned char incomingcmd;
|
||||||
|
char *password,*outgoingtext;
|
||||||
|
char *remotever;
|
||||||
|
|
||||||
|
/////////// predeclare functions /////////////////////////
|
||||||
|
int connect(void *p);
|
||||||
|
void closeconnection(bool);
|
||||||
|
void quitproc(void);
|
||||||
|
int tquitproc(void *p);
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
void Gets(char *z,int m) {
|
||||||
|
int ch;
|
||||||
|
int counter=0;
|
||||||
|
while((ch=getchar()) != '\n') {
|
||||||
|
z[counter++]=ch;
|
||||||
|
if(counter >= m)break;
|
||||||
|
if(quit){printf("Q: returning from input.");return;}
|
||||||
|
}
|
||||||
|
z[counter] = '\0'; /* Terminieren */
|
||||||
|
}
|
||||||
|
|
||||||
|
char *triml(char *data,int count){
|
||||||
|
data=data+count;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool readconf(void){
|
||||||
|
|
||||||
|
// read the shit, then set nopassword=false :)
|
||||||
|
return 0; //error
|
||||||
|
}
|
||||||
|
|
||||||
|
void send(char code, char* sm_message="()"){
|
||||||
|
if(quit)return;
|
||||||
|
if(tcpsock==NULL){printf("ERROR: Tried to send data over a cloed socket!\n"); return;}
|
||||||
|
int sm_result;
|
||||||
|
char *packet=(char*)malloc(1024);
|
||||||
|
sprintf(packet,"%c%s",code,sm_message);
|
||||||
|
int len = strlen(packet) + 1; // add one for the terminating NULL
|
||||||
|
sm_result = SDLNet_TCP_Send(tcpsock,packet,len);
|
||||||
|
if( sm_result < len ) {
|
||||||
|
printf( "SDLNet_TCP_Send: %s\n", SDLNet_GetError() );
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//printf("out: %i, %s\n",code,sm_message);
|
||||||
|
}
|
||||||
|
free(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
int recieve(void *p) {
|
||||||
|
int result;
|
||||||
|
char msg[MAXLEN];
|
||||||
|
while(connected) {
|
||||||
|
//printf("recieve: Waiting for incoming data...\n");
|
||||||
|
result = SDLNet_TCP_Recv(tcpsock,msg,MAXLEN);
|
||||||
|
if(result <= 0) {
|
||||||
|
// TCP Connection is broken. (because of error or closure)
|
||||||
|
//closeconnection(false);
|
||||||
|
|
||||||
|
quitproc_thread=SDL_CreateThread(tquitproc,NULL);
|
||||||
|
} else {
|
||||||
|
msg[result] = 0;
|
||||||
|
|
||||||
|
incomingcmd=msg[0];
|
||||||
|
incomingtext=triml(msg,1);
|
||||||
|
//printf("in: %i, %s\n",incomingcmd,incomingtext);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(DEBUG)printf("Reciever lost the connection, thread exited.\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int connect(void *p){
|
||||||
|
if(quit)return 0;
|
||||||
|
IPaddress ip;
|
||||||
|
while(SDLNet_ResolveHost(&ip,hostname,port)==-1)SDL_Delay(100);
|
||||||
|
printf("Waiting for connection...\n");
|
||||||
|
while(tcpsock==NULL){
|
||||||
|
tcpsock=SDLNet_TCP_Open(&ip);
|
||||||
|
//SDL_Delay(100);
|
||||||
|
}
|
||||||
|
connected=true;
|
||||||
|
if(DEBUG)printf("Connection established.\n");
|
||||||
|
recieve_thread=SDL_CreateThread(recieve,NULL);
|
||||||
|
send(_REQUESTCONNECTION,ver);
|
||||||
|
if(DEBUG)printf("Thread exited: Connector\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void closeconnection(bool reconnect){
|
||||||
|
if(DEBUG)printf("Closing connections. Reconnect=%i\n",reconnect);
|
||||||
|
SDL_KillThread(recieve_thread);
|
||||||
|
SDLNet_TCP_Close(tcpsock);
|
||||||
|
tcpsock=NULL;
|
||||||
|
connected=false;
|
||||||
|
authenticated=false;
|
||||||
|
if(reconnect){
|
||||||
|
connect_thread=SDL_CreateThread(connect,NULL);
|
||||||
|
if(DEBUG)printf("Thread restarted: Connector\n");
|
||||||
|
}
|
||||||
|
// more to come
|
||||||
|
}
|
||||||
|
|
||||||
|
int tquitproc(void *p){
|
||||||
|
exit(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void quitproc(void){
|
||||||
|
static bool quitted;
|
||||||
|
if(quitted) return;
|
||||||
|
quitted=true;
|
||||||
|
printf("Quitting...\n");
|
||||||
|
quit=true;
|
||||||
|
SDL_KillThread(input_thread);
|
||||||
|
|
||||||
|
if(DEBUG)printf("Closing Connection\n");
|
||||||
|
closeconnection(false);
|
||||||
|
|
||||||
|
|
||||||
|
printf("End.\n");
|
||||||
|
|
||||||
|
//SDL_Delay(100);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void forceclose(void){
|
||||||
|
//if(connected) disconnect();
|
||||||
|
quitproc();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int cmdhandler(void *p){
|
||||||
|
while(true){
|
||||||
|
if (incomingcmd!=_NODATA){
|
||||||
|
switch(incomingcmd){
|
||||||
|
//case _SENDTEXT:printf("%s\n",incomingtext);break; //bugged somehow
|
||||||
|
case _PASSWORDOK:{printf("%s has accepted the connection.\n",remotever);authenticated=true;}break;
|
||||||
|
case _PASSWORDWRONG:{printf("%s has rejected the connection, exiting...\n",remotever);SDL_Delay(2000);quitproc();}break;
|
||||||
|
//case _DISCONNECT:{printf("Got disconnected from the remote side!\n");closeconnection(false);}break; // no longer needed
|
||||||
|
case _REQUESTPASSWORD:
|
||||||
|
strcpy(remotever,incomingtext);
|
||||||
|
printf("%s requests a password.\n",remotever);
|
||||||
|
if (nopassword){
|
||||||
|
printf("Enter Password, max. 32 chars: ");
|
||||||
|
Gets(password,32);
|
||||||
|
}
|
||||||
|
send(_SENDPASSWORD,password);
|
||||||
|
printf("Password sent, waiting for answer...\n");
|
||||||
|
break;
|
||||||
|
case _RECIEVEDANDREADY:{printf("%s\n",incomingtext);ready=true;}break;
|
||||||
|
case _RECIEVEDBUTUNKNOWN:{printf("The opcode was not recognized by the remote side.\n");ready=true;}break;
|
||||||
|
case _UNKNOWNCOMMAND:{printf("Unknown command.\n");ready=true;}break;
|
||||||
|
case _BADCOMMAND:{printf("Bad command: %s\n",incomingtext);ready=true;}break;
|
||||||
|
default:{printf("Recieved unknown opcode!\n");}break;
|
||||||
|
}
|
||||||
|
incomingcmd=_NODATA;
|
||||||
|
}
|
||||||
|
SDL_Delay(1);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool initproc(void){
|
||||||
|
printf("%s\n",ver);
|
||||||
|
if(DEBUG)printf("Allocating buffer memory...\n");
|
||||||
|
|
||||||
|
incomingtext=(char*)malloc(1024);
|
||||||
|
outgoingtext=(char*)malloc(1024);
|
||||||
|
password=(char*)malloc(32);
|
||||||
|
remotever=(char*)malloc(128);
|
||||||
|
// more malloc...
|
||||||
|
|
||||||
|
printf("Reading Config file... ");
|
||||||
|
if (readconf()) printf("done.\n"); else {
|
||||||
|
printf("error!\n");
|
||||||
|
//printf("Enter Password, max. 32 chars: ");
|
||||||
|
//scanf("%s",&password);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(DEBUG)printf("Initializing SDL...\n");
|
||||||
|
if(SDL_Init(0)==-1) {
|
||||||
|
printf("SDL_Init: %s\n", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(DEBUG)printf("Initializing SDL_Net...\n");
|
||||||
|
if(SDLNet_Init()==-1) {
|
||||||
|
printf("SDLNet_Init: %s\n", SDLNet_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(DEBUG)printf("Starting threads...\n");
|
||||||
|
|
||||||
|
connect_thread=SDL_CreateThread(connect,NULL);
|
||||||
|
if(DEBUG)printf("Thread started: Connector\n");
|
||||||
|
cmdhandler_thread=SDL_CreateThread(cmdhandler,NULL);
|
||||||
|
if(DEBUG)printf("Thread started: CmdHandler\n");
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
int waitfortimeout(void *p){
|
||||||
|
int timeout;
|
||||||
|
for (timeout=10000;timeout>0||!ready;timeout--){
|
||||||
|
SDL_Delay(1);
|
||||||
|
if(timeout%1000==0) printf(".");
|
||||||
|
}
|
||||||
|
if(!ready) closeconnection(); // still not ready? disconnect!
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void showhelp(void){
|
||||||
|
printf("commands - displays a list of commands the remote side supports\n");
|
||||||
|
printf("ver - show version\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsLocalCommand(char *txt){
|
||||||
|
if(strcmp(outgoingtext,"help")==0){showhelp();return true;}
|
||||||
|
if(strcmp(outgoingtext,"ver")==0){printf("%s\n",ver);return true;}
|
||||||
|
if(strcmp(outgoingtext,"quit")==0||strcmp(outgoingtext,"exit")==0){quitproc();return true;}
|
||||||
|
if(strcmp(outgoingtext,"?")==0){showhelp();return true;}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
atexit(forceclose);
|
||||||
|
|
||||||
|
///! printf("%c",(char)_SAYHELLO);
|
||||||
|
if (!initproc()){
|
||||||
|
printf("Initialisation failed!\n");
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
// more init...?
|
||||||
|
printf("Initialisation finished.\n");
|
||||||
|
while(!(authenticated&&connected)){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SDL_Delay(1);
|
||||||
|
}
|
||||||
|
send(_RECIEVEDANDREADY);
|
||||||
|
printf("Authentication ok, opening console. You can enter commands now.\n");
|
||||||
|
printf("Type \"help\" for a short introduction\n");
|
||||||
|
while(true){
|
||||||
|
while(authenticated){
|
||||||
|
SDL_Delay(1);
|
||||||
|
|
||||||
|
if(ready){
|
||||||
|
printf("> ");
|
||||||
|
while(true){
|
||||||
|
/*if(!waitforinput){
|
||||||
|
SDL_CreateThread(tinput,NULL);
|
||||||
|
SDL_Delay(10);
|
||||||
|
while(waitforinput)SDL_Delay(1);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
Gets(outgoingtext,MAXLEN);
|
||||||
|
if(strlen(outgoingtext)<=0)printf("Maybe you want to enter something...?!\n> ");else break;
|
||||||
|
SDL_Delay(1);
|
||||||
|
}
|
||||||
|
if (!IsLocalCommand(outgoingtext)){send(_SENDCOMMAND,outgoingtext);ready=false;}
|
||||||
|
|
||||||
|
|
||||||
|
//SDL_CreateThread(waitfortimeout,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
SDL_Delay(1);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
294
src/PseuWoW.vcproj
Normal file
294
src/PseuWoW.vcproj
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="7.10"
|
||||||
|
Name="PseuWoW"
|
||||||
|
ProjectGUID="{EFFE60F4-DA39-41E8-9E53-E462000A2D91}"
|
||||||
|
RootNamespace="PseuWoW"
|
||||||
|
SccProjectName=""
|
||||||
|
SccLocalPath="">
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"/>
|
||||||
|
</Platforms>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)/bin"
|
||||||
|
IntermediateDirectory="$(SolutionDir)/temp/$(ProjectName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="3"
|
||||||
|
GlobalOptimizations="TRUE"
|
||||||
|
InlineFunctionExpansion="2"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
OptimizeForWindowsApplication="TRUE"
|
||||||
|
AdditionalIncludeDirectories="./shared/;./Client/;./Client/World/;./Client/Realm/;./zthread/include/;./zlib/"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
|
StringPooling="TRUE"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="TRUE"
|
||||||
|
PrecompiledHeaderFile=".\Release/PseuWoW.pch"
|
||||||
|
AssemblerListingLocation="$(SolutionDir)/temp/$(ProjectName)/"
|
||||||
|
ObjectFile="$(SolutionDir)/temp/$(ProjectName)/"
|
||||||
|
ProgramDataBaseFileName="$(SolutionDir)/temp/$(ProjectName)/"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="TRUE"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="odbc32.lib odbccp32.lib sdl.lib sdl_net.lib sdlmain.lib libeay32MT.lib ssleay32MT.lib WS2_32.LIB"
|
||||||
|
OutputFile="$(OutDir)/$(InputName).exe"
|
||||||
|
LinkIncremental="1"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
AdditionalLibraryDirectories="./dep/lib/release/"
|
||||||
|
ProgramDatabaseFile="$(SolutionDir)/temp/$(ProjectName)/Release/PseuWoW.pdb"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TypeLibraryName=".\Release/PseuWoW.tlb"
|
||||||
|
HeaderFileName=""/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1031"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)/bin"
|
||||||
|
IntermediateDirectory="$(SolutionDir)/temp/$(ProjectName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
OptimizeForProcessor="0"
|
||||||
|
AdditionalIncludeDirectories="./shared/;./Client/;./Client/World/;./Client/Realm/;./dep/include/"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
PrecompiledHeaderFile=""
|
||||||
|
AssemblerListingLocation="$(SolutionDir)/temp/$(ProjectName)/"
|
||||||
|
ObjectFile="$(SolutionDir)/temp/$(ProjectName)/"
|
||||||
|
ProgramDataBaseFileName="$(SolutionDir)/temp/$(ProjectName)/"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
DebugInformationFormat="3"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="odbc32.lib odbccp32.lib sdl.lib sdl_net.lib sdlmain.lib libeay32MT.lib ssleay32MT.lib WS2_32.LIB"
|
||||||
|
OutputFile="$(OutDir)/$(InputName).exe"
|
||||||
|
LinkIncremental="1"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
AdditionalLibraryDirectories="./deb/lib/"
|
||||||
|
GenerateDebugInformation="TRUE"
|
||||||
|
ProgramDatabaseFile="$(SolutionDir)/temp/$(ProjectName)/PseuWoW.pdb"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TypeLibraryName=".\Debug/PseuWoW.tlb"
|
||||||
|
HeaderFileName=""/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1031"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\DefScriptInterface.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\main.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\main.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\NameTables.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\PseuWoW.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\PseuWoW.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\PseuWoW.rc">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\resource1.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\SysDefs.h">
|
||||||
|
</File>
|
||||||
|
<Filter
|
||||||
|
Name="Auth"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\AuthCrypt.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\AuthCrypt.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\BigNumber.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\BigNumber.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\ByteBuffer.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\md5.c">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\md5.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\Sha1.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Auth\Sha1.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="DefScript"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\DefScript\DefScript.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\DefScript\DefScript.h">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\DefScript\DefScriptFunctions.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\DefScript\DefScriptFunctions.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\DefScript\VarSet.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\DefScript\VarSet.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Realm"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Realm\RealmSocket.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\Realm\RealmSocket.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="World"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\CMSGConstructor.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\Opcodes.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\Opcodes.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\Player.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\Player.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\SharedDefines.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\WorldPacket.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\WorldPacket.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\WorldSession.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\WorldSession.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\WorldSocket.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\WorldSocket.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||||
|
<File
|
||||||
|
RelativePath=".\Pseu1.ico">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
441
src/dep/include/zlib/crc32.h
Normal file
441
src/dep/include/zlib/crc32.h
Normal file
@ -0,0 +1,441 @@
|
|||||||
|
/* crc32.h -- tables for rapid CRC calculation
|
||||||
|
* Generated automatically by crc32.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
local const unsigned long FAR crc_table[TBLS][256] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
|
||||||
|
0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
|
||||||
|
0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
|
||||||
|
0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
|
||||||
|
0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
|
||||||
|
0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
|
||||||
|
0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
|
||||||
|
0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
|
||||||
|
0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
|
||||||
|
0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
|
||||||
|
0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
|
||||||
|
0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
|
||||||
|
0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
|
||||||
|
0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
|
||||||
|
0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
|
||||||
|
0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
|
||||||
|
0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
|
||||||
|
0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
|
||||||
|
0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
|
||||||
|
0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
|
||||||
|
0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
|
||||||
|
0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
|
||||||
|
0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
|
||||||
|
0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
|
||||||
|
0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
|
||||||
|
0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
|
||||||
|
0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
|
||||||
|
0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
|
||||||
|
0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
|
||||||
|
0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
|
||||||
|
0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
|
||||||
|
0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
|
||||||
|
0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
|
||||||
|
0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
|
||||||
|
0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
|
||||||
|
0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
|
||||||
|
0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
|
||||||
|
0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
|
||||||
|
0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
|
||||||
|
0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
|
||||||
|
0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
|
||||||
|
0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
|
||||||
|
0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
|
||||||
|
0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
|
||||||
|
0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
|
||||||
|
0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
|
||||||
|
0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
|
||||||
|
0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
|
||||||
|
0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
|
||||||
|
0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
|
||||||
|
0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
|
||||||
|
0x2d02ef8dUL
|
||||||
|
#ifdef BYFOUR
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
|
||||||
|
0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
|
||||||
|
0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
|
||||||
|
0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
|
||||||
|
0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
|
||||||
|
0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
|
||||||
|
0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
|
||||||
|
0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
|
||||||
|
0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
|
||||||
|
0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
|
||||||
|
0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
|
||||||
|
0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
|
||||||
|
0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
|
||||||
|
0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
|
||||||
|
0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
|
||||||
|
0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
|
||||||
|
0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
|
||||||
|
0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
|
||||||
|
0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
|
||||||
|
0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
|
||||||
|
0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
|
||||||
|
0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
|
||||||
|
0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
|
||||||
|
0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
|
||||||
|
0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
|
||||||
|
0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
|
||||||
|
0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
|
||||||
|
0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
|
||||||
|
0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
|
||||||
|
0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
|
||||||
|
0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
|
||||||
|
0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
|
||||||
|
0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
|
||||||
|
0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
|
||||||
|
0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
|
||||||
|
0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
|
||||||
|
0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
|
||||||
|
0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
|
||||||
|
0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
|
||||||
|
0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
|
||||||
|
0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
|
||||||
|
0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
|
||||||
|
0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
|
||||||
|
0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
|
||||||
|
0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
|
||||||
|
0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
|
||||||
|
0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
|
||||||
|
0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
|
||||||
|
0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
|
||||||
|
0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
|
||||||
|
0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
|
||||||
|
0x9324fd72UL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
|
||||||
|
0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
|
||||||
|
0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
|
||||||
|
0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
|
||||||
|
0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
|
||||||
|
0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
|
||||||
|
0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
|
||||||
|
0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
|
||||||
|
0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
|
||||||
|
0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
|
||||||
|
0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
|
||||||
|
0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
|
||||||
|
0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
|
||||||
|
0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
|
||||||
|
0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
|
||||||
|
0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
|
||||||
|
0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
|
||||||
|
0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
|
||||||
|
0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
|
||||||
|
0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
|
||||||
|
0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
|
||||||
|
0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
|
||||||
|
0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
|
||||||
|
0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
|
||||||
|
0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
|
||||||
|
0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
|
||||||
|
0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
|
||||||
|
0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
|
||||||
|
0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
|
||||||
|
0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
|
||||||
|
0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
|
||||||
|
0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
|
||||||
|
0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
|
||||||
|
0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
|
||||||
|
0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
|
||||||
|
0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
|
||||||
|
0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
|
||||||
|
0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
|
||||||
|
0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
|
||||||
|
0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
|
||||||
|
0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
|
||||||
|
0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
|
||||||
|
0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
|
||||||
|
0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
|
||||||
|
0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
|
||||||
|
0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
|
||||||
|
0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
|
||||||
|
0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
|
||||||
|
0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
|
||||||
|
0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
|
||||||
|
0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
|
||||||
|
0xbe9834edUL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
|
||||||
|
0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
|
||||||
|
0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
|
||||||
|
0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
|
||||||
|
0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
|
||||||
|
0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
|
||||||
|
0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
|
||||||
|
0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
|
||||||
|
0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
|
||||||
|
0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
|
||||||
|
0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
|
||||||
|
0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
|
||||||
|
0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
|
||||||
|
0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
|
||||||
|
0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
|
||||||
|
0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
|
||||||
|
0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
|
||||||
|
0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
|
||||||
|
0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
|
||||||
|
0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
|
||||||
|
0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
|
||||||
|
0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
|
||||||
|
0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
|
||||||
|
0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
|
||||||
|
0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
|
||||||
|
0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
|
||||||
|
0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
|
||||||
|
0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
|
||||||
|
0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
|
||||||
|
0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
|
||||||
|
0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
|
||||||
|
0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
|
||||||
|
0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
|
||||||
|
0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
|
||||||
|
0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
|
||||||
|
0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
|
||||||
|
0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
|
||||||
|
0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
|
||||||
|
0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
|
||||||
|
0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
|
||||||
|
0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
|
||||||
|
0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
|
||||||
|
0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
|
||||||
|
0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
|
||||||
|
0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
|
||||||
|
0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
|
||||||
|
0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
|
||||||
|
0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
|
||||||
|
0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
|
||||||
|
0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
|
||||||
|
0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
|
||||||
|
0xde0506f1UL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
|
||||||
|
0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
|
||||||
|
0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
|
||||||
|
0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
|
||||||
|
0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
|
||||||
|
0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
|
||||||
|
0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
|
||||||
|
0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
|
||||||
|
0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
|
||||||
|
0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
|
||||||
|
0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
|
||||||
|
0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
|
||||||
|
0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
|
||||||
|
0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
|
||||||
|
0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
|
||||||
|
0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
|
||||||
|
0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
|
||||||
|
0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
|
||||||
|
0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
|
||||||
|
0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
|
||||||
|
0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
|
||||||
|
0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
|
||||||
|
0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
|
||||||
|
0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
|
||||||
|
0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
|
||||||
|
0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
|
||||||
|
0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
|
||||||
|
0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
|
||||||
|
0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
|
||||||
|
0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
|
||||||
|
0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
|
||||||
|
0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
|
||||||
|
0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
|
||||||
|
0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
|
||||||
|
0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
|
||||||
|
0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
|
||||||
|
0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
|
||||||
|
0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
|
||||||
|
0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
|
||||||
|
0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
|
||||||
|
0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
|
||||||
|
0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
|
||||||
|
0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
|
||||||
|
0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
|
||||||
|
0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
|
||||||
|
0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
|
||||||
|
0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
|
||||||
|
0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
|
||||||
|
0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
|
||||||
|
0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
|
||||||
|
0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
|
||||||
|
0x8def022dUL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
|
||||||
|
0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
|
||||||
|
0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
|
||||||
|
0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
|
||||||
|
0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
|
||||||
|
0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
|
||||||
|
0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
|
||||||
|
0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
|
||||||
|
0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
|
||||||
|
0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
|
||||||
|
0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
|
||||||
|
0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
|
||||||
|
0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
|
||||||
|
0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
|
||||||
|
0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
|
||||||
|
0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
|
||||||
|
0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
|
||||||
|
0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
|
||||||
|
0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
|
||||||
|
0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
|
||||||
|
0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
|
||||||
|
0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
|
||||||
|
0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
|
||||||
|
0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
|
||||||
|
0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
|
||||||
|
0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
|
||||||
|
0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
|
||||||
|
0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
|
||||||
|
0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
|
||||||
|
0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
|
||||||
|
0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
|
||||||
|
0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
|
||||||
|
0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
|
||||||
|
0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
|
||||||
|
0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
|
||||||
|
0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
|
||||||
|
0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
|
||||||
|
0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
|
||||||
|
0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
|
||||||
|
0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
|
||||||
|
0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
|
||||||
|
0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
|
||||||
|
0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
|
||||||
|
0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
|
||||||
|
0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
|
||||||
|
0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
|
||||||
|
0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
|
||||||
|
0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
|
||||||
|
0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
|
||||||
|
0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
|
||||||
|
0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
|
||||||
|
0x72fd2493UL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
|
||||||
|
0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
|
||||||
|
0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
|
||||||
|
0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
|
||||||
|
0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
|
||||||
|
0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
|
||||||
|
0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
|
||||||
|
0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
|
||||||
|
0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
|
||||||
|
0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
|
||||||
|
0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
|
||||||
|
0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
|
||||||
|
0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
|
||||||
|
0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
|
||||||
|
0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
|
||||||
|
0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
|
||||||
|
0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
|
||||||
|
0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
|
||||||
|
0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
|
||||||
|
0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
|
||||||
|
0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
|
||||||
|
0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
|
||||||
|
0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
|
||||||
|
0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
|
||||||
|
0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
|
||||||
|
0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
|
||||||
|
0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
|
||||||
|
0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
|
||||||
|
0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
|
||||||
|
0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
|
||||||
|
0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
|
||||||
|
0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
|
||||||
|
0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
|
||||||
|
0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
|
||||||
|
0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
|
||||||
|
0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
|
||||||
|
0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
|
||||||
|
0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
|
||||||
|
0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
|
||||||
|
0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
|
||||||
|
0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
|
||||||
|
0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
|
||||||
|
0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
|
||||||
|
0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
|
||||||
|
0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
|
||||||
|
0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
|
||||||
|
0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
|
||||||
|
0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
|
||||||
|
0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
|
||||||
|
0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
|
||||||
|
0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
|
||||||
|
0xed3498beUL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
|
||||||
|
0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
|
||||||
|
0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
|
||||||
|
0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
|
||||||
|
0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
|
||||||
|
0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
|
||||||
|
0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
|
||||||
|
0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
|
||||||
|
0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
|
||||||
|
0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
|
||||||
|
0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
|
||||||
|
0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
|
||||||
|
0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
|
||||||
|
0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
|
||||||
|
0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
|
||||||
|
0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
|
||||||
|
0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
|
||||||
|
0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
|
||||||
|
0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
|
||||||
|
0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
|
||||||
|
0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
|
||||||
|
0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
|
||||||
|
0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
|
||||||
|
0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
|
||||||
|
0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
|
||||||
|
0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
|
||||||
|
0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
|
||||||
|
0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
|
||||||
|
0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
|
||||||
|
0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
|
||||||
|
0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
|
||||||
|
0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
|
||||||
|
0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
|
||||||
|
0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
|
||||||
|
0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
|
||||||
|
0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
|
||||||
|
0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
|
||||||
|
0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
|
||||||
|
0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
|
||||||
|
0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
|
||||||
|
0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
|
||||||
|
0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
|
||||||
|
0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
|
||||||
|
0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
|
||||||
|
0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
|
||||||
|
0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
|
||||||
|
0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
|
||||||
|
0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
|
||||||
|
0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
|
||||||
|
0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
|
||||||
|
0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
|
||||||
|
0xf10605deUL
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
331
src/dep/include/zlib/deflate.h
Normal file
331
src/dep/include/zlib/deflate.h
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
/* deflate.h -- internal compression state
|
||||||
|
* Copyright (C) 1995-2004 Jean-loup Gailly
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* WARNING: this file should *not* be used by applications. It is
|
||||||
|
part of the implementation of the compression library and is
|
||||||
|
subject to change. Applications should only use zlib.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @(#) $Id$ */
|
||||||
|
|
||||||
|
#ifndef DEFLATE_H
|
||||||
|
#define DEFLATE_H
|
||||||
|
|
||||||
|
#include "zutil.h"
|
||||||
|
|
||||||
|
/* define NO_GZIP when compiling if you want to disable gzip header and
|
||||||
|
trailer creation by deflate(). NO_GZIP would be used to avoid linking in
|
||||||
|
the crc code when it is not needed. For shared libraries, gzip encoding
|
||||||
|
should be left enabled. */
|
||||||
|
#ifndef NO_GZIP
|
||||||
|
# define GZIP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Internal compression state.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LENGTH_CODES 29
|
||||||
|
/* number of length codes, not counting the special END_BLOCK code */
|
||||||
|
|
||||||
|
#define LITERALS 256
|
||||||
|
/* number of literal bytes 0..255 */
|
||||||
|
|
||||||
|
#define L_CODES (LITERALS+1+LENGTH_CODES)
|
||||||
|
/* number of Literal or Length codes, including the END_BLOCK code */
|
||||||
|
|
||||||
|
#define D_CODES 30
|
||||||
|
/* number of distance codes */
|
||||||
|
|
||||||
|
#define BL_CODES 19
|
||||||
|
/* number of codes used to transfer the bit lengths */
|
||||||
|
|
||||||
|
#define HEAP_SIZE (2*L_CODES+1)
|
||||||
|
/* maximum heap size */
|
||||||
|
|
||||||
|
#define MAX_BITS 15
|
||||||
|
/* All codes must not exceed MAX_BITS bits */
|
||||||
|
|
||||||
|
#define INIT_STATE 42
|
||||||
|
#define EXTRA_STATE 69
|
||||||
|
#define NAME_STATE 73
|
||||||
|
#define COMMENT_STATE 91
|
||||||
|
#define HCRC_STATE 103
|
||||||
|
#define BUSY_STATE 113
|
||||||
|
#define FINISH_STATE 666
|
||||||
|
/* Stream status */
|
||||||
|
|
||||||
|
|
||||||
|
/* Data structure describing a single value and its code string. */
|
||||||
|
typedef struct ct_data_s {
|
||||||
|
union {
|
||||||
|
ush freq; /* frequency count */
|
||||||
|
ush code; /* bit string */
|
||||||
|
} fc;
|
||||||
|
union {
|
||||||
|
ush dad; /* father node in Huffman tree */
|
||||||
|
ush len; /* length of bit string */
|
||||||
|
} dl;
|
||||||
|
} FAR ct_data;
|
||||||
|
|
||||||
|
#define Freq fc.freq
|
||||||
|
#define Code fc.code
|
||||||
|
#define Dad dl.dad
|
||||||
|
#define Len dl.len
|
||||||
|
|
||||||
|
typedef struct static_tree_desc_s static_tree_desc;
|
||||||
|
|
||||||
|
typedef struct tree_desc_s {
|
||||||
|
ct_data *dyn_tree; /* the dynamic tree */
|
||||||
|
int max_code; /* largest code with non zero frequency */
|
||||||
|
static_tree_desc *stat_desc; /* the corresponding static tree */
|
||||||
|
} FAR tree_desc;
|
||||||
|
|
||||||
|
typedef ush Pos;
|
||||||
|
typedef Pos FAR Posf;
|
||||||
|
typedef unsigned IPos;
|
||||||
|
|
||||||
|
/* A Pos is an index in the character window. We use short instead of int to
|
||||||
|
* save space in the various tables. IPos is used only for parameter passing.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct internal_state {
|
||||||
|
z_streamp strm; /* pointer back to this zlib stream */
|
||||||
|
int status; /* as the name implies */
|
||||||
|
Bytef *pending_buf; /* output still pending */
|
||||||
|
ulg pending_buf_size; /* size of pending_buf */
|
||||||
|
Bytef *pending_out; /* next pending byte to output to the stream */
|
||||||
|
uInt pending; /* nb of bytes in the pending buffer */
|
||||||
|
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
|
||||||
|
gz_headerp gzhead; /* gzip header information to write */
|
||||||
|
uInt gzindex; /* where in extra, name, or comment */
|
||||||
|
Byte method; /* STORED (for zip only) or DEFLATED */
|
||||||
|
int last_flush; /* value of flush param for previous deflate call */
|
||||||
|
|
||||||
|
/* used by deflate.c: */
|
||||||
|
|
||||||
|
uInt w_size; /* LZ77 window size (32K by default) */
|
||||||
|
uInt w_bits; /* log2(w_size) (8..16) */
|
||||||
|
uInt w_mask; /* w_size - 1 */
|
||||||
|
|
||||||
|
Bytef *window;
|
||||||
|
/* Sliding window. Input bytes are read into the second half of the window,
|
||||||
|
* and move to the first half later to keep a dictionary of at least wSize
|
||||||
|
* bytes. With this organization, matches are limited to a distance of
|
||||||
|
* wSize-MAX_MATCH bytes, but this ensures that IO is always
|
||||||
|
* performed with a length multiple of the block size. Also, it limits
|
||||||
|
* the window size to 64K, which is quite useful on MSDOS.
|
||||||
|
* To do: use the user input buffer as sliding window.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ulg window_size;
|
||||||
|
/* Actual size of window: 2*wSize, except when the user input buffer
|
||||||
|
* is directly used as sliding window.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Posf *prev;
|
||||||
|
/* Link to older string with same hash index. To limit the size of this
|
||||||
|
* array to 64K, this link is maintained only for the last 32K strings.
|
||||||
|
* An index in this array is thus a window index modulo 32K.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Posf *head; /* Heads of the hash chains or NIL. */
|
||||||
|
|
||||||
|
uInt ins_h; /* hash index of string to be inserted */
|
||||||
|
uInt hash_size; /* number of elements in hash table */
|
||||||
|
uInt hash_bits; /* log2(hash_size) */
|
||||||
|
uInt hash_mask; /* hash_size-1 */
|
||||||
|
|
||||||
|
uInt hash_shift;
|
||||||
|
/* Number of bits by which ins_h must be shifted at each input
|
||||||
|
* step. It must be such that after MIN_MATCH steps, the oldest
|
||||||
|
* byte no longer takes part in the hash key, that is:
|
||||||
|
* hash_shift * MIN_MATCH >= hash_bits
|
||||||
|
*/
|
||||||
|
|
||||||
|
long block_start;
|
||||||
|
/* Window position at the beginning of the current output block. Gets
|
||||||
|
* negative when the window is moved backwards.
|
||||||
|
*/
|
||||||
|
|
||||||
|
uInt match_length; /* length of best match */
|
||||||
|
IPos prev_match; /* previous match */
|
||||||
|
int match_available; /* set if previous match exists */
|
||||||
|
uInt strstart; /* start of string to insert */
|
||||||
|
uInt match_start; /* start of matching string */
|
||||||
|
uInt lookahead; /* number of valid bytes ahead in window */
|
||||||
|
|
||||||
|
uInt prev_length;
|
||||||
|
/* Length of the best match at previous step. Matches not greater than this
|
||||||
|
* are discarded. This is used in the lazy match evaluation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
uInt max_chain_length;
|
||||||
|
/* To speed up deflation, hash chains are never searched beyond this
|
||||||
|
* length. A higher limit improves compression ratio but degrades the
|
||||||
|
* speed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
uInt max_lazy_match;
|
||||||
|
/* Attempt to find a better match only when the current match is strictly
|
||||||
|
* smaller than this value. This mechanism is used only for compression
|
||||||
|
* levels >= 4.
|
||||||
|
*/
|
||||||
|
# define max_insert_length max_lazy_match
|
||||||
|
/* Insert new strings in the hash table only if the match length is not
|
||||||
|
* greater than this length. This saves time but degrades compression.
|
||||||
|
* max_insert_length is used only for compression levels <= 3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int level; /* compression level (1..9) */
|
||||||
|
int strategy; /* favor or force Huffman coding*/
|
||||||
|
|
||||||
|
uInt good_match;
|
||||||
|
/* Use a faster search when the previous match is longer than this */
|
||||||
|
|
||||||
|
int nice_match; /* Stop searching when current match exceeds this */
|
||||||
|
|
||||||
|
/* used by trees.c: */
|
||||||
|
/* Didn't use ct_data typedef below to supress compiler warning */
|
||||||
|
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
|
||||||
|
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
|
||||||
|
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
|
||||||
|
|
||||||
|
struct tree_desc_s l_desc; /* desc. for literal tree */
|
||||||
|
struct tree_desc_s d_desc; /* desc. for distance tree */
|
||||||
|
struct tree_desc_s bl_desc; /* desc. for bit length tree */
|
||||||
|
|
||||||
|
ush bl_count[MAX_BITS+1];
|
||||||
|
/* number of codes at each bit length for an optimal tree */
|
||||||
|
|
||||||
|
int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
|
||||||
|
int heap_len; /* number of elements in the heap */
|
||||||
|
int heap_max; /* element of largest frequency */
|
||||||
|
/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
|
||||||
|
* The same heap array is used to build all trees.
|
||||||
|
*/
|
||||||
|
|
||||||
|
uch depth[2*L_CODES+1];
|
||||||
|
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
||||||
|
*/
|
||||||
|
|
||||||
|
uchf *l_buf; /* buffer for literals or lengths */
|
||||||
|
|
||||||
|
uInt lit_bufsize;
|
||||||
|
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
||||||
|
* limiting lit_bufsize to 64K:
|
||||||
|
* - frequencies can be kept in 16 bit counters
|
||||||
|
* - if compression is not successful for the first block, all input
|
||||||
|
* data is still in the window so we can still emit a stored block even
|
||||||
|
* when input comes from standard input. (This can also be done for
|
||||||
|
* all blocks if lit_bufsize is not greater than 32K.)
|
||||||
|
* - if compression is not successful for a file smaller than 64K, we can
|
||||||
|
* even emit a stored file instead of a stored block (saving 5 bytes).
|
||||||
|
* This is applicable only for zip (not gzip or zlib).
|
||||||
|
* - creating new Huffman trees less frequently may not provide fast
|
||||||
|
* adaptation to changes in the input data statistics. (Take for
|
||||||
|
* example a binary file with poorly compressible code followed by
|
||||||
|
* a highly compressible string table.) Smaller buffer sizes give
|
||||||
|
* fast adaptation but have of course the overhead of transmitting
|
||||||
|
* trees more frequently.
|
||||||
|
* - I can't count above 4
|
||||||
|
*/
|
||||||
|
|
||||||
|
uInt last_lit; /* running index in l_buf */
|
||||||
|
|
||||||
|
ushf *d_buf;
|
||||||
|
/* Buffer for distances. To simplify the code, d_buf and l_buf have
|
||||||
|
* the same number of elements. To use different lengths, an extra flag
|
||||||
|
* array would be necessary.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ulg opt_len; /* bit length of current block with optimal trees */
|
||||||
|
ulg static_len; /* bit length of current block with static trees */
|
||||||
|
uInt matches; /* number of string matches in current block */
|
||||||
|
int last_eob_len; /* bit length of EOB code for last block */
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
|
||||||
|
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ush bi_buf;
|
||||||
|
/* Output buffer. bits are inserted starting at the bottom (least
|
||||||
|
* significant bits).
|
||||||
|
*/
|
||||||
|
int bi_valid;
|
||||||
|
/* Number of valid bits in bi_buf. All bits above the last valid bit
|
||||||
|
* are always zero.
|
||||||
|
*/
|
||||||
|
|
||||||
|
} FAR deflate_state;
|
||||||
|
|
||||||
|
/* Output a byte on the stream.
|
||||||
|
* IN assertion: there is enough room in pending_buf.
|
||||||
|
*/
|
||||||
|
#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
|
||||||
|
|
||||||
|
|
||||||
|
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
|
||||||
|
/* Minimum amount of lookahead, except at the end of the input file.
|
||||||
|
* See deflate.c for comments about the MIN_MATCH+1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
|
||||||
|
/* In order to simplify the code, particularly on 16 bit machines, match
|
||||||
|
* distances are limited to MAX_DIST instead of WSIZE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* in trees.c */
|
||||||
|
void _tr_init OF((deflate_state *s));
|
||||||
|
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
||||||
|
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||||
|
int eof));
|
||||||
|
void _tr_align OF((deflate_state *s));
|
||||||
|
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||||
|
int eof));
|
||||||
|
|
||||||
|
#define d_code(dist) \
|
||||||
|
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
||||||
|
/* Mapping from a distance to a distance code. dist is the distance - 1 and
|
||||||
|
* must not have side effects. _dist_code[256] and _dist_code[257] are never
|
||||||
|
* used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
/* Inline versions of _tr_tally for speed: */
|
||||||
|
|
||||||
|
#if defined(GEN_TREES_H) || !defined(STDC)
|
||||||
|
extern uch _length_code[];
|
||||||
|
extern uch _dist_code[];
|
||||||
|
#else
|
||||||
|
extern const uch _length_code[];
|
||||||
|
extern const uch _dist_code[];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# define _tr_tally_lit(s, c, flush) \
|
||||||
|
{ uch cc = (c); \
|
||||||
|
s->d_buf[s->last_lit] = 0; \
|
||||||
|
s->l_buf[s->last_lit++] = cc; \
|
||||||
|
s->dyn_ltree[cc].Freq++; \
|
||||||
|
flush = (s->last_lit == s->lit_bufsize-1); \
|
||||||
|
}
|
||||||
|
# define _tr_tally_dist(s, distance, length, flush) \
|
||||||
|
{ uch len = (length); \
|
||||||
|
ush dist = (distance); \
|
||||||
|
s->d_buf[s->last_lit] = dist; \
|
||||||
|
s->l_buf[s->last_lit++] = len; \
|
||||||
|
dist--; \
|
||||||
|
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
||||||
|
s->dyn_dtree[d_code(dist)].Freq++; \
|
||||||
|
flush = (s->last_lit == s->lit_bufsize-1); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
||||||
|
# define _tr_tally_dist(s, distance, length, flush) \
|
||||||
|
flush = _tr_tally(s, distance, length)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* DEFLATE_H */
|
||||||
11
src/dep/include/zlib/inffast.h
Normal file
11
src/dep/include/zlib/inffast.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* inffast.h -- header to use inffast.c
|
||||||
|
* Copyright (C) 1995-2003 Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* WARNING: this file should *not* be used by applications. It is
|
||||||
|
part of the implementation of the compression library and is
|
||||||
|
subject to change. Applications should only use zlib.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void inflate_fast OF((z_streamp strm, unsigned start));
|
||||||
94
src/dep/include/zlib/inffixed.h
Normal file
94
src/dep/include/zlib/inffixed.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/* inffixed.h -- table for decoding fixed codes
|
||||||
|
* Generated automatically by makefixed().
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* WARNING: this file should *not* be used by applications. It
|
||||||
|
is part of the implementation of the compression library and
|
||||||
|
is subject to change. Applications should only use zlib.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const code lenfix[512] = {
|
||||||
|
{96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
|
||||||
|
{0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
|
||||||
|
{0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
|
||||||
|
{0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
|
||||||
|
{0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
|
||||||
|
{21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
|
||||||
|
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
|
||||||
|
{0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
|
||||||
|
{18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
|
||||||
|
{0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
|
||||||
|
{0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
|
||||||
|
{0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
|
||||||
|
{20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
|
||||||
|
{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
|
||||||
|
{0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
|
||||||
|
{0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
|
||||||
|
{16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
|
||||||
|
{0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
|
||||||
|
{0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
|
||||||
|
{0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
|
||||||
|
{0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
|
||||||
|
{0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
|
||||||
|
{0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
|
||||||
|
{0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
|
||||||
|
{17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
|
||||||
|
{0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
|
||||||
|
{0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
|
||||||
|
{0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
|
||||||
|
{19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
|
||||||
|
{0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
|
||||||
|
{0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
|
||||||
|
{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
|
||||||
|
{16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
|
||||||
|
{0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
|
||||||
|
{0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
|
||||||
|
{0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
|
||||||
|
{0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
|
||||||
|
{20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
|
||||||
|
{0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
|
||||||
|
{0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
|
||||||
|
{17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
|
||||||
|
{0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
|
||||||
|
{0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
|
||||||
|
{0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
|
||||||
|
{20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
|
||||||
|
{0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
|
||||||
|
{0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
|
||||||
|
{0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
|
||||||
|
{16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
|
||||||
|
{0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
|
||||||
|
{0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
|
||||||
|
{0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
|
||||||
|
{0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
|
||||||
|
{0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
|
||||||
|
{0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
|
||||||
|
{0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
|
||||||
|
{16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
|
||||||
|
{0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
|
||||||
|
{0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
|
||||||
|
{0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
|
||||||
|
{19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
|
||||||
|
{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
|
||||||
|
{0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
|
||||||
|
{0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
|
||||||
|
{16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
|
||||||
|
{0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
|
||||||
|
{0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
|
||||||
|
{0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
|
||||||
|
{0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
|
||||||
|
{64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
|
||||||
|
{0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
|
||||||
|
{0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
|
||||||
|
{18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
|
||||||
|
{0,9,255}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const code distfix[32] = {
|
||||||
|
{16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
|
||||||
|
{21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
|
||||||
|
{18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
|
||||||
|
{19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
|
||||||
|
{16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
|
||||||
|
{22,5,193},{64,5,0}
|
||||||
|
};
|
||||||
115
src/dep/include/zlib/inflate.h
Normal file
115
src/dep/include/zlib/inflate.h
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/* inflate.h -- internal inflate state definition
|
||||||
|
* Copyright (C) 1995-2004 Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* WARNING: this file should *not* be used by applications. It is
|
||||||
|
part of the implementation of the compression library and is
|
||||||
|
subject to change. Applications should only use zlib.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* define NO_GZIP when compiling if you want to disable gzip header and
|
||||||
|
trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
|
||||||
|
the crc code when it is not needed. For shared libraries, gzip decoding
|
||||||
|
should be left enabled. */
|
||||||
|
#ifndef NO_GZIP
|
||||||
|
# define GUNZIP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Possible inflate modes between inflate() calls */
|
||||||
|
typedef enum {
|
||||||
|
HEAD, /* i: waiting for magic header */
|
||||||
|
FLAGS, /* i: waiting for method and flags (gzip) */
|
||||||
|
TIME, /* i: waiting for modification time (gzip) */
|
||||||
|
OS, /* i: waiting for extra flags and operating system (gzip) */
|
||||||
|
EXLEN, /* i: waiting for extra length (gzip) */
|
||||||
|
EXTRA, /* i: waiting for extra bytes (gzip) */
|
||||||
|
NAME, /* i: waiting for end of file name (gzip) */
|
||||||
|
COMMENT, /* i: waiting for end of comment (gzip) */
|
||||||
|
HCRC, /* i: waiting for header crc (gzip) */
|
||||||
|
DICTID, /* i: waiting for dictionary check value */
|
||||||
|
DICT, /* waiting for inflateSetDictionary() call */
|
||||||
|
TYPE, /* i: waiting for type bits, including last-flag bit */
|
||||||
|
TYPEDO, /* i: same, but skip check to exit inflate on new block */
|
||||||
|
STORED, /* i: waiting for stored size (length and complement) */
|
||||||
|
COPY, /* i/o: waiting for input or output to copy stored block */
|
||||||
|
TABLE, /* i: waiting for dynamic block table lengths */
|
||||||
|
LENLENS, /* i: waiting for code length code lengths */
|
||||||
|
CODELENS, /* i: waiting for length/lit and distance code lengths */
|
||||||
|
LEN, /* i: waiting for length/lit code */
|
||||||
|
LENEXT, /* i: waiting for length extra bits */
|
||||||
|
DIST, /* i: waiting for distance code */
|
||||||
|
DISTEXT, /* i: waiting for distance extra bits */
|
||||||
|
MATCH, /* o: waiting for output space to copy string */
|
||||||
|
LIT, /* o: waiting for output space to write literal */
|
||||||
|
CHECK, /* i: waiting for 32-bit check value */
|
||||||
|
LENGTH, /* i: waiting for 32-bit length (gzip) */
|
||||||
|
DONE, /* finished check, done -- remain here until reset */
|
||||||
|
BAD, /* got a data error -- remain here until reset */
|
||||||
|
MEM, /* got an inflate() memory error -- remain here until reset */
|
||||||
|
SYNC /* looking for synchronization bytes to restart inflate() */
|
||||||
|
} inflate_mode;
|
||||||
|
|
||||||
|
/*
|
||||||
|
State transitions between above modes -
|
||||||
|
|
||||||
|
(most modes can go to the BAD or MEM mode -- not shown for clarity)
|
||||||
|
|
||||||
|
Process header:
|
||||||
|
HEAD -> (gzip) or (zlib)
|
||||||
|
(gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
|
||||||
|
NAME -> COMMENT -> HCRC -> TYPE
|
||||||
|
(zlib) -> DICTID or TYPE
|
||||||
|
DICTID -> DICT -> TYPE
|
||||||
|
Read deflate blocks:
|
||||||
|
TYPE -> STORED or TABLE or LEN or CHECK
|
||||||
|
STORED -> COPY -> TYPE
|
||||||
|
TABLE -> LENLENS -> CODELENS -> LEN
|
||||||
|
Read deflate codes:
|
||||||
|
LEN -> LENEXT or LIT or TYPE
|
||||||
|
LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
|
||||||
|
LIT -> LEN
|
||||||
|
Process trailer:
|
||||||
|
CHECK -> LENGTH -> DONE
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* state maintained between inflate() calls. Approximately 7K bytes. */
|
||||||
|
struct inflate_state {
|
||||||
|
inflate_mode mode; /* current inflate mode */
|
||||||
|
int last; /* true if processing last block */
|
||||||
|
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
|
||||||
|
int havedict; /* true if dictionary provided */
|
||||||
|
int flags; /* gzip header method and flags (0 if zlib) */
|
||||||
|
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
|
||||||
|
unsigned long check; /* protected copy of check value */
|
||||||
|
unsigned long total; /* protected copy of output count */
|
||||||
|
gz_headerp head; /* where to save gzip header information */
|
||||||
|
/* sliding window */
|
||||||
|
unsigned wbits; /* log base 2 of requested window size */
|
||||||
|
unsigned wsize; /* window size or zero if not using window */
|
||||||
|
unsigned whave; /* valid bytes in the window */
|
||||||
|
unsigned write; /* window write index */
|
||||||
|
unsigned char FAR *window; /* allocated sliding window, if needed */
|
||||||
|
/* bit accumulator */
|
||||||
|
unsigned long hold; /* input bit accumulator */
|
||||||
|
unsigned bits; /* number of bits in "in" */
|
||||||
|
/* for string and stored block copying */
|
||||||
|
unsigned length; /* literal or length of data to copy */
|
||||||
|
unsigned offset; /* distance back to copy string from */
|
||||||
|
/* for table and code decoding */
|
||||||
|
unsigned extra; /* extra bits needed */
|
||||||
|
/* fixed and dynamic code tables */
|
||||||
|
code const FAR *lencode; /* starting table for length/literal codes */
|
||||||
|
code const FAR *distcode; /* starting table for distance codes */
|
||||||
|
unsigned lenbits; /* index bits for lencode */
|
||||||
|
unsigned distbits; /* index bits for distcode */
|
||||||
|
/* dynamic table building */
|
||||||
|
unsigned ncode; /* number of code length code lengths */
|
||||||
|
unsigned nlen; /* number of length code lengths */
|
||||||
|
unsigned ndist; /* number of distance code lengths */
|
||||||
|
unsigned have; /* number of code lengths in lens[] */
|
||||||
|
code FAR *next; /* next available space in codes[] */
|
||||||
|
unsigned short lens[320]; /* temporary storage for code lengths */
|
||||||
|
unsigned short work[288]; /* work area for code table building */
|
||||||
|
code codes[ENOUGH]; /* space for code tables */
|
||||||
|
};
|
||||||
55
src/dep/include/zlib/inftrees.h
Normal file
55
src/dep/include/zlib/inftrees.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/* inftrees.h -- header to use inftrees.c
|
||||||
|
* Copyright (C) 1995-2005 Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* WARNING: this file should *not* be used by applications. It is
|
||||||
|
part of the implementation of the compression library and is
|
||||||
|
subject to change. Applications should only use zlib.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Structure for decoding tables. Each entry provides either the
|
||||||
|
information needed to do the operation requested by the code that
|
||||||
|
indexed that table entry, or it provides a pointer to another
|
||||||
|
table that indexes more bits of the code. op indicates whether
|
||||||
|
the entry is a pointer to another table, a literal, a length or
|
||||||
|
distance, an end-of-block, or an invalid code. For a table
|
||||||
|
pointer, the low four bits of op is the number of index bits of
|
||||||
|
that table. For a length or distance, the low four bits of op
|
||||||
|
is the number of extra bits to get after the code. bits is
|
||||||
|
the number of bits in this code or part of the code to drop off
|
||||||
|
of the bit buffer. val is the actual byte to output in the case
|
||||||
|
of a literal, the base length or distance, or the offset from
|
||||||
|
the current table to the next table. Each entry is four bytes. */
|
||||||
|
typedef struct {
|
||||||
|
unsigned char op; /* operation, extra bits, table bits */
|
||||||
|
unsigned char bits; /* bits in this part of the code */
|
||||||
|
unsigned short val; /* offset in table or code value */
|
||||||
|
} code;
|
||||||
|
|
||||||
|
/* op values as set by inflate_table():
|
||||||
|
00000000 - literal
|
||||||
|
0000tttt - table link, tttt != 0 is the number of table index bits
|
||||||
|
0001eeee - length or distance, eeee is the number of extra bits
|
||||||
|
01100000 - end of block
|
||||||
|
01000000 - invalid code
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Maximum size of dynamic tree. The maximum found in a long but non-
|
||||||
|
exhaustive search was 1444 code structures (852 for length/literals
|
||||||
|
and 592 for distances, the latter actually the result of an
|
||||||
|
exhaustive search). The true maximum is not known, but the value
|
||||||
|
below is more than safe. */
|
||||||
|
#define ENOUGH 2048
|
||||||
|
#define MAXD 592
|
||||||
|
|
||||||
|
/* Type of code to build for inftable() */
|
||||||
|
typedef enum {
|
||||||
|
CODES,
|
||||||
|
LENS,
|
||||||
|
DISTS
|
||||||
|
} codetype;
|
||||||
|
|
||||||
|
extern int inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||||
|
unsigned codes, code FAR * FAR *table,
|
||||||
|
unsigned FAR *bits, unsigned short FAR *work));
|
||||||
128
src/dep/include/zlib/trees.h
Normal file
128
src/dep/include/zlib/trees.h
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/* header created automatically with -DGEN_TREES_H */
|
||||||
|
|
||||||
|
local const ct_data static_ltree[L_CODES+2] = {
|
||||||
|
{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
|
||||||
|
{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
|
||||||
|
{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
|
||||||
|
{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
|
||||||
|
{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
|
||||||
|
{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
|
||||||
|
{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
|
||||||
|
{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
|
||||||
|
{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
|
||||||
|
{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
|
||||||
|
{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
|
||||||
|
{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
|
||||||
|
{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
|
||||||
|
{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
|
||||||
|
{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
|
||||||
|
{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
|
||||||
|
{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
|
||||||
|
{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
|
||||||
|
{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
|
||||||
|
{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
|
||||||
|
{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
|
||||||
|
{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
|
||||||
|
{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
|
||||||
|
{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
|
||||||
|
{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
|
||||||
|
{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
|
||||||
|
{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
|
||||||
|
{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
|
||||||
|
{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
|
||||||
|
{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
|
||||||
|
{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
|
||||||
|
{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
|
||||||
|
{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
|
||||||
|
{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
|
||||||
|
{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
|
||||||
|
{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
|
||||||
|
{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
|
||||||
|
{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
|
||||||
|
{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
|
||||||
|
{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
|
||||||
|
{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
|
||||||
|
{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
|
||||||
|
{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
|
||||||
|
{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
|
||||||
|
{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
|
||||||
|
{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
|
||||||
|
{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
|
||||||
|
{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
|
||||||
|
{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
|
||||||
|
{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
|
||||||
|
{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
|
||||||
|
{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
|
||||||
|
{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
|
||||||
|
{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
|
||||||
|
{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
|
||||||
|
{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
|
||||||
|
{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
|
||||||
|
{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
|
||||||
|
};
|
||||||
|
|
||||||
|
local const ct_data static_dtree[D_CODES] = {
|
||||||
|
{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
|
||||||
|
{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
|
||||||
|
{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
|
||||||
|
{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
|
||||||
|
{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
|
||||||
|
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
|
||||||
|
};
|
||||||
|
|
||||||
|
const uch _dist_code[DIST_CODE_LEN] = {
|
||||||
|
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
|
||||||
|
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||||
|
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
||||||
|
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
|
||||||
|
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
|
||||||
|
13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||||
|
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||||
|
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||||
|
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||||
|
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||||
|
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||||
|
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
|
||||||
|
18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
|
||||||
|
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
|
||||||
|
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
||||||
|
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||||
|
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||||
|
27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||||
|
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||||
|
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||||
|
28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||||
|
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
|
||||||
|
};
|
||||||
|
|
||||||
|
const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
|
||||||
|
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||||
|
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
|
||||||
|
19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||||
|
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
|
||||||
|
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
|
||||||
|
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||||
|
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
|
||||||
|
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
|
||||||
|
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
||||||
|
26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||||
|
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
|
||||||
|
};
|
||||||
|
|
||||||
|
local const int base_length[LENGTH_CODES] = {
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
|
||||||
|
64, 80, 96, 112, 128, 160, 192, 224, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
local const int base_dist[D_CODES] = {
|
||||||
|
0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
|
||||||
|
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
|
||||||
|
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
|
||||||
|
};
|
||||||
|
|
||||||
332
src/dep/include/zlib/zconf.h
Normal file
332
src/dep/include/zlib/zconf.h
Normal file
@ -0,0 +1,332 @@
|
|||||||
|
/* zconf.h -- configuration of the zlib compression library
|
||||||
|
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @(#) $Id$ */
|
||||||
|
|
||||||
|
#ifndef ZCONF_H
|
||||||
|
#define ZCONF_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If you *really* need a unique prefix for all types and library functions,
|
||||||
|
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||||
|
*/
|
||||||
|
#ifdef Z_PREFIX
|
||||||
|
# define deflateInit_ z_deflateInit_
|
||||||
|
# define deflate z_deflate
|
||||||
|
# define deflateEnd z_deflateEnd
|
||||||
|
# define inflateInit_ z_inflateInit_
|
||||||
|
# define inflate z_inflate
|
||||||
|
# define inflateEnd z_inflateEnd
|
||||||
|
# define deflateInit2_ z_deflateInit2_
|
||||||
|
# define deflateSetDictionary z_deflateSetDictionary
|
||||||
|
# define deflateCopy z_deflateCopy
|
||||||
|
# define deflateReset z_deflateReset
|
||||||
|
# define deflateParams z_deflateParams
|
||||||
|
# define deflateBound z_deflateBound
|
||||||
|
# define deflatePrime z_deflatePrime
|
||||||
|
# define inflateInit2_ z_inflateInit2_
|
||||||
|
# define inflateSetDictionary z_inflateSetDictionary
|
||||||
|
# define inflateSync z_inflateSync
|
||||||
|
# define inflateSyncPoint z_inflateSyncPoint
|
||||||
|
# define inflateCopy z_inflateCopy
|
||||||
|
# define inflateReset z_inflateReset
|
||||||
|
# define inflateBack z_inflateBack
|
||||||
|
# define inflateBackEnd z_inflateBackEnd
|
||||||
|
# define compress z_compress
|
||||||
|
# define compress2 z_compress2
|
||||||
|
# define compressBound z_compressBound
|
||||||
|
# define uncompress z_uncompress
|
||||||
|
# define adler32 z_adler32
|
||||||
|
# define crc32 z_crc32
|
||||||
|
# define get_crc_table z_get_crc_table
|
||||||
|
# define zError z_zError
|
||||||
|
|
||||||
|
# define alloc_func z_alloc_func
|
||||||
|
# define free_func z_free_func
|
||||||
|
# define in_func z_in_func
|
||||||
|
# define out_func z_out_func
|
||||||
|
# define Byte z_Byte
|
||||||
|
# define uInt z_uInt
|
||||||
|
# define uLong z_uLong
|
||||||
|
# define Bytef z_Bytef
|
||||||
|
# define charf z_charf
|
||||||
|
# define intf z_intf
|
||||||
|
# define uIntf z_uIntf
|
||||||
|
# define uLongf z_uLongf
|
||||||
|
# define voidpf z_voidpf
|
||||||
|
# define voidp z_voidp
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||||
|
# define MSDOS
|
||||||
|
#endif
|
||||||
|
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||||
|
# define OS2
|
||||||
|
#endif
|
||||||
|
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||||
|
# define WINDOWS
|
||||||
|
#endif
|
||||||
|
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||||
|
# ifndef WIN32
|
||||||
|
# define WIN32
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||||
|
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||||
|
# ifndef SYS16BIT
|
||||||
|
# define SYS16BIT
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||||
|
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||||
|
*/
|
||||||
|
#ifdef SYS16BIT
|
||||||
|
# define MAXSEG_64K
|
||||||
|
#endif
|
||||||
|
#ifdef MSDOS
|
||||||
|
# define UNALIGNED_OK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __STDC_VERSION__
|
||||||
|
# ifndef STDC
|
||||||
|
# define STDC
|
||||||
|
# endif
|
||||||
|
# if __STDC_VERSION__ >= 199901L
|
||||||
|
# ifndef STDC99
|
||||||
|
# define STDC99
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||||
|
# define STDC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef STDC
|
||||||
|
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||||
|
# define const /* note: need a more gentle solution here */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Some Mac compilers merge all .h files incorrectly: */
|
||||||
|
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||||
|
# define NO_DUMMY_DECL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Maximum value for memLevel in deflateInit2 */
|
||||||
|
#ifndef MAX_MEM_LEVEL
|
||||||
|
# ifdef MAXSEG_64K
|
||||||
|
# define MAX_MEM_LEVEL 8
|
||||||
|
# else
|
||||||
|
# define MAX_MEM_LEVEL 9
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||||
|
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||||
|
* created by gzip. (Files created by minigzip can still be extracted by
|
||||||
|
* gzip.)
|
||||||
|
*/
|
||||||
|
#ifndef MAX_WBITS
|
||||||
|
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The memory requirements for deflate are (in bytes):
|
||||||
|
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||||
|
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||||
|
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||||
|
the default memory requirements from 256K to 128K, compile with
|
||||||
|
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||||
|
Of course this will generally degrade compression (there's no free lunch).
|
||||||
|
|
||||||
|
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||||
|
that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
||||||
|
for small objects.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Type declarations */
|
||||||
|
|
||||||
|
#ifndef OF /* function prototypes */
|
||||||
|
# ifdef STDC
|
||||||
|
# define OF(args) args
|
||||||
|
# else
|
||||||
|
# define OF(args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||||
|
* model programming (small or medium model with some far allocations).
|
||||||
|
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||||
|
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||||
|
* just define FAR to be empty.
|
||||||
|
*/
|
||||||
|
#ifdef SYS16BIT
|
||||||
|
# if defined(M_I86SM) || defined(M_I86MM)
|
||||||
|
/* MSC small or medium model */
|
||||||
|
# define SMALL_MEDIUM
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
# define FAR _far
|
||||||
|
# else
|
||||||
|
# define FAR far
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||||
|
/* Turbo C small or medium model */
|
||||||
|
# define SMALL_MEDIUM
|
||||||
|
# ifdef __BORLANDC__
|
||||||
|
# define FAR _far
|
||||||
|
# else
|
||||||
|
# define FAR far
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(WINDOWS) || defined(WIN32)
|
||||||
|
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||||
|
* This is not mandatory, but it offers a little performance increase.
|
||||||
|
*/
|
||||||
|
# ifdef ZLIB_DLL
|
||||||
|
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||||
|
# ifdef ZLIB_INTERNAL
|
||||||
|
# define ZEXTERN extern __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define ZEXTERN extern __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif /* ZLIB_DLL */
|
||||||
|
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||||
|
* define ZLIB_WINAPI.
|
||||||
|
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||||
|
*/
|
||||||
|
# ifdef ZLIB_WINAPI
|
||||||
|
# ifdef FAR
|
||||||
|
# undef FAR
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
|
/* No need for _export, use ZLIB.DEF instead. */
|
||||||
|
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||||
|
# define ZEXPORT WINAPI
|
||||||
|
# ifdef WIN32
|
||||||
|
# define ZEXPORTVA WINAPIV
|
||||||
|
# else
|
||||||
|
# define ZEXPORTVA FAR CDECL
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__BEOS__)
|
||||||
|
# ifdef ZLIB_DLL
|
||||||
|
# ifdef ZLIB_INTERNAL
|
||||||
|
# define ZEXPORT __declspec(dllexport)
|
||||||
|
# define ZEXPORTVA __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define ZEXPORT __declspec(dllimport)
|
||||||
|
# define ZEXPORTVA __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ZEXTERN
|
||||||
|
# define ZEXTERN extern
|
||||||
|
#endif
|
||||||
|
#ifndef ZEXPORT
|
||||||
|
# define ZEXPORT
|
||||||
|
#endif
|
||||||
|
#ifndef ZEXPORTVA
|
||||||
|
# define ZEXPORTVA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FAR
|
||||||
|
# define FAR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__MACTYPES__)
|
||||||
|
typedef unsigned char Byte; /* 8 bits */
|
||||||
|
#endif
|
||||||
|
typedef unsigned int uInt; /* 16 bits or more */
|
||||||
|
typedef unsigned long uLong; /* 32 bits or more */
|
||||||
|
|
||||||
|
#ifdef SMALL_MEDIUM
|
||||||
|
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||||
|
# define Bytef Byte FAR
|
||||||
|
#else
|
||||||
|
typedef Byte FAR Bytef;
|
||||||
|
#endif
|
||||||
|
typedef char FAR charf;
|
||||||
|
typedef int FAR intf;
|
||||||
|
typedef uInt FAR uIntf;
|
||||||
|
typedef uLong FAR uLongf;
|
||||||
|
|
||||||
|
#ifdef STDC
|
||||||
|
typedef void const *voidpc;
|
||||||
|
typedef void FAR *voidpf;
|
||||||
|
typedef void *voidp;
|
||||||
|
#else
|
||||||
|
typedef Byte const *voidpc;
|
||||||
|
typedef Byte FAR *voidpf;
|
||||||
|
typedef Byte *voidp;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
||||||
|
# include <sys/types.h> /* for off_t */
|
||||||
|
# include <unistd.h> /* for SEEK_* and off_t */
|
||||||
|
# ifdef VMS
|
||||||
|
# include <unixio.h> /* for off_t */
|
||||||
|
# endif
|
||||||
|
# define z_off_t off_t
|
||||||
|
#endif
|
||||||
|
#ifndef SEEK_SET
|
||||||
|
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||||
|
# define SEEK_CUR 1 /* Seek from current position. */
|
||||||
|
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||||
|
#endif
|
||||||
|
#ifndef z_off_t
|
||||||
|
# define z_off_t long
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__OS400__)
|
||||||
|
# define NO_vsnprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MVS__)
|
||||||
|
# define NO_vsnprintf
|
||||||
|
# ifdef FAR
|
||||||
|
# undef FAR
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* MVS linker does not support external names larger than 8 bytes */
|
||||||
|
#if defined(__MVS__)
|
||||||
|
# pragma map(deflateInit_,"DEIN")
|
||||||
|
# pragma map(deflateInit2_,"DEIN2")
|
||||||
|
# pragma map(deflateEnd,"DEEND")
|
||||||
|
# pragma map(deflateBound,"DEBND")
|
||||||
|
# pragma map(inflateInit_,"ININ")
|
||||||
|
# pragma map(inflateInit2_,"ININ2")
|
||||||
|
# pragma map(inflateEnd,"INEND")
|
||||||
|
# pragma map(inflateSync,"INSY")
|
||||||
|
# pragma map(inflateSetDictionary,"INSEDI")
|
||||||
|
# pragma map(compressBound,"CMBND")
|
||||||
|
# pragma map(inflate_table,"INTABL")
|
||||||
|
# pragma map(inflate_fast,"INFA")
|
||||||
|
# pragma map(inflate_copyright,"INCOPY")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* ZCONF_H */
|
||||||
1357
src/dep/include/zlib/zlib.h
Normal file
1357
src/dep/include/zlib/zlib.h
Normal file
File diff suppressed because it is too large
Load Diff
269
src/dep/include/zlib/zutil.h
Normal file
269
src/dep/include/zlib/zutil.h
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
/* zutil.h -- internal interface and configuration of the compression library
|
||||||
|
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* WARNING: this file should *not* be used by applications. It is
|
||||||
|
part of the implementation of the compression library and is
|
||||||
|
subject to change. Applications should only use zlib.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @(#) $Id$ */
|
||||||
|
|
||||||
|
#ifndef ZUTIL_H
|
||||||
|
#define ZUTIL_H
|
||||||
|
|
||||||
|
#define ZLIB_INTERNAL
|
||||||
|
#include "zlib.h"
|
||||||
|
|
||||||
|
#ifdef STDC
|
||||||
|
# ifndef _WIN32_WCE
|
||||||
|
# include <stddef.h>
|
||||||
|
# endif
|
||||||
|
# include <string.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef NO_ERRNO_H
|
||||||
|
# ifdef _WIN32_WCE
|
||||||
|
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
||||||
|
* errno. We define it as a global variable to simplify porting.
|
||||||
|
* Its value is always 0 and should not be used. We rename it to
|
||||||
|
* avoid conflict with other libraries that use the same workaround.
|
||||||
|
*/
|
||||||
|
# define errno z_errno
|
||||||
|
# endif
|
||||||
|
extern int errno;
|
||||||
|
#else
|
||||||
|
# ifndef _WIN32_WCE
|
||||||
|
# include <errno.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef local
|
||||||
|
# define local static
|
||||||
|
#endif
|
||||||
|
/* compile with -Dlocal if your debugger can't find static symbols */
|
||||||
|
|
||||||
|
typedef unsigned char uch;
|
||||||
|
typedef uch FAR uchf;
|
||||||
|
typedef unsigned short ush;
|
||||||
|
typedef ush FAR ushf;
|
||||||
|
typedef unsigned long ulg;
|
||||||
|
|
||||||
|
extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
|
/* (size given to avoid silly warnings with Visual C++) */
|
||||||
|
|
||||||
|
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
||||||
|
|
||||||
|
#define ERR_RETURN(strm,err) \
|
||||||
|
return (strm->msg = (char*)ERR_MSG(err), (err))
|
||||||
|
/* To be used only when the state is known to be valid */
|
||||||
|
|
||||||
|
/* common constants */
|
||||||
|
|
||||||
|
#ifndef DEF_WBITS
|
||||||
|
# define DEF_WBITS MAX_WBITS
|
||||||
|
#endif
|
||||||
|
/* default windowBits for decompression. MAX_WBITS is for compression only */
|
||||||
|
|
||||||
|
#if MAX_MEM_LEVEL >= 8
|
||||||
|
# define DEF_MEM_LEVEL 8
|
||||||
|
#else
|
||||||
|
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||||
|
#endif
|
||||||
|
/* default memLevel */
|
||||||
|
|
||||||
|
#define STORED_BLOCK 0
|
||||||
|
#define STATIC_TREES 1
|
||||||
|
#define DYN_TREES 2
|
||||||
|
/* The three kinds of block type */
|
||||||
|
|
||||||
|
#define MIN_MATCH 3
|
||||||
|
#define MAX_MATCH 258
|
||||||
|
/* The minimum and maximum match lengths */
|
||||||
|
|
||||||
|
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
|
||||||
|
|
||||||
|
/* target dependencies */
|
||||||
|
|
||||||
|
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
|
||||||
|
# define OS_CODE 0x00
|
||||||
|
# if defined(__TURBOC__) || defined(__BORLANDC__)
|
||||||
|
# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
|
||||||
|
/* Allow compilation with ANSI keywords only enabled */
|
||||||
|
void _Cdecl farfree( void *block );
|
||||||
|
void *_Cdecl farmalloc( unsigned long nbytes );
|
||||||
|
# else
|
||||||
|
# include <alloc.h>
|
||||||
|
# endif
|
||||||
|
# else /* MSC or DJGPP */
|
||||||
|
# include <malloc.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef AMIGA
|
||||||
|
# define OS_CODE 0x01
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(VAXC) || defined(VMS)
|
||||||
|
# define OS_CODE 0x02
|
||||||
|
# define F_OPEN(name, mode) \
|
||||||
|
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ATARI) || defined(atarist)
|
||||||
|
# define OS_CODE 0x05
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef OS2
|
||||||
|
# define OS_CODE 0x06
|
||||||
|
# ifdef M_I86
|
||||||
|
#include <malloc.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
||||||
|
# define OS_CODE 0x07
|
||||||
|
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
|
||||||
|
# include <unix.h> /* for fdopen */
|
||||||
|
# else
|
||||||
|
# ifndef fdopen
|
||||||
|
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TOPS20
|
||||||
|
# define OS_CODE 0x0a
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
|
||||||
|
# define OS_CODE 0x0b
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __50SERIES /* Prime/PRIMOS */
|
||||||
|
# define OS_CODE 0x0f
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_BEOS_) || defined(RISCOS)
|
||||||
|
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined(_MSC_VER) && (_MSC_VER > 600))
|
||||||
|
# if defined(_WIN32_WCE)
|
||||||
|
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||||
|
# ifndef _PTRDIFF_T_DEFINED
|
||||||
|
typedef int ptrdiff_t;
|
||||||
|
# define _PTRDIFF_T_DEFINED
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define fdopen(fd,type) _fdopen(fd,type)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* common defaults */
|
||||||
|
|
||||||
|
#ifndef OS_CODE
|
||||||
|
# define OS_CODE 0x03 /* assume Unix */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef F_OPEN
|
||||||
|
# define F_OPEN(name, mode) fopen((name), (mode))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* functions */
|
||||||
|
|
||||||
|
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
|
||||||
|
# ifndef HAVE_VSNPRINTF
|
||||||
|
# define HAVE_VSNPRINTF
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if defined(__CYGWIN__)
|
||||||
|
# ifndef HAVE_VSNPRINTF
|
||||||
|
# define HAVE_VSNPRINTF
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#ifndef HAVE_VSNPRINTF
|
||||||
|
# ifdef MSDOS
|
||||||
|
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
|
||||||
|
but for now we just assume it doesn't. */
|
||||||
|
# define NO_vsnprintf
|
||||||
|
# endif
|
||||||
|
# ifdef __TURBOC__
|
||||||
|
# define NO_vsnprintf
|
||||||
|
# endif
|
||||||
|
# ifdef WIN32
|
||||||
|
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
|
||||||
|
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
|
||||||
|
# define vsnprintf _vsnprintf
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifdef __SASC
|
||||||
|
# define NO_vsnprintf
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#ifdef VMS
|
||||||
|
# define NO_vsnprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(pyr)
|
||||||
|
# define NO_MEMCPY
|
||||||
|
#endif
|
||||||
|
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
|
||||||
|
/* Use our own functions for small and medium model with MSC <= 5.0.
|
||||||
|
* You may have to use the same strategy for Borland C (untested).
|
||||||
|
* The __SC__ check is for Symantec.
|
||||||
|
*/
|
||||||
|
# define NO_MEMCPY
|
||||||
|
#endif
|
||||||
|
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
|
||||||
|
# define HAVE_MEMCPY
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_MEMCPY
|
||||||
|
# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
|
||||||
|
# define zmemcpy _fmemcpy
|
||||||
|
# define zmemcmp _fmemcmp
|
||||||
|
# define zmemzero(dest, len) _fmemset(dest, 0, len)
|
||||||
|
# else
|
||||||
|
# define zmemcpy memcpy
|
||||||
|
# define zmemcmp memcmp
|
||||||
|
# define zmemzero(dest, len) memset(dest, 0, len)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
||||||
|
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
||||||
|
extern void zmemzero OF((Bytef* dest, uInt len));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Diagnostic functions */
|
||||||
|
#ifdef DEBUG
|
||||||
|
# include <stdio.h>
|
||||||
|
extern int z_verbose;
|
||||||
|
extern void z_error OF((char *m));
|
||||||
|
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
||||||
|
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
||||||
|
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
||||||
|
# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
|
||||||
|
# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
|
||||||
|
# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
|
||||||
|
#else
|
||||||
|
# define Assert(cond,msg)
|
||||||
|
# define Trace(x)
|
||||||
|
# define Tracev(x)
|
||||||
|
# define Tracevv(x)
|
||||||
|
# define Tracec(c,x)
|
||||||
|
# define Tracecv(c,x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
|
||||||
|
void zcfree OF((voidpf opaque, voidpf ptr));
|
||||||
|
|
||||||
|
#define ZALLOC(strm, items, size) \
|
||||||
|
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||||
|
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
|
||||||
|
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
|
||||||
|
|
||||||
|
#endif /* ZUTIL_H */
|
||||||
74
src/dep/include/zthread/AtomicCount.h
Normal file
74
src/dep/include/zthread/AtomicCount.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTATOMICCOUNT_H__
|
||||||
|
#define __ZTATOMICCOUNT_H__
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include "zthread/Config.h"
|
||||||
|
#include "zthread/NonCopyable.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class AtomicCount
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T09:41:55-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* This class provides an interface to a small integer whose value can be
|
||||||
|
* incremented or decremented atomically. It's designed to be as simple and
|
||||||
|
* lightweight as possible so that it can be used cheaply to create reference
|
||||||
|
* counts.
|
||||||
|
*/
|
||||||
|
class ZTHREAD_API AtomicCount : public NonCopyable {
|
||||||
|
|
||||||
|
void* _value;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new AtomicCount, initialized to a value of 1
|
||||||
|
AtomicCount();
|
||||||
|
|
||||||
|
//! Destroy a new AtomicCount
|
||||||
|
~AtomicCount();
|
||||||
|
|
||||||
|
//! Postfix decrement and return the current value
|
||||||
|
size_t operator--(int);
|
||||||
|
|
||||||
|
//! Postfix increment and return the current value
|
||||||
|
size_t operator++(int);
|
||||||
|
|
||||||
|
//! Prefix decrement and return the current value
|
||||||
|
size_t operator--();
|
||||||
|
|
||||||
|
//! Prefix increment and return the current value
|
||||||
|
size_t operator++();
|
||||||
|
|
||||||
|
|
||||||
|
}; /* AtomicCount */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTATOMICCOUNT_H__
|
||||||
328
src/dep/include/zthread/Barrier.h
Normal file
328
src/dep/include/zthread/Barrier.h
Normal file
@ -0,0 +1,328 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTBARRIER_H__
|
||||||
|
#define __ZTBARRIER_H__
|
||||||
|
|
||||||
|
#include "zthread/Condition.h"
|
||||||
|
#include "zthread/Guard.h"
|
||||||
|
#include "zthread/Waitable.h"
|
||||||
|
#include "zthread/Runnable.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Barrier
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T09:54:01-0400>
|
||||||
|
* @version 2.2.1
|
||||||
|
*
|
||||||
|
* A Barrier is a Waitable object that serves as synchronization points for
|
||||||
|
* a set of threads. A Barrier is constructed for a fixed number (<i>N</i>) of threads.
|
||||||
|
* Threads attempting to wait() on a Barrier (<i> 1 - N</i>) will block until the <i>N</i>th
|
||||||
|
* thread arrives. The <i>N</i>th thread will awaken all the the others.
|
||||||
|
*
|
||||||
|
* An optional Runnable command may be associated with the Barrier. This will be run()
|
||||||
|
* when the <i>N</i>th thread arrives and Barrier is not broken.
|
||||||
|
*
|
||||||
|
* <b>Error Checking</b>
|
||||||
|
*
|
||||||
|
* A Barrier uses an all-or-nothing. All threads involved must successfully
|
||||||
|
* meet at Barrier. If any one of those threads leaves before all the threads
|
||||||
|
* have (as the result of an error or exception) then all threads present at
|
||||||
|
* the Barrier will throw BrokenBarrier_Exception.
|
||||||
|
*
|
||||||
|
* A broken Barrier will cause all threads attempting to wait() on it to
|
||||||
|
* throw a BrokenBarrier_Exception.
|
||||||
|
*
|
||||||
|
* A Barrier will remain 'broken', until it is manually reset().
|
||||||
|
*/
|
||||||
|
template <unsigned int Count, class LockType>
|
||||||
|
class Barrier : public Waitable, private NonCopyable {
|
||||||
|
|
||||||
|
//! Broken flag
|
||||||
|
bool _broken;
|
||||||
|
//! Task flag
|
||||||
|
bool _haveTask;
|
||||||
|
//! Thread count
|
||||||
|
unsigned int _count;
|
||||||
|
//! Wait generation
|
||||||
|
unsigned int _generation;
|
||||||
|
//! Serialize access
|
||||||
|
LockType _lock;
|
||||||
|
//! Signaled when all thread arrive
|
||||||
|
Condition _arrived;
|
||||||
|
//! Command to run when all the thread arrive
|
||||||
|
Task _task;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a Barrier
|
||||||
|
Barrier()
|
||||||
|
: _broken(false), _haveTask(false), _count(Count), _generation(0), _arrived(_lock), _task(0) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Barrier that executes the given task when all threads arrive
|
||||||
|
* without error
|
||||||
|
*
|
||||||
|
* @param task Task to associate with this Barrier
|
||||||
|
*/
|
||||||
|
Barrier(const Task& task)
|
||||||
|
: _broken(false), _haveTask(true), _count(Count), _generation(0), _arrived(_lock),
|
||||||
|
_task(task) { }
|
||||||
|
|
||||||
|
//! Destroy this Barrier
|
||||||
|
virtual ~Barrier() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter barrier and wait for the other threads to arrive. This can block for an indefinite
|
||||||
|
* amount of time.
|
||||||
|
*
|
||||||
|
* @exception BrokenBarrier_Exception thrown when any thread has left a wait on this
|
||||||
|
* Barrier as a result of an error.
|
||||||
|
* @exception Interrupted_Exception thrown when the calling thread is interrupted.
|
||||||
|
* A thread may be interrupted at any time, prematurely ending a wait
|
||||||
|
* for one thread and breaking the barrier for all threads
|
||||||
|
*
|
||||||
|
* @see Waitable::wait()
|
||||||
|
*
|
||||||
|
* @post If no exception was thrown, all threads have successfully arrived
|
||||||
|
* @post If an exception was thrown, the barrier is broken
|
||||||
|
*/
|
||||||
|
virtual void wait() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
if(_broken)
|
||||||
|
throw BrokenBarrier_Exception();
|
||||||
|
|
||||||
|
// Break the barrier if an arriving thread is interrupted
|
||||||
|
if(Thread::interrupted()) {
|
||||||
|
|
||||||
|
// Release the other waiter, propagate the exception
|
||||||
|
_arrived.broadcast();
|
||||||
|
_broken = true;
|
||||||
|
|
||||||
|
throw Interrupted_Exception();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(--_count == 0) {
|
||||||
|
|
||||||
|
// Wake the other threads if this was the last
|
||||||
|
// arriving thread
|
||||||
|
_arrived.broadcast();
|
||||||
|
|
||||||
|
// Try to run the associated task, if it throws then
|
||||||
|
// break the barrier and propagate the exception
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(_task)
|
||||||
|
_task->run();
|
||||||
|
|
||||||
|
_generation++;
|
||||||
|
|
||||||
|
} catch(Synchronization_Exception&) {
|
||||||
|
|
||||||
|
_broken = true;
|
||||||
|
throw;
|
||||||
|
|
||||||
|
} catch(...) { assert(0); }
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
int myGeneration = _generation;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Wait for the other threads to arrive
|
||||||
|
_arrived.wait();
|
||||||
|
|
||||||
|
} catch(Interrupted_Exception&) {
|
||||||
|
|
||||||
|
// Its possible for a thread to be interrupted before the
|
||||||
|
// last thread arrives. If the interrupted thread hasn't
|
||||||
|
// resumed, then just propagate the interruption
|
||||||
|
|
||||||
|
if(myGeneration != _generation)
|
||||||
|
Thread().interrupt();
|
||||||
|
|
||||||
|
else _broken = true;
|
||||||
|
|
||||||
|
} catch(Synchronization_Exception&) {
|
||||||
|
|
||||||
|
// Break the barrier and propagate the exception
|
||||||
|
_broken = true;
|
||||||
|
throw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the thread woke because it was notified by the thread
|
||||||
|
// that broke the barrier, throw.
|
||||||
|
if(_broken)
|
||||||
|
throw BrokenBarrier_Exception();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter barrier and wait for the other threads to arrive. This can block up to the
|
||||||
|
* amount of time specified with the timeout parameter. The barrier will not break
|
||||||
|
* if a thread leaves this function due to a timeout.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time, in milliseconds, to wait before
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if the set of tasks being wait for complete before
|
||||||
|
* <i>timeout</i> milliseconds elapse.
|
||||||
|
* - <em>false</em> otherwise.
|
||||||
|
*
|
||||||
|
* @exception BrokenBarrier_Exception thrown when any thread has left a wait on this
|
||||||
|
* Barrier as a result of an error.
|
||||||
|
* @exception Interrupted_Exception thrown when the calling thread is interrupted.
|
||||||
|
* A thread may be interrupted at any time, prematurely ending a wait
|
||||||
|
* for one thread and breaking the barrier for all threads
|
||||||
|
*
|
||||||
|
* @see Waitable::wait(unsigned long timeout)
|
||||||
|
*
|
||||||
|
* @post If no exception was thrown, all threads have successfully arrived
|
||||||
|
* @post If an exception was thrown, the barrier is broken
|
||||||
|
*/
|
||||||
|
virtual bool wait(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
if(_broken)
|
||||||
|
throw BrokenBarrier_Exception();
|
||||||
|
|
||||||
|
// Break the barrier if an arriving thread is interrupted
|
||||||
|
if(Thread::interrupted()) {
|
||||||
|
|
||||||
|
// Release the other waiter, propagate the exception
|
||||||
|
_arrived.broadcast();
|
||||||
|
_broken = true;
|
||||||
|
|
||||||
|
throw Interrupted_Exception();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(--_count == 0) {
|
||||||
|
|
||||||
|
// Wake the other threads if this was the last
|
||||||
|
// arriving thread
|
||||||
|
_arrived.broadcast();
|
||||||
|
|
||||||
|
// Try to run the associated task, if it throws then
|
||||||
|
// break the barrier and propagate the exception
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(_task)
|
||||||
|
_task->run();
|
||||||
|
|
||||||
|
_generation++;
|
||||||
|
|
||||||
|
} catch(Synchronization_Exception&) {
|
||||||
|
|
||||||
|
_broken = true;
|
||||||
|
throw;
|
||||||
|
|
||||||
|
} catch(...) { assert(0); }
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
int myGeneration = _generation;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Wait for the other threads to arrive
|
||||||
|
if(!_arrived.wait(timeout))
|
||||||
|
_broken = true;
|
||||||
|
|
||||||
|
} catch(Interrupted_Exception&) {
|
||||||
|
|
||||||
|
// Its possible for a thread to be interrupted before the
|
||||||
|
// last thread arrives. If the interrupted thread hasn't
|
||||||
|
// resumed, then just propagate the interruption
|
||||||
|
|
||||||
|
if(myGeneration != _generation)
|
||||||
|
Thread().interrupt();
|
||||||
|
|
||||||
|
else _broken = true;
|
||||||
|
|
||||||
|
} catch(Synchronization_Exception&) {
|
||||||
|
|
||||||
|
// Break the barrier and propagate the exception
|
||||||
|
_broken = true;
|
||||||
|
throw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the thread woke because it was notified by the thread
|
||||||
|
// that broke the barrier, throw.
|
||||||
|
if(_broken)
|
||||||
|
throw BrokenBarrier_Exception();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Break the Barrier ending the wait for any threads that were waiting on
|
||||||
|
* the barrier.
|
||||||
|
*
|
||||||
|
* @post the Barrier is broken, all waiting threads will throw the
|
||||||
|
* BrokenBarrier_Exception
|
||||||
|
*/
|
||||||
|
void shatter() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
_broken = true;
|
||||||
|
_arrived.broadcast();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the Barrier.
|
||||||
|
*
|
||||||
|
* @post the Barrier is no longer Broken and can be used again.
|
||||||
|
*/
|
||||||
|
void reset() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
_broken = false;
|
||||||
|
_generation++;
|
||||||
|
_count = Count;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTBARRIER_H__
|
||||||
319
src/dep/include/zthread/BiasedReadWriteLock.h
Normal file
319
src/dep/include/zthread/BiasedReadWriteLock.h
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTBIASEDREADWRITELOCK_H__
|
||||||
|
#define __ZTBIASEDREADWRITELOCK_H__
|
||||||
|
|
||||||
|
#include "zthread/ReadWriteLock.h"
|
||||||
|
#include "zthread/Condition.h"
|
||||||
|
#include "zthread/Guard.h"
|
||||||
|
#include "zthread/FastMutex.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class BiasedReadWriteLock
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T10:22:34-0400>
|
||||||
|
* @version 2.2.7
|
||||||
|
*
|
||||||
|
* A BiasedReadWriteLock has a bias toward writers. It will prefer read-write access over
|
||||||
|
* read-only access when many threads are contending for access to either Lockable this
|
||||||
|
* ReadWriteLock provides.
|
||||||
|
*
|
||||||
|
* @see ReadWriteLock
|
||||||
|
*/
|
||||||
|
class BiasedReadWriteLock : public ReadWriteLock {
|
||||||
|
|
||||||
|
FastMutex _lock;
|
||||||
|
Condition _condRead;
|
||||||
|
Condition _condWrite;
|
||||||
|
|
||||||
|
volatile int _activeWriters;
|
||||||
|
volatile int _activeReaders;
|
||||||
|
|
||||||
|
volatile int _waitingReaders;
|
||||||
|
volatile int _waitingWriters;
|
||||||
|
|
||||||
|
//! @class ReadLock
|
||||||
|
class ReadLock : public Lockable {
|
||||||
|
|
||||||
|
BiasedReadWriteLock& _rwlock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ReadLock(BiasedReadWriteLock& rwlock) : _rwlock(rwlock) {}
|
||||||
|
|
||||||
|
virtual ~ReadLock() {}
|
||||||
|
|
||||||
|
virtual void acquire() {
|
||||||
|
_rwlock.beforeRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) {
|
||||||
|
return _rwlock.beforeReadAttempt(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void release() {
|
||||||
|
_rwlock.afterRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//! @class WriteLock
|
||||||
|
class WriteLock : public Lockable {
|
||||||
|
|
||||||
|
BiasedReadWriteLock& _rwlock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
WriteLock(BiasedReadWriteLock& rwlock) : _rwlock(rwlock) {}
|
||||||
|
|
||||||
|
virtual ~WriteLock() {}
|
||||||
|
|
||||||
|
|
||||||
|
virtual void acquire() {
|
||||||
|
_rwlock.beforeWrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) {
|
||||||
|
return _rwlock.beforeWriteAttempt(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void release() {
|
||||||
|
_rwlock.afterWrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
friend class ReadLock;
|
||||||
|
friend class WriteLock;
|
||||||
|
|
||||||
|
ReadLock _rlock;
|
||||||
|
WriteLock _wlock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a BiasedReadWriteLock
|
||||||
|
*
|
||||||
|
* @exception Initialization_Exception thrown if resources could not be
|
||||||
|
* allocated for this object.
|
||||||
|
*/
|
||||||
|
BiasedReadWriteLock() : _condRead(_lock), _condWrite(_lock), _rlock(*this), _wlock(*this) {
|
||||||
|
|
||||||
|
_activeWriters = 0;
|
||||||
|
_activeReaders = 0;
|
||||||
|
|
||||||
|
_waitingReaders = 0;
|
||||||
|
_waitingWriters = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Destroy this ReadWriteLock
|
||||||
|
virtual ~BiasedReadWriteLock() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ReadWriteLock::getReadLock()
|
||||||
|
*/
|
||||||
|
virtual Lockable& getReadLock() { return _rlock; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ReadWriteLock::getWriteLock()
|
||||||
|
*/
|
||||||
|
virtual Lockable& getWriteLock() { return _wlock; }
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void beforeRead() {
|
||||||
|
|
||||||
|
Guard<FastMutex> guard(_lock);
|
||||||
|
|
||||||
|
++_waitingReaders;
|
||||||
|
|
||||||
|
while(!allowReader()) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// wait
|
||||||
|
_condRead.wait();
|
||||||
|
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
--_waitingReaders;
|
||||||
|
throw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
--_waitingReaders;
|
||||||
|
++_activeReaders;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool beforeReadAttempt(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<FastMutex> guard(_lock);
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
++_waitingReaders;
|
||||||
|
|
||||||
|
while(!allowReader()) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
result = _condRead.wait(timeout);
|
||||||
|
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
--_waitingReaders;
|
||||||
|
throw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
--_waitingReaders;
|
||||||
|
++_activeReaders;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void afterRead() {
|
||||||
|
|
||||||
|
bool wakeReader = false;
|
||||||
|
bool wakeWriter = false;
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
Guard<FastMutex> guard(_lock);
|
||||||
|
|
||||||
|
--_activeReaders;
|
||||||
|
|
||||||
|
wakeReader = (_waitingReaders > 0);
|
||||||
|
wakeWriter = (_waitingWriters > 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(wakeWriter)
|
||||||
|
_condWrite.signal();
|
||||||
|
|
||||||
|
else if(wakeReader)
|
||||||
|
_condRead.signal();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void beforeWrite() {
|
||||||
|
|
||||||
|
Guard<FastMutex> guard(_lock);
|
||||||
|
|
||||||
|
++_waitingWriters;
|
||||||
|
|
||||||
|
while(!allowWriter()) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
_condWrite.wait();
|
||||||
|
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
--_waitingWriters;
|
||||||
|
throw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
--_waitingWriters;
|
||||||
|
++_activeWriters;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool beforeWriteAttempt(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<FastMutex> guard(_lock);
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
++_waitingWriters;
|
||||||
|
|
||||||
|
while(!allowWriter()) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
result = _condWrite.wait(timeout);
|
||||||
|
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
--_waitingWriters;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
--_waitingWriters;
|
||||||
|
++_activeWriters;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void afterWrite() {
|
||||||
|
|
||||||
|
bool wakeReader = false;
|
||||||
|
bool wakeWriter = false;
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
Guard<FastMutex> guard(_lock);
|
||||||
|
|
||||||
|
--_activeWriters;
|
||||||
|
|
||||||
|
wakeReader = (_waitingReaders > 0);
|
||||||
|
wakeWriter = (_waitingWriters > 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(wakeWriter)
|
||||||
|
_condWrite.signal();
|
||||||
|
|
||||||
|
else if(wakeReader)
|
||||||
|
_condRead.signal();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool allowReader() {
|
||||||
|
return (_activeWriters == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool allowWriter() {
|
||||||
|
return (_activeWriters == 0 && _activeReaders == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}; // __ZTBIASEDREADWRITELOCK_H__
|
||||||
|
|
||||||
|
#endif
|
||||||
245
src/dep/include/zthread/BlockingQueue.h
Normal file
245
src/dep/include/zthread/BlockingQueue.h
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTBLOCKINGQUEUE_H__
|
||||||
|
#define __ZTBLOCKINGQUEUE_H__
|
||||||
|
|
||||||
|
#include "zthread/Guard.h"
|
||||||
|
#include "zthread/Condition.h"
|
||||||
|
#include "zthread/Queue.h"
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class BlockingQueue
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T12:01:43-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* Like a LockedQueue, a BlockingQueue is a Queue implementation that provides
|
||||||
|
* serialized access to the items added to it. It differs by causing threads
|
||||||
|
* accessing the next() methods to block until a value becomes available.
|
||||||
|
*/
|
||||||
|
template <class T, class LockType, typename StorageType = std::deque<T> >
|
||||||
|
class BlockingQueue : public Queue<T>, public Lockable {
|
||||||
|
|
||||||
|
//! Serialize access
|
||||||
|
LockType _lock;
|
||||||
|
|
||||||
|
//! Signaled when empty
|
||||||
|
Condition _notEmpty;
|
||||||
|
|
||||||
|
//! Storage backing the queue
|
||||||
|
StorageType _queue;
|
||||||
|
|
||||||
|
//! Cancellation flag
|
||||||
|
volatile bool _canceled;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new BlockingQueue
|
||||||
|
BlockingQueue() : _notEmpty(_lock), _canceled(false) {}
|
||||||
|
|
||||||
|
//! Destroy this BlockingQueue
|
||||||
|
virtual ~BlockingQueue() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::add(const T& item)
|
||||||
|
*/
|
||||||
|
virtual void add(const T& item) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
if(_canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
_queue.push_back(item);
|
||||||
|
|
||||||
|
_notEmpty.signal();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::add(const T& item, unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual bool add(T item, unsigned long timeout) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
if(_canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
_queue.push_back(item);
|
||||||
|
|
||||||
|
_notEmpty.signal();
|
||||||
|
|
||||||
|
} catch(Timeout_Exception&) { return false; }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a value from this Queue. The calling thread may block indefinitely.
|
||||||
|
*
|
||||||
|
* @return <em>T</em> next available value
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown if the calling thread is interrupted
|
||||||
|
* before a value becomes available.
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post The value returned will have been removed from the Queue.
|
||||||
|
*
|
||||||
|
* @see Queue::next()
|
||||||
|
*/
|
||||||
|
virtual T next() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
while(_queue.size() == 0 && !_canceled)
|
||||||
|
_notEmpty.wait();
|
||||||
|
|
||||||
|
if( _queue.size() == 0 )
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
T item = _queue.front();
|
||||||
|
_queue.pop_front();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a value from this Queue. The calling thread may block indefinitely.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method may block
|
||||||
|
* the calling thread.
|
||||||
|
*
|
||||||
|
* @return <em>T</em> next available value
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Timeout_Exception thrown if the timeout expires before a value
|
||||||
|
* can be retrieved.
|
||||||
|
* @exception Interrupted_Exception thrown if the calling thread is interrupted
|
||||||
|
* before a value becomes available.
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post The value returned will have been removed from the Queue.
|
||||||
|
*
|
||||||
|
* @see Queue::next(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual T next(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
while(_queue.size() == 0 && !_canceled) {
|
||||||
|
if(!_notEmpty.wait(timeout))
|
||||||
|
throw Timeout_Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_queue.size() == 0 )
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
T item = _queue.front();
|
||||||
|
_queue.pop_front();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::cancel()
|
||||||
|
*
|
||||||
|
* @post If threads are blocked on one of the next() functions then
|
||||||
|
* they will be awakened with a Cancellation_Exception.
|
||||||
|
*/
|
||||||
|
virtual void cancel() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
_notEmpty.broadcast();
|
||||||
|
_canceled = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::isCanceled()
|
||||||
|
*/
|
||||||
|
virtual bool isCanceled() {
|
||||||
|
|
||||||
|
// Faster check since the queue will not become un-canceled
|
||||||
|
if(_canceled)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
return _canceled;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::size()
|
||||||
|
*/
|
||||||
|
virtual size_t size() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
return _queue.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::size(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual size_t size(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
return _queue.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void acquire() {
|
||||||
|
_lock.acquire();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) {
|
||||||
|
return _lock.tryAcquire(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void release() {
|
||||||
|
_lock.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
}; /* BlockingQueue */
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTBLOCKINGQUEUE_H__
|
||||||
387
src/dep/include/zthread/BoundedQueue.h
Normal file
387
src/dep/include/zthread/BoundedQueue.h
Normal file
@ -0,0 +1,387 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTBOUNDEDQUEUE_H__
|
||||||
|
#define __ZTBOUNDEDQUEUE_H__
|
||||||
|
|
||||||
|
#include "zthread/Condition.h"
|
||||||
|
#include "zthread/Guard.h"
|
||||||
|
#include "zthread/Queue.h"
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class BoundedQueue
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T13:54:04-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* A BoundedQueue provides serialized access to a set of values. It differs from other
|
||||||
|
* Queues by adding a maximum capacity, giving it the following properties:
|
||||||
|
*
|
||||||
|
* - Threads calling the empty() methods will be blocked until the BoundedQueue becomes empty.
|
||||||
|
* - Threads calling the next() methods will be blocked until the BoundedQueue has a value to
|
||||||
|
* return.
|
||||||
|
* - Threads calling the add() methods will be blocked until the number of values in the
|
||||||
|
* Queue drops below the maximum capacity.
|
||||||
|
*
|
||||||
|
* @see Queue
|
||||||
|
*/
|
||||||
|
template <class T, class LockType, typename StorageType=std::deque<T> >
|
||||||
|
class BoundedQueue : public Queue<T>, public Lockable {
|
||||||
|
|
||||||
|
//! Maximum capacity for the Queue
|
||||||
|
size_t _capacity;
|
||||||
|
|
||||||
|
//! Serialize access
|
||||||
|
LockType _lock;
|
||||||
|
|
||||||
|
//! Signaled if not full
|
||||||
|
Condition _notFull;
|
||||||
|
|
||||||
|
//! Signaled if not empty
|
||||||
|
Condition _notEmpty;
|
||||||
|
|
||||||
|
//! Signaled if empty
|
||||||
|
Condition _isEmpty;
|
||||||
|
|
||||||
|
//! Storage backing the queue
|
||||||
|
StorageType _queue;
|
||||||
|
|
||||||
|
//! Cancellation flag
|
||||||
|
volatile bool _canceled;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a BoundedQueue with the given capacity.
|
||||||
|
*
|
||||||
|
* @param capacity maximum number of values to allow in the Queue at
|
||||||
|
* at any time
|
||||||
|
*/
|
||||||
|
BoundedQueue(size_t capacity)
|
||||||
|
: _notFull(_lock), _notEmpty(_lock), _isEmpty(_lock),
|
||||||
|
_capacity(capacity), _canceled(false) {}
|
||||||
|
|
||||||
|
//! Destroy this Queue
|
||||||
|
virtual ~BoundedQueue() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the maximum capacity of this Queue.
|
||||||
|
*
|
||||||
|
* @return <i>size_t</i> maximum capacity
|
||||||
|
*/
|
||||||
|
size_t capacity() {
|
||||||
|
return _capacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value to this Queue.
|
||||||
|
*
|
||||||
|
* If the number of values in the queue matches the value returned by <i>capacity</i>()
|
||||||
|
* then the calling thread will be blocked until at least one value is removed from
|
||||||
|
* the Queue.
|
||||||
|
*
|
||||||
|
* @param item value to be added to the Queue
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Interrupted_Exception thrown if the thread was interrupted while waiting
|
||||||
|
* to add a value
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post If no exception is thrown, a copy of <i>item</i> will have been added to the Queue.
|
||||||
|
*
|
||||||
|
* @see Queue::add(const T& item)
|
||||||
|
*/
|
||||||
|
virtual void add(const T& item) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
// Wait for the capacity of the Queue to drop
|
||||||
|
while ((_queue.size() == _capacity) && !_canceled)
|
||||||
|
_notFull.wait();
|
||||||
|
|
||||||
|
if(_canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
_queue.push_back(item);
|
||||||
|
_notEmpty.signal(); // Wake any waiters
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value to this Queue.
|
||||||
|
*
|
||||||
|
* If the number of values in the queue matches the value returned by <i>capacity</i>()
|
||||||
|
* then the calling thread will be blocked until at least one value is removed from
|
||||||
|
* the Queue.
|
||||||
|
*
|
||||||
|
* @param item value to be added to the Queue
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method may block
|
||||||
|
* the calling thread.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if a copy of <i>item</i> can be added before <i>timeout</i>
|
||||||
|
* milliseconds elapse.
|
||||||
|
* - <em>false</em> otherwise.
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Interrupted_Exception thrown if the thread was interrupted while waiting
|
||||||
|
* to add a value
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post If no exception is thrown, a copy of <i>item</i> will have been added to the Queue.
|
||||||
|
*
|
||||||
|
* @see Queue::add(const T& item, unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual bool add(const T& item, unsigned long timeout) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
// Wait for the capacity of the Queue to drop
|
||||||
|
while ((_queue.size() == _capacity) && !_canceled)
|
||||||
|
if(!_notFull.wait(timeout))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(_canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
_queue.push_back(item);
|
||||||
|
_notEmpty.signal(); // Wake any waiters
|
||||||
|
|
||||||
|
} catch(Timeout_Exception&) { return false; }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve and remove a value from this Queue.
|
||||||
|
*
|
||||||
|
* If invoked when there are no values present to return then the calling thread
|
||||||
|
* will be blocked until a value arrives in the Queue.
|
||||||
|
*
|
||||||
|
* @return <em>T</em> next available value
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Interrupted_Exception thrown if the thread was interrupted while waiting
|
||||||
|
* to retrieve a value
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post The value returned will have been removed from the Queue.
|
||||||
|
*/
|
||||||
|
virtual T next() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
while ( _queue.size() == 0 && !_canceled)
|
||||||
|
_notEmpty.wait();
|
||||||
|
|
||||||
|
if( _queue.size() == 0) // Queue canceled
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
T item = _queue.front();
|
||||||
|
_queue.pop_front();
|
||||||
|
|
||||||
|
_notFull.signal(); // Wake any thread trying to add
|
||||||
|
|
||||||
|
if(_queue.size() == 0) // Wake empty waiters
|
||||||
|
_isEmpty.broadcast();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve and remove a value from this Queue.
|
||||||
|
*
|
||||||
|
* If invoked when there are no values present to return then the calling thread
|
||||||
|
* will be blocked until a value arrives in the Queue.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method may block
|
||||||
|
* the calling thread.
|
||||||
|
*
|
||||||
|
* @return <em>T</em> next available value
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Timeout_Exception thrown if the timeout expires before a value
|
||||||
|
* can be retrieved.
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post The value returned will have been removed from the Queue.
|
||||||
|
*/
|
||||||
|
virtual T next(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
// Wait for items to be added
|
||||||
|
while (_queue.size() == 0 && !_canceled) {
|
||||||
|
if(!_notEmpty.wait(timeout))
|
||||||
|
throw Timeout_Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_queue.size() == 0) // Queue canceled
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
T item = _queue.front();
|
||||||
|
_queue.pop_front();
|
||||||
|
|
||||||
|
_notFull.signal(); // Wake add() waiters
|
||||||
|
|
||||||
|
if(_queue.size() == 0) // Wake empty() waiters
|
||||||
|
_isEmpty.broadcast();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel this queue.
|
||||||
|
*
|
||||||
|
* @post Any threads blocked by an add() function will throw a Cancellation_Exception.
|
||||||
|
* @post Any threads blocked by a next() function will throw a Cancellation_Exception.
|
||||||
|
*
|
||||||
|
* @see Queue::cancel()
|
||||||
|
*/
|
||||||
|
virtual void cancel() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
_canceled = true;
|
||||||
|
_notEmpty.broadcast(); // Wake next() waiters
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::isCanceled()
|
||||||
|
*/
|
||||||
|
virtual bool isCanceled() {
|
||||||
|
|
||||||
|
// Faster check since the Queue will not become un-canceled
|
||||||
|
if(_canceled)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
return _canceled;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::size()
|
||||||
|
*/
|
||||||
|
virtual size_t size() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
return _queue.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::size(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual size_t size(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
return _queue.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether any values are available in this Queue.
|
||||||
|
*
|
||||||
|
* The calling thread is blocked until there are no values present
|
||||||
|
* in the Queue.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if there are no values available.
|
||||||
|
* - <em>false</em> if there <i>are</i> values available.
|
||||||
|
*
|
||||||
|
* @see Queue::empty()
|
||||||
|
*/
|
||||||
|
virtual bool empty() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
while(_queue.size() > 0) // Wait for an empty signal
|
||||||
|
_isEmpty.wait();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether any values are available in this Queue.
|
||||||
|
*
|
||||||
|
* The calling thread is blocked until there are no values present
|
||||||
|
* in the Queue.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method may block
|
||||||
|
* the calling thread.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if there are no values available.
|
||||||
|
* - <em>false</em> if there <i>are</i> values available.
|
||||||
|
*
|
||||||
|
* @exception Timeout_Exception thrown if <i>timeout</i> milliseconds
|
||||||
|
* expire before a value becomes available
|
||||||
|
*
|
||||||
|
* @see Queue::empty()
|
||||||
|
*/
|
||||||
|
virtual bool empty(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
while(_queue.size() > 0) // Wait for an empty signal
|
||||||
|
_isEmpty.wait(timeout);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void acquire() {
|
||||||
|
_lock.acquire();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) {
|
||||||
|
return _lock.tryAcquire(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void release() {
|
||||||
|
_lock.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
}; /* BoundedQueue */
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTBOUNDEDQUEUE_H__
|
||||||
86
src/dep/include/zthread/Cancelable.h
Normal file
86
src/dep/include/zthread/Cancelable.h
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTCANCELABLE_H__
|
||||||
|
#define __ZTCANCELABLE_H__
|
||||||
|
|
||||||
|
#include "zthread/Exceptions.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Cancelable
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T09:28:46-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* The Cancelable interface defines a common method of adding general <i>disable-and-exit</i>
|
||||||
|
* semantics to some object. By cancel()ing a Cancelable object, a request is
|
||||||
|
* made to disable that object.
|
||||||
|
*
|
||||||
|
* <b>Disabling</b>
|
||||||
|
*
|
||||||
|
* A cancel()ed object may not necessarily abort it work immediately. Often, it much more
|
||||||
|
* elegant for a cancel()ed object to complete handling whatever responsibilities have
|
||||||
|
* been assigned to it, but it will <i>not</i> take on any new responsibility.
|
||||||
|
*
|
||||||
|
* <b>Exiting</b>
|
||||||
|
*
|
||||||
|
* A cancel()ed should complete its responsibilities as soon as possible.
|
||||||
|
* Canceling is not only a request to stop taking on new responsibility, and to
|
||||||
|
* complete its current responsibility. Its also a request to complete dealing with its
|
||||||
|
* current responsibilities, quickly when possible.
|
||||||
|
*/
|
||||||
|
class Cancelable {
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Destroy a Cancelable object.
|
||||||
|
virtual ~Cancelable() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Canceling a Cancelable object makes a request to disable that object.
|
||||||
|
* This entails refusing to take on any new responsibility, and completing
|
||||||
|
* its current responsibilities quickly.
|
||||||
|
*
|
||||||
|
* Canceling an object more than once has no effect.
|
||||||
|
*
|
||||||
|
* @post The Cancelable object will have permanently transitioned to a
|
||||||
|
* disabled state; it will now refuse to accept new responsibility.
|
||||||
|
*/
|
||||||
|
virtual void cancel() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a Cancelable object has been canceled.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if cancel() was called prior to this function.
|
||||||
|
* - <em>false</em> otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool isCanceled() = 0;
|
||||||
|
|
||||||
|
}; /* Cancelable */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTCANCELABLE_H__
|
||||||
74
src/dep/include/zthread/ClassLockable.h
Normal file
74
src/dep/include/zthread/ClassLockable.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTCLASSLOCKABLE_H__
|
||||||
|
#define __ZTCLASSLOCKABLE_H__
|
||||||
|
|
||||||
|
#include "zthread/CountedPtr.h"
|
||||||
|
#include "zthread/Mutex.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class ClassLockable
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T23:37:38-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template <typename ClassType, class LockType = Mutex>
|
||||||
|
class ClassLockable : public Lockable {
|
||||||
|
|
||||||
|
static CountedPtr<LockType> _instance;
|
||||||
|
CountedPtr<LockType> _lock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a ClassLockable
|
||||||
|
ClassLockable()
|
||||||
|
: _lock(_instance) {}
|
||||||
|
|
||||||
|
//! acquire() the ClassLockable
|
||||||
|
virtual void acquire() {
|
||||||
|
_lock->acquire();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! tryAcquire() the ClassLockable
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) {
|
||||||
|
return _lock->tryAcquire(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! release() the ClassLockable
|
||||||
|
virtual void release() {
|
||||||
|
_lock->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename ClassType, class LockType>
|
||||||
|
CountedPtr<LockType> ClassLockable<ClassType, LockType>::_instance(new LockType);
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTCLASSLOCKABLE_H__
|
||||||
124
src/dep/include/zthread/ConcurrentExecutor.h
Normal file
124
src/dep/include/zthread/ConcurrentExecutor.h
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTCONCURRENTEXECUTOR_H__
|
||||||
|
#define __ZTCONCURRENTEXECUTOR_H__
|
||||||
|
|
||||||
|
#include "zthread/PoolExecutor.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class ConcurrentExecutor
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T22:36:11-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* A ConcurrentExecutor spawns a single thread to service a series of Tasks.
|
||||||
|
*
|
||||||
|
* @see PoolExecutor.
|
||||||
|
*/
|
||||||
|
class ConcurrentExecutor : public Executor {
|
||||||
|
|
||||||
|
PoolExecutor _executor;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a ConcurrentExecutor
|
||||||
|
ConcurrentExecutor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interrupting a ConcurrentExecutor will cause the thread running the tasks to be
|
||||||
|
* be interrupted once during the execution of each task that has been submitted
|
||||||
|
* at the time this function is called.
|
||||||
|
*
|
||||||
|
* Tasks that are submitted after this function is called will
|
||||||
|
* not be interrupt()ed; unless this function is invoked again().
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
*
|
||||||
|
* void aFunction() {
|
||||||
|
*
|
||||||
|
* ConcurrentExecutor executor;
|
||||||
|
*
|
||||||
|
* // Submit p Tasks
|
||||||
|
* for(size_t n = 0; n < p; n++)
|
||||||
|
* executor.execute(new aRunnable);
|
||||||
|
*
|
||||||
|
* // Tasks [m, p) may be interrupted, where m is the first task that has
|
||||||
|
* // not completed at the time the interrupt() is invoked.
|
||||||
|
* executor.interrupt();
|
||||||
|
*
|
||||||
|
* // Submit (q - p) Tasks
|
||||||
|
* for(size_t n = p; n < q; n++)
|
||||||
|
* executor.execute(new Chore);
|
||||||
|
*
|
||||||
|
* // Tasks [p, q) are not interrupted
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
virtual void interrupt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit a Task to this Executor. This will not block the current thread
|
||||||
|
* for very long. The task will be enqueued internally and eventually run
|
||||||
|
* in the context of the single thread driving all the Tasks submitted to this
|
||||||
|
* Executor.
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Executor has been canceled.
|
||||||
|
* The Task being submitted will not be executed by this Executor.
|
||||||
|
*
|
||||||
|
* @exception Synchronization_Exception thrown only in the event of an error
|
||||||
|
* in the implementation of the library.
|
||||||
|
*
|
||||||
|
* @see Executor::execute(const Task&)
|
||||||
|
*/
|
||||||
|
virtual void execute(const Task&);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Cancelable::cancel()
|
||||||
|
*/
|
||||||
|
virtual void cancel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Cancelable::isCanceled()
|
||||||
|
*/
|
||||||
|
virtual bool isCanceled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see PoolExecutor::wait()
|
||||||
|
*/
|
||||||
|
virtual void wait();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see PoolExecutor::wait(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual bool wait(unsigned long timeout);
|
||||||
|
|
||||||
|
}; /* ConcurrentExecutor */
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTCONCURRENTEXECUTOR_H__
|
||||||
154
src/dep/include/zthread/Condition.h
Normal file
154
src/dep/include/zthread/Condition.h
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTCONDITION_H__
|
||||||
|
#define __ZTCONDITION_H__
|
||||||
|
|
||||||
|
#include "zthread/Lockable.h"
|
||||||
|
#include "zthread/NonCopyable.h"
|
||||||
|
#include "zthread/Waitable.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
class FifoConditionImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Condition
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T14:38:59-0400>
|
||||||
|
* @version 2.2.1
|
||||||
|
*
|
||||||
|
* A Condition is a Waitable object used to block a thread until a particular
|
||||||
|
* condition is met. A Condition object is always used in conjunction with Lockable
|
||||||
|
* object. This object should be a FastMutex, Mutex, PriorityMutex or PriorityInheritanceMutex.
|
||||||
|
*
|
||||||
|
* Condition objects are reminiscent of POSIX condition variables in several ways but
|
||||||
|
* are slightly different.
|
||||||
|
*
|
||||||
|
* A Condition is <i>not</i> subject to spurious wakeup.
|
||||||
|
*
|
||||||
|
* Like all Waitable objects, Conditions are sensitive to Thread::interupt() which can
|
||||||
|
* be used to prematurely end a wait().
|
||||||
|
*
|
||||||
|
* @see Thread::interupt()
|
||||||
|
*
|
||||||
|
* Before a wait() is performed on a Condition, the associated Lockable object should
|
||||||
|
* have been acquire()ed. When the wait() begins, that Lockable object is release()d
|
||||||
|
* (wait() will atomically begin the wait and unlock the Lockable).
|
||||||
|
*
|
||||||
|
* A thread blocked by wait() will remain so until an exception occurs, or until
|
||||||
|
* the thread awakened by a signal() or broadcast(). When the thread resumes execution,
|
||||||
|
* the associated Lockable is acquire()d before wait() returns.
|
||||||
|
*
|
||||||
|
* <b>Scheduling</b>
|
||||||
|
*
|
||||||
|
* Threads blocked on a Condition are resumed in FIFO order.
|
||||||
|
*/
|
||||||
|
class ZTHREAD_API Condition : public Waitable, private NonCopyable {
|
||||||
|
|
||||||
|
FifoConditionImpl* _impl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Condition associated with the given Lockable object.
|
||||||
|
*
|
||||||
|
* @param l Lockable object to associate with this Condition object.
|
||||||
|
*/
|
||||||
|
Condition(Lockable& l);
|
||||||
|
|
||||||
|
//! Destroy Condition object
|
||||||
|
virtual ~Condition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wake <em>one</em> thread waiting on this Condition.
|
||||||
|
*
|
||||||
|
* The associated Lockable need not have been acquire when this function is
|
||||||
|
* invoked.
|
||||||
|
*
|
||||||
|
* @post a waiting thread, if any exists, will be awakened.
|
||||||
|
*/
|
||||||
|
void signal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wake <em>all</em> threads wait()ing on this Condition.
|
||||||
|
*
|
||||||
|
* The associated Lockable need not have been acquire when this function is
|
||||||
|
* invoked.
|
||||||
|
*
|
||||||
|
* @post all wait()ing threads, if any exist, will be awakened.
|
||||||
|
*/
|
||||||
|
void broadcast();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for this Condition, blocking the calling thread until a signal or broadcast
|
||||||
|
* is received.
|
||||||
|
*
|
||||||
|
* This operation atomically releases the associated Lockable and blocks the calling thread.
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown when the calling thread is interrupted.
|
||||||
|
* A thread may be interrupted at any time, prematurely ending any wait.
|
||||||
|
*
|
||||||
|
* @pre The thread calling this method must have first acquired the associated
|
||||||
|
* Lockable object.
|
||||||
|
*
|
||||||
|
* @post A thread that has resumed execution without exception (because of a signal(),
|
||||||
|
* broadcast() or exception) will have acquire()d the associated Lockable object
|
||||||
|
* before returning from a wait().
|
||||||
|
*
|
||||||
|
* @see Waitable::wait()
|
||||||
|
*/
|
||||||
|
virtual void wait();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for this Condition, blocking the calling thread until a signal or broadcast
|
||||||
|
* is received.
|
||||||
|
*
|
||||||
|
* This operation atomically releases the associated Lockable and blocks the calling thread.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method could block
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if the Condition receives a signal or broadcast before
|
||||||
|
* <i>timeout</i> milliseconds elapse.
|
||||||
|
* - <em>false</em> otherwise.
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown when the calling thread is interrupted.
|
||||||
|
* A thread may be interrupted at any time, prematurely ending any wait.
|
||||||
|
*
|
||||||
|
* @pre The thread calling this method must have first acquired the associated
|
||||||
|
* Lockable object.
|
||||||
|
*
|
||||||
|
* @post A thread that has resumed execution without exception (because of a signal(),
|
||||||
|
* broadcast() or exception) will have acquire()d the associated Lockable object
|
||||||
|
* before returning from a wait().
|
||||||
|
*
|
||||||
|
* @see Waitable::wait(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual bool wait(unsigned long timeout);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTCONDITION_H__
|
||||||
218
src/dep/include/zthread/Config.h
Normal file
218
src/dep/include/zthread/Config.h
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTCONFIG_H__
|
||||||
|
#define __ZTCONFIG_H__
|
||||||
|
|
||||||
|
// =====================================================================================
|
||||||
|
// The following section describes the symbols the configure program will define.
|
||||||
|
// If you are not using configure (autoconf), then you make want to set these by
|
||||||
|
// uncommenting them here, or whatever other means you'd like.
|
||||||
|
// =====================================================================================
|
||||||
|
|
||||||
|
// (configure)
|
||||||
|
// Uncomment to disable actually changing the operating systems real thread priority
|
||||||
|
// #define ZTHREAD_DISABLE_PRIORITY 1
|
||||||
|
|
||||||
|
// (configure)
|
||||||
|
// Uncomment to disable compiling the interrupt() hook mechanisms.
|
||||||
|
// #define ZTHREAD_DISABLE_INTERRUPT 1
|
||||||
|
|
||||||
|
// (configure)
|
||||||
|
// Uncomment to select a Win32 ThreadOps implementation that uses _beginthreadex()
|
||||||
|
// otherwise, CreateThread() will be used for a Windows compilation
|
||||||
|
// #define HAVE_BEGINTHREADEX 1
|
||||||
|
|
||||||
|
// (configure)
|
||||||
|
// Uncomment to select a pthreads based implementation
|
||||||
|
// #define ZT_POSIX 1
|
||||||
|
|
||||||
|
// (configure)
|
||||||
|
// Uncomment to select a Windows based implementation that uses features not
|
||||||
|
// supported by windows 98 and 95
|
||||||
|
// #define ZT_WIN32 1
|
||||||
|
|
||||||
|
// (configure)
|
||||||
|
// Uncomment to select a Windows based implementation that does not use features not
|
||||||
|
// supported by windows 98 and 95, but may not be compatible with 64 bit or alpha systems
|
||||||
|
// #define ZT_WIN9X 1
|
||||||
|
|
||||||
|
// (configure)
|
||||||
|
// Uncomment to select a MacOS based implementation
|
||||||
|
// #define ZT_MACOS 1
|
||||||
|
|
||||||
|
// (configure)
|
||||||
|
// Uncomment to prefer vanilla implementations of primatives when possible
|
||||||
|
// #define ZT_VANILLA 1
|
||||||
|
|
||||||
|
// =====================================================================================
|
||||||
|
// The following section can be customized to select the implementation that is compiled
|
||||||
|
// Eventually, the configure program will be updated to define these symbols as well.
|
||||||
|
// =====================================================================================
|
||||||
|
|
||||||
|
// Uncomment to select very simple spinlock based implementations
|
||||||
|
// #define ZTHREAD_USE_SPIN_LOCKS 1
|
||||||
|
|
||||||
|
// Uncomment to select the vannila dual mutex implementation of FastRecursiveLock
|
||||||
|
// #define ZTHREAD_DUAL_LOCKS 1
|
||||||
|
|
||||||
|
// Uncomment to select a POSIX implementation of FastRecursiveLock that does not
|
||||||
|
// spin, but instead sleeps on a condition variable.
|
||||||
|
// #define ZTHREAD_CONDITION_LOCKS 1
|
||||||
|
|
||||||
|
// Uncomment if you want to eliminate inlined code used as a part of some template classes
|
||||||
|
// #define ZTHREAD_NOINLINE
|
||||||
|
|
||||||
|
// Uncomment if you want to compile a DLL version of the library. (Win32)
|
||||||
|
// #define ZTHREAD_EXPORTS 1
|
||||||
|
|
||||||
|
// Uncomment if you want to compile a client using the DLL version of the library. (Win32)
|
||||||
|
// #define ZTHREAD_IMPORTS 1
|
||||||
|
|
||||||
|
// ===================================================================================
|
||||||
|
// The following section will attempt to guess the best configuration for your system
|
||||||
|
// ===================================================================================
|
||||||
|
|
||||||
|
// Select an implementation by checking out the environment, first looking for
|
||||||
|
// compilers, then by looking for other definitions that could be present
|
||||||
|
|
||||||
|
#if !defined(ZT_POSIX) && !defined(ZT_WIN9X) && !defined(ZT_WIN32) && !defined(ZT_MACOS)
|
||||||
|
|
||||||
|
// Check for well known compilers
|
||||||
|
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__BCPLUSPLUS__) || defined(__MINGW32__)
|
||||||
|
|
||||||
|
# define ZT_WIN32
|
||||||
|
|
||||||
|
#elif defined(__CYGWIN__)
|
||||||
|
|
||||||
|
# define ZT_POSIX
|
||||||
|
|
||||||
|
// Check for well known platforms
|
||||||
|
#elif defined(__linux__) || \
|
||||||
|
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||||
|
defined(__hpux) || \
|
||||||
|
defined(__sgi) || \
|
||||||
|
defined(__sun)
|
||||||
|
|
||||||
|
# define ZT_POSIX
|
||||||
|
|
||||||
|
// Check for definitions from well known headers
|
||||||
|
#elif defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
|
||||||
|
|
||||||
|
# define ZT_POSIX
|
||||||
|
|
||||||
|
#elif defined(WIN32_LEAN_AND_MEAN)
|
||||||
|
|
||||||
|
# define ZT_WIN32
|
||||||
|
|
||||||
|
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
|
||||||
|
|
||||||
|
# define ZT_MACOS
|
||||||
|
|
||||||
|
#else
|
||||||
|
# error "Could not select implementation, define ZT_WIN9X, ZT_WIN32, ZT_POSIX or ZT_MACOS"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Once an implementation has been selected, configure the API decorator
|
||||||
|
// for shared libraries if its needed.
|
||||||
|
|
||||||
|
#if defined(ZTHREAD_SHARED) // Compatibility w/ past releases
|
||||||
|
|
||||||
|
# define ZTHREAD_IMPORTS
|
||||||
|
|
||||||
|
#elif defined(ZTHREAD_STATIC)
|
||||||
|
|
||||||
|
# undef ZTHREAD_EXPORTS
|
||||||
|
# undef ZTHREAD_IMPORTS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Windows users will get a static build by default, unless they
|
||||||
|
// define either ZTHREAD_IMPORTS or ZTHREAD_EXPORTS. Client code
|
||||||
|
// of a dll version of this library should define the first flag;
|
||||||
|
// To build the dll version of this library, define the second.
|
||||||
|
|
||||||
|
#if defined(ZTHREAD_IMPORTS) && defined(ZTHREAD_EXPORTS)
|
||||||
|
# error "Import and export declarations are not valid"
|
||||||
|
#else
|
||||||
|
|
||||||
|
# if defined(ZTHREAD_IMPORTS)
|
||||||
|
# define ZTHREAD_API __declspec(dllimport)
|
||||||
|
# elif defined(ZTHREAD_EXPORTS)
|
||||||
|
# define ZTHREAD_API __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define ZTHREAD_API
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Once the API decorator is configured, create a macro for
|
||||||
|
// explicit template instantiation (whose need can hopefully
|
||||||
|
// be removed from the library)
|
||||||
|
|
||||||
|
#if defined(ZTHREAD_EXPORTS)
|
||||||
|
# define EXPLICIT_TEMPLATE(X) template class __declspec( dllexport ) X;
|
||||||
|
#elif defined(ZTHREAD_IMPORTS)
|
||||||
|
# define EXPLICIT_TEMPLATE(X) template class __declspec( dllimport ) X;
|
||||||
|
#else
|
||||||
|
# define EXPLICIT_TEMPLATE(X)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Give libc a hint, should be defined by the user - but people tend
|
||||||
|
// to forget.
|
||||||
|
|
||||||
|
#if !defined(REENTRANT)
|
||||||
|
# define REENTRANT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_REENTRANT)
|
||||||
|
# define _REENTRANT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# pragma warning(disable:4275)
|
||||||
|
# pragma warning(disable:4290)
|
||||||
|
# pragma warning(disable:4786)
|
||||||
|
# pragma warning(disable:4251)
|
||||||
|
# pragma warning(disable:4355)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Ensure that only one implementation is selected
|
||||||
|
#if \
|
||||||
|
(defined(ZT_POSIX) && defined(ZT_WIN32)) \
|
||||||
|
|| (defined(ZT_POSIX) && defined(ZT_WIN9X)) \
|
||||||
|
|| (defined(ZT_WIN32) && defined(ZT_WIN9X))
|
||||||
|
|
||||||
|
# error "Only one implementation should be selected!"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ZTHREAD_NOINLINE)
|
||||||
|
# define ZTHREAD_INLINE
|
||||||
|
#else
|
||||||
|
# define ZTHREAD_INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __ZTCONFIG_H__
|
||||||
|
|
||||||
289
src/dep/include/zthread/CountedPtr.h
Normal file
289
src/dep/include/zthread/CountedPtr.h
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTCOUNTEDPTR_H__
|
||||||
|
#define __ZTCOUNTEDPTR_H__
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "zthread/AtomicCount.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# pragma warning(push)
|
||||||
|
# pragma warning(disable:4786) // warning: long template symbol name
|
||||||
|
# pragma warning(push)
|
||||||
|
# pragma warning(disable:4284) // warning: odd return type for operator->
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class CountedPtr
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com/>
|
||||||
|
* @date <2003-07-29T06:43:48-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template <typename T, typename CountT = AtomicCount>
|
||||||
|
class CountedPtr {
|
||||||
|
|
||||||
|
#if !defined(__MWERKS__)
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1200)
|
||||||
|
template <typename U, typename V> friend class CountedPtr;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CountT* _count;
|
||||||
|
T* _instance;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
CountedPtr() : _count(0), _instance(0) { }
|
||||||
|
|
||||||
|
#if !defined(__MWERKS__)
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1200)
|
||||||
|
|
||||||
|
explicit CountedPtr(T* raw) : _count(new CountT()), _instance(raw) {
|
||||||
|
(*_count)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename U>
|
||||||
|
explicit CountedPtr(U* raw) : _count(new CountT()), _instance(raw) {
|
||||||
|
(*_count)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(__MWERKS__)
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1200)
|
||||||
|
|
||||||
|
CountedPtr(const CountedPtr& ptr) : _count(ptr._count), _instance(ptr._instance) {
|
||||||
|
|
||||||
|
if(_count)
|
||||||
|
(*_count)++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename U, typename V>
|
||||||
|
CountedPtr(const CountedPtr<U, V>& ptr) : _count(ptr._count), _instance(ptr._instance) {
|
||||||
|
|
||||||
|
if(_count)
|
||||||
|
(*_count)++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
~CountedPtr() {
|
||||||
|
|
||||||
|
if(_count && --(*_count) == 0) {
|
||||||
|
|
||||||
|
if(_instance)
|
||||||
|
delete _instance;
|
||||||
|
|
||||||
|
delete _count;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(__MWERKS__)
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1200)
|
||||||
|
|
||||||
|
const CountedPtr& operator=(const CountedPtr& ptr) {
|
||||||
|
|
||||||
|
typedef CountedPtr<T, CountT> ThisT;
|
||||||
|
|
||||||
|
ThisT(ptr).swap(*this);
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename U, typename V>
|
||||||
|
const CountedPtr& operator=(const CountedPtr<U, V>& ptr) {
|
||||||
|
|
||||||
|
typedef CountedPtr<T, CountT> ThisT;
|
||||||
|
|
||||||
|
ThisT(ptr).swap(*this);
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
|
||||||
|
typedef CountedPtr<T, CountT> ThisT;
|
||||||
|
ThisT().swap(*this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(__MWERKS__)
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1200)
|
||||||
|
|
||||||
|
void swap(CountedPtr& ptr) {
|
||||||
|
|
||||||
|
std::swap(_count, ptr._count);
|
||||||
|
std::swap(_instance, ptr._instance);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename U, typename V>
|
||||||
|
void swap(CountedPtr<U, V>& ptr) {
|
||||||
|
|
||||||
|
std::swap(_count, ptr._count);
|
||||||
|
std::swap(_instance, ptr._instance);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convience operators
|
||||||
|
|
||||||
|
#if !defined(__MWERKS__)
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1200)
|
||||||
|
|
||||||
|
bool less(const CountedPtr& ptr) const {
|
||||||
|
return _instance < ptr._instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename U, typename V>
|
||||||
|
bool less(const CountedPtr<U, V>& ptr) const {
|
||||||
|
return _instance < ptr._instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(__MWERKS__)
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1200)
|
||||||
|
|
||||||
|
bool equal(const CountedPtr& ptr) const {
|
||||||
|
return _count == ptr._count;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename U, typename V>
|
||||||
|
bool equal(const CountedPtr<U, V>& ptr) const {
|
||||||
|
return _count == ptr._count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
friend inline bool operator==(const CountedPtr& lhs, const CountedPtr& rhs) {
|
||||||
|
return lhs.equal(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
friend inline bool operator<(const CountedPtr& lhs, const CountedPtr& rhs) {
|
||||||
|
return lhs.less(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
T& operator*() {
|
||||||
|
assert(_instance != 0);
|
||||||
|
return *_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
T* operator->() {
|
||||||
|
assert(_instance != 0);
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
const T* operator->() const {
|
||||||
|
assert(_instance != 0);
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!() const {
|
||||||
|
return _instance == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
operator bool() const {
|
||||||
|
return _instance != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}; /* CountedPtr */
|
||||||
|
|
||||||
|
template<typename U, typename V, typename X, typename Y>
|
||||||
|
inline bool operator<(CountedPtr<U, V> const &lhs, CountedPtr<X, Y> const &rhs) {
|
||||||
|
return lhs.less(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename U, typename V, typename X, typename Y>
|
||||||
|
inline bool operator==(CountedPtr<U, V> const &lhs, CountedPtr<X, Y> const &rhs) {
|
||||||
|
return lhs.equal(rhs.get);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename U, typename V, typename X, typename Y>
|
||||||
|
inline bool operator!=(CountedPtr<U, V> const &lhs, CountedPtr<X, Y> const &rhs) {
|
||||||
|
return !(lhs.equal(rhs.get));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename U, typename V, typename X, typename Y>
|
||||||
|
inline void swap(CountedPtr<U, V> const &lhs, CountedPtr<X, Y> const &rhs) {
|
||||||
|
lhs.swap(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(__MWERKS__)
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1200)
|
||||||
|
|
||||||
|
template<typename U, typename V>
|
||||||
|
inline bool operator<(CountedPtr<U, V> const &lhs, CountedPtr<U, V> const &rhs) {
|
||||||
|
return lhs.less(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename U, typename V>
|
||||||
|
inline bool operator==(CountedPtr<U, V> const &lhs, CountedPtr<U, V> const &rhs) {
|
||||||
|
return lhs.equal(rhs.get);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename U, typename V>
|
||||||
|
inline bool operator!=(CountedPtr<U, V> const &lhs, CountedPtr<U, V> const &rhs) {
|
||||||
|
return !(lhs.equal(rhs.get));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename U, typename V>
|
||||||
|
inline void swap(CountedPtr<U, V> const &lhs, CountedPtr<U, V> const &rhs) {
|
||||||
|
lhs.swap(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# pragma warning(pop)
|
||||||
|
# pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __ZTCOUNTEDPTR_H__
|
||||||
138
src/dep/include/zthread/CountingSemaphore.h
Normal file
138
src/dep/include/zthread/CountingSemaphore.h
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTCOUNTINGSEMAPHORE_H__
|
||||||
|
#define __ZTCOUNTINGSEMAPHORE_H__
|
||||||
|
|
||||||
|
#include "zthread/Lockable.h"
|
||||||
|
#include "zthread/NonCopyable.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
class FifoSemaphoreImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class CountingSemaphore
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T15:26:18-0400>
|
||||||
|
* @version 2.2.1
|
||||||
|
*
|
||||||
|
* A CountingSemaphore is an owner-less Lockable object.
|
||||||
|
*
|
||||||
|
* It differs from a normal Semaphore in that there is no upper bound on the count
|
||||||
|
* and it will not throw an exception because a maximum value has been exceeded.
|
||||||
|
*
|
||||||
|
* @see Semaphore
|
||||||
|
*
|
||||||
|
* Threads blocked on a CountingSemaphore are resumed in FIFO order.
|
||||||
|
*/
|
||||||
|
class ZTHREAD_API CountingSemaphore : public Lockable, private NonCopyable {
|
||||||
|
|
||||||
|
FifoSemaphoreImpl* _impl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new CountingSemaphore.
|
||||||
|
*
|
||||||
|
* @param count - initial count
|
||||||
|
*/
|
||||||
|
CountingSemaphore(int initialCount = 0);
|
||||||
|
|
||||||
|
//! Destroy the CountingSemaphore
|
||||||
|
virtual ~CountingSemaphore();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <i>Provided to reflect the traditional Semaphore semantics</i>
|
||||||
|
*
|
||||||
|
* @see acquire()
|
||||||
|
*/
|
||||||
|
void wait();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <i>Provided to reflect the traditional Semaphore semantics</i>
|
||||||
|
*
|
||||||
|
* @see tryAcquire(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
bool tryWait(unsigned long timeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <i>Provided to reflect the traditional Semaphore semantics</i>
|
||||||
|
*
|
||||||
|
* @see release()
|
||||||
|
*/
|
||||||
|
void post();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current count of the semaphore.
|
||||||
|
*
|
||||||
|
* This value may change immediately after this function returns to the calling thread.
|
||||||
|
*
|
||||||
|
* @return <em>int</em> count
|
||||||
|
*/
|
||||||
|
virtual int count();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrement the count, blocking that calling thread if the count becomes 0 or
|
||||||
|
* less than 0. The calling thread will remain blocked until the count is
|
||||||
|
* raised above 0, an exception is thrown or the given amount of time expires.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method could block
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if the Semaphore was acquired before <i>timeout</i> milliseconds elapse.
|
||||||
|
* - <em>false</em> otherwise.
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown when the calling thread is interrupted.
|
||||||
|
* A thread may be interrupted at any time, prematurely ending any wait.
|
||||||
|
*
|
||||||
|
* @see Lockable::tryAcquire(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual bool tryAcquire(unsigned long timeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrement the count, blocking that calling thread if the count becomes 0 or
|
||||||
|
* less than 0. The calling thread will remain blocked until the count is
|
||||||
|
* raised above 0 or if an exception is thrown.
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown when the calling thread is interrupted.
|
||||||
|
* A thread may be interrupted at any time, prematurely ending any wait.
|
||||||
|
*
|
||||||
|
* @see Lockable::acquire()
|
||||||
|
*/
|
||||||
|
virtual void acquire();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increment the count, unblocking one thread if count is positive.
|
||||||
|
*
|
||||||
|
* @see Lockable::release()
|
||||||
|
*/
|
||||||
|
virtual void release();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTCOUNTINGSEMAPHORE_H__
|
||||||
244
src/dep/include/zthread/Exceptions.h
Normal file
244
src/dep/include/zthread/Exceptions.h
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTEXCEPTIONS_H__
|
||||||
|
#define __ZTEXCEPTIONS_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include "zthread/Config.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Synchronization_Exception
|
||||||
|
*
|
||||||
|
* Serves as a general base class for the Exception hierarchy used within
|
||||||
|
* this package.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Synchronization_Exception {
|
||||||
|
|
||||||
|
// Restrict heap allocation
|
||||||
|
static void * operator new(size_t size);
|
||||||
|
static void * operator new[](size_t size);
|
||||||
|
|
||||||
|
std::string _msg;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new exception with a default error message 'Synchronization
|
||||||
|
* Exception'
|
||||||
|
*/
|
||||||
|
Synchronization_Exception() : _msg("Synchronization exception") { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new exception with a given error message
|
||||||
|
*
|
||||||
|
* @param const char* - error message
|
||||||
|
*/
|
||||||
|
Synchronization_Exception(const char* msg) : _msg(msg) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get additional info about the exception
|
||||||
|
*
|
||||||
|
* @return const char* for the error message
|
||||||
|
*/
|
||||||
|
const char* what() const {
|
||||||
|
return _msg.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Interrupted_Exception
|
||||||
|
*
|
||||||
|
* Used to describe an interrupted operation that would have normally
|
||||||
|
* blocked the calling thread
|
||||||
|
*/
|
||||||
|
class Interrupted_Exception : public Synchronization_Exception {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
Interrupted_Exception() : Synchronization_Exception("Thread interrupted") { }
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
Interrupted_Exception(const char* msg) : Synchronization_Exception(msg) { }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Deadlock_Exception
|
||||||
|
*
|
||||||
|
* Thrown when deadlock has been detected
|
||||||
|
*/
|
||||||
|
class Deadlock_Exception : public Synchronization_Exception {
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
Deadlock_Exception() : Synchronization_Exception("Deadlock detected") { }
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
Deadlock_Exception(const char* msg) : Synchronization_Exception(msg) { }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class InvalidOp_Exception
|
||||||
|
*
|
||||||
|
* Thrown when performing an illegal operation this object
|
||||||
|
*/
|
||||||
|
class InvalidOp_Exception : public Synchronization_Exception {
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
InvalidOp_Exception() : Synchronization_Exception("Invalid operation") { }
|
||||||
|
//! Create a new exception
|
||||||
|
InvalidOp_Exception(const char* msg) : Synchronization_Exception(msg) { }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Initialization_Exception
|
||||||
|
*
|
||||||
|
* Thrown when the system has no more resources to create new
|
||||||
|
* synchronization controls
|
||||||
|
*/
|
||||||
|
class Initialization_Exception : public Synchronization_Exception {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
Initialization_Exception() : Synchronization_Exception("Initialization error") { }
|
||||||
|
//! Create a new exception
|
||||||
|
Initialization_Exception(const char*msg) : Synchronization_Exception(msg) { }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Cancellation_Exception
|
||||||
|
*
|
||||||
|
* Cancellation_Exceptions are thrown by 'Canceled' objects.
|
||||||
|
* @see Cancelable
|
||||||
|
*/
|
||||||
|
class Cancellation_Exception : public Synchronization_Exception {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new Cancelltion_Exception
|
||||||
|
Cancellation_Exception() : Synchronization_Exception("Canceled") { }
|
||||||
|
//! Create a new Cancelltion_Exception
|
||||||
|
Cancellation_Exception(const char*msg) : Synchronization_Exception(msg) { }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Timeout_Exception
|
||||||
|
*
|
||||||
|
* There is no need for error messaged simply indicates the last
|
||||||
|
* operation timed out
|
||||||
|
*/
|
||||||
|
class Timeout_Exception : public Synchronization_Exception {
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new Timeout_Exception
|
||||||
|
Timeout_Exception() : Synchronization_Exception("Timeout") { }
|
||||||
|
//! Create a new
|
||||||
|
Timeout_Exception(const char*msg) : Synchronization_Exception(msg) { }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class NoSuchElement_Exception
|
||||||
|
*
|
||||||
|
* The last operation that was attempted on a Queue could not find
|
||||||
|
* the item that was indicated (during that last Queue method invocation)
|
||||||
|
*/
|
||||||
|
class NoSuchElement_Exception {
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
NoSuchElement_Exception() {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class InvalidTask_Exception
|
||||||
|
*
|
||||||
|
* Thrown when a task is not valid (e.g. null or start()ing a thread with
|
||||||
|
* no overriden run() method)
|
||||||
|
*/
|
||||||
|
class InvalidTask_Exception : public InvalidOp_Exception {
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
InvalidTask_Exception() : InvalidOp_Exception("Invalid task") {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class BrokenBarrier_Exception
|
||||||
|
*
|
||||||
|
* Thrown when a Barrier is broken because one of the participating threads
|
||||||
|
* has been interrupted.
|
||||||
|
*/
|
||||||
|
class BrokenBarrier_Exception : public Synchronization_Exception {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
BrokenBarrier_Exception() : Synchronization_Exception("Barrier broken") { }
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
BrokenBarrier_Exception(const char* msg) : Synchronization_Exception(msg) { }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Future_Exception
|
||||||
|
*
|
||||||
|
* Thrown when there is an error using a Future.
|
||||||
|
*/
|
||||||
|
class Future_Exception : public Synchronization_Exception {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
Future_Exception() : Synchronization_Exception() { }
|
||||||
|
|
||||||
|
//! Create a new exception
|
||||||
|
Future_Exception(const char* msg) : Synchronization_Exception(msg) { }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __ZTEXCEPTIONS_H__
|
||||||
94
src/dep/include/zthread/Executor.h
Normal file
94
src/dep/include/zthread/Executor.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTEXECUTOR_H__
|
||||||
|
#define __ZTEXECUTOR_H__
|
||||||
|
|
||||||
|
#include "zthread/Thread.h"
|
||||||
|
#include "zthread/Waitable.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Executor
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T22:39:39-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* Execeutors are an implementation of the Executor pattern. This is
|
||||||
|
* a more versatile construct than a thread pool. A paper describing can
|
||||||
|
* be found in the proceedings of the 2002 VikingPLOP conference.
|
||||||
|
*
|
||||||
|
* <b>Executing</b>
|
||||||
|
*
|
||||||
|
* - <em>execute</em>()ing task with an Executor will submit the task, scheduling
|
||||||
|
* it for execution at some future time depending on the Executor being used.
|
||||||
|
*
|
||||||
|
* <b>Disabling</b>
|
||||||
|
*
|
||||||
|
* - <em>cancel</em>()ing an Executor will cause it to stop accepting
|
||||||
|
* new tasks.
|
||||||
|
*
|
||||||
|
* <b>Interrupting</b>
|
||||||
|
*
|
||||||
|
* - <em>interrupt</em>()ing an Executor will cause the any thread running
|
||||||
|
* a task which was submitted prior to the invocation of this function to
|
||||||
|
* be interrupted during the execution of that task.
|
||||||
|
*
|
||||||
|
* <b>Waiting</b>
|
||||||
|
*
|
||||||
|
* - <em>wait</em>()ing on a PoolExecutor will block the calling thread
|
||||||
|
* until all tasks that were submitted prior to the invocation of this function
|
||||||
|
* have completed.
|
||||||
|
*
|
||||||
|
* @see Cancelable
|
||||||
|
* @see Waitable
|
||||||
|
*/
|
||||||
|
class Executor : public Cancelable, public Waitable, private NonCopyable {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If supported by the Executor, interrupt all tasks submitted prior to
|
||||||
|
* the invocation of this function.
|
||||||
|
*/
|
||||||
|
virtual void interrupt() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit a task to this Executor.
|
||||||
|
*
|
||||||
|
* @param task Task to be run by a thread managed by this executor
|
||||||
|
*
|
||||||
|
* @pre The Executor should have been canceled prior to this invocation.
|
||||||
|
* @post The submitted task will be run at some point in the future by this Executor.
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if the Executor was canceled prior to
|
||||||
|
* the invocation of this function.
|
||||||
|
*/
|
||||||
|
virtual void execute(const Task& task) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTEXECUTOR_H__
|
||||||
183
src/dep/include/zthread/FairReadWriteLock.h
Normal file
183
src/dep/include/zthread/FairReadWriteLock.h
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTFAIRREADWRITELOCK_H__
|
||||||
|
#define __ZTFAIRREADWRITELOCK_H__
|
||||||
|
|
||||||
|
#include "zthread/ReadWriteLock.h"
|
||||||
|
#include "zthread/Condition.h"
|
||||||
|
#include "zthread/Guard.h"
|
||||||
|
#include "zthread/Mutex.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class FairReadWriteLock
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T10:26:25-0400>
|
||||||
|
* @version 2.2.7
|
||||||
|
*
|
||||||
|
* A FairReadWriteLock maintains a balance between the order read-only access
|
||||||
|
* and read-write access is allowed. Threads contending for the pair of Lockable
|
||||||
|
* objects this ReadWriteLock provides will gain access to the locks in FIFO order.
|
||||||
|
*
|
||||||
|
* @see ReadWriteLock
|
||||||
|
*/
|
||||||
|
class FairReadWriteLock : public ReadWriteLock {
|
||||||
|
|
||||||
|
Mutex _lock;
|
||||||
|
Condition _cond;
|
||||||
|
|
||||||
|
volatile int _readers;
|
||||||
|
|
||||||
|
//! @class ReadLock
|
||||||
|
class ReadLock : public Lockable {
|
||||||
|
|
||||||
|
FairReadWriteLock& _rwlock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ReadLock(FairReadWriteLock& rwlock) : _rwlock(rwlock) {}
|
||||||
|
|
||||||
|
virtual ~ReadLock() {}
|
||||||
|
|
||||||
|
virtual void acquire() {
|
||||||
|
|
||||||
|
Guard<Mutex> g(_rwlock._lock);
|
||||||
|
++_rwlock._readers;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) {
|
||||||
|
|
||||||
|
if(!_rwlock._lock.tryAcquire(timeout))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
++_rwlock._readers;
|
||||||
|
_rwlock._lock.release();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void release() {
|
||||||
|
|
||||||
|
Guard<Mutex> g(_rwlock._lock);
|
||||||
|
--_rwlock._readers;
|
||||||
|
|
||||||
|
if(_rwlock._readers == 0)
|
||||||
|
_rwlock._cond.signal();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//! @class WriteLock
|
||||||
|
class WriteLock : public Lockable {
|
||||||
|
|
||||||
|
FairReadWriteLock& _rwlock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
WriteLock(FairReadWriteLock& rwlock) : _rwlock(rwlock) {}
|
||||||
|
|
||||||
|
virtual ~WriteLock() {}
|
||||||
|
|
||||||
|
virtual void acquire() {
|
||||||
|
|
||||||
|
_rwlock._lock.acquire();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
while(_rwlock._readers > 0)
|
||||||
|
_rwlock._cond.wait();
|
||||||
|
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
_rwlock._lock.release();
|
||||||
|
throw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) {
|
||||||
|
|
||||||
|
if(!_rwlock._lock.tryAcquire(timeout))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
while(_rwlock._readers > 0)
|
||||||
|
_rwlock._cond.wait(timeout);
|
||||||
|
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
_rwlock._lock.release();
|
||||||
|
throw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void release() {
|
||||||
|
_rwlock._lock.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
friend class ReadLock;
|
||||||
|
friend class WriteLock;
|
||||||
|
|
||||||
|
ReadLock _rlock;
|
||||||
|
WriteLock _wlock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a BiasedReadWriteLock
|
||||||
|
*
|
||||||
|
* @exception Initialization_Exception thrown if resources could not be
|
||||||
|
* allocated for this object.
|
||||||
|
*/
|
||||||
|
FairReadWriteLock() : _cond(_lock), _readers(0), _rlock(*this), _wlock(*this) {}
|
||||||
|
|
||||||
|
//! Destroy this ReadWriteLock
|
||||||
|
virtual ~FairReadWriteLock() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ReadWriteLock::getReadLock()
|
||||||
|
*/
|
||||||
|
virtual Lockable& getReadLock() { return _rlock; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ReadWriteLock::getWriteLock()
|
||||||
|
*/
|
||||||
|
virtual Lockable& getWriteLock() { return _wlock; }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}; // __ZTFAIRREADWRITELOCK_H__
|
||||||
|
|
||||||
|
#endif
|
||||||
111
src/dep/include/zthread/FastMutex.h
Normal file
111
src/dep/include/zthread/FastMutex.h
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTFASTMUTEX_H__
|
||||||
|
#define __ZTFASTMUTEX_H__
|
||||||
|
|
||||||
|
#include "zthread/Lockable.h"
|
||||||
|
#include "zthread/NonCopyable.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
class FastLock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class FastMutex
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-19T18:45:39-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* A FastMutex is a small fast implementation of a non-recursive, mutually exclusive
|
||||||
|
* Lockable object. This implementation is a bit faster than the other Mutex classes
|
||||||
|
* as it involved the least overhead. However, this slight increase in speed is
|
||||||
|
* gained by sacrificing the robustness provided by the other classes.
|
||||||
|
*
|
||||||
|
* A FastMutex has the useful property of not being interruptable; that is to say
|
||||||
|
* that acquire() and tryAcquire() will not throw Interrupted_Exceptions.
|
||||||
|
*
|
||||||
|
* @see Mutex
|
||||||
|
*
|
||||||
|
* <b>Scheduling</b>
|
||||||
|
*
|
||||||
|
* Scheduling is left to the operating systems and may vary.
|
||||||
|
*
|
||||||
|
* <b>Error Checking</b>
|
||||||
|
*
|
||||||
|
* No error checking is performed, this means there is the potential for deadlock.
|
||||||
|
*/
|
||||||
|
class ZTHREAD_API FastMutex : public Lockable, private NonCopyable {
|
||||||
|
|
||||||
|
FastLock* _lock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a FastMutex
|
||||||
|
FastMutex();
|
||||||
|
|
||||||
|
//! Destroy a FastMutex
|
||||||
|
virtual ~FastMutex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquire exclusive access to the mutex. The calling thread will block until the
|
||||||
|
* lock can be acquired. No safety or state checks are performed.
|
||||||
|
*
|
||||||
|
* @pre The calling thread should <i>not</i> have previously acquired this lock.
|
||||||
|
* Deadlock will result if the same thread attempts to acquire the mutex more
|
||||||
|
* than once.
|
||||||
|
*
|
||||||
|
* @post The calling thread obtains the lock successfully if no exception is thrown.
|
||||||
|
* @exception Interrupted_Exception never thrown
|
||||||
|
*/
|
||||||
|
virtual void acquire();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release exclusive access. No safety or state checks are performed.
|
||||||
|
*
|
||||||
|
* @pre the caller should have previously acquired this lock
|
||||||
|
*/
|
||||||
|
virtual void release();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to acquire exclusive access to the mutex. The calling thread will block until the
|
||||||
|
* lock can be acquired. No safety or state checks are performed.
|
||||||
|
*
|
||||||
|
* @pre The calling thread should <i>not</i> have previously acquired this lock.
|
||||||
|
* Deadlock will result if the same thread attempts to acquire the mutex more
|
||||||
|
* than once.
|
||||||
|
*
|
||||||
|
* @param timeout unused
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if the lock was acquired
|
||||||
|
* - <em>false</em> if the lock was acquired
|
||||||
|
*
|
||||||
|
* @post The calling thread obtains the lock successfully if no exception is thrown.
|
||||||
|
* @exception Interrupted_Exception never thrown
|
||||||
|
*/
|
||||||
|
virtual bool tryAcquire(unsigned long timeout);
|
||||||
|
|
||||||
|
}; /* FastMutex */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __ZTFASTMUTEX_H__
|
||||||
106
src/dep/include/zthread/FastRecursiveMutex.h
Normal file
106
src/dep/include/zthread/FastRecursiveMutex.h
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTFASTRECURSIVEMUTEX_H__
|
||||||
|
#define __ZTFASTRECURSIVEMUTEX_H__
|
||||||
|
|
||||||
|
#include "zthread/Lockable.h"
|
||||||
|
#include "zthread/NonCopyable.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
class FastRecursiveLock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class FastRecursiveMutex
|
||||||
|
*
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-19T19:00:25-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* A FastRecursiveMutex is a small fast implementation of a recursive, mutally exclusive
|
||||||
|
* Lockable object. This implementation is a bit faster than the other Mutex classes
|
||||||
|
* as it involved the least overhead. However, this slight increase in speed is
|
||||||
|
* gained by sacrificing the robustness provided by the other classes.
|
||||||
|
*
|
||||||
|
* A FastRecursiveMutex has the useful property of not being interruptable; that is to say
|
||||||
|
* that acquire() and tryAcquire() will not throw Interrupted_Exceptions.
|
||||||
|
*
|
||||||
|
* @see RecursiveMutex
|
||||||
|
*
|
||||||
|
* <b>Scheduling</b>
|
||||||
|
*
|
||||||
|
* Scheduling is left to the operating systems and may vary.
|
||||||
|
*
|
||||||
|
* <b>Error Checking</b>
|
||||||
|
*
|
||||||
|
* No error checking is performed, this means there is the potential for deadlock.
|
||||||
|
*/
|
||||||
|
class ZTHREAD_API FastRecursiveMutex : public Lockable, private NonCopyable {
|
||||||
|
|
||||||
|
FastRecursiveLock* _lock;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new FastRecursiveMutex
|
||||||
|
FastRecursiveMutex();
|
||||||
|
|
||||||
|
//! Destroy this FastRecursiveMutex
|
||||||
|
virtual ~FastRecursiveMutex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquire exclusive access to the mutex. The calling thread will block until the
|
||||||
|
* lock can be acquired. No safety or state checks are performed. The calling thread
|
||||||
|
* may acquire the mutex nore than once.
|
||||||
|
*
|
||||||
|
* @post The calling thread obtains the lock successfully if no exception is thrown.
|
||||||
|
* @exception Interrupted_Exception never thrown
|
||||||
|
*/
|
||||||
|
virtual void acquire();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release access. No safety or state checks are performed.
|
||||||
|
*
|
||||||
|
* @pre the caller should have previously acquired this lock at least once.
|
||||||
|
*/
|
||||||
|
virtual void release();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to acquire exclusive access to the mutex. The calling thread will block until the
|
||||||
|
* lock can be acquired. No safety or state checks are performed. The calling thread
|
||||||
|
* may acquire the mutex more than once.
|
||||||
|
*
|
||||||
|
* @param timeout unused
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if the lock was acquired
|
||||||
|
* - <em>false</em> if the lock was acquired
|
||||||
|
*
|
||||||
|
* @post The calling thread obtains the lock successfully if no exception is thrown.
|
||||||
|
* @exception Interrupted_Exception never thrown
|
||||||
|
*/
|
||||||
|
virtual bool tryAcquire(unsigned long timeout);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTFASTRECURSIVEMUTEX_H__
|
||||||
511
src/dep/include/zthread/Guard.h
Normal file
511
src/dep/include/zthread/Guard.h
Normal file
@ -0,0 +1,511 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTGUARD_H__
|
||||||
|
#define __ZTGUARD_H__
|
||||||
|
|
||||||
|
#include "zthread/NonCopyable.h"
|
||||||
|
#include "zthread/Exceptions.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
//
|
||||||
|
// GuardLockingPolicyContract {
|
||||||
|
//
|
||||||
|
// createScope(lock_type&)
|
||||||
|
// bool createScope(lock_type&, unsigned long)
|
||||||
|
// destroyScope(lock_type&)
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class LockHolder
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T17:55:42-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* This is a simple base class for Guards class. It allows Guards
|
||||||
|
* that have compatible targets to refer to each others targets
|
||||||
|
* allowing for the construction of Guards that share the same lock
|
||||||
|
* but have different locking policies.
|
||||||
|
*/
|
||||||
|
template <class LockType>
|
||||||
|
class LockHolder {
|
||||||
|
|
||||||
|
LockType &_lock;
|
||||||
|
bool _enabled;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
LockHolder(T& t) : _lock(extract(t)._lock), _enabled(true) { }
|
||||||
|
|
||||||
|
LockHolder(LockHolder& holder) : _lock(holder._lock), _enabled(true) { }
|
||||||
|
|
||||||
|
LockHolder(LockType& lock) : _lock(lock), _enabled(true) { }
|
||||||
|
|
||||||
|
void disable() {
|
||||||
|
_enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isDisabled() {
|
||||||
|
return !_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
LockType& getLock() {
|
||||||
|
return _lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
static LockHolder& extract(T& t) {
|
||||||
|
// Design and Evolution of C++, page 328
|
||||||
|
return (LockHolder&)(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class CompoundScope
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T17:55:42-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* Locking policy that aggregates two policies that share a target.
|
||||||
|
* It is not appropriate to use with any type of OverlappedScope
|
||||||
|
*/
|
||||||
|
template <class Scope1, class Scope2>
|
||||||
|
class CompoundScope {
|
||||||
|
public:
|
||||||
|
|
||||||
|
template <class LockType>
|
||||||
|
static void createScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
Scope1::createScope(l);
|
||||||
|
Scope2::createScope(l);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class LockType>
|
||||||
|
static void createScope(LockHolder<LockType>& l, unsigned long ms) {
|
||||||
|
|
||||||
|
if(Scope1::createScope(l, ms))
|
||||||
|
if(!Scope2::createScope(l, ms)) {
|
||||||
|
|
||||||
|
Scope1::destroyScope(l);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class LockType>
|
||||||
|
static void destroyScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
Scope1::destroyScope(l);
|
||||||
|
Scope2::destroyScope(l);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class LockedScope
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T17:55:42-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* Locking policy for Lockable objects. This policy acquire()s a Lockable
|
||||||
|
* when the protection scope is created, and it release()s a Lockable
|
||||||
|
* when the scope is destroyed.
|
||||||
|
*/
|
||||||
|
class LockedScope {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A new protection scope is being created by l2, using an existing scope
|
||||||
|
* created by l1.
|
||||||
|
*
|
||||||
|
* @param lock1 LockType1& is the LockHolder that holds the desired lock
|
||||||
|
* @param lock2 LockType1& is the LockHolder that wants to share
|
||||||
|
template <class LockType1, class LockType2>
|
||||||
|
static void shareScope(LockHolder<LockType1>& l1, LockHolder<LockType2>& l2) {
|
||||||
|
|
||||||
|
l2.getLock().acquire();
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A new protection scope is being created.
|
||||||
|
*
|
||||||
|
* @param lock LockType& is a type of LockHolder.
|
||||||
|
*/
|
||||||
|
template <class LockType>
|
||||||
|
static bool createScope(LockHolder<LockType>& l, unsigned long ms) {
|
||||||
|
|
||||||
|
return l.getLock().tryAcquire(ms);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A new protection scope is being created.
|
||||||
|
*
|
||||||
|
* @param lock LockType& is a type of LockHolder.
|
||||||
|
*/
|
||||||
|
template <class LockType>
|
||||||
|
static void createScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
l.getLock().acquire();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A protection scope is being destroyed.
|
||||||
|
*
|
||||||
|
* @param lock LockType& is a type of LockHolder.
|
||||||
|
*/
|
||||||
|
template <class LockType>
|
||||||
|
static void destroyScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
l.getLock().release();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class UnlockedScope
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T17:55:42-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* Locking policy for Lockable objects. This policy release()s a Lockable
|
||||||
|
* when the protection scope is created, and it acquire()s a Lockable
|
||||||
|
* when the scope is destroyed.
|
||||||
|
*/
|
||||||
|
class UnlockedScope {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A new protection scope is being created by l2, using an existing scope
|
||||||
|
* created by l1.
|
||||||
|
*
|
||||||
|
* @param lock1 LockType1& is the LockHolder that holds the desired lock
|
||||||
|
* @param lock2 LockType1& is the LockHolder that wants to share
|
||||||
|
*/
|
||||||
|
template <class LockType1, class LockType2>
|
||||||
|
static void shareScope(LockHolder<LockType1>& l1, LockHolder<LockType2>& l2) {
|
||||||
|
|
||||||
|
l2.getLock().release();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A new protection scope is being created.
|
||||||
|
*
|
||||||
|
* @param lock LockType& is a type of LockHolder.
|
||||||
|
template <class LockType>
|
||||||
|
static void createScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
l.getLock().release();
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A protection scope is being destroyed.
|
||||||
|
*
|
||||||
|
* @param lock LockType& is a type of LockHolder.
|
||||||
|
*/
|
||||||
|
template <class LockType>
|
||||||
|
static void destroyScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
l.getLock().acquire();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class TimedLockedScope
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T17:55:42-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* Locking policy that attempts to enterScope some resource
|
||||||
|
* in a certain amount of time using an tryEnterScope-relase protocol.
|
||||||
|
*/
|
||||||
|
template <int TimeOut>
|
||||||
|
class TimedLockedScope {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to enterScope the given LockHolder.
|
||||||
|
*
|
||||||
|
* @param lock LockType& is a type of LockHolder.
|
||||||
|
*/
|
||||||
|
template <class LockType1, class LockType2>
|
||||||
|
static void shareScope(LockHolder<LockType1>& l1, LockHolder<LockType2>& l2) {
|
||||||
|
|
||||||
|
if(!l2.getLock().tryAcquire(TimeOut))
|
||||||
|
throw Timeout_Exception();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class LockType>
|
||||||
|
static void createScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
if(!l.getLock().tryAcquire(TimeOut))
|
||||||
|
throw Timeout_Exception();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class LockType>
|
||||||
|
static void destroyScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
l.getLock().release();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class OverlappedScope
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T17:55:42-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* Locking policy allows the effective scope of two locks to overlap
|
||||||
|
* by releasing and disabling one lock before its Guard does so.
|
||||||
|
*/
|
||||||
|
class OverlappedScope {
|
||||||
|
public:
|
||||||
|
|
||||||
|
template <class LockType1, class LockType2>
|
||||||
|
static void transferScope(LockHolder<LockType1>& l1, LockHolder<LockType2>& l2) {
|
||||||
|
|
||||||
|
l1.getLock().acquire();
|
||||||
|
|
||||||
|
l2.getLock().release();
|
||||||
|
l2.disable();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class LockType>
|
||||||
|
static void destroyScope(LockHolder<LockType>& l) {
|
||||||
|
|
||||||
|
l.getLock().release();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Guard
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T17:55:42-0400>
|
||||||
|
* @version 2.2.0
|
||||||
|
*
|
||||||
|
* Scoped locking utility. This template class can be given a Lockable
|
||||||
|
* synchronization object and can 'Guard' or serialize access to
|
||||||
|
* that method.
|
||||||
|
*
|
||||||
|
* For instance, consider a case in which a class or program have a
|
||||||
|
* Mutex object associated with it. Access can be serialized with a
|
||||||
|
* Guard as shown below.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
*
|
||||||
|
* Mutex _mtx;
|
||||||
|
* void guarded() {
|
||||||
|
*
|
||||||
|
* Guard<Mutex> g(_mtx);
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* The Guard will lock the synchronization object when it is created and
|
||||||
|
* automatically unlock it when it goes out of scope. This eliminates
|
||||||
|
* common mistakes like forgetting to unlock your mutex.
|
||||||
|
*
|
||||||
|
* An alternative to the above example would be
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
*
|
||||||
|
* void guarded() {
|
||||||
|
*
|
||||||
|
* (Guard<Mutex>)(_mtx);
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* HOWEVER; using a Guard in this method is dangerous. Depending on your
|
||||||
|
* compiler an anonymous variable like this can go out of scope immediately
|
||||||
|
* which can result in unexpected behavior. - This is the case with MSVC
|
||||||
|
* and was the reason for introducing assertions into the Win32_MutexImpl
|
||||||
|
* to track this problem down
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template <class LockType, class LockingPolicy = LockedScope>
|
||||||
|
class Guard : private LockHolder<LockType>, private NonCopyable {
|
||||||
|
|
||||||
|
friend class LockHolder<LockType>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Guard that enforces a the effective protection scope
|
||||||
|
* throughout the lifetime of the Guard object or until the protection
|
||||||
|
* scope is modified by another Guard.
|
||||||
|
*
|
||||||
|
* @param lock LockType the lock this Guard will use to enforce its
|
||||||
|
* protection scope.
|
||||||
|
* @post the protection scope may be ended prematurely
|
||||||
|
*/
|
||||||
|
Guard(LockType& lock) : LockHolder<LockType>(lock) {
|
||||||
|
|
||||||
|
LockingPolicy::createScope(*this);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Guard that enforces a the effective protection scope
|
||||||
|
* throughout the lifetime of the Guard object or until the protection
|
||||||
|
* scope is modified by another Guard.
|
||||||
|
*
|
||||||
|
* @param lock LockType the lock this Guard will use to enforce its
|
||||||
|
* protection scope.
|
||||||
|
* @post the protection scope may be ended prematurely
|
||||||
|
*/
|
||||||
|
Guard(LockType& lock, unsigned long timeout) : LockHolder<LockType>(lock) {
|
||||||
|
|
||||||
|
if(!LockingPolicy::createScope(*this, timeout))
|
||||||
|
throw Timeout_Exception();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Guard that shares the effective protection scope
|
||||||
|
* from the given Guard to this Guard.
|
||||||
|
*
|
||||||
|
* @param g Guard<U, V> guard that is currently enabled
|
||||||
|
* @param lock LockType the lock this Guard will use to enforce its
|
||||||
|
* protection scope.
|
||||||
|
*/
|
||||||
|
template <class U, class V>
|
||||||
|
Guard(Guard<U, V>& g) : LockHolder<LockType>(g) {
|
||||||
|
|
||||||
|
LockingPolicy::shareScope(*this, extract(g));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Guard that shares the effective protection scope
|
||||||
|
* from the given Guard to this Guard.
|
||||||
|
*
|
||||||
|
* @param g Guard guard that is currently enabled
|
||||||
|
* @param lock LockType the lock this Guard will use to enforce its
|
||||||
|
* protection scope.
|
||||||
|
*/
|
||||||
|
Guard(Guard& g) : LockHolder<LockType>(g) {
|
||||||
|
|
||||||
|
LockingPolicy::shareScope(*this, g);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Guard that transfers the effective protection scope
|
||||||
|
* from the given Guard to this Guard.
|
||||||
|
*
|
||||||
|
* @param g Guard<U, V> guard that is currently enabled
|
||||||
|
* @param lock LockType the lock this Guard will use to enforce its
|
||||||
|
* protection scope.
|
||||||
|
*/
|
||||||
|
template <class U, class V>
|
||||||
|
Guard(Guard<U, V>& g, LockType& lock) : LockHolder<LockType>(lock) {
|
||||||
|
|
||||||
|
LockingPolicy::transferScope(*this, extract(g));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Guard that transfers the effective protection scope
|
||||||
|
* from the given Guard to this Guard.
|
||||||
|
*
|
||||||
|
* @param g Guard guard that is currently enabled
|
||||||
|
* @param lock LockType the lock this Guard will use to enforce its
|
||||||
|
* protection scope.
|
||||||
|
*/
|
||||||
|
Guard(Guard& g, LockType& lock) : LockHolder<LockType>(lock) {
|
||||||
|
|
||||||
|
LockingPolicy::transferScope(*this, g);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlock a given Lockable object with the destruction of this Guard
|
||||||
|
*/
|
||||||
|
~Guard() throw();
|
||||||
|
|
||||||
|
}; /* Guard */
|
||||||
|
|
||||||
|
|
||||||
|
template <class LockType, class LockingPolicy>
|
||||||
|
Guard<LockType, LockingPolicy>::~Guard() throw() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(!this->isDisabled())
|
||||||
|
LockingPolicy::destroyScope(*this);
|
||||||
|
|
||||||
|
} catch (...) { /* ignore */ }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __ZTGUARD_H__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
103
src/dep/include/zthread/GuardedClass.h
Normal file
103
src/dep/include/zthread/GuardedClass.h
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GUARDEDCLASS_H__
|
||||||
|
#define __GUARDEDCLASS_H__
|
||||||
|
|
||||||
|
#include "zthread/Guard.h"
|
||||||
|
#include "zthread/Mutex.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class GuardedClass
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-20T20:17:34-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* A simple wrapper template that uses Guard's to provide
|
||||||
|
* serialized access to an objects member functions.
|
||||||
|
*/
|
||||||
|
template <class T, class LockType = Mutex>
|
||||||
|
class GuardedClass {
|
||||||
|
|
||||||
|
LockType _lock;
|
||||||
|
T* _ptr;
|
||||||
|
|
||||||
|
class TransferedScope {
|
||||||
|
public:
|
||||||
|
|
||||||
|
template <class LockType1, class LockType2>
|
||||||
|
static void shareScope(LockHolder<LockType1>& l1,
|
||||||
|
LockHolder<LockType2>& l2) {
|
||||||
|
l1.disable();
|
||||||
|
l2.getLock().acquire();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class LockType1>
|
||||||
|
static void createScope(LockHolder<LockType1>& l) {
|
||||||
|
// Don't acquire the lock when scope the Guard is created
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class LockType1>
|
||||||
|
static void destroyScope(LockHolder<LockType1>& l) {
|
||||||
|
l.getLock().release();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class Proxy : Guard<LockType, TransferedScope> {
|
||||||
|
|
||||||
|
T* _object;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Proxy(LockType& lock, T* object) :
|
||||||
|
Guard<LockType, TransferedScope>(lock), _object(object) { }
|
||||||
|
|
||||||
|
T* operator->() {
|
||||||
|
return _object;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GuardedClass();
|
||||||
|
GuardedClass& operator=(const GuardedClass&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GuardedClass(T* ptr) : _ptr(ptr) {}
|
||||||
|
~GuardedClass() {
|
||||||
|
if(_ptr)
|
||||||
|
delete _ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Proxy operator->() {
|
||||||
|
Proxy p(_lock, _ptr);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTGUARDEDCLASS_H__
|
||||||
96
src/dep/include/zthread/Lockable.h
Normal file
96
src/dep/include/zthread/Lockable.h
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTLOCKABLE_H__
|
||||||
|
#define __ZTLOCKABLE_H__
|
||||||
|
|
||||||
|
#include "zthread/Exceptions.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Lockable
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T10:33:32-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* The Lockable interface defines a common method of adding general <i>acquire-release</i>
|
||||||
|
* semantics to an object. An <i>acquire-release</i> protocol does not necessarily imply
|
||||||
|
* exclusive access.
|
||||||
|
*/
|
||||||
|
class Lockable {
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Destroy a Lockable object.
|
||||||
|
virtual ~Lockable() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquire the Lockable object.
|
||||||
|
*
|
||||||
|
* This method may or may not block the caller for an indefinite amount
|
||||||
|
* of time. Those details are defined by specializations of this class.
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown if the calling thread is interrupted before
|
||||||
|
* the operation completes.
|
||||||
|
*
|
||||||
|
* @post The Lockable is acquired only if no exception was thrown.
|
||||||
|
*/
|
||||||
|
virtual void acquire() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to acquire the Lockable object.
|
||||||
|
*
|
||||||
|
* This method may or may not block the caller for a definite amount
|
||||||
|
* of time. Those details are defined by specializations of this class;
|
||||||
|
* however, this method includes a timeout value that can be used to
|
||||||
|
* limit the maximum amount of time that a specialization <i>could</i> block.
|
||||||
|
*
|
||||||
|
* @param timeout - maximum amount of time (milliseconds) this method could block
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if the operation completes and the Lockable is acquired before
|
||||||
|
* the timeout expires.
|
||||||
|
* - <em>false</em> if the operation times out before the Lockable can be acquired.
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown if the calling thread is interrupted before
|
||||||
|
* the operation completes.
|
||||||
|
*
|
||||||
|
* @post The Lockable is acquired only if no exception was thrown.
|
||||||
|
*/
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release the Lockable object.
|
||||||
|
*
|
||||||
|
* This method may or may not block the caller for an indefinite amount
|
||||||
|
* of time. Those details are defined by specializations of this class.
|
||||||
|
*
|
||||||
|
* @post The Lockable is released only if no exception was thrown.
|
||||||
|
*/
|
||||||
|
virtual void release() = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTLOCKABLE_H__
|
||||||
188
src/dep/include/zthread/LockedQueue.h
Normal file
188
src/dep/include/zthread/LockedQueue.h
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTLOCKEDQUEUE_H__
|
||||||
|
#define __ZTLOCKEDQUEUE_H__
|
||||||
|
|
||||||
|
#include "zthread/Guard.h"
|
||||||
|
#include "zthread/Queue.h"
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class LockedQueue
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T11:42:33-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* A LockedQueue is the simple Queue implementation that provides
|
||||||
|
* serialized access to the values added to it.
|
||||||
|
*/
|
||||||
|
template <class T, class LockType, typename StorageType=std::deque<T> >
|
||||||
|
class LockedQueue : public Queue<T> {
|
||||||
|
|
||||||
|
//! Serialize access to the Queue
|
||||||
|
LockType _lock;
|
||||||
|
|
||||||
|
//! Storage backing the queue
|
||||||
|
StorageType _queue;
|
||||||
|
|
||||||
|
//! Cancellation flag
|
||||||
|
volatile bool _canceled;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a LockedQueue
|
||||||
|
LockedQueue() : _canceled(false) {}
|
||||||
|
|
||||||
|
//! Destroy a LockedQueue
|
||||||
|
virtual ~LockedQueue() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::add(const T& item)
|
||||||
|
*/
|
||||||
|
virtual void add(const T& item) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
if(_canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
_queue.push_back(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::add(const T& item, unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual bool add(const T& item, unsigned long timeout) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
if(_canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
_queue.push_back(item);
|
||||||
|
|
||||||
|
} catch(Timeout_Exception&) { return false; }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::next()
|
||||||
|
*/
|
||||||
|
virtual T next() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
if(_queue.size() == 0 && _canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
if(_queue.size() == 0)
|
||||||
|
throw NoSuchElement_Exception();
|
||||||
|
|
||||||
|
T item = _queue.front();
|
||||||
|
_queue.pop_front();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::next(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual T next(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
if(_queue.size() == 0 && _canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
if(_queue.size() == 0)
|
||||||
|
throw NoSuchElement_Exception();
|
||||||
|
|
||||||
|
T item = _queue.front();
|
||||||
|
_queue.pop_front();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::cancel()
|
||||||
|
*/
|
||||||
|
virtual void cancel() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
_canceled = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::isCanceled()
|
||||||
|
*/
|
||||||
|
virtual bool isCanceled() {
|
||||||
|
|
||||||
|
// Faster check since the queue will not become un-canceled
|
||||||
|
if(_canceled)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
return _canceled;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::size()
|
||||||
|
*/
|
||||||
|
virtual size_t size() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
return _queue.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::size(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual size_t size(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
return _queue.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}; /* LockedQueue */
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTLOCKEDQUEUE_H__
|
||||||
345
src/dep/include/zthread/MonitoredQueue.h
Normal file
345
src/dep/include/zthread/MonitoredQueue.h
Normal file
@ -0,0 +1,345 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTMONITOREDQUEUE_H__
|
||||||
|
#define __ZTMONITOREDQUEUE_H__
|
||||||
|
|
||||||
|
#include "zthread/Condition.h"
|
||||||
|
#include "zthread/Guard.h"
|
||||||
|
#include "zthread/Queue.h"
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class MonitoredQueue
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T20:23:28-0400>
|
||||||
|
* @version 2.3.0
|
||||||
|
*
|
||||||
|
* A MonitoredQueue is a Queue implementation that provides serialized access to the
|
||||||
|
* items added to it.
|
||||||
|
*
|
||||||
|
* - Threads calling the empty() methods will be blocked until the BoundedQueue becomes empty.
|
||||||
|
* - Threads calling the next() methods will be blocked until the BoundedQueue has a value to
|
||||||
|
* return.
|
||||||
|
*
|
||||||
|
* @see Queue
|
||||||
|
*/
|
||||||
|
template <class T, class LockType, typename StorageType=std::deque<T> >
|
||||||
|
class MonitoredQueue : public Queue<T>, public Lockable {
|
||||||
|
|
||||||
|
//! Serialize access
|
||||||
|
LockType _lock;
|
||||||
|
|
||||||
|
//! Signaled on not empty
|
||||||
|
Condition _notEmpty;
|
||||||
|
|
||||||
|
//! Signaled on empty
|
||||||
|
Condition _isEmpty;
|
||||||
|
|
||||||
|
//! Storage backing the queue
|
||||||
|
StorageType _queue;
|
||||||
|
|
||||||
|
//! Cancellation flag
|
||||||
|
volatile bool _canceled;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new MonitoredQueue
|
||||||
|
MonitoredQueue()
|
||||||
|
: _notEmpty(_lock), _isEmpty(_lock), _canceled(false) {}
|
||||||
|
|
||||||
|
//! Destroy a MonitoredQueue, delete remaining items
|
||||||
|
virtual ~MonitoredQueue() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value to this Queue.
|
||||||
|
*
|
||||||
|
* @param item value to be added to the Queue
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Interrupted_Exception thrown if the thread was interrupted while waiting
|
||||||
|
* to add a value
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post If no exception is thrown, a copy of <i>item</i> will have been added to the Queue.
|
||||||
|
*
|
||||||
|
* @see Queue::add(const T& item)
|
||||||
|
*/
|
||||||
|
virtual void add(const T& item) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
// Allow no further additions in the canceled state
|
||||||
|
if(_canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
_queue.push_back( item );
|
||||||
|
|
||||||
|
_notEmpty.signal(); // Wake one waiter
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value to this Queue.
|
||||||
|
*
|
||||||
|
* @param item value to be added to the Queue
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method may block
|
||||||
|
* the calling thread.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if a copy of <i>item</i> can be added before <i>timeout</i>
|
||||||
|
* milliseconds elapse.
|
||||||
|
* - <em>false</em> otherwise.
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Interrupted_Exception thrown if the thread was interrupted while waiting
|
||||||
|
* to add a value
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post If no exception is thrown, a copy of <i>item</i> will have been added to the Queue.
|
||||||
|
*
|
||||||
|
* @see Queue::add(const T& item, unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual bool add(const T& item, unsigned long timeout) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
if(_canceled)
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
_queue.push_back(item);
|
||||||
|
|
||||||
|
_notEmpty.signal();
|
||||||
|
|
||||||
|
} catch(Timeout_Exception&) { return false; }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve and remove a value from this Queue.
|
||||||
|
*
|
||||||
|
* If invoked when there are no values present to return then the calling thread
|
||||||
|
* will be blocked until a value arrives in the Queue.
|
||||||
|
*
|
||||||
|
* @return <em>T</em> next available value
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Interrupted_Exception thrown if the thread was interrupted while waiting
|
||||||
|
* to retrieve a value
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post The value returned will have been removed from the Queue.
|
||||||
|
*/
|
||||||
|
virtual T next() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
while (_queue.size() == 0 && !_canceled)
|
||||||
|
_notEmpty.wait();
|
||||||
|
|
||||||
|
if(_queue.size() == 0) // Queue canceled
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
T item = _queue.front();
|
||||||
|
_queue.pop_front();
|
||||||
|
|
||||||
|
if(_queue.size() == 0) // Wake empty waiters
|
||||||
|
_isEmpty.broadcast();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve and remove a value from this Queue.
|
||||||
|
*
|
||||||
|
* If invoked when there are no values present to return then the calling thread
|
||||||
|
* will be blocked until a value arrives in the Queue.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method may block
|
||||||
|
* the calling thread.
|
||||||
|
*
|
||||||
|
* @return <em>T</em> next available value
|
||||||
|
*
|
||||||
|
* @exception Cancellation_Exception thrown if this Queue has been canceled.
|
||||||
|
* @exception Timeout_Exception thrown if the timeout expires before a value
|
||||||
|
* can be retrieved.
|
||||||
|
*
|
||||||
|
* @pre The Queue should not have been canceled prior to the invocation of this function.
|
||||||
|
* @post The value returned will have been removed from the Queue.
|
||||||
|
*/
|
||||||
|
virtual T next(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
while(_queue.size() == 0 && !_canceled) {
|
||||||
|
if(!_notEmpty.wait(timeout))
|
||||||
|
throw Timeout_Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( _queue.size() == 0) // Queue canceled
|
||||||
|
throw Cancellation_Exception();
|
||||||
|
|
||||||
|
T item = _queue.front();
|
||||||
|
_queue.pop_front();
|
||||||
|
|
||||||
|
if(_queue.size() == 0) // Wake empty waiters
|
||||||
|
_isEmpty.broadcast();
|
||||||
|
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel this queue.
|
||||||
|
*
|
||||||
|
* @post Any threads blocked by a next() function will throw a Cancellation_Exception.
|
||||||
|
*
|
||||||
|
* @see Queue::cancel()
|
||||||
|
*/
|
||||||
|
virtual void cancel() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
_canceled = true;
|
||||||
|
_notEmpty.broadcast(); // Wake next() waiters
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::isCanceled()
|
||||||
|
*/
|
||||||
|
virtual bool isCanceled() {
|
||||||
|
|
||||||
|
// Faster check since the queue will not become un-canceled
|
||||||
|
if(_canceled)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
return _canceled;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::size()
|
||||||
|
*/
|
||||||
|
virtual size_t size() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
return _queue.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Queue::size(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual size_t size(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
return _queue.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether any values are available in this Queue.
|
||||||
|
*
|
||||||
|
* The calling thread is blocked until there are no values present
|
||||||
|
* in the Queue.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if there are no values available.
|
||||||
|
* - <em>false</em> if there <i>are</i> values available.
|
||||||
|
*
|
||||||
|
* @see Queue::empty()
|
||||||
|
*/
|
||||||
|
virtual bool empty() {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock);
|
||||||
|
|
||||||
|
while(_queue.size() > 0) // Wait for an empty signal
|
||||||
|
_isEmpty.wait();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether any values are available in this Queue.
|
||||||
|
*
|
||||||
|
* The calling thread is blocked until there are no values present
|
||||||
|
* in the Queue.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method may block
|
||||||
|
* the calling thread.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if there are no values available.
|
||||||
|
* - <em>false</em> if there <i>are</i> values available.
|
||||||
|
*
|
||||||
|
* @exception Timeout_Exception thrown if <i>timeout</i> milliseconds
|
||||||
|
* expire before a value becomes available
|
||||||
|
*
|
||||||
|
* @see Queue::empty()
|
||||||
|
*/
|
||||||
|
virtual bool empty(unsigned long timeout) {
|
||||||
|
|
||||||
|
Guard<LockType> g(_lock, timeout);
|
||||||
|
|
||||||
|
while(_queue.size() > 0) // Wait for an empty signal
|
||||||
|
_isEmpty.wait(timeout);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void acquire() {
|
||||||
|
_lock.acquire();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool tryAcquire(unsigned long timeout) {
|
||||||
|
return _lock.tryAcquire(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void release() {
|
||||||
|
_lock.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}; /* MonitoredQueue */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTMONITOREDQUEUE_H__
|
||||||
|
|
||||||
135
src/dep/include/zthread/Mutex.h
Normal file
135
src/dep/include/zthread/Mutex.h
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Eric Crahen
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
* to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ZTMUTEX_H__
|
||||||
|
#define __ZTMUTEX_H__
|
||||||
|
|
||||||
|
#include "zthread/Lockable.h"
|
||||||
|
#include "zthread/NonCopyable.h"
|
||||||
|
|
||||||
|
namespace ZThread {
|
||||||
|
|
||||||
|
class FifoMutexImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Mutex
|
||||||
|
* @author Eric Crahen <http://www.code-foo.com>
|
||||||
|
* @date <2003-07-16T19:35:28-0400>
|
||||||
|
* @version 2.2.1
|
||||||
|
*
|
||||||
|
* A Mutex is used to provide serialized (one thread at a time) access to some portion
|
||||||
|
* of code. This is accomplished by attempting to acquire the Mutex before entering that
|
||||||
|
* piece of code, and by releasing the Mutex when leaving that region. It is a non-reentrant,
|
||||||
|
* MUTual EXclusion Lockable object.
|
||||||
|
*
|
||||||
|
* @see Guard
|
||||||
|
*
|
||||||
|
* <b>Scheduling</b>
|
||||||
|
*
|
||||||
|
* Threads competing to acquire() a Mutex are granted access in FIFO order.
|
||||||
|
*
|
||||||
|
* <b>Error Checking</b>
|
||||||
|
*
|
||||||
|
* A Mutex will throw a Deadlock_Exception if an attempt to acquire a Mutex more
|
||||||
|
* than once is made from the context of the same thread.
|
||||||
|
*
|
||||||
|
* A Mutex will throw an InvalidOp_Exception if an attempt to release a Mutex is
|
||||||
|
* made from the context of a thread that does not currently own that Mutex.
|
||||||
|
*/
|
||||||
|
class ZTHREAD_API Mutex : public Lockable, private NonCopyable {
|
||||||
|
|
||||||
|
FifoMutexImpl* _impl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Create a new Mutex.
|
||||||
|
Mutex();
|
||||||
|
|
||||||
|
//! Destroy this Mutex.
|
||||||
|
virtual ~Mutex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquire a Mutex, possibly blocking until either the current owner of the
|
||||||
|
* Mutex releases it or until an exception is thrown.
|
||||||
|
*
|
||||||
|
* Only one thread may acquire() the Mutex at any given time.
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown when the calling thread is interrupted.
|
||||||
|
* A thread may be interrupted at any time, prematurely ending any wait.
|
||||||
|
* @exception Deadlock_Exception thrown when the same thread attempts to acquire
|
||||||
|
* a Mutex more than once, without having first release()ed it.
|
||||||
|
*
|
||||||
|
* @pre the calling thread must not have already acquired Mutex
|
||||||
|
*
|
||||||
|
* @post the calling thread successfully acquired Mutex only if no exception
|
||||||
|
* was thrown.
|
||||||
|
*
|
||||||
|
* @see Lockable::acquire()
|
||||||
|
*/
|
||||||
|
virtual void acquire();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquire a Mutex, possibly blocking until the current owner of the
|
||||||
|
* Mutex releases it, until an exception is thrown or until the given amount
|
||||||
|
* of time expires.
|
||||||
|
*
|
||||||
|
* Only one thread may acquire the Mutex at any given time.
|
||||||
|
*
|
||||||
|
* @param timeout maximum amount of time (milliseconds) this method could block
|
||||||
|
* @return
|
||||||
|
* - <em>true</em> if the lock was acquired
|
||||||
|
* - <em>false</em> if the lock was acquired
|
||||||
|
*
|
||||||
|
* @exception Interrupted_Exception thrown when the calling thread is interrupted.
|
||||||
|
* A thread may be interrupted at any time, prematurely ending any wait.
|
||||||
|
* @exception Deadlock_Exception thrown when the same thread attempts to acquire
|
||||||
|
* a Mutex more than once, without having first released it.
|
||||||
|
*
|
||||||
|
* @pre the calling thread must not have already acquired Mutex
|
||||||
|
*
|
||||||
|
* @post the calling thread successfully acquired Mutex only if no exception
|
||||||
|
* was thrown.
|
||||||
|
*
|
||||||
|
* @see Lockable::tryAcquire(unsigned long timeout)
|
||||||
|
*/
|
||||||
|
virtual bool tryAcquire(unsigned long timeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release a Mutex allowing another thread to acquire it.
|
||||||
|
*
|
||||||
|
* @exception InvalidOp_Exception - thrown if there is an attempt to release is
|
||||||
|
* a Mutex that was not owner by the calling thread.
|
||||||
|
*
|
||||||
|
* @pre the calling thread must have first acquired the Mutex.
|
||||||
|
* @post the calling thread successfully released Mutex only if no exception
|
||||||
|
* was thrown.
|
||||||
|
*
|
||||||
|
* @see Lockable::release()
|
||||||
|
*/
|
||||||
|
virtual void release();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ZThread
|
||||||
|
|
||||||
|
#endif // __ZTMUTEX_H__
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user