ANNA Suite  2020b
Multipurpose development suite for Telco applications
Handler.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_http_Handler_hpp
10 #define anna_http_Handler_hpp
11 
12 #include <anna/core/mt/Mutex.hpp>
13 
14 #include <anna/comm/Receiver.hpp>
15 
16 namespace anna {
17 
18 class DataBlock;
19 
20 namespace comm {
21 class ClientSocket;
22 class Message;
23 }
24 
25 namespace http {
26 
27 class Request;
28 class Response;
29 
33 class Handler : public comm::Receiver {
34 public:
38  virtual ~Handler();
39 
49  void apply(comm::ClientSocket& clientSocket, const comm::Message& message) noexcept(false);
50 
51 protected:
56  Handler(const char* name) : comm::Receiver(name), a_response(NULL) {;}
57 
62  Response* allocateResponse() ;
63 
70  virtual void evRequest(comm::ClientSocket& clientSocket, const Request& request) noexcept(false) = 0;
71 
77  virtual void evResponse(comm::ClientSocket& clientSocket, const Response& response) noexcept(false) = 0;
78 
79 private:
80  Response* a_response;
81 };
82 
83 }
84 }
85 
86 #endif
87 
Definition: Request.hpp:22
Handler(const char *name)
Definition: Handler.hpp:56
Definition: ClientSocket.hpp:38
Definition: Handler.hpp:33
Definition: Message.hpp:26
Definition: Receiver.hpp:33
Definition: app.hpp:12
Definition: Response.hpp:21