NeoMutt
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
crypt_mod.c
Go to the documentation of this file.
1
29#include "config.h"
30#include "mutt/lib.h"
31#include "crypt_mod.h"
32#include "lib.h"
33
40{
41 const struct CryptModuleSpecs *specs;
42 STAILQ_ENTRY(CryptModule) entries;
43};
44STAILQ_HEAD(CryptModuleList, CryptModule);
45
47static struct CryptModuleList CryptModules = STAILQ_HEAD_INITIALIZER(CryptModules);
48
54{
55 struct CryptModule *module = mutt_mem_calloc(1, sizeof(struct CryptModule));
56 module->specs = specs;
57 STAILQ_INSERT_HEAD(&CryptModules, module, entries);
58}
59
68{
69 const struct CryptModule *module = NULL;
70 STAILQ_FOREACH(module, &CryptModules, entries)
71 {
72 if (module->specs->identifier == identifier)
73 {
74 return module->specs;
75 }
76 }
77 return NULL;
78}
79
84{
85 struct CryptModule *np = NULL, *tmp = NULL;
86 STAILQ_FOREACH_SAFE(np, &CryptModules, entries, tmp)
87 {
89 FREE(&np);
90 }
91}
const struct CryptModuleSpecs * crypto_module_lookup(int identifier)
Lookup a crypto module by name.
Definition: crypt_mod.c:67
void crypto_module_register(const struct CryptModuleSpecs *specs)
Register a new crypto module.
Definition: crypt_mod.c:53
void crypto_module_cleanup(void)
Clean up the crypto modules.
Definition: crypt_mod.c:83
static struct CryptModuleList CryptModules
Linked list of crypto modules, e.g. CryptModSmimeClassic, CryptModPgpGpgme.
Definition: crypt_mod.c:47
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:40
const struct CryptModuleSpecs * specs
Crypto module definition.
Definition: crypt_mod.c:41