REORG: split "protocols" files into protocol and listener
It was becoming confusing to have protocols and listeners in the same
files, split them.
diff --git a/include/proto/connection.h b/include/proto/connection.h
index 3ed605f..32e77cf 100644
--- a/include/proto/connection.h
+++ b/include/proto/connection.h
@@ -24,7 +24,7 @@
#include <common/config.h>
#include <types/connection.h>
-#include <types/protocols.h>
+#include <types/listener.h>
/* I/O callback for fd-based connections. It calls the read/write handlers
* provided by the connection's sock_ops. Returns 0.
diff --git a/include/proto/protocols.h b/include/proto/listener.h
similarity index 68%
rename from include/proto/protocols.h
rename to include/proto/listener.h
index ec98e59..415b913 100644
--- a/include/proto/protocols.h
+++ b/include/proto/listener.h
@@ -1,28 +1,28 @@
/*
- include/proto/protocols.h
- This file declares generic protocol primitives.
-
- Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation, version 2.1
- exclusively.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ * include/proto/listener.h
+ * This file declares listener management primitives.
+ *
+ * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
-#ifndef _PROTO_PROTOCOLS_H
-#define _PROTO_PROTOCOLS_H
+#ifndef _PROTO_LISTENER_H
+#define _PROTO_LISTENER_H
-#include <types/protocols.h>
+#include <types/listener.h>
/* This function adds the specified listener's file descriptor to the polling
* lists if it is in the LI_LISTEN state. The listener enters LI_READY or
@@ -105,35 +105,6 @@
*/
int listener_accept(int fd);
-/* Registers the protocol <proto> */
-void protocol_register(struct protocol *proto);
-
-/* Unregisters the protocol <proto>. Note that all listeners must have
- * previously been unbound.
- */
-void protocol_unregister(struct protocol *proto);
-
-/* binds all listeneres of all registered protocols. Returns a composition
- * of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
- */
-int protocol_bind_all(char *errmsg, int errlen);
-
-/* unbinds all listeners of all registered protocols. They are also closed.
- * This must be performed before calling exit() in order to get a chance to
- * remove file-system based sockets and pipes.
- * Returns a composition of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
- */
-int protocol_unbind_all(void);
-
-/* enables all listeners of all registered protocols. This is intended to be
- * used after a fork() to enable reading on all file descriptors. Returns a
- * composition of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
- */
-int protocol_enable_all(void);
-
-/* returns the protocol associated to family <family> or NULL if not found */
-struct protocol *protocol_by_family(int family);
-
/* allocate an ssl_conf struct for a bind line, and chain it to list head <lh>.
* If <arg> is not NULL, it is duplicated into ->arg to store useful config
* information for error reporting.
@@ -151,7 +122,7 @@
return ssl_conf;
}
-#endif /* _PROTO_PROTOCOLS_H */
+#endif /* _PROTO_LISTENER_H */
/*
* Local variables:
diff --git a/include/proto/protocol.h b/include/proto/protocol.h
new file mode 100644
index 0000000..1842faf
--- /dev/null
+++ b/include/proto/protocol.h
@@ -0,0 +1,63 @@
+/*
+ * include/proto/protocol.h
+ * This file declares generic protocol management primitives.
+ *
+ * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _PROTO_PROTOCOL_H
+#define _PROTO_PROTOCOL_H
+
+#include <types/protocol.h>
+
+/* Registers the protocol <proto> */
+void protocol_register(struct protocol *proto);
+
+/* Unregisters the protocol <proto>. Note that all listeners must have
+ * previously been unbound.
+ */
+void protocol_unregister(struct protocol *proto);
+
+/* binds all listeneres of all registered protocols. Returns a composition
+ * of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
+ */
+int protocol_bind_all(char *errmsg, int errlen);
+
+/* unbinds all listeners of all registered protocols. They are also closed.
+ * This must be performed before calling exit() in order to get a chance to
+ * remove file-system based sockets and pipes.
+ * Returns a composition of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
+ */
+int protocol_unbind_all(void);
+
+/* enables all listeners of all registered protocols. This is intended to be
+ * used after a fork() to enable reading on all file descriptors. Returns a
+ * composition of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
+ */
+int protocol_enable_all(void);
+
+/* returns the protocol associated to family <family> or NULL if not found */
+struct protocol *protocol_by_family(int family);
+
+#endif /* _PROTO_PROTOCOL_H */
+
+/*
+ * Local variables:
+ * c-indent-level: 8
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/include/proto/proxy.h b/include/proto/proxy.h
index d5fd3e0..4a4b285 100644
--- a/include/proto/proxy.h
+++ b/include/proto/proxy.h
@@ -27,6 +27,7 @@
#include <common/time.h>
#include <types/global.h>
#include <types/proxy.h>
+#include <types/listener.h>
#include <proto/freq_ctr.h>
int start_proxies(int verbose);
diff --git a/include/proto/ssl_sock.h b/include/proto/ssl_sock.h
index 9d04624..6192fe8 100644
--- a/include/proto/ssl_sock.h
+++ b/include/proto/ssl_sock.h
@@ -23,7 +23,9 @@
#define _PROTO_SSL_SOCK_H
#include <openssl/ssl.h>
-#include <types/protocols.h>
+#include <types/connection.h>
+#include <types/listener.h>
+#include <types/proxy.h>
#include <types/stream_interface.h>
extern struct data_ops ssl_sock;