NeoMutt  2024-04-16-36-g75b6fb
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
crypt_mod.c
Go to the documentation of this file.
1
30#include "config.h"
31#include "mutt/lib.h"
32#include "crypt_mod.h"
33#include "lib.h"
34
41{
42 const struct CryptModuleSpecs *specs;
43 STAILQ_ENTRY(CryptModule) entries;
44};
45STAILQ_HEAD(CryptModuleList, CryptModule);
46
48static struct CryptModuleList CryptModules = STAILQ_HEAD_INITIALIZER(CryptModules);
49
55{
56 struct CryptModule *module = mutt_mem_calloc(1, sizeof(struct CryptModule));
57 module->specs = specs;
58 STAILQ_INSERT_HEAD(&CryptModules, module, entries);
59}
60
69{
70 const struct CryptModule *module = NULL;
71 STAILQ_FOREACH(module, &CryptModules, entries)
72 {
73 if (module->specs->identifier == identifier)
74 {
75 return module->specs;
76 }
77 }
78 return NULL;
79}
80
85{
86 struct CryptModule *np = NULL, *tmp = NULL;
87 STAILQ_FOREACH_SAFE(np, &CryptModules, entries, tmp)
88 {
90 FREE(&np);
91 }
92}
const struct CryptModuleSpecs * crypto_module_lookup(int identifier)
Lookup a crypto module by name.
Definition: crypt_mod.c:68
void crypto_module_register(const struct CryptModuleSpecs *specs)
Register a new crypto module.
Definition: crypt_mod.c:54
void crypto_module_cleanup(void)
Clean up the crypto modules.
Definition: crypt_mod.c:84
static struct CryptModuleList CryptModules
Linked list of crypto modules, e.g. CryptModSmimeClassic, CryptModPgpGpgme.
Definition: crypt_mod.c:48
Register crypto modules.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define FREE(x)
Definition: memory.h:45
Convenience wrapper for the library headers.
#define STAILQ_REMOVE(head, elm, type, field)
Definition: queue.h:402
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
#define STAILQ_ENTRY(type)
Definition: queue.h:327
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
#define STAILQ_HEAD(name, type)
Definition: queue.h:312
#define STAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:383
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:362
Key value store.
int identifier
Identifying bit.
Definition: crypt_mod.h:48
A crypto plugin module.
Definition: crypt_mod.c:41
const struct CryptModuleSpecs * specs
Crypto module definition.
Definition: crypt_mod.c:42