NeoMutt
2025-12-11-1009-ga75d9e
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
crypt_mod.c
Go to the documentation of this file.
1
23
29
30
#include "config.h"
31
#include "
mutt/lib.h
"
32
#include "
core/lib.h
"
33
#include "
crypt_mod.h
"
34
#include "
lib.h
"
35
#include "
module_data.h
"
36
41
void
crypto_module_register
(
const
struct
CryptModuleSpecs
*
specs
)
42
{
43
struct
NcryptModuleData
*mod_data =
neomutt_get_module_data
(
NeoMutt
,
MODULE_ID_NCRYPT
);
44
struct
CryptModule
*module =
MUTT_MEM_CALLOC
(1,
struct
CryptModule
);
45
module
->specs = specs;
46
STAILQ_INSERT_HEAD
(&mod_data->
crypt_modules
, module, entries);
47
}
48
57
const
struct
CryptModuleSpecs
*
crypto_module_lookup
(
struct
NcryptModuleData
*mod_data,
int
identifier
)
58
{
59
const
struct
CryptModule
*module = NULL;
60
STAILQ_FOREACH
(module, &mod_data->
crypt_modules
, entries)
61
{
62
if
(module->
specs
->
identifier
== identifier)
63
{
64
return
module
->specs;
65
}
66
}
67
return
NULL;
68
}
69
74
void
crypto_module_cleanup
(
struct
NcryptModuleData
*mod_data)
75
{
76
struct
CryptModule
*np = NULL;
77
struct
CryptModule
*tmp = NULL;
78
STAILQ_FOREACH_SAFE
(np, &mod_data->
crypt_modules
, entries, tmp)
79
{
80
STAILQ_REMOVE
(&mod_data->
crypt_modules
, np,
CryptModule
, entries);
81
FREE
(&np);
82
}
83
}
lib.h
Convenience wrapper for the core headers.
crypto_module_cleanup
void crypto_module_cleanup(struct NcryptModuleData *mod_data)
Clean up the crypto modules.
Definition
crypt_mod.c:74
crypto_module_lookup
const struct CryptModuleSpecs * crypto_module_lookup(struct NcryptModuleData *mod_data, int identifier)
Lookup a crypto module by name.
Definition
crypt_mod.c:57
crypto_module_register
void crypto_module_register(const struct CryptModuleSpecs *specs)
Register a new crypto module.
Definition
crypt_mod.c:41
crypt_mod.h
Register crypto modules.
FREE
#define FREE(x)
Free memory and set the pointer to NULL.
Definition
memory.h:68
MUTT_MEM_CALLOC
#define MUTT_MEM_CALLOC(n, type)
Definition
memory.h:52
MODULE_ID_NCRYPT
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
Definition
module_api.h:82
lib.h
Convenience wrapper for the library headers.
lib.h
API for encryption/signing of emails.
module_data.h
Ncrypt private Module data.
neomutt_get_module_data
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition
neomutt.c:666
STAILQ_REMOVE
#define STAILQ_REMOVE(head, elm, type, field)
Definition
queue.h:441
STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field)
Definition
queue.h:390
STAILQ_INSERT_HEAD
#define STAILQ_INSERT_HEAD(head, elm, field)
Definition
queue.h:421
STAILQ_FOREACH_SAFE
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition
queue.h:400
CryptModuleSpecs
Definition
crypt_mod.h:48
CryptModuleSpecs::identifier
int identifier
Identifying bit.
Definition
crypt_mod.h:49
CryptModule
A crypto plugin module.
Definition
crypt_mod.h:315
CryptModule::specs
const struct CryptModuleSpecs * specs
Crypto module definition.
Definition
crypt_mod.h:316
NcryptModuleData
Ncrypt private Module data.
Definition
module_data.h:39
NcryptModuleData::crypt_modules
struct CryptModuleList crypt_modules
Linked list of crypto modules.
Definition
module_data.h:49
NeoMutt
Container for Accounts, Notifications.
Definition
neomutt.h:41