SEGS  0.6.1-develop [39915b3b]
Super Entity Game Server
AuthorizationProtocolVersion.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
10 
11 namespace SEGSEvents
12 {
13 
14 // [[ev_def:type]]
16 {
17 public:
18  // [[ev_def:field]]
19  uint32_t m_seed = 1;
20  // [[ev_def:field]]
21  uint32_t m_proto_vers = 0;
23  {}
24  AuthProtocolVersion(uint32_t version_id,uint32_t seed) :
26  m_seed(seed),
27  m_proto_vers(version_id)
28  {}
29  void init(EventSrc *ev_src,uint32_t version_id,uint32_t seed)
30  {
31  m_proto_vers=version_id;
32  m_event_source=ev_src; m_seed=seed;
33  }
34  void serializeto(GrowingBuffer &buf) const override
35  {
36  buf.uPut((uint8_t)0);
37  buf.uPut(m_seed);
38  buf.uPut(m_proto_vers);
39  }
40  void serializefrom(GrowingBuffer &buf) override
41  {
42  uint8_t packet_type;
43  buf.uGet(packet_type);
44  buf.uGet(m_seed);
45  buf.uGet(m_proto_vers);
46  }
47  uint32_t getSeed() const
48  {
49  return m_seed;
50  }
51  uint32_t getProtoVers() const
52  {
53  return m_proto_vers;
54  }
56 };
57 } // end of namespace SEGSEvents
EventSrc * m_event_source
Definition: SEGSEvent.h:40
void init(EventSrc *ev_src, uint32_t version_id, uint32_t seed)
Definition: AuthorizationProtocolVersion.h:29
void serializeto(GrowingBuffer &buf) const override
Definition: AuthorizationProtocolVersion.h:34
uint32_t getProtoVers() const
Definition: AuthorizationProtocolVersion.h:51
uint32_t m_seed
Definition: AuthorizationProtocolVersion.h:19
AuthProtocolVersion(uint32_t version_id, uint32_t seed)
Definition: AuthorizationProtocolVersion.h:24
Definition: EventProcessor.h:14
void uGet(T &val)
Definition: Buffer.h:77
Definition: LinkLevelEvent.h:13
Definition: AuthEvents.h:32
AuthProtocolVersion()
Definition: AuthorizationProtocolVersion.h:22
uint32_t getSeed() const
Definition: AuthorizationProtocolVersion.h:47
Definition: Buffer.h:17
uint32_t m_proto_vers
Definition: AuthorizationProtocolVersion.h:21
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77
void uPut(const T &val)
Definition: Buffer.h:70
Definition: AuthorizationProtocolVersion.h:15
Definition: AuthEvents.h:18
void serializefrom(GrowingBuffer &buf) override
Definition: AuthorizationProtocolVersion.h:40