LeviLamina
Loading...
Searching...
No Matches
RakWebSocket.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/websockets/CloseStatusCode.h"
7#include "mc/websockets/OpCode.h"
8#include "mc/websockets/WSConnectionResult.h"
9
10// auto generated forward declare list
11// clang-format off
13class TcpProxy;
14namespace RakNet { class BitStream; }
15// clang-format on
16
18public:
19 // RakWebSocket inner types define
20 enum class PacketDirection : int {
21 Inward = 1,
22 Outward = 2,
23 Bothways = 3,
24 };
25
26 enum class ConnectionState : int {
27 None = 0,
28 CloseHandshake = 1,
29 Starting = 2,
30 Connecting = 3,
31 OpenHandshakeInit = 4,
32 OpenHandshakeAwait = 5,
33 OpenAndProcessing = 6,
34 };
35
36public:
37 // member variables
38 // NOLINTBEGIN
66 // NOLINTEND
67
68public:
69 // prevent constructor by default
70 RakWebSocket& operator=(RakWebSocket const&);
73
74public:
75 // virtual functions
76 // NOLINTBEGIN
77 // vIndex: 0
78 virtual ~RakWebSocket();
79
80 // vIndex: 2
81 virtual ::WSConnectionResult connect(::std::string const& uri, ::std::vector<::std::string> const& subProtocols);
82
83 // vIndex: 1
84 virtual ::WSConnectionResult connect(::std::string const& uri);
85
86 // vIndex: 3
87 virtual bool isReady() const;
88
89 // vIndex: 4
90 virtual void setOnMessageReceivedHandler(::std::function<void(::RakWebSocketDataFrame const&)> const& handler);
91
92 // vIndex: 5
93 virtual void setOnCloseHandler(::std::function<void(::CloseStatusCode, ::std::string const&)> const& handler);
94
95 // vIndex: 6
96 virtual void setOnConnectedHandler(::std::function<void(::std::string const&)> const& handler);
97
98 // vIndex: 7
99 virtual void tick();
100
101 // vIndex: 8
102 virtual void _updateState() = 0;
103
104 // vIndex: 9
105 virtual uint _genMaskingKey() const = 0;
106 // NOLINTEND
107
108public:
109 // member functions
110 // NOLINTBEGIN
111 MCNAPI RakWebSocket(::std::unique_ptr<::TcpProxy> proxy, bool isServer);
112
113 MCNAPI void _close(::CloseStatusCode code);
114
115 MCNAPI void _createWebSocketKey();
116
117 MCNAPI void _fail(::std::string const& error, ::CloseStatusCode code);
118
119 MCNAPI ::std::string _generateBase64SHA1Key(::std::string const& key);
120
121 MCNAPI void _processClosingHandshake(bool notifyHandler);
122
123 MCNAPI void _processDataFrames(::RakNet::BitStream& newIncoming);
124
125 MCNAPI bool
126 _processPacket(::std::function<void(::RakNet::BitStream&)> const& processStep, bool acceptNewConnection);
127
128 MCNAPI void _reset();
129
130 MCNAPI bool _sendControlFrame(uchar const* payload, uint64 size, ::OpCode opCode);
131
132 MCNAPI bool _sendDataFrame(uchar const* payload, uint size, ::OpCode opCode, bool isFinalFragment);
133
134 MCNAPI bool _sendNonControlFrame(uchar const* payload, uint64 size, ::OpCode opCode);
135
136 MCNAPI void
137 _splitWebSocketURI(::std::string const& uri, ::std::string& scheme, ::std::string& host, ::std::string& path);
138
140
141 MCNAPI void _validateFields();
142
144
145 MCNAPI bool send(::std::string const& message);
146 // NOLINTEND
147
148public:
149 // constructor thunks
150 // NOLINTBEGIN
151 MCNAPI void* $ctor(::std::unique_ptr<::TcpProxy> proxy, bool isServer);
152 // NOLINTEND
153
154public:
155 // destructor thunk
156 // NOLINTBEGIN
157 MCNAPI void $dtor();
158 // NOLINTEND
159
160public:
161 // virtual function thunks
162 // NOLINTBEGIN
163 MCNAPI ::WSConnectionResult $connect(::std::string const& uri, ::std::vector<::std::string> const& subProtocols);
164
165 MCNAPI ::WSConnectionResult $connect(::std::string const& uri);
166
167 MCNAPI bool $isReady() const;
168
169 MCNAPI void $setOnMessageReceivedHandler(::std::function<void(::RakWebSocketDataFrame const&)> const& handler);
170
171 MCNAPI void $setOnCloseHandler(::std::function<void(::CloseStatusCode, ::std::string const&)> const& handler);
172
173 MCNAPI void $setOnConnectedHandler(::std::function<void(::std::string const&)> const& handler);
174
175 MCNAPI void $tick();
176 // NOLINTEND
177
178public:
179 // vftables
180 // NOLINTBEGIN
181 MCNAPI static void** $vftable();
182 // NOLINTEND
183};
Definition BitStream.h:7
Definition RakWebSocketDataFrame.h:13
Definition RakWebSocket.h:17
MCAPI void _subProcessHttpResponse(::RakNet::BitStream &newIncoming)
MCAPI bool _sendControlFrame(uchar const *payload, uint64 size, ::OpCode opCode)
MCAPI void $tick()
MCAPI void _processClosingHandshake(bool notifyHandler)
MCAPI void _createWebSocketKey()
MCAPI void $setOnCloseHandler(::std::function< void(::CloseStatusCode, ::std::string const &)> const &handler)
MCAPI bool send(::std::string const &message)
MCAPI void _fail(::std::string const &error, ::CloseStatusCode code)
MCAPI void $setOnMessageReceivedHandler(::std::function< void(::RakWebSocketDataFrame const &)> const &handler)
MCAPI void _reset()
MCAPI void $dtor()
MCAPI::WSConnectionResult $connect(::std::string const &uri, ::std::vector<::std::string > const &subProtocols)
MCAPI::WSConnectionResult $connect(::std::string const &uri)
static MCAPI void ** $vftable()
MCAPI void * $ctor(::std::unique_ptr<::TcpProxy > proxy, bool isServer)
MCAPI bool _sendNonControlFrame(uchar const *payload, uint64 size, ::OpCode opCode)
MCAPI bool _validateWebSocketURI()
MCAPI bool _processPacket(::std::function< void(::RakNet::BitStream &)> const &processStep, bool acceptNewConnection)
MCAPI RakWebSocket(::std::unique_ptr<::TcpProxy > proxy, bool isServer)
MCAPI void _splitWebSocketURI(::std::string const &uri, ::std::string &scheme, ::std::string &host, ::std::string &path)
MCAPI bool _sendDataFrame(uchar const *payload, uint size, ::OpCode opCode, bool isFinalFragment)
MCAPI bool $isReady() const
MCAPI void $setOnConnectedHandler(::std::function< void(::std::string const &)> const &handler)
MCAPI void _close(::CloseStatusCode code)
MCAPI void _validateFields()
MCAPI::std::string _generateBase64SHA1Key(::std::string const &key)
MCAPI void _processDataFrames(::RakNet::BitStream &newIncoming)
Definition TcpProxy.h:11
Definition code.h:5
Definition Alias.h:14