steam-min-cpp
Loading...
Searching...
No Matches
events.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
13#include <cstdint>
15#include <string>
16
17namespace Steam::Messaging::Packets {
18class IPacketMsg;
19}
20
21namespace Steam::Events {
22
27struct Event {
28 virtual ~Event() = default;
29};
30
38 bool success;
39
41 std::string message;
42
44 static EventResult ok() { return {true, {}}; }
45
48 static EventResult fail(std::string msg) { return {false, std::move(msg)}; }
49};
50
56struct ResultEvent : Event {
59
60 ResultEvent() = default;
61 ResultEvent(EventResult r) : result(std::move(r)) {}
62
64 bool ok() const { return result.success; }
65
67 const std::string& what() const { return result.message; }
68};
69
74struct ChannelSecuredEvent : ResultEvent {
75 using ResultEvent::ResultEvent;
76};
77
82struct ClientLogonEvent : ResultEvent {
83 using ResultEvent::ResultEvent;
84
86 uint64_t steamid;
87
90
91 ClientLogonEvent(EventResult r, uint64_t s_id, int32_t c_sid)
92 : ResultEvent(std::move(r)), steamid(s_id), client_sessionid(c_sid) {}
93};
94
98struct MsgNotImplementedEvent : Event {
100 uint32_t emsg;
101
107
108 explicit MsgNotImplementedEvent(
109 uint32_t e, const Steam::Messaging::Packets::IPacketMsg* p)
110 : emsg(e), packet(p) {}
111};
112
114struct DisconnectionEvent : Event {
116 const std::string& reason;
117
118 explicit DisconnectionEvent(const std::string& r) : reason(r) {}
119};
120
124struct ProductInfoResult : Event {
128 uint32_t appid;
129
131 std::string sha;
132
135 };
136
140 uint32_t packageid;
141
143 std::string sha;
144
147 };
148
150 std::vector<ProductAppInfo> apps;
151
153 std::vector<ProductPackageInfo> packages;
154
155 explicit ProductInfoResult(std::vector<ProductAppInfo> a,
156 std::vector<ProductPackageInfo> p)
157 : apps(std::move(a)), packages(std::move(p)) {}
158};
159
160} // namespace Steam::Events
161
162namespace Steam::Commands {
163
165struct Command {
166 virtual ~Command() = default;
167};
168
173
176
178struct Heartbeat : Command {};
179
186 uint32_t id;
187
189 uint64_t steamid;
190
193
198 uint64_t app_token = 0;
199
201 explicit GetProductInfo(uint32_t i, uint64_t s_id, int32_t c_sid)
202 : id(i), steamid(s_id), client_sessionid(c_sid) {}
203
205 explicit GetProductInfo(uint32_t i, uint64_t s_id, int32_t c_sid, uint64_t t)
206 : id(i), steamid(s_id), client_sessionid(c_sid), app_token(t) {}
207};
208} // namespace Steam::Commands
Definition packetbase.hpp:11
Request an anonymous Steam login.
Definition events.hpp:172
Request termination of the current Steam user session.
Definition events.hpp:175
Base type for commands sent to the Steam CM server.
Definition events.hpp:165
GetProductInfo(uint32_t i, uint64_t s_id, int32_t c_sid, uint64_t t)
Construct a request with an app token.
Definition events.hpp:205
uint32_t id
Target application ID.
Definition events.hpp:186
uint64_t app_token
Optional application access token.
Definition events.hpp:198
uint64_t steamid
SteamID associated with the current session.
Definition events.hpp:189
int32_t client_sessionid
Steam CM session identifier.
Definition events.hpp:192
GetProductInfo(uint32_t i, uint64_t s_id, int32_t c_sid)
Construct a request without an app token.
Definition events.hpp:201
Send a heartbeat to Steam CM servers to keep sessions alive.
Definition events.hpp:178
Emitted when the channel encryption handshake completes.
Definition events.hpp:74
int32_t client_sessionid
Steam CM session identifier.
Definition events.hpp:89
uint64_t steamid
Authenticated SteamID for the session.
Definition events.hpp:86
const std::string & reason
The reason the TCP connection was dropped.
Definition events.hpp:116
Result information returned by operations.
Definition events.hpp:36
bool success
Indicates whether the operation succeeded.
Definition events.hpp:38
std::string message
Optional error or diagnostic message.
Definition events.hpp:41
static EventResult fail(std::string msg)
Construct a failure result.
Definition events.hpp:48
static EventResult ok()
Construct a successful result.
Definition events.hpp:44
Base type for all emitted events.
Definition events.hpp:27
const Steam::Messaging::Packets::IPacketMsg * packet
Raw packet associated with the message.
Definition events.hpp:106
uint32_t emsg
Numeric Steam message identifier.
Definition events.hpp:100
Application information entry.
Definition events.hpp:126
std::string sha
SHA hash representing the appinfo version.
Definition events.hpp:131
uint32_t appid
Application identifier.
Definition events.hpp:128
Steam::Utils::VDF::VDFNode appinfo
Parsed VDF metadata for the application.
Definition events.hpp:134
Package information entry.
Definition events.hpp:138
uint32_t packageid
Package identifier.
Definition events.hpp:140
Steam::Utils::VDF::VDFNode pkginfo
Parsed VDF metadata for the package.
Definition events.hpp:146
std::string sha
SHA hash representing the package version.
Definition events.hpp:143
std::vector< ProductPackageInfo > packages
Returned package metadata.
Definition events.hpp:153
std::vector< ProductAppInfo > apps
Returned application metadata.
Definition events.hpp:150
const std::string & what() const
Retrieve the failure message if present.
Definition events.hpp:67
bool ok() const
Check whether the operation succeeded.
Definition events.hpp:64
EventResult result
Result of the associated operation.
Definition events.hpp:58
Node in a VDF tree.
Definition vdf.hpp:40
Minimal representation and parser for Valve Data Format (VDF).