summaryrefslogtreecommitdiffhomepage
path: root/plugin_interface.h
blob: 9fc208581170ede3325d7217a0048d55b23144f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include <boost/config.hpp>

#include <string>
#include <functional>

typedef std::string(*plugin_interface_getter_type)(const std::string& key);
typedef void(*plugin_interface_setter_type)(const std::string& key, const std::string& value);

class BOOST_SYMBOL_VISIBLE webserver_plugin_interface {
public:
 static const int interface_version {1};
 virtual int version() { return interface_version; }
 
 //
 // The Interface to be implemented by plugins
 //
 //
 
 virtual std::string name() = 0;

 // returns result page without headers
 virtual std::string generate_page(
  std::function<std::string(const std::string& key)>& GetServerParam,
  std::function<std::string(const std::string& key)>& GetRequestParam, // request including body (POST...)
  std::function<void(const std::string& key, const std::string& value)>& SetResponseHeader // to be added to result string
 ) = 0;

 virtual ~webserver_plugin_interface(){} // optional
};