Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
labyrinthonlineconnection.hpp
1 //////////////////////////////
2 //
3 // File: labyrinth/online/labyrinthonlineconnection.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Jun 2014
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __LXS_LABONLINE_CON__
15 #define __LXS_LABONLINE_CON__
16 #include "lxs/network/client.hpp"
17 #include "lxs/windowing/button.hpp"
18 #include "lxs/windowing/form.hpp"
19 namespace Labyrinth
20 {
21  //! namespace for "online" features of Labyrinth
22  namespace Online
23  {
25  {
26  std::string login;
27  std::string password;
28  int network_timeout;
29  public:
30  // true = no error;
31  // false = error; string = error message
32  typedef std::pair<bool,std::string> NetworkOperatopnResult;
33  typedef NetworkOperatopnResult NetOpRes;
34  private:
35  NetOpRes WaitTimeout(int seconds);
36  NetOpRes CollectOKResponse();
37  NetOpRes CollectErrors();
38  NetOpRes LogInPrologue();
39 
40  public:
41  void SetLogin(std::string l);
42  void SetPassword(std::string p);
43  void SetConnectionTimeout(int t);
45  NetOpRes CheckEcho();
46  //
47  NetOpRes PutFile(std::string filename, char * data, size_t datasize);
48  NetOpRes GetFile(std::string filename, char ** data, size_t *datasize);
49  NetOpRes LogIn();
50  //! create new account or set password for existing one
51  NetOpRes SetPassword();
52  };
53 
54  }
55 }
56 #endif