+/****d* silcutil/SilcConfigAPI/SilcConfigErrno
+ *
+ * NAME
+ *
+ * enum { ... } - describe a SILC Config error
+ *
+ * DESCRIPTION
+ *
+ * The virtual integer `errno' is returned by the silc_config_main()
+ * function and indicates what went wrong.
+ * You can convert it to the corresponding error string with the function
+ * silc_config_strerror().
+ *
+ * SOURCE
+ */
+enum {
+ SILC_CONFIG_OK, /* OK */
+ SILC_CONFIG_ESILENT, /* Error defined by callback function */
+ SILC_CONFIG_EPRINTLINE, /* Error defined by callback function */
+ SILC_CONFIG_EGENERIC, /* Invalid syntax */
+ SILC_CONFIG_EINTERNAL, /* Internal Error (caused by developer) */
+ SILC_CONFIG_ECANTOPEN, /* Can't open specified file */
+ SILC_CONFIG_EOPENBRACE, /* Expected open-brace '{' */
+ SILC_CONFIG_ECLOSEBRACE, /* Missing close-brace '}' */
+ SILC_CONFIG_ETYPE, /* Invalid data type */
+ SILC_CONFIG_EBADOPTION, /* Unknown option */
+ SILC_CONFIG_EINVALIDTEXT, /* Invalid text */
+ SILC_CONFIG_EDOUBLE, /* Double option specification */
+ SILC_CONFIG_EEXPECTED, /* Expected data but not found */
+ SILC_CONFIG_EEXPECTEDEQUAL, /* Expected '=' */
+ SILC_CONFIG_EUNEXPECTED, /* Unexpected data */
+ SILC_CONFIG_EMISSFIELDS, /* Missing mandatory fields */
+ SILC_CONFIG_EMISSCOLON, /* Missing ';' */
+};
+/***/
+
+/****d* silcutil/SilcConfigAPI/SilcConfigType
+ *
+ * NAME
+ *
+ * typedef enum { ... } SilcConfigType;
+ *
+ * DESCRIPTION
+ *
+ * This identifies the parameter type that an option has. This parameter
+ * is very important because the callback's *val pointer points to a
+ * memory location containing the previously specified data type.
+ * For example, if you specified an option with an integer parameter
+ * callback's *val will be a pointer to an integer.
+ *
+ * SOURCE
+ */
+typedef enum {
+ SILC_CONFIG_ARG_TOGGLE, /* TOGGLE on,off; yes,no; true, false; */
+ SILC_CONFIG_ARG_INT, /* callback wants an integer */
+ SILC_CONFIG_ARG_STR, /* callback expects \0-terminated str */
+ SILC_CONFIG_ARG_STRE, /* same as above, but can also be empty */
+ SILC_CONFIG_ARG_BLOCK, /* this is a sub-block */
+ SILC_CONFIG_ARG_SIZE, /* like int, but accepts suffixes kMG */
+ SILC_CONFIG_ARG_NONE, /* does not expect any args */
+} SilcConfigType;
+/***/
+
+/****f* silcutil/SilcConfigAPI/SilcConfigCallback
+ *
+ * SYNOPSIS
+ *
+ * typedef int (*SilcConfigCallback)(SilcConfigType type, const char *name,
+ * SilcUInt32 line, void *val,
+ * void *context);
+ * DESCRIPTION
+ *
+ * This is the callback prototype for the options handler. The pointer
+ * `val' points to a location of type described by `type'. `name' points
+ * to a null-terminated string with the name of the option which triggered
+ * this callback, that is stated at line `line'. `context' is the
+ * user-specified context provided when this option was registered.
+ *
+ ***/
+typedef int (*SilcConfigCallback)(SilcConfigType type, const char *name,
+ SilcUInt32 line, void *val, void *context);
+
+/****s* silcutil/SilcConfigAPI/SilcConfigTable
+ *
+ * SYNOPSIS
+ *
+ * typedef struct { ... } SilcConfigTable;
+ *
+ * DESCRIPTION
+ *
+ * SILC Config table defines an easy and quick way of registering options
+ * in an entity. The function silc_config_register_table() will take as
+ * argument a SilcConfigTable array terminated by a NULL struct, it is
+ * important thus, that the `name' field of the terminating struct is set
+ * to NULL.
+ *
+ * char *name
+ *
+ * The option name lowercase. The matching is always case-insensitive,
+ * but for convention the option specification must always be lowercase.
+ *
+ * SilcConfigType type
+ *
+ * This specifies what kind of parameter this option expects. The
+ * special cases SILC_CONFIG_ARG_BLOCK tells SILC Config that this is
+ * not a normal option but the name of a sub-block of the current
+ * block (there is no limit to the number of nested blocks allowed).
+ *
+ * SilcConfigCallback callback
+ *
+ * Normally this is the value handler of the current option. If this
+ * field is set to NULL then the value is silently discarded. Useful
+ * for example to support deprecated options.
+ *
+ * SilcConfigTable *subtable
+ *
+ * If the `type' field is set to SILC_CONFIG_ARG_BLOCK, then this field
+ * must point to a valid sub-table NULL-terminated array. If `type' is
+ * something else, this valued is unused.
+ *
+ ***/
+typedef struct SilcConfigTableStruct {
+ char *name;
+ SilcConfigType type;
+ SilcConfigCallback callback;
+ const struct SilcConfigTableStruct *subtable;
+} SilcConfigTable;
+
+/****s* silcutil/SilcConfigAPI/SilcConfigFile
+ *
+ * SYNOPSIS
+ *
+ * typedef struct SilcConfigFileObject SilcConfigFile;
+ *
+ * DESCRIPTION
+ *
+ * A File object holds the data contained in a previously loaded file by
+ * the silc_config_open() function.
+ * This is an internally allocated struct and must be used only with the
+ * helper functions.
+ *
+ ***/
+typedef struct SilcConfigFileObject SilcConfigFile;
+
+/****s* silcutil/SilcConfigAPI/SilcConfigEntity
+ *
+ * SYNOPSIS
+ *
+ * typedef struct SilcConfigEntityObject *SilcConfigEntity;
+ *
+ * DESCRIPTION
+ *
+ * The SILC Config is based on config entities. An entity contains the
+ * SilcConfigFile object we are parsing and the registered options.
+ *
+ ***/
+typedef struct SilcConfigEntityObject *SilcConfigEntity;
+
+/* Macros */
+
+/****d* silcutil/SilcConfigAPI/SILC_CONFIG_CALLBACK
+ *
+ * NAME
+ *
+ * #define SILC_CONFIG_CALLBACK ...
+ *
+ * DESCRIPTION
+ *
+ * Generic macro to define SilcConfigCallback functions. This defines a
+ * static function with name `func' as a config callback function.
+ *
+ * SOURCE
+ */
+#define SILC_CONFIG_CALLBACK(func) \
+static int func(SilcConfigType type, const char *name, \
+ SilcUInt32 line, void *val, void *context)
+/***/
+