SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
AuthEvents.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
9 #include "LinkLevelEvent.h"
10 #include "Buffer.h"
11 #include "Logging.h"
12 class AuthLink;
13 
14 namespace SEGSEvents
15 {
18 class AuthLinkEvent : public Event
19 {
20 protected:
21  ~AuthLinkEvent() override = default;
22 public:
23  AuthLinkEvent(size_t evtype,EventSrc *ev_src=nullptr) : Event(evtype,ev_src)
24  {}
25  virtual void serializeto(GrowingBuffer &) const=0;
26  virtual void serializefrom(GrowingBuffer &)=0;
27 };
28 
30 {
42 
43 };
44 // [[ev_def:type]]
45 class SendLeftovers final : public Event // this event is posted from AuthLink to AuthLink, it means there are leftover unsent bytes.
46 {
47 public:
49  {}
51 };
52 // [[ev_def:type]]
53 class ReconnectAttempt final : public AuthLinkEvent
54 {
55 public:
56  // [[ev_def:field]]
57  uint8_t m_arr[8];
59  {}
60  void init(EventSrc *ev_src,const uint8_t *auth_arr) {memcpy(m_arr,auth_arr,8);m_event_source=ev_src;}
61  void serializeto(GrowingBuffer &buf) const override
62  {
63  buf.uPut((uint8_t)3);
64  buf.uPutBytes(m_arr,8);
65  }
66  void serializefrom(GrowingBuffer &buf) override
67  {
68  uint8_t op;
69  buf.uGet(op);
70  if(op != 3)
71  {
72  qWarning() << op << "in ReconnectAttempt serializefrom";
73  for (auto i : m_arr)
74  qWarning() << i;
75  }
76  buf.uGetBytes(m_arr,8);
77  }
79 };
80 } // end of SEGSEvents namespace
83 #include "Auth/DbError.h"
85 #include "Auth/LoginResponse.h"
86 #include "Auth/LoginRequest.h"
88 #include "Auth/ServerListRequest.h"
EventSrc * m_event_source
Definition: SEGSEvent.h:40
AuthEventTypes
Definition: AuthEvents.h:29
SendLeftovers()
Definition: AuthEvents.h:48
void serializefrom(GrowingBuffer &buf) override
Definition: AuthEvents.h:66
void uGetBytes(uint8_t *t, uint32_t len)
Definition: Buffer.cpp:144
Definition: EventProcessor.h:14
void uGet(T &val)
Definition: Buffer.h:77
Definition: SEGSEvent.h:35
Definition: AuthEvents.h:39
virtual void serializefrom(GrowingBuffer &)=0
void init(EventSrc *ev_src, const uint8_t *auth_arr)
Definition: AuthEvents.h:60
Definition: LinkLevelEvent.h:13
Definition: AuthEvents.h:31
AuthLinkEvent(size_t evtype, EventSrc *ev_src=nullptr)
Definition: AuthEvents.h:23
Definition: AuthEvents.h:32
Definition: AuthEvents.h:45
Definition: Buffer.h:17
ReconnectAttempt()
Definition: AuthEvents.h:58
Definition: AuthEvents.h:53
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77
~AuthLinkEvent() override=default
virtual void serializeto(GrowingBuffer &) const =0
void uPut(const T &val)
Definition: Buffer.h:70
Definition: AuthEvents.h:36
Definition: SEGSEvent.h:32
Definition: AuthEvents.h:37
Definition: AuthEvents.h:34
Definition: AuthEvents.h:38
Definition: AuthEvents.h:35
void uPutBytes(const uint8_t *t, uint32_t len)
Definition: Buffer.cpp:108
Definition: AuthEvents.h:33
Definition: AuthEvents.h:40
Definition: AuthEvents.h:41
Definition: AuthEvents.h:18
void serializeto(GrowingBuffer &buf) const override
Definition: AuthEvents.h:61