]> git.ipfire.org Git - thirdparty/squid.git/blob - src/LoadableModule.h
Merged from trunk.
[thirdparty/squid.git] / src / LoadableModule.h
1 #ifndef SQUID_LOADABLE_MODULE_H
2 #define SQUID_LOADABLE_MODULE_H
3
4 #include "SquidString.h"
5
6 // wrapper for dlopen(3), libltdl, and friends
7 class LoadableModule {
8 public:
9 enum LoadMode { lmNow, lmLazy };
10
11 public:
12 LoadableModule(const String &aName);
13 ~LoadableModule(); // unloads if loaded
14
15 bool loaded() const;
16 const String &name() const { return theName; }
17 const String &error() const { return theError; }
18
19 void load(int mode = lmNow); // throws Texc
20 void unload(); // throws Texc
21
22 protected:
23 String theName;
24 String theError;
25 void *theHandle;
26
27 private:
28 void *openModule(int mode);
29 bool closeModule();
30 const char *errorMsg();
31 };
32
33 #endif