src/module.h
author Tero Marttila <terom@fixme.fi>
Mon, 16 Mar 2009 01:14:36 +0200
changeset 66 ef8c9d7daf62
parent 65 d7508879ad01
child 70 a9a4c5e6aa30
permissions -rw-r--r--
all options are now fully implemented
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
#ifndef MODULE_H
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
#define MODULE_H
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
/**
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
 * @file
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
 *
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
     7
 * Dynamically loadable modules for use with nexus.
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
     8
 *
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
     9
 * The modules are loaded using dlopen(), and hence should be standard dynamic libraries. Module initialization happens
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    10
 * using a module_init_func_t named "<name>_init", which should return some kind of context pointer, which can later be
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    11
 * used to perform other operations on the module.
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
 */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
#include "nexus.h"
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
#include "error.h"
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
#include <sys/queue.h>
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
/**
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
 * Information required to load/identify a module.
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
 */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
struct module_info {
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
    /** Human-readable name */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
    const char *name;
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
    
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
    /** Filesystem path to the .so */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26
    const char *path;
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    27
};
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    29
/**
57
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    30
 * A module's behaviour is defined as a set of function pointers, which is dynamically resolved from the module DSO,
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    31
 * using the <mod_name>_funcs symbol.
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    32
 */
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    33
struct module_funcs {
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    34
    /**
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    35
     * Initialize the module, returning an opaque context pointer that is stored in the module state, and supplied for
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    36
     * subsequent calls. The supplied nexus arg can be used to access the global state.
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    37
     *
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    38
     * @param nexus a pointer to the nexus struct containing the global state
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    39
     * @param ctx_ptr the context pointer should be returned via this
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    40
     * @param err returned error info
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    41
     */
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    42
    err_t (*init) (struct nexus *nexus, void **ctx_ptr, struct error_info *err);
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    43
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    44
    /**
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    45
     * Set a configuration option with the given name and value, given by the user. Configuration settings are not
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    46
     * regarded as unique-per-name, but rather, several invocations of 'conf' with the same name and different values
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    47
     * could set up a multitude of things.
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    48
     *
66
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
    49
     * The given value is either a NUL-terminated string value (which may be mutated, using e.g. strsep), or NULL if
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
    50
     * no value was given (flag option).
57
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    51
     *
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    52
     * @param ctx the module's context pointer as returned by init
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    53
     * @param name the name of the configuration setting
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    54
     * @param value the value of the configuration setting
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    55
     * @param err returned error info
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    56
     */
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    57
    err_t (*conf) (void *ctx, const char *name, char *value, struct error_info *err);
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    58
};
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    59
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    60
/**
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    61
 * A loaded module.
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    62
 */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    63
struct module {
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    64
    /** The identifying info for the module */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    65
    struct module_info info;
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    66
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    67
    /** The dlopen handle */
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    68
    void *handle;
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    69
57
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    70
    /** The resolved function table */
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    71
    struct module_funcs *funcs;
ce1accba5fc7 slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents: 56
diff changeset
    72
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    73
    /** The module context object */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    74
    void *ctx;
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    75
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    76
    /** Our entry in the list of modules */
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    77
    TAILQ_ENTRY(module) modules_list;
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    78
};
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    79
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    80
/**
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    81
 * A set of loaded modules, and functionality to load more
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    82
 */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    83
struct modules {
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    84
    /** The nexus in use */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    85
    struct nexus *nexus;
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    86
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    87
    /** List of loaded modules */
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    88
    TAILQ_HEAD(module_ctx_modules, module) list;
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    89
};
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    90
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    91
/**
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    92
 * Possible error codes
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    93
 */
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    94
enum module_error_code {
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    95
    _ERR_MODULE_BEGIN = _ERR_MODULE,
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    96
    
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    97
    ERR_MODULE_OPEN,        ///< dlopen() failed
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    98
    ERR_MODULE_NAME,        ///< invalid module_info.name
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
    99
    ERR_MODULE_SYM,         ///< invalid symbol
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   100
    ERR_MODULE_INIT_FUNC,   ///< invalid module_init_func_t
56
942370000450 compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents: 55
diff changeset
   101
    ERR_MODULE_CONF,        ///< value error in configuration data
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   102
};
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   103
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   104
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   105
/**
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   106
 * Maximum length of a module name
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   107
 */
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   108
#define MODULE_NAME_MAX 24
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   109
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   110
/**
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   111
 * Maximum length of module symbol suffix
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   112
 */
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   113
#define MODULE_SUFFIX_MAX 16
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   114
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   115
/**
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   116
 * Maximum length of symbol name name, including terminating NUL
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   117
 */
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   118
#define MODULE_SYMBOL_MAX (MODULE_NAME_MAX + 1 + MODULE_SUFFIX_MAX + 1)
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   119
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   120
/**
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   121
 * Create a new modules state
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   122
 */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   123
err_t modules_create (struct modules **modules_ptr, struct nexus *nexus);
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   124
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   125
/**
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   126
 * Load a new module
65
d7508879ad01 add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents: 57
diff changeset
   127
 *
d7508879ad01 add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents: 57
diff changeset
   128
 * @param modules the module-loading context
d7508879ad01 add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents: 57
diff changeset
   129
 * @param module_ptr return the new module via this, if not NULL
d7508879ad01 add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents: 57
diff changeset
   130
 * @param info the info required to identify and load the module
d7508879ad01 add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents: 57
diff changeset
   131
 * @param err return error info
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   132
 */
56
942370000450 compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents: 55
diff changeset
   133
err_t module_load (struct modules *modules, struct module **module_ptr, const struct module_info *info, struct error_info *err);
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   134
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   135
/**
66
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   136
 * Lookup a module by name
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   137
 *
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   138
 * @param modules the modules state
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   139
 * @param name the module name to get
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   140
 * @return the module struct, or NULL if not found
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   141
 */
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   142
struct module* module_get (struct modules *modules, const char *name);
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   143
ef8c9d7daf62 all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents: 65
diff changeset
   144
/**
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   145
 * Set a module configuration option
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   146
 */
56
942370000450 compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents: 55
diff changeset
   147
err_t module_conf (struct module *module, const char *name, char *value, struct error_info *err);
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   148
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   149
/**
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   150
 * Unload a module
55
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   151
 *
6f7f6ae729d0 'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents: 54
diff changeset
   152
 * XXX: not implemented
54
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   153
 */
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   154
err_t module_unload (struct module *module);
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   155
9f74e924b01a initial modules code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   156
#endif