MCPcopy Create free account
hub / github.com/Segs/Segs / OpcodeToType

Function OpcodeToType

Projects/CoX/Common/AuthProtocol/AuthLink.cpp:70–101  ·  view source on GitHub ↗

\brief Convert opcode byte to corresponding packet type \arg opcode packet opcode byte \arg direction if this is false then the packet is from server to client, other way around otherwise */

Source from the content-addressed store, hash-verified

68 \arg direction if this is false then the packet is from server to client, other way around otherwise
69*/
70eAuthPacketType OpcodeToType(AuthLinkType link_type,uint8_t opcode )
71{
72 // packets coming in from server to client
73 if(link_type==AuthLinkType::Client)
74 {
75 switch(opcode)
76 {
77 case 0: return SMSG_AUTHVERSION;
78 case 1: return SMSG_AUTH_ALREADY_LOGGED_IN;
79 case 2: return SMSG_AUTH_INVALID_PASSWORD;
80 case 3: return PKT_AUTH_LOGIN_SUCCESS;
81 case 4: return SMSG_AUTH_SERVER_LIST;
82 case 5: return CMSG_DB_CONN_FAILURE;
83 case 6: return SMSG_AUTH_OK; // still a type of error ?
84 case 7: return PKT_SELECT_SERVER_RESPONSE;
85 case 9: return SMSG_AUTH_ERROR;
86 }
87
88 }
89 else
90 {
91 // packets incoming from client to server
92 switch(opcode)
93 {
94 case 0: return CMSG_AUTH_LOGIN;
95 case 2: return CMSG_AUTH_SELECT_DBSERVER;
96 case 3: return CMSG_RECONNECT_ATTEMPT;
97 case 5: return CMSG_AUTH_REQUEST_SERVER_LIST;
98 }
99 }
100 return MSG_AUTH_UNKNOWN;
101}
102//! tries to convert the available bytes into a valid AuthHandler LinkLevelEvent.
103Event * bytes_to_event(AuthLinkState &m_state)
104{

Callers 1

bytes_to_eventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected