src/config.h
author Tero Marttila <terom@fixme.fi>
Thu, 21 May 2009 17:08:47 +0300
changeset 214 0d5d46ab49d5
parent 154 f4472119de3b
permissions -rw-r--r--
merge lua_thread_setup bcak into _lua_thread_start, as everything can be done on the main lua state
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
#ifndef CONFIG_H
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
#define CONFIG_H
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
/**
87
f0db6ebf18b9 documentation tweaks
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
     5
 * @file
f0db6ebf18b9 documentation tweaks
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
     6
 *
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     7
 * Support for module configuration parameters
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
 */
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
#include "error.h"
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    10
#include <stdbool.h>
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
/** 
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
 * Different types of configuration parameters
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
 */
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
enum config_type {
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
    CONFIG_INVALID,
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    18
    /** No value at all */
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    19
    CONFIG_NULL,
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    20
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
    /** A plain NUL-terminated string */
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
    CONFIG_STRING,
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    23
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    24
    /** A user-defined type, further identified by a string */
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    25
    CONFIG_USER,
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    26
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    27
    /** An IRC channel */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    28
    CONFIG_IRC_CHAN,
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    29
};
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    30
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    31
/**
154
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    32
 * A CONFIG_USER type info
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    33
 */
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    34
struct config_user_type {
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    35
    /** The name of the type */
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    36
    const char *name;
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    37
};
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    38
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    39
/**
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    40
 * Structure to hold a value as defined by config_type
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    41
 */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    42
