2
0
Fork 0
lighttpd2/src/options.h

69 lines
1.6 KiB
C
Raw Normal View History

2008-06-24 19:19:20 +00:00
#ifndef _LIGHTTPD_OPTIONS_H_
#define _LIGHTTPD_OPTIONS_H_
2008-07-08 19:29:02 +00:00
typedef enum {
OPTION_NONE,
OPTION_BOOLEAN,
OPTION_INT,
OPTION_STRING,
OPTION_LIST,
OPTION_HASH,
OPTION_ACTION, /**< shouldn't be used for options, but may be needed for constructing actions */
OPTION_CONDITION /**< shouldn't be used for options, but may be needed for constructing actions */
2008-07-08 19:29:02 +00:00
} option_type;
2008-06-24 19:19:20 +00:00
struct option;
typedef struct option option;
2008-07-08 19:29:02 +00:00
struct option_set;
typedef struct option_set option_set;
2008-06-24 19:19:20 +00:00
2008-07-15 20:11:53 +00:00
#include "settings.h"
2008-06-24 19:19:20 +00:00
struct option {
option_type type;
union {
gboolean opt_bool;
gint opt_int;
2008-06-24 19:19:20 +00:00
GString *opt_string;
/* array of option */
GArray *opt_list;
/* hash GString => option */
2008-06-28 18:37:28 +00:00
GHashTable *opt_hash;
struct {
server *srv; /* needed for destruction */
action *action;
} opt_action;
struct {
server *srv; /* needed for destruction */
condition *cond;
} opt_cond;
2008-06-24 19:19:20 +00:00
} value;
};
2008-07-08 20:38:22 +00:00
2008-07-08 19:29:02 +00:00
struct server_option;
2008-07-08 19:32:51 +00:00
struct option_set {
2008-06-24 19:19:20 +00:00
size_t ndx;
gpointer value;
2008-07-08 19:29:02 +00:00
struct server_option *sopt;
2008-06-24 19:19:20 +00:00
};
2008-06-28 18:37:28 +00:00
LI_API option* option_new_bool(gboolean val);
LI_API option* option_new_int(gint val);
LI_API option* option_new_string(GString *val);
LI_API option* option_new_list();
LI_API option* option_new_hash();
LI_API option* option_new_action(server *srv, action *a);
LI_API option* option_new_condition(server *srv, condition *c);
2008-06-28 18:37:28 +00:00
LI_API void option_free(option* opt);
2008-07-08 19:29:02 +00:00
LI_API const char* option_type_string(option_type type);
LI_API void option_list_free(GArray *optlist);
/* Extract value from option, option set to none */
2008-07-08 19:29:02 +00:00
LI_API gpointer option_extract_value(option *opt);
2008-06-24 19:19:20 +00:00
#endif