#include <netinet/in.h>
#include <arpa/inet.h>
#include <event.h>
-
-#define RXPD_COMMANDS \
- RXPD_CMD(CHECK) \
- RXPD_CMD(APPEND) \
- RXPD_CMD(PREPEND) \
- RXPD_CMD(REMOVE) \
- RXPD_CMD(REPLACE) \
- RXPD_CMD(LOAD) \
- RXPD_CMD(SAVE) \
- RXPD_CMD(DUMP) \
- RXPD_CMD(LIST) \
- RXPD_CMD(SHUTDOWN)
-
-#define RXPD_CMD(cmd) RXPD_CMD_##cmd,
+#include <time.h>
+
+#define RXPD_COMMANDS \
+ RXPD_CMD(CHECK, "data against regular expressions") \
+ RXPD_CMD(APPEND, "new rules to a list") \
+ 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_VERSION) \
+ RXPD_CMD(HELP, "is what you see right now") \
+ RXPD_CMD(SHUTDOWN, "the daemon")
+
+#define RXPD_CMD(cmd, _) RXPD_CMD_##cmd,
enum rxpd_cmd_e {RXPD_COMMANDS};
#undef RXPD_CMD
/*
* characters which are absolutely not allowed in rule filenames
- * for finer control use policies
+ * for finer control use policies, note that this are arbitary
+ * decisions also reserving some chars for later extension
*/
-#define RXPD_FILE_ILG_CHARS "/: \t\n*?"
+#define RXPD_FILE_ILG_CHARS "@&?<>|/: \t\n\r*?\\"
struct rxpd_base;
struct rxpd_file;
{
llist node;
char* string;
+ time_t atime;
regex_t rx;
};
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);
rxpd_connection_parse_cmd (int fd, short event, void* ptr);
/* generate prototypes for each defined command */
-#define RXPD_CMD(cmd) void rxpd_connection_cmd_##cmd (int fd, short event, void* ptr);
+#define RXPD_CMD(cmd, _) void rxpd_connection_cmd_##cmd (int fd, short event, void* ptr);
RXPD_COMMANDS
#undef RXPD_CMD