]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
f70aedc4 | 2 | * Copyright (C) 1996-2021 The Squid Software Foundation and contributors |
bbc27441 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
57afc994 AR |
9 | #ifndef SQUID_LOADABLE_MODULE_H |
10 | #define SQUID_LOADABLE_MODULE_H | |
11 | ||
12 | #include "SquidString.h" | |
13 | ||
14 | // wrapper for dlopen(3), libltdl, and friends | |
26ac0430 AJ |
15 | class LoadableModule |
16 | { | |
57afc994 AR |
17 | public: |
18 | enum LoadMode { lmNow, lmLazy }; | |
19 | ||
20 | public: | |
21 | LoadableModule(const String &aName); | |
22 | ~LoadableModule(); // unloads if loaded | |
23 | ||
24 | bool loaded() const; | |
25 | const String &name() const { return theName; } | |
26 | const String &error() const { return theError; } | |
27 | ||
28 | void load(int mode = lmNow); // throws Texc | |
29 | void unload(); // throws Texc | |
30 | ||
31 | protected: | |
32 | String theName; | |
33 | String theError; | |
34 | void *theHandle; | |
35 | ||
36 | private: | |
37 | void *openModule(int mode); | |
38 | bool closeModule(); | |
39 | const char *errorMsg(); | |
40 | }; | |
41 | ||
42 | #endif | |
f53969cc | 43 |