blob: 878c975f558e90a4fccf4f502afa51d9adc5630b [file] [log] [blame]
Alex Vakulenko039da312015-02-03 08:58:55 -08001// Copyright 2014 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_INTERFACE_H_
6#define WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_INTERFACE_H_
7
Alex Vakulenko83e66cd2015-04-24 14:51:58 -07008#include <memory>
9
Alex Vakulenko039da312015-02-03 08:58:55 -080010#include <libwebserv/request.h>
11#include <libwebserv/response.h>
12
13namespace libwebserv {
14
15// The base interface for HTTP request handlers. When registering a handler,
16// the RequestHandlerInterface is provided, and when a request comes in,
17// RequestHandlerInterface::HandleRequest() is called to process the data and
18// send response.
19class RequestHandlerInterface {
20 public:
Alex Vakulenko83e66cd2015-04-24 14:51:58 -070021 using HandlerSignature =
22 void(std::unique_ptr<Request>, std::unique_ptr<Response>);
Alex Vakulenko039da312015-02-03 08:58:55 -080023
Alex Vakulenko83e66cd2015-04-24 14:51:58 -070024 virtual void HandleRequest(std::unique_ptr<Request> request,
25 std::unique_ptr<Response> response) = 0;
Alex Vakulenko039da312015-02-03 08:58:55 -080026};
27
28} // namespace libwebserv
29
30#endif // WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_INTERFACE_H_