summaryrefslogtreecommitdiffstats
path: root/src/main.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-09-14 20:59:23 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-09-14 20:59:23 +0400
commit2d81eded1e64737d2ecca278efc2a84be7dbd8f5 (patch)
treef9eab401bca807461a76911bcf0199bdb27f8e6d /src/main.h
parentea68f17ec2f7bffbb8db9000a05d7208fb611204 (diff)
downloadrspamd-2d81eded1e64737d2ecca278efc2a84be7dbd8f5.tar.gz
rspamd-2d81eded1e64737d2ecca278efc2a84be7dbd8f5.zip
* Initial approach to RESTful controller.
Fix security issues in fstring handling.
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main.h b/src/main.h
index f90edf1d2..9a28793cd 100644
--- a/src/main.h
+++ b/src/main.h
@@ -131,10 +131,15 @@ union sa_union {
/**
* Control session object
*/
+struct controller_command;
+struct controller_session;
+typedef void (*controller_func_t)(gchar **args, struct controller_session *session);
+
struct controller_session {
struct rspamd_worker *worker; /**< pointer to worker structure (controller in fact) */
enum {
STATE_COMMAND,
+ STATE_HEADER,
STATE_LEARN,
STATE_LEARN_SPAM_PRE,
STATE_LEARN_SPAM,
@@ -146,7 +151,10 @@ struct controller_session {
} state; /**< current session state */
gint sock; /**< socket descriptor */
/* Access to authorized commands */
- gint authorized; /**< whether this session is authorized */
+ gboolean authorized; /**< whether this session is authorized */
+ gboolean restful; /**< whether this session is a restful session */
+ GHashTable *kwargs; /**< keyword arguments for restful command */
+ struct controller_command *cmd; /**< real command */
memory_pool_t *session_pool; /**< memory pool for session */
struct config_file *cfg; /**< pointer to config file */
gchar *learn_rcpt; /**< recipient for learning */
@@ -161,14 +169,13 @@ struct controller_session {
void (*other_handler)(struct controller_session *session,
f_str_t *in); /**< other command handler to execute at the end of processing */
void *other_data; /**< and its data */
+ controller_func_t custom_handler; /**< custom command handler */
struct rspamd_async_session* s; /**< async session object */
struct worker_task *learn_task;
struct rspamd_dns_resolver *resolver; /**< DNS resolver */
struct event_base *ev_base; /**< Event base */
};
-typedef void (*controller_func_t)(gchar **args, struct controller_session *session);
-
/**
* Worker task structure
*/