#define NO_LOG_HEADER "Log"
#define MLEN_HEADER "Message-Length"
-static GList *custom_commands = NULL;
static GQuark
rspamd_protocol_quark (void)
rspamd_protocol_handle_url (struct rspamd_task *task,
struct rspamd_http_message *msg)
{
- GList *cur;
GHashTable *query_args;
GHashTableIter it;
- struct custom_command *cmd;
struct http_parser_url u;
const gchar *p;
gsize pathlen;
}
break;
default:
- cur = custom_commands;
- while (cur) {
- cmd = cur->data;
- if (g_ascii_strncasecmp (p, cmd->name, pathlen) == 0) {
- task->cmd = CMD_OTHER;
- task->custom_cmd = cmd;
- break;
- }
- cur = g_list_next (cur);
- }
-
- if (cur == NULL) {
- goto err;
- }
- break;
+ goto err;
}
if (u.field_set & (1 << UF_QUERY)) {
task->processed_stages |= RSPAMD_TASK_STAGE_REPLIED;
}
-
-void
-register_protocol_command (const gchar *name, protocol_reply_func func)
-{
- struct custom_command *cmd;
-
- cmd = g_malloc (sizeof (struct custom_command));
- cmd->name = name;
- cmd->func = func;
-
- custom_commands = g_list_prepend (custom_commands, cmd);
-}
void rspamd_protocol_write_reply (struct rspamd_task *task);
-/**
- * Register custom fucntion to extend protocol
- * @param name symbolic name of custom function
- * @param func callback function for writing reply
- */
-void register_protocol_command (const gchar *name, protocol_reply_func func);
-
#endif
#define RSPAMD_TASK_IS_PROCESSED(task) (((task)->processed_stages & RSPAMD_TASK_STAGE_DONE))
#define RSPAMD_TASK_IS_CLASSIFIED(task) (((task)->processed_stages & RSPAMD_TASK_STAGE_CLASSIFIERS))
-typedef gint (*protocol_reply_func)(struct rspamd_task *task);
-
-struct custom_command {
- const gchar *name;
- protocol_reply_func func;
-};
-
/**
* Worker task structure
*/
struct rspamd_task {
struct rspamd_worker *worker; /**< pointer to worker object */
- struct custom_command *custom_cmd; /**< custom command if any */
guint processed_stages; /**< bits of stages that are processed */
enum rspamd_command cmd; /**< command */
gint sock; /**< socket descriptor */