aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-18 18:20:54 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-18 18:20:54 +0000
commite2f2eed337ecdb17c897fe7e04626dfffe32f2a2 (patch)
tree25f39a0aef9ed9eacc117407cc3824b16acccb9c /src/protocol.h
parentf5933d697d2cd9854afcbc7421efda353e165aea (diff)
downloadrspamd-e2f2eed337ecdb17c897fe7e04626dfffe32f2a2.tar.gz
rspamd-e2f2eed337ecdb17c897fe7e04626dfffe32f2a2.zip
Parse HTTP requests, cleanup the code.
--HG-- extra : rebase_source : 6b35fbf55fc9fe65d7f033620670bb210928e9b4
Diffstat (limited to 'src/protocol.h')
-rw-r--r--src/protocol.h42
1 files changed, 8 insertions, 34 deletions
diff --git a/src/protocol.h b/src/protocol.h
index 72460940f..4b62fdfb2 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -8,6 +8,7 @@
#include "config.h"
#include "filter.h"
+#include "http.h"
#define RSPAMD_FILTER_ERROR 1
#define RSPAMD_NETWORK_ERROR 2
@@ -15,27 +16,9 @@
#define RSPAMD_LENGTH_ERROR 4
#define RSPAMD_STATFILE_ERROR 5
-#define RSPAMC_PROTO_1_0 "1.0"
-#define RSPAMC_PROTO_1_1 "1.1"
-#define RSPAMC_PROTO_1_2 "1.2"
-#define RSPAMC_PROTO_1_3 "1.3"
-
-/*
- * Reply messages
- */
-#define RSPAMD_REPLY_BANNER "RSPAMD"
-#define SPAMD_REPLY_BANNER "SPAMD"
-#define SPAMD_OK "EX_OK"
-/* XXX: try to convert rspamd errors to spamd errors */
-#define SPAMD_ERROR "EX_ERROR"
-
struct worker_task;
struct metric;
-enum rspamd_protocol {
- SPAMC_PROTO,
- RSPAMC_PROTO,
-};
enum rspamd_command {
CMD_CHECK,
@@ -45,8 +28,7 @@ enum rspamd_command {
CMD_SKIP,
CMD_PING,
CMD_PROCESS,
- CMD_LEARN,
- CMD_OTHER,
+ CMD_OTHER
};
@@ -58,27 +40,19 @@ struct custom_command {
};
/**
- * Find a character in command in and return pointer to the first part of the string, in is modified to point to the second part of string
- * @param in f_str_t input
- * @param c separator character
- * @return pointer to the first part of string or NULL if there is no separator found
- */
-gchar* separate_command (f_str_t * in, gchar c);
-
-/**
- * Read one line of user's input for specified task
- * @param task task object
- * @param line line of user's input
- * @return 0 if line was successfully parsed and -1 if we have protocol error
+ * Process HTTP request to the task structure
+ * @param task
+ * @param msg
+ * @return
*/
-gboolean read_rspamd_input_line (struct worker_task *task, f_str_t *line);
+gboolean rspamd_protocol_handle_request (struct worker_task *task, struct rspamd_http_message *msg);
/**
* Write reply for specified task command
* @param task task object
* @return 0 if we wrote reply and -1 if there was some error
*/
-gboolean write_reply (struct worker_task *task) G_GNUC_WARN_UNUSED_RESULT;
+gboolean rspamd_protocol_write_reply (struct worker_task *task);
/**