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

83 lines
1.9 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_TLIST
15 years ago
} action_type;
15 years ago
struct action;
typedef struct action action;
15 years ago
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 {
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* target; /** action target to jump to if condition is fulfilled */
15 years ago
} condition;
15 years ago
action_func function;
GArray* list; /** array of (action*) */
15 years ago
} value;
};
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(server *srv, action_stack *as);
LI_API void action_stack_clear(server *srv, action_stack *as);
15 years ago
15 years ago
/** handle sublist now, remember current position (stack) */
LI_API void action_enter(connection *con, action *a);
15 years ago
LI_API action_result action_execute(server *srv, connection *con);
15 years ago
LI_API void action_release(server *srv, action *a);
LI_API void action_acquire(action *a);
/* create new action */
LI_API action *action_new_setting(server *srv, const gchar *name, option *value);
LI_API action *action_new_function(ActionFunc func, ActionFree free, gpointer param);
LI_API action *action_new_list();
LI_API action *action_new_condition(condition *cond, action *target);
15 years ago
#endif