SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
CRUD_Events.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 "Logging.h"
10 #include "CRUDP_Packet.h"
11 #include "EventProcessor.h"
12 #include "LinkLevelEvent.h"
13 
14 #include <memory>
15 
16 namespace SEGSEvents
17 {
18 
19 enum CRUD_EventTypes : uint32_t
20 {
21  // skip 11 entries here, they are used by AuthEventTypes
32 };
33 // [[ev_def:type]]
34 class Packet : public Event
35 {
36 public:
37  Packet() : Event(CRUD_EventTypes::evPacket,nullptr) {}
38  Packet(EventSrc *evsrc, std::unique_ptr<CrudP_Packet> &&pkt, const ACE_INET_Addr &tgt)
39  : Event(evPacket, evsrc), m_pkt(std::move(pkt)), target(tgt)
40  {
41  }
42  std::unique_ptr<CrudP_Packet> m_pkt;
43  ACE_INET_Addr target;
44  const uint8_t *bytes() const;
45  size_t size() const;
47 };
48 class CRUDLink_Event : public Event
49 {
50 public:
51  CRUDLink_Event(uint32_t evtype, EventSrc *ev_src = nullptr) : Event(evtype, ev_src) //,LINK
52  {
53  }
54  virtual void serializeto(BitStream &) const = 0;
55  virtual void serializefrom(BitStream &) = 0;
56  size_t m_seq_number;
57  bool m_reliable = true;
58 };
59 
60 // [[ev_def:type]]
62 {
63 public:
65  void serializeto(BitStream &tgt) const override;
66  void serializefrom(BitStream &src) override;
67  // [[ev_def:field]]
68  uint32_t m_tickcount;
69  // [[ev_def:field]]
70  uint32_t m_version;
72 };
73 
74 // [[ev_def:type]]
76 {
77 public:
79  void serializeto(BitStream &tgt) const override;
80  void serializefrom(BitStream &) override {}
82 };
83 // [[ev_def:type]]
85 {
86 public:
88  void serializefrom(BitStream &bs) override;
89  void serializeto(BitStream &bs) const override;
91 };
92 // [[ev_def:type]]
94 {
95 public:
97  void serializefrom(BitStream &bs) override;
98  void serializeto(BitStream &bs) const override;
100 };
101 // [[ev_def:type]]
102 class Idle : public CRUDLink_Event
103 {
104 public:
106  void serializefrom(BitStream &bs) override;
107  void serializeto(BitStream &bs) const override;
109 };
110 // [[ev_def:type]]
112 {
113 public:
115  { }
116  void serializeto(BitStream &) const override { }
117  void serializefrom(BitStream &) override { }
119 };
120 } // end of SEGSEvents namespace
122 {
123 public:
124  virtual SEGSEvents::CRUDLink_Event *EventFromStream(BitStream &bs);
125 };
126 
Packet()
Definition: CRUD_Events.h:37
Definition: CRUD_Events.h:34
Idle()
Definition: CRUD_Events.h:105
DisconnectRequest()
Definition: CRUD_Events.h:87
Definition: CRUD_Events.h:23
Definition: CRUD_Events.h:75
Definition: EventProcessor.h:14
Definition: SEGSEvent.h:35
Definition: seq_definitions.h:23
Definition: BitStream.h:34
CRUD_EventTypes
Definition: CRUD_Events.h:19
UnknownEvent()
Definition: CRUD_Events.h:114
Definition: LinkLevelEvent.h:13
Definition: CRUD_Events.h:24
Definition: CRUD_Events.h:84
uint32_t m_tickcount
Definition: CRUD_Events.h:68
void serializefrom(BitStream &) override
Definition: CRUD_Events.h:117
uint32_t m_version
Definition: CRUD_Events.h:70
#define END_EVENTS(enum_name, cnt)
Definition: SEGSEvent.h:24
Definition: CRUD_Events.h:29
std::unique_ptr< CrudP_Packet > m_pkt
Definition: CRUD_Events.h:42
Definition: CRUD_Events.h:26
#define BEGINE_EVENTS_SKIP(enum_name, parent_class, skip)
Definition: SEGSEvent.h:21
ConnectRequest()
Definition: CRUD_Events.h:64
Definition: CRUD_Events.h:28
void serializefrom(BitStream &) override
Definition: CRUD_Events.h:80
Packet(EventSrc *evsrc, std::unique_ptr< CrudP_Packet > &&pkt, const ACE_INET_Addr &tgt)
Definition: CRUD_Events.h:38
DisconnectResponse()
Definition: CRUD_Events.h:96
Definition: CRUD_Events.h:27
Definition: CRUD_Events.h:25
void serializeto(BitStream &) const override
Definition: CRUD_Events.h:116
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77
Definition: CRUD_Events.h:102
Definition: CRUD_Events.h:61
Definition: CRUD_Events.h:93
EventSrc * src() const
Definition: SEGSEvent.h:65
ConnectResponse()
Definition: CRUD_Events.h:78
Definition: CRUD_Events.h:111
Definition: CRUD_Events.h:30
ACE_INET_Addr target
Definition: CRUD_Events.h:43
Definition: CRUD_Events.h:121
CommonTypes
Definition: SEGSEvent.h:26