You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lighttpd2/src/actions.h

89 lines
2.1 KiB

15 years ago
#ifndef _LIGHTTPD_ACTIONS_H_
#define _LIGHTTPD_ACTIONS_H_
15 years ago
#include "settings.h"
typedef enum {
ACTION_GO_ON,
ACTION_FINISHED,
ACTION_ERROR,
ACTION_WAIT_FOR_EVENT
} action_result;
15 years ago
// action type
15 years ago
typedef enum {
ACTION_TSETTING,
ACTION_TFUNCTION,
ACTION_TCONDITION
} action_type;
15 years ago
struct action;
typedef struct action action;
15 years ago
struct action_list;
typedef struct action_list action_list;
struct action_stack;
typedef struct action_stack action_stack;
15 years ago
15 years ago
struct action_stack {
GArray* stack;
};
15 years ago
15 years ago
struct server; struct connection;
typedef action_result (*ActionFunc)(struct server *srv, struct connection *con, gpointer param);
typedef void (*ActionFree)(struct server *srv, gpointer param);
struct action_func {
ActionFunc func;
ActionFree free;
gpointer param;
};
typedef struct action_func action_func;
15 years ago
15 years ago
#include "condition.h"
15 years ago
#include "plugin.h"
#include "options.h"
15 years ago
15 years ago
struct action_list {
15 years ago
gint refcount;
15 years ago
15 years ago
GArray* actions; /** array of (action*) */
15 years ago
};
15 years ago
15 years ago
struct action {
15 years ago
gint refcount;
15 years ago
action_type type;
15 years ago
union {
option_set setting;
15 years ago
15 years ago
struct {
condition *cond;
action_list* target; /** action target to jump to if condition is fulfilled */
} condition;
15 years ago
action_func function;
15 years ago
} value;
};
15 years ago
LI_API void action_list_release(action_list *al);
LI_API action_list *action_list_new();
15 years ago
15 years ago
/* no new/free function, so just use the struct direct (i.e. not a pointer) */
LI_API void action_stack_init(action_stack *as);
LI_API void action_stack_reset(action_stack *as);
LI_API void action_stack_clear(action_stack *as);
15 years ago
15 years ago
/** handle sublist now, remember current position (stack) */
LI_API void action_enter(connection *con, action_list *al);
LI_API action_result action_execute(server *srv, connection *con);
15 years ago
/* create new action */
LI_API action *action_new_setting(server *srv, GString *name, option *value);
LI_API action *action_new_function(server *srv, const char *name, option *value);
LI_API action *action_new_condition_string(comp_key_t comp, comp_operator_t op, GString *str);
LI_API action *action_new_condition_int(comp_key_t comp, comp_operator_t op, guint64 i);
15 years ago
#endif