TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OpcodeTable Class Reference

#include <Opcodes.h>

Public Member Functions

 OpcodeTable ()
 
 OpcodeTable (OpcodeTable const &)=delete
 
OpcodeTableoperator= (OpcodeTable const &)=delete
 
 ~OpcodeTable ()
 
void Initialize ()
 Correspondence between opcodes and their names. More...
 
ClientOpcodeHandler constoperator[] (OpcodeClient index) const
 
ServerOpcodeHandler constoperator[] (OpcodeServer index) const
 

Private Member Functions

template<class PacketClass , void(WorldSession::*)(PacketClass &) HandlerFunction>
void ValidateAndSetClientOpcode (OpcodeClient opcode, char const *name, SessionStatus status, PacketProcessing processing)
 
void ValidateAndSetServerOpcode (OpcodeServer opcode, char const *name, SessionStatus status, ConnectionType conIdx)
 

Private Attributes

ClientOpcodeHandler_internalTableClient [NUM_OPCODE_HANDLERS]
 
ServerOpcodeHandler_internalTableServer [NUM_OPCODE_HANDLERS]
 

Constructor & Destructor Documentation

OpcodeTable::OpcodeTable ( )
inline
1732  {
1733  memset(_internalTableClient, 0, sizeof(_internalTableClient));
1734  memset(_internalTableServer, 0, sizeof(_internalTableServer));
1735  }
ServerOpcodeHandler * _internalTableServer[NUM_OPCODE_HANDLERS]
Definition: Opcodes.h:1768
ClientOpcodeHandler * _internalTableClient[NUM_OPCODE_HANDLERS]
Definition: Opcodes.h:1767
OpcodeTable::OpcodeTable ( OpcodeTable const )
delete
OpcodeTable::~OpcodeTable ( )
inline
1741  {
1742  for (uint16 i = 0; i < NUM_OPCODE_HANDLERS; ++i)
1743  {
1744  delete _internalTableClient[i];
1745  delete _internalTableServer[i];
1746  }
1747  }
ServerOpcodeHandler * _internalTableServer[NUM_OPCODE_HANDLERS]
Definition: Opcodes.h:1768
Definition: Opcodes.h:41
uint16_t uint16
Definition: Define.h:151
ClientOpcodeHandler * _internalTableClient[NUM_OPCODE_HANDLERS]
Definition: Opcodes.h:1767

Member Function Documentation

void OpcodeTable::Initialize ( void  )

Correspondence between opcodes and their names.

112 {
113 #define DEFINE_HANDLER(opcode, status, processing, packetclass, handler) \
114  ValidateAndSetClientOpcode<packetclass, handler>(opcode, #opcode, status, processing);
115 
116 #define DEFINE_OPCODE_HANDLER_OLD(opcode, status, processing, handler) \
117  DEFINE_HANDLER(opcode, status, processing, WorldPacket, handler);
118 
250  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_MODERATOR, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::SetModerator>);
251  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_MUTE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::SetMute>);
252  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_OWNER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelCommand<&Channel::SendWhoOwner>);
253  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_PASSWORD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::Password>);
255  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_SILENCE_ALL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::SilenceAll>);
256  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_SILENCE_VOICE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::SilenceVoice>);
258  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNMODERATOR, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::UnsetModerator>);
259  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNMUTE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::UnsetMute>);
260  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNSILENCE_ALL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::UnsilenceAll>);
261  DEFINE_HANDLER(CMSG_CHAT_CHANNEL_UNSILENCE_VOICE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Channel::ChannelPlayerCommand, &WorldSession::HandleChannelPlayerCommand<&Channel::UnsilenceVoice>);
794 
795 #undef DEFINE_OPCODE_HANDLER_OLD
796 #undef DEFINE_HANDLER
797 
798 #define DEFINE_SERVER_OPCODE_HANDLER(opcode, status, con) \
799  static_assert(status == STATUS_NEVER || status == STATUS_UNHANDLED, "Invalid status for server opcode"); \
800  ValidateAndSetServerOpcode(opcode, #opcode, status, con)
801