TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ServiceBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ServiceBase_h__
19 #define ServiceBase_h__
20 
21 #include "MessageBuffer.h"
22 #include "Define.h"
23 #include <functional>
24 #include <string>
25 
26 namespace google
27 {
28  namespace protobuf
29  {
30  class Message;
31  }
32 }
33 
35 {
36 public:
37  virtual ~ServiceBase() { }
38 
39  virtual void CallServerMethod(uint32 token, uint32 methodId, MessageBuffer buffer) = 0;
40 
41 protected:
42  virtual void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request, std::function<void(MessageBuffer)> callback) = 0;
43  virtual void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request) = 0;
44  virtual void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, uint32 status) = 0;
45  virtual void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, google::protobuf::Message const* response) = 0;
46  virtual std::string GetCallerInfo() const = 0;
47 };
48 
49 #endif // ServiceBase_h__
Definition: message.h:165
virtual ~ServiceBase()
Definition: ServiceBase.h:37
uint32_t uint32
Definition: Define.h:150
#define TC_SHARED_API
Definition: Define.h:128
Definition: ServiceBase.h:34
Definition: BnetFileGenerator.h:47
Definition: MessageBuffer.h:24