SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AuthDBSyncEvents.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 
10 #include "Servers/InternalEvents.h"
11 
12 #include <QDateTime>
13 
14 enum AuthDBEventTypes : uint32_t
15 {
16  evRetrieveAccountRequest = Internal_EventTypes::evLAST_EVENT,
22 };
23 
24 #define ONE_WAY_MESSAGE(name)\
25 struct name ## Message final : public InternalEvent\
26 {\
27  name ## Data m_data;\
28  name ## Message(name ## Data &&d) : InternalEvent(AuthDBEventTypes::ev ## name),m_data(d) {}\
29 };
30 
32 #define SIMPLE_TWO_WAY_MESSAGE(name)\
33 struct name ## Request final : public InternalEvent\
34 {\
35  name ## Message(uint64_t token) : InternalEvent(AuthDBEventTypes::ev ## name ## Request) {session_token(token);}\
36 };\
37 struct name ## Response final : public InternalEvent\
38 {\
39  name ## Data m_data;\
40  name ## Response(name ## Data &&d,uint64_t token) : InternalEvent(AuthDBEventTypes::ev ## name ## Response),m_data(d) {session_token(token);}\
41 };
42 
44 #define TWO_WAY_MESSAGE(name)\
45 struct name ## Request final : public InternalEvent\
46 {\
47  name ## RequestData m_data;\
48  name ## Request(name ## RequestData &&d,uint64_t token) : InternalEvent(AuthDBEventTypes::ev ## name ## Request),m_data(d) {session_token(token);}\
49 };\
50 struct name ## Response final : public InternalEvent\
51 {\
52  name ## ResponseData m_data;\
53  name ## Response(name ## ResponseData &&d,uint64_t token) : InternalEvent(AuthDBEventTypes::ev ## name ## Response),m_data(d) {session_token(token);}\
54 };
55 
57 {
58  QString username;
59  QString password;
61 };
62 ONE_WAY_MESSAGE(CreateAccount)
63 
65 {
66  QString message;
67 };
68 ONE_WAY_MESSAGE(AuthDbError)
69 
71 {
73  QString m_login;
74  QDateTime m_creation_date;
75  uint8_t m_access_level;
76  void mark_as_missing() { m_acc_server_acc_id = 0; }
77  bool valid() const { return m_acc_server_acc_id!=0; }
78  bool isBlocked() const { return m_access_level == 0; }
79 
80 };
81 
83 {
84  QString m_login;
85  QString m_password;
86  uint32_t m_id; // if this is 0, the lookup will be done by login, otherwise by id
87 };
88 TWO_WAY_MESSAGE(RetrieveAccount)
89 
91 {
92  QString username;
93  QString password;
94 };
95 
97 {
99 };
100 TWO_WAY_MESSAGE(ValidatePassword)
101 
102 #undef ONE_WAY_MESSAGE
103 #undef SIMPLE_TWO_WAY_MESSAGE
104 #undef TWO_WAY_MESSAGE
#define ONE_WAY_MESSAGE(name)
Definition: AuthDBSyncEvents.h:24
Definition: AuthDBSyncEvents.h:90
QString m_login
Definition: AuthDBSyncEvents.h:84
uint32_t m_id
Definition: AuthDBSyncEvents.h:86
Definition: AuthDBSyncEvents.h:82
bool isBlocked() const
Definition: AuthDBSyncEvents.h:78
bool valid() const
Definition: AuthDBSyncEvents.h:77
Definition: AuthDBSyncEvents.h:16
Definition: AuthDBSyncEvents.h:70
QString username
Definition: AuthDBSyncEvents.h:92
uint64_t m_acc_server_acc_id
Definition: AuthDBSyncEvents.h:72
Definition: AuthDBSyncEvents.h:17
Definition: AuthDBSyncEvents.h:19
QString username
Definition: AuthDBSyncEvents.h:58
QString m_login
Definition: AuthDBSyncEvents.h:73
AuthDBEventTypes
Definition: AuthDBSyncEvents.h:14
void mark_as_missing()
Definition: AuthDBSyncEvents.h:76
Definition: AuthDBSyncEvents.h:56
int access_level
Definition: AuthDBSyncEvents.h:60
QDateTime m_creation_date
Definition: AuthDBSyncEvents.h:74
QString password
Definition: AuthDBSyncEvents.h:93
Definition: AuthDBSyncEvents.h:20
Definition: AuthDBSyncEvents.h:18
Definition: AuthDBSyncEvents.h:21
QString message
Definition: AuthDBSyncEvents.h:66
#define TWO_WAY_MESSAGE(name)
A message with Request having additional data.
Definition: AuthDBSyncEvents.h:44
uint8_t m_access_level
Definition: AuthDBSyncEvents.h:75
bool m_valid_password
Definition: AuthDBSyncEvents.h:98
Definition: AuthDBSyncEvents.h:96
QString password
Definition: AuthDBSyncEvents.h:59
QString m_password
Definition: AuthDBSyncEvents.h:85
Definition: AuthDBSyncEvents.h:64