summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Steam/src/steam_utils.cpp')
-rw-r--r--protocols/Steam/src/steam_utils.cpp57
1 files changed, 1 insertions, 56 deletions
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp
index ed90bc5178..800abe47e8 100644
--- a/protocols/Steam/src/steam_utils.cpp
+++ b/protocols/Steam/src/steam_utils.cpp
@@ -1,67 +1,12 @@
#include "stdafx.h"
-static int64_t getRandomInt()
+int64_t getRandomInt()
{
int64_t ret;
Utils_GetRandom(&ret, sizeof(ret));
return (ret >= 0) ? ret : -ret;
}
-void CSteamProto::WSSend(EMsg msgType, const ProtobufCppMessage &msg)
-{
- CMsgProtoBufHeader hdr;
- hdr.has_client_sessionid = hdr.has_steamid = hdr.has_jobid_source = hdr.has_jobid_target = true;
-
- switch (msgType) {
- case EMsg::ClientHello:
- hdr.jobid_source = -1;
- break;
-
- default:
- hdr.jobid_source = getRandomInt();
- break;
- }
-
- hdr.jobid_target = -1;
-
- WSSendHeader(msgType, hdr, msg);
-}
-
-void CSteamProto::WSSendHeader(EMsg msgType, const CMsgProtoBufHeader &hdr, const ProtobufCppMessage &msg)
-{
- uint32_t hdrLen = (uint32_t)protobuf_c_message_get_packed_size(&hdr);
- MBinBuffer hdrbuf(hdrLen);
- protobuf_c_message_pack(&hdr, (uint8_t *)hdrbuf.data());
- hdrbuf.appendBefore(&hdrLen, sizeof(hdrLen));
-
- uint32_t type = (uint32_t)msgType;
- type |= STEAM_PROTOCOL_MASK;
- hdrbuf.appendBefore(&type, sizeof(type));
-
- MBinBuffer body(protobuf_c_message_get_packed_size(&msg));
- protobuf_c_message_pack(&msg, body.data());
-
- hdrbuf.append(body);
- m_ws->sendBinary(hdrbuf.data(), hdrbuf.length());
-}
-
-void CSteamProto::WSSendService(const char *pszServiceName, const ProtobufCppMessage &msg, MsgCallback pCallback)
-{
- CMsgProtoBufHeader hdr;
- hdr.has_client_sessionid = hdr.has_steamid = hdr.has_jobid_source = hdr.has_jobid_target = true;
- hdr.jobid_source = getRandomInt();
- hdr.jobid_target = -1;
- hdr.target_job_name = (char*)pszServiceName;
- hdr.realm = 1; hdr.has_realm = true;
-
- if (pCallback) {
- mir_cslock lck(m_csRequests);
- m_arRequests.insert(new ProtoRequest(hdr.jobid_source, pCallback));
- }
-
- WSSendHeader(EMsg::ServiceMethodCallFromClientNonAuthed, hdr, msg);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
int64_t CSteamProto::GetId(MCONTACT hContact, const char *pszSetting)