]> git.ipfire.org Git - thirdparty/squid.git/blame - src/LoadableModule.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / LoadableModule.h
CommitLineData
bbc27441 1/*
b8ae064d 2 * Copyright (C) 1996-2023 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
15class LoadableModule
16{
57afc994
AR
17public:
18 LoadableModule(const String &aName);
19 ~LoadableModule(); // unloads if loaded
20
21 bool loaded() const;
22 const String &name() const { return theName; }
23 const String &error() const { return theError; }
24
8b082ed9 25 void load(); // throws Texc
57afc994
AR
26 void unload(); // throws Texc
27
28protected:
29 String theName;
30 String theError;
31 void *theHandle;
32
33private:
8b082ed9 34 void *openModule();
57afc994
AR
35 bool closeModule();
36 const char *errorMsg();
37};
38
39#endif
f53969cc 40