Emergency 20 Dokumentation  4.2.0
TestOpenPortResponse.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
17 
18 
19 //[-------------------------------------------------------]
20 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24  namespace packet
25  {
26 
27 
28  //[-------------------------------------------------------]
29  //[ Classes ]
30  //[-------------------------------------------------------]
35  class EM5_API_EXPORT TestOpenPortResponse : public qsf::packet::BinaryPacket<TestOpenPortResponse>
36  {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Public definitions ]
41  //[-------------------------------------------------------]
42  public:
43  static const uint32 PACKET_ID;
44 
46  {
47  std::string address;
48  bool isIpv4;
49  };
50 
51  struct ResultSet
52  {
53  bool testedIPv4;
54  bool testedIPv6;
55  std::vector<ReachableAddress> reachableAddresses;
56  };
57 
58 
59  //[-------------------------------------------------------]
60  //[ Public methods ]
61  //[-------------------------------------------------------]
62  public:
68 
69  const ResultSet& getResultSet() const;
70  void setResultSet(const ResultSet& resultSet);
71 
72  bool getOverallResult() const;
73 
74 
75  //[--------------------------------------------------------]
76  //[ Public virtual em5::packet::SerializedPacket methods ]
77  //[--------------------------------------------------------]
78  public:
79  virtual void serialize(qsf::BinarySerializer& serializer) override;
80 
81 
82  //[-------------------------------------------------------]
83  //[ Private data ]
84  //[-------------------------------------------------------]
85  private:
86  bool mOverallResult;
87  ResultSet mResult;
88 
89 
90  };
91 
92 
93 //[-------------------------------------------------------]
94 //[ Namespace ]
95 //[-------------------------------------------------------]
96  } // packet
97 } // em5
98 
99 namespace qsf
100 {
101  namespace serialization
102  {
103  // Serialization specialization for TestOpenPortResponse::ReachableAddress for use with the QSF binary serialization
104  template<>
105  struct serializer<em5::packet::TestOpenPortResponse::ReachableAddress>
106  {
108  {
109  serializer & value.address;
110  serializer & value.isIpv4;
111  }
112  };
113 
114  // Serialization specialization for TestOpenPortResponse::ResultSet for use with the QSF binary serialization
115  template<>
116  struct serializer<em5::packet::TestOpenPortResponse::ResultSet>
117  {
119  {
120  serializer & value.testedIPv4;
121  serializer & value.testedIPv6;
122  serializer & value.reachableAddresses;
123  }
124  };
125  }
126 }
Definition: ActionPriority.h:13
bool isIpv4
Definition: TestOpenPortResponse.h:48
unsigned int uint32
Definition: PlatformTypes.h:181
std::string address
Definition: TestOpenPortResponse.h:47
#define EM5_API_EXPORT
Definition: Export.h:28
This class represents a network package sent by the server as a response to the TestOpenPortRequest, telling the client (=game host) if it is reachable from the internet or not.
Definition: TestOpenPortResponse.h:35
Definition: TestOpenPortResponse.h:51
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
static void serialize(BinarySerializer &serializer, em5::packet::TestOpenPortResponse::ReachableAddress &value)
Definition: TestOpenPortResponse.h:107
Definition: PickupPersonByParamedicAction.h:21
TODO(co) Comment me.
Definition: BinaryPacket.h:108
Definition: BinarySerializer.h:332
std::vector< ReachableAddress > reachableAddresses
Definition: TestOpenPortResponse.h:55
bool testedIPv4
Definition: TestOpenPortResponse.h:53
static void serialize(BinarySerializer &serializer, em5::packet::TestOpenPortResponse::ResultSet &value)
Definition: TestOpenPortResponse.h:118
bool testedIPv6
Definition: TestOpenPortResponse.h:54
Binary serializer class.
Definition: BinarySerializer.h:35
static const uint32 PACKET_ID
StringHash of the string "em5::packet::TestOpenPortResponse".
Definition: TestOpenPortResponse.h:43
Definition: TestOpenPortResponse.h:45