CppWAMP
C++11 client library for the WAMP protocol
messagetraits.hpp
1 /*------------------------------------------------------------------------------
2  Copyright Butterfly Energy Systems 2014-2015, 2022.
3  Distributed under the Boost Software License, Version 1.0.
4  http://www.boost.org/LICENSE_1_0.txt
5 ------------------------------------------------------------------------------*/
6 
7 #ifndef CPPWAMP_MESSSAGE_TRAITS_HPP
8 #define CPPWAMP_MESSSAGE_TRAITS_HPP
9 
10 #include <cstdint>
11 #include "../api.hpp"
12 #include "../variant.hpp"
13 
14 namespace wamp
15 {
16 
17 namespace internal
18 {
19 
20 //------------------------------------------------------------------------------
21 enum class WampMsgType : uint8_t
22 {
23  none = 0,
24  hello = 1,
25  welcome = 2,
26  abort = 3,
27  challenge = 4,
28  authenticate = 5,
29  goodbye = 6,
30  error = 8,
31  publish = 16,
32  published = 17,
33  subscribe = 32,
34  subscribed = 33,
35  unsubscribe = 34,
36  unsubscribed = 35,
37  event = 36,
38  call = 48,
39  cancel = 49,
40  result = 50,
41  enroll = 64,
42  registered = 65,
43  unregister = 66,
44  unregistered = 67,
45  invocation = 68,
46  interrupt = 69,
47  yield = 70
48 };
49 
50 //------------------------------------------------------------------------------
51 struct CPPWAMP_API MessageTraits
52 {
53  // CPPWAMP_API visibility required by codec component libraries
54 
55  static const MessageTraits& lookup(WampMsgType type);
56 
57  bool isValid() const;
58 
59  const char* name;
60  WampMsgType repliesTo : 8;
61  size_t idPosition : 8;
62  size_t minSize : 8;
63  size_t maxSize : 8;
64  bool isClientRx : 1;
65  bool isRouterRx : 1;
66  bool forEstablishing : 1;
67  bool forChallenging : 1;
68  bool forEstablished : 1;
69  TypeId fieldTypes[7];
70 };
71 
72 } // namespace internal
73 
74 } // namespace wamp
75 
76 #ifndef CPPWAMP_COMPILED_LIB
77 #include "messagetraits.ipp"
78 #endif
79 
80 #endif // CPPWAMP_MESSSAGE_TRAITS_HPP
wamp::TypeId
TypeId
Integer ID used to indicate the current dynamic type of a Variant.
Definition: variantdefs.hpp:26
wamp
Definition: anyhandler.hpp:36