struct config_value {
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    43
    /** The type of the value */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    44
    enum config_type type;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    45
    
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    46
    /** The typed value */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    47
    union {
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    48
        /** Value for CONFIG_STRING */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    49
        char *string;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    50
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    51
        /** Value for CONFIG_IRC_CHAN */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    52
        struct irc_chan *irc_chan;
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    53
        
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    54
        /** Value for CONFIG_USER */
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    55
        struct {
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    56
            /** The specific user type */
154
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    57
            const struct config_user_type *type;
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    58
154
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    59
            /** The pointer value */
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    60
            void *ptr;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    61
        } user;
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    62
    };
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    63
};
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    64
87
f0db6ebf18b9 documentation tweaks
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    65
/**
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    66
 * Structure to define a single parameter for an option
87
f0db6ebf18b9 documentation tweaks
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    67
 */
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    68
struct config_param {
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    69
    /** The name of the arg */
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    70
    const char *name;
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    71
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    72
    /** The type */
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    73
    enum config_type type;
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    74
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    75
    /** The specific type for CONFIG_USER */
154
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
    76
    const struct config_user_type *user_type;
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    77
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    78
    /** Description */
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    79
    const char *description;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    80
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    81
    /** Optional value handler function, by type */
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    82
    union {
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    83
        err_t (*string) (void *ctx, char *value, struct error_info *err);
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    84
        err_t (*irc_chan) (void *ctx, struct irc_chan *chan, struct error_info *err);
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
    85
    } func;
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    86
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    87
    /** Use handler function? */
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    88
    bool is_handler;
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    89
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    90
    /** Optional value? */
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
    91
    bool optional;
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    92
};
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    93
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    94
/**
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    95
 * The maximum number of parameters that a single option can have, although this includes the terminating NULL
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    96
 */
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    97
#define CONFIG_PARAMS_MAX (15 + 1)
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    98
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    99
/**
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   100
 * The maximum number of values that an option can access, including the terminating NULL
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   101
 */
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   102
#define CONFIG_VALUES_MAX CONFIG_PARAMS_MAX
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   103
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   104
/**
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   105
 * A more complicated configuration option that can have multiple parameters
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   106
 */
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   107
struct config_option {
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   108
    /** The name of the config option */
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   109
    const char *name;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   110
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   111
    /** The list of parameters */
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   112
    const struct config_param params[CONFIG_PARAMS_MAX];
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   113
    
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   114
    /** The handler function */
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   115
    err_t (*func) (void *ctx, const struct config_option *option, const struct config_value values[], struct error_info *err);
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   116
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   117
    /** Help text */
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   118
    const char *help;
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   119
};
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   120
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   121
#define CONFIG_PARAM(name, type, desc, optional) \
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   122
    {   name, type, NULL, desc, { NULL }, false, optional }
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   123
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   124
#define CONFIG_PARAM_OPTIONAL(name, type, desc) \
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   125
    CONFIG_PARAM(name, type, desc, true)
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   126
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   127
#define CONFIG_PARAM_USER(name, user_type, desc, optional) \
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   128
    {   name, CONFIG_USER, user_type, desc, { NULL }, false, optional }
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   129
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   130
#define CONFIG_PARAM_USER_OPTIONAL(name, user_type, desc) \
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   131
    CONFIG_PARAM_USER(name, user_type, desc, true) 
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   132
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   133
#define CONFIG_PARAM_HANDLER(name, type, desc, _func_name_, func) \
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   134
    {   name, type, NULL, desc, {._func_name_ = func }, true, false }
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   135
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   136
#define CONFIG_PARAM_END \
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   137
    {   NULL, 0, NULL, NULL, { NULL }, false, false }
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   138
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   139
#define CONFIG_OPT(name, func, help, ...) \
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   140
    {   name, { __VA_ARGS__, CONFIG_PARAM_END }, func, help }
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   141
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   142
#define CONFIG_OPT_STRING(name, func, desc, help) \
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   143
    CONFIG_OPT(name, NULL, help, CONFIG_PARAM_HANDLER(name, CONFIG_STRING, desc, string, func))
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   144
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   145
#define CONFIG_OPT_IRC_CHAN(name, func, desc, help) \
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   146
    CONFIG_OPT(name, NULL, help, CONFIG_PARAM_HANDLER(name, CONFIG_IRC_CHAN, desc, irc_chan, func))
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   147
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   148
#define CONFIG_OPT_END \
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   149
    {   NULL,   {}, NULL, NULL }
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   150
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   151
#define CONFIG_OPTIONS(...) \
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   152
    { __VA_ARGS__, CONFIG_OPT_END }
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   153
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   154
#define CONFIG_VALUE(type, _name_, value) \
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   155
    {   (type), { ._name_ = value } }
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   156
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   157
#define CONFIG_VALUE_STRING(str_value) \
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   158
    CONFIG_VALUE(CONFIG_STRING, string, (str_value))
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   159
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   160
#define CONFIG_VALUE_IRC_CHAN(irc_chan_value) \
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   161
    CONFIG_VALUE(CONFIG_IRC_CHAN, irc_chan, (irc_chan_value))
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   162
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   163
#define CONFIG_VALUE_USER(user_type, user_value) \
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   164
    CONFIG_VALUE(CONFIG_USER, user, { user_type, user_value })
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   165
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   166
#define CONFIG_VALUE_END \
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   167
    {   0, { NULL } }
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   168
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   169
/**
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   170
 * Lookup a config option by name.
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   171
 *
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   172
 * @param options a CONFIG_OPT_END-terminated array of config_option's
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   173
 * @param name the config_option::name to look up
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   174
 * @param err returned error info if not found
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   175
 * @return a direct pointer to the config_option if found
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   176
 */
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   177
const struct config_option* config_lookup (const struct config_option *options, const char *name, struct error_info *err);
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   178
122
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   179
/**
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   180
 * Returns the number of params that an option has
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   181
 *
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   182
 * @param option the option to count
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   183
 * @return the number of params
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   184
 */
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   185
int config_params_count (const struct config_option *option);
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   186
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   187
// XXX: move this into nexus
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   188
#include "nexus.h"
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   189
/**
122
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   190
 * Parse a raw value into a suitable configuration value for the given param, based on its type.
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   191
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   192
 * Since this needs to access the application state, you need to pass in the nexus as an argument.
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   193
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   194
 * Formats supported:
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   195
 *  CONFIG_IRC_CHAN         - uses a '<network>/<channel>' format and irc_client_get_chan
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   196
 *
122
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   197
 */
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   198
err_t config_parse_param (const struct config_param *param, struct nexus *nexus, struct config_value *value, char *raw_value, struct error_info *err);
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   199
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   200
/**
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   201
 * Parse a raw value into a suitable configuration value for a single-param option, based on the config option type.
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   202
 *
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   203
 * @param option the option to parse the value for, use config_lookup to find it
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   204
 * @param nexus the application state
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   205
 * @param value the returned value, if succesfull
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   206
 * @param raw_value the raw value to parse based on the type
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   207
 * @param err returned error info
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   208
 */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   209
