SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 #include "LinkLevelEvent.h"
10 #include "Buffer.h"
11 class AuthLink;
12 
15 class AuthLinkEvent : public SEGSEvent
16 {
17 protected:
18  ~AuthLinkEvent() override = default;
19 public:
20  AuthLinkEvent(size_t evtype,EventProcessor *ev_src=nullptr) : SEGSEvent(evtype,ev_src)
21  {}
22  virtual void serializeto(GrowingBuffer &) const=0;
23  virtual void serializefrom(GrowingBuffer &)=0;
24 };
25 
27 {
28  evContinue=SEGS_EventTypes::evLAST_EVENT,
39 
40 };
41 class ContinueEvent : public SEGSEvent // this event is posted from AuthLink to AuthLink, it means there are leftover unsent bytes.
42 {
43 public:
45  {}
46 };
48 {
49  uint8_t m_arr[8];
50 public:
52  {}
53  void init(EventProcessor *ev_src,const uint8_t *auth_arr) {memcpy(m_arr,auth_arr,8);m_event_source=ev_src;}
54  void serializeto(GrowingBuffer &buf) const
55  {
56  buf.uPut((uint8_t)3);
57  buf.uPutBytes(m_arr,8);
58  }
60  {
61  uint8_t op;
62  buf.uGet(op);
63  assert(op==3);
64  buf.uGetBytes(m_arr,8);
65  }
66 };
69 #include "Events/DbError.h"
71 #include "Events/LoginResponse.h"
72 #include "Events/LoginRequest.h"
Definition: AuthEvents.h:31
virtual void serializeto(GrowingBuffer &) const =0
ContinueEvent()
Definition: AuthEvents.h:44
Definition: AuthEvents.h:34
Definition: SEGSEvent.h:32
void uGet(T &val)
Definition: Buffer.h:76
Definition: AuthEvents.h:35
Definition: AuthEvents.h:36
Definition: AuthEvents.h:29
Definition: AuthEvents.h:33
void serializefrom(GrowingBuffer &buf)
Definition: AuthEvents.h:59
ReconnectAttempt()
Definition: AuthEvents.h:51
Definition: Buffer.h:17
void uPutBytes(const uint8_t *t, size_t len)
Definition: Buffer.cpp:96
Definition: AuthEvents.h:30
void serializeto(GrowingBuffer &buf) const
Definition: AuthEvents.h:54
Definition: AuthEvents.h:47
void init(EventProcessor *ev_src, const uint8_t *auth_arr)
Definition: AuthEvents.h:53
Definition: AuthEvents.h:38
Definition: AuthEvents.h:28
void uPut(const T &val)
Definition: Buffer.h:69
Definition: AuthEvents.h:32
Definition: EventProcessor.h:13
EventProcessor * m_event_source
Definition: SEGSEvent.h:36
virtual void serializefrom(GrowingBuffer &)=0
void uGetBytes(uint8_t *t, size_t len)
Definition: Buffer.cpp:133
Definition: AuthEvents.h:41
Definition: AuthEvents.h:15
AuthEventTypes
Definition: AuthEvents.h:26
~AuthLinkEvent() override=default
AuthLinkEvent(size_t evtype, EventProcessor *ev_src=nullptr)
Definition: AuthEvents.h:20
Definition: AuthEvents.h:37