RXPD_CMD(PREPEND, "new rules in front of a list") \
RXPD_CMD(REMOVE, "rules from a list") \
RXPD_CMD(REPLACE, "a rule in a list with new rules") \
+ RXPD_CMD(DELETE, "a list from memory") \
RXPD_CMD(LOAD, "a list from disk") \
RXPD_CMD(SAVE, "a list to disk") \
RXPD_CMD(EXPIRE, "aged rules from a list") \
RXPD_CMD(DUMP, "rules in a list") \
RXPD_CMD(LIST, "all existing lists") \
- RXPD_CMD(VERSION, "of this rxpd is "PACKAGE_STRING) \
+ RXPD_CMD(VERSION, "of this rxpd is "PACKAGE_VERSION) \
RXPD_CMD(HELP, "is what you see right now") \
RXPD_CMD(SHUTDOWN, "the daemon")
rxpd_file_new (struct rxpd_base* base, const char* filename);
void
-rxpd_file_delete (PSplay file);
+rxpd_file_delete (struct rxpd_file* file);
int
rxpd_file_load (struct rxpd_file* self);
}
}
+void
+rxpd_connection_cmd_DELETE (int fd, short event, void* ptr)
+{
+ (void) fd;
+ struct rxpd_connection* self = (struct rxpd_connection*) ptr;
+
+ if (!event)
+ {
+ if (self->file)
+ {
+ rxpd_file_delete (self->file);
+ rxpd_buffer_printf (&self->out, "#OK:\n");
+ }
+ rxpd_connection_delete (self);
+ }
+}
+
void
rxpd_connection_cmd_DUMP (int fd, short event, void* ptr)
{
}
void
-rxpd_file_delete (PSplay f)
+rxpd_file_delete (struct rxpd_file* self)
{
- if (f)
+ if (self)
{
- struct rxpd_file* file = (struct rxpd_file*)f;
- LLIST_WHILE_HEAD (&file->rules, n)
+ LLIST_WHILE_HEAD (&self->rules, n)
{
struct rxpd_rule* node = (struct rxpd_rule*)n;
rxpd_rule_delete (node);
}
- free ((void*)file->filename);
- free (f);
+ psplay_remove (&self->base->files, &self->node);
+ free ((void*)self->filename);
+ free (self);
}
}