err_t config_parse (const struct config_option *option, struct nexus *nexus, struct config_value *value, char *raw_value, struct error_info *err);
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   210
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   211
/**
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   212
 * Apply a list of parsed configuration values to the given config_option struct.
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   213
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   214
 * The config option handlers take a context argument; the value of this depends on the implementor of the config_option.
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   215
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   216
 * @param option the option to apply
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   217
 * @param ctx the context pointer for the option handler
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   218
 * @param values the NULL-terminated array of parsed values
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   219
 * @param err returned error info
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   220
 */
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   221
err_t config_apply_opt (const struct config_option *option, void *ctx, const struct config_value values[], struct error_info *err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   222
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   223
/**
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   224
 * Apply a list of parsed configuration values for the named config opt.
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   225
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   226
 * @param options a CONFIG_OPT_END-terminated array of config_option's
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   227
 * @param ctx the context pointer for the option handler
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   228
 * @param name the config_option::name to look up
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   229
 * @param values the NULL-termianted array of parsed values
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   230
 * @param err returned error info
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   231
 */
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   232
err_t config_apply (const struct config_option *options, void *ctx, const char *name, const struct config_value values[], struct error_info *err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   233
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   234
/**
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   235
 * Apply a string value for the named config opt.
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   236
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   237
 * @param options a CONFIG_OPT_END-terminated array of config_option's
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   238
 * @param ctx the context pointer for the option handler
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   239
 * @param name the config_option::name to look up
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   240
 * @param value the string value
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   241
 * @param err returned error info
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   242
 */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   243
err_t config_apply_string (const struct config_option *options, void *ctx, const char *name, char *value, struct error_info *err);
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   244
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   245
/**
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   246
 * Apply an irc_chan value for the named config opt.
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   247
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   248
 * @param options a CONFIG_OPT_END-terminated array of config_option's
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   249
 * @param ctx the context pointer for the option handler
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   250
 * @param name the config_option::name to look up
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   251
 * @param value the irc_chan value
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   252
 * @param err returned error info
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   253
 */
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   254
err_t config_apply_irc_chan (const struct config_option *options, void *ctx, const char *name, struct irc_chan *value, struct error_info *err);
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   255
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   256
/**
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   257
 * Parse and apply a configuration value for the named config opt.
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   258
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   259
 * See config_parse() for more info.
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   260
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   261
 * @param options a CONFIG_OPT_END-terminated array of config_option's
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   262
 * @param nexus the application state
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   263
 * @param ctx the context pointer for the option handler
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   264
 * @param name the config_option::name to look up
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   265
 * @param raw_value the raw value to parse
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   266
 * @param err returned error info
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   267
 *
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   268
 * @see config_parse
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 87
diff changeset
   269
 */
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   270
err_t config_apply_raw (const struct config_option option[], struct nexus *nexus, void *ctx, const char *name, char *raw_value, struct error_info *err);
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   271
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   272
/**
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   273
 * Lookup a config_value by name from the given list of config_values for the given config_option
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   274
 */
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   275
const struct config_value* config_get_value (const struct config_option *option, const struct config_value values[], const char *name);
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   276
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   277
const char* config_get_string (const struct config_option *option, const struct config_value values[], const char *name);
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   278
struct irc_chan* config_get_irc_chan (const struct config_option *option, const struct config_value values[], const char *name);
154
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   279
void* config_get_user (const struct config_option *option, const struct config_value values[], const char *name, const struct config_user_type *user_type);
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   280
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   281
#endif