2 rxpd.h - regex policy daemon
5 2007, Christian Thaeter <ct@pipapo.org>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 #include <sys/types.h>
34 #include <sys/socket.h>
35 #include <netinet/in.h>
36 #include <arpa/inet.h>
39 #define RXPD_COMMANDS \
51 #define RXPD_CMD(cmd) RXPD_CMD_##cmd,
59 struct rxpd_connection;
66 llist sockets_pending;
68 llist connections_pending;
69 llist connections_active;
74 rxpd_init (char* rulesdir);
90 rxpd_rule_new (const char* buf);
93 rxpd_rule_delete (struct rxpd_rule*);
101 //TODO later struct stat last_stat;
106 rxpd_file_load (struct rxpd_base* base, const char* filename);
109 rxpd_file_delete (PSplay file);
112 rxpd_file_cmp (const void* A, const void* B);
122 struct rxpd_base* base;
127 rxpd_socket_new_tcp4 (struct rxpd_base* base, const char* addr, unsigned short port);
129 //struct rxpd_socket*
130 //rxpd_socket_new_unix (struct rxpd_base* base, const char* name);
133 rxpd_socket_delete (struct rxpd_socket* self);
136 rxpd_socket_accept (int sock, short event, void* ptr);
139 rxpd_socket_activate (struct rxpd_socket* self);
142 rxpd_socket_suspend (struct rxpd_socket* self);
147 struct rxpd_connection
152 struct rxpd_base* base;
154 struct sockaddr_in peer_addr;
162 struct rxpd_connection*
163 rxpd_connection_new (struct rxpd_base* base);
166 rxpd_connection_delete (struct rxpd_connection* self);
169 rxpd_connection_readline (struct rxpd_connection* self);
172 rxpd_connection_parse_cmd (int sock, short event, void* ptr);
174 /* generate prototypes for each defined command */
175 #define RXPD_CMD(cmd) void rxpd_connection_cmd_##cmd (int sock, short event, void* ptr);