nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
servers.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_SERVERS_H_
2#define NANOMMO_CLIENT_SERVERS_H_
3
4#include <memory>
5#include <string>
6
7#include "absl/status/statusor.h"
8#include "client/link.h"
9#include "protocol/nanommo.pb.h"
10
11namespace nanommo {
12
13/// Whether this build can reach the servers at all: a browser's can't.
14bool CanReachServers();
15
16/// The login server and the worlds it lists, over the network. In a browser,
17/// which gives us no sockets, each says why it can't be reached.
18class Servers {
19 public:
20 /// The servers, with the login server at host, and the worlds sent over
21 /// UDP, or TCP. Or why not, such as a certificate that won't load.
22 static absl::StatusOr<std::unique_ptr<Servers>> Create(std::string host,
23 bool udp);
24
25 virtual ~Servers() = default;
26
27 /// The login server's answer to the request.
28 virtual absl::StatusOr<protocol::LoginReply> Ask(
29 const protocol::LoginRequest& request) = 0;
30
31 /// Into the world, as the character the token's for.
32 virtual absl::StatusOr<std::unique_ptr<Link>> Enter(
33 const protocol::WorldListing& world, const std::string& token) = 0;
34
35 /// To the world's instance its last one handed us over to.
36 virtual absl::StatusOr<std::unique_ptr<Link>> Move(
37 const protocol::Move& move) = 0;
38};
39
40} // namespace nanommo
41
42#endif // NANOMMO_CLIENT_SERVERS_H_
virtual ~Servers()=default
static absl::StatusOr< std::unique_ptr< Servers > > Create(std::string host, bool udp)
Definition servers.cc:75
virtual absl::StatusOr< protocol::LoginReply > Ask(const protocol::LoginRequest &request)=0
The login server's answer to the request.
virtual absl::StatusOr< std::unique_ptr< Link > > Enter(const protocol::WorldListing &world, const std::string &token)=0
Into the world, as the character the token's for.
virtual absl::StatusOr< std::unique_ptr< Link > > Move(const protocol::Move &move)=0
To the world's instance its last one handed us over to.
Definition chat.cc:9
bool CanReachServers()
Whether this build can reach the servers at all: a browser's can't.
Definition servers.cc:73