-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.h
More file actions
44 lines (31 loc) · 1.4 KB
/
Copy pathPlugin.h
File metadata and controls
44 lines (31 loc) · 1.4 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
// Plugin interface for the LinuxTinyServer.
// #include <string>
class PluginObject
{
public:
// MagicPath returns true if this is a path the plugin
// intercepts.
virtual bool MagicPath( const string path ) = 0;
// The request passed to ProcessRequest is the raw contents
// of the HTTP request as read from the socket (up to the
// 10K limit currently imposed by LinuxTinyServer.)
// The c_str( ) contents of whatever is returned will be
// written unchanged to the socket (and to the client)
// and should start with a proper HTTP header.
// ProcessRequest is expected to be thread-safe, e.g., by
// using Mutex.h to create a lock to ensure that only one
// thread at a time can procede where necessary for correct
// operation. (Alterately, might create a derived
// SingledThreadedPluginObject that does this.)
// (Might consider a variation that also passes the talk
// socket for a ProcessRequest routine that needs more than
// just the initial 10K or wants to do its own writing.)
virtual string ProcessRequest( string request ) = 0;
virtual ~PluginObject( )
{
}
};
// The constructor for any plugin should set Plugin = this
// so that LinuxTinyServer knows it exists and can call it.
extern PluginObject *Plugin;