ScummVM API documentation
connectcloudhandler.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef BACKENDS_NETWORKING_SDL_NET_CONNECTCLOUDHANDLER_H
23
#define BACKENDS_NETWORKING_SDL_NET_CONNECTCLOUDHANDLER_H
24
25
#include "backends/networking/sdl_net/handlers/basehandler.h"
26
#include "backends/networking/sdl_net/client.h"
27
#include "backends/networking/curl/request.h"
28
#include "common/memstream.h"
29
30
namespace
Networking
{
31
32
class
ConnectCloudHandler
:
public
BaseHandler
{
33
void
handleError(
Client
&client,
const
Common::String
&message)
const
;
34
void
setJsonResponseHandler(
Client
&client,
const
Common::String
&type,
const
Common::String
&message)
const
;
35
36
Networking::ErrorCallback
_storageConnectionCallback;
37
38
public
:
39
ConnectCloudHandler
();
40
~
ConnectCloudHandler
()
override
;
41
42
void
handle(
Client
&client)
override
;
43
bool
minimalModeSupported()
override
{
return
true
; }
44
45
void
setStorageConnectionCallback(
Networking::ErrorCallback
cb) { _storageConnectionCallback = cb; }
46
void
storageConnected(
const
Networking::ErrorResponse
& response)
const
;
47
};
48
49
class
ConnectCloudClientHandler
:
public
ClientHandler
{
50
const
ConnectCloudHandler
*_cloudHandler;
51
Common::MemoryWriteStreamDynamic
_clientContent;
52
Client
*_client;
53
static
const
int32 SUSPICIOUS_CONTENT_SIZE = 640 * 1024;
// 640K ought to be enough for anybody
54
55
void
respond(
Client
&client,
const
Common::String
&response,
long
responseCode = 200)
const
;
56
void
respondWithJson(
Client
&client,
bool
error
,
const
Common::String
&message,
long
responseCode = 200)
const
;
57
void
handleError(
Client
&client,
const
Common::String
&message,
long
responseCode)
const
;
58
void
handleSuccess(
Client
&client,
const
Common::String
&message)
const
;
59
void
storageConnectionCallback(
const
Networking::ErrorResponse
&response);
60
61
public
:
62
ConnectCloudClientHandler
(
const
ConnectCloudHandler
* cloudHandler);
63
~
ConnectCloudClientHandler
()
override
;
64
65
void
handle(
Client
*client)
override
;
66
};
67
68
}
// End of namespace Networking
69
70
#endif
Networking::ConnectCloudHandler
Definition:
connectcloudhandler.h:32
Networking::Client
Definition:
client.h:75
Common::String
Definition:
str.h:59
Networking
Definition:
scummvmcloud.h:31
Networking::ErrorResponse
Definition:
request.h:73
Common::MemoryWriteStreamDynamic
Definition:
memstream.h:194
Networking::BaseHandler
Definition:
basehandler.h:29
Networking::ConnectCloudClientHandler
Definition:
connectcloudhandler.h:49
Common::BaseCallback
Definition:
callback.h:49
Networking::ClientHandler
Definition:
client.h:49
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
backends
networking
sdl_net
handlers
connectcloudhandler.h
Generated on Sat Aug 31 2024 09:03:59 for ScummVM API documentation by
1.8.13