EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
APIServiceManager.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Aknor Jaden
24 */
25 
26 #ifndef __APISERVICEMANAGER__H__INCL__
27 #define __APISERVICEMANAGER__H__INCL__
28 
29 #include "PyServiceMgr.h"
30 #include "apiserver/APIServiceDB.h"
31 
32 namespace EVEAPI {
33  namespace CacheStyles {
34  enum
35  {
39  };
40  }
41 
42  namespace KeyType {
43  enum
44  {
47  };
48  }
49 
50  namespace Roles {
51  enum
52  {
53  Player = 100,
54  Admin = 1000
55  };
56  }
57 }
58 
59 typedef std::map<std::string, std::string> APICommandCall;
60 
74 {
75 public:
78 
79  // Common call shared to all derived classes called via polymorphism
80  virtual std::tr1::shared_ptr<std::string> ProcessCall(const APICommandCall * pAPICommandCall);
81  std::tr1::shared_ptr<std::string> BuildErrorXMLResponse(std::string errorCode, std::string errorMessage);
82 
83 protected:
84  bool _AuthenticateUserNamePassword(std::string userName, std::string password);
85  bool _AuthenticateFullAPIQuery(std::string userID, std::string apiKey);
86  bool _AuthenticateLimitedAPIQuery(std::string userID, std::string apiKey);
87 
88  // Internal Utility functions used to make it easier to build the xml document to send back to the client:
89  void _BuildXMLHeader();
90  void _CloseXMLHeader(uint32 cacheStyle);
91  void _BuildXMLRowSet(std::string name, std::string key, const std::vector<std::string> * columns);
92  void _CloseXMLRowSet();
93  void _BuildXMLRow(const std::vector<std::string> * columns);
94  void _BuildXMLTag(std::string name);
95  void _BuildXMLTag(std::string name, const std::vector<std::pair<std::string, std::string> > * params);
96  void _BuildXMLTag(std::string name, const std::vector<std::pair<std::string, std::string> > * params, std::string value);
97  void _CloseXMLTag();
98  void _BuildSingleXMLTag(std::string name, std::string param);
99  void _BuildErrorXMLTag(std::string code, std::string param);
100  std::tr1::shared_ptr<std::string> _GetXMLDocumentString();
101 
104 
105  TiXmlDocument _XmlDoc;
106  TiXmlElement * _pXmlDocOuterTag;
108  std::stack<TiXmlElement *> * _pXmlElementStack;
109 };
110 
111 #endif // __APISERVICEMANAGER__H__INCL__
std::tr1::shared_ptr< std::string > BuildErrorXMLResponse(std::string errorCode, std::string errorMessage)
APIServiceManager(const PyServiceMgr &services)
TiXmlDocument _XmlDoc
std::stack< TiXmlElement * > * _pXmlElementStack
std::tr1::shared_ptr< std::string > _GetXMLDocumentString()
void _BuildSingleXMLTag(std::string name, std::string param)
PyServiceMgr m_services
std::map< std::string, std::string > APICommandCall
bool _AuthenticateFullAPIQuery(std::string userID, std::string apiKey)
virtual std::tr1::shared_ptr< std::string > ProcessCall(const APICommandCall *pAPICommandCall)
Generic Base Class used to derive classes for specific service handlers (character, corporation, etc)
std::string _CurrentRowSetColumnString
unsigned __int32 uint32
Definition: eve-compat.h:50
bool _AuthenticateUserNamePassword(std::string userName, std::string password)
void _BuildXMLTag(std::string name)
TiXmlElement * _pXmlDocOuterTag
PyServiceMgr & services()
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr
void _BuildXMLRow(const std::vector< std::string > *columns)
void _BuildErrorXMLTag(std::string code, std::string param)
void _CloseXMLHeader(uint32 cacheStyle)
void _BuildXMLRowSet(std::string name, std::string key, const std::vector< std::string > *columns)
bool _AuthenticateLimitedAPIQuery(std::string userID, std::string apiKey)