]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: listener: move the receiver part to a new file
authorWilly Tarreau <w@1wt.eu>
Tue, 1 Sep 2020 08:37:19 +0000 (10:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2020 20:08:07 +0000 (22:08 +0200)
We'll soon add flags for the receivers, better add them to the final
file, so it's time to move the definition to receiver-t.h. The struct
receiver and rx_settings were placed there.

include/haproxy/listener-t.h
include/haproxy/receiver-t.h [new file with mode: 0644]

index d7c45d5fa340b49f1b61f42d0756dc0aa1397ea9..36c8cbb0b4bc238abe1244434a16a868aa5d9ff4 100644 (file)
@@ -29,7 +29,8 @@
 
 #include <haproxy/api-t.h>
 #include <haproxy/obj_type-t.h>
-#include <haproxy/thread.h>
+#include <haproxy/receiver-t.h>
+#include <haproxy/thread-t.h>
 
 #ifdef USE_OPENSSL
 #include <haproxy/openssl-compat.h>
@@ -178,27 +179,7 @@ struct bind_conf {
        char *arg;                 /* argument passed to "bind" for better error reporting */
        char *file;                /* file where the section appears */
        int line;                  /* line where the section appears */
-       struct {
-               unsigned long bind_proc;   /* bitmask of processes allowed to use these listeners */
-               unsigned long bind_thread; /* bitmask of threads allowed to use these listeners */
-               struct {                   /* UNIX socket permissions */
-                       uid_t uid;         /* -1 to leave unchanged */
-                       gid_t gid;         /* -1 to leave unchanged */
-                       mode_t mode;       /* 0 to leave unchanged */
-               } ux;
-               char *interface;           /* interface name or NULL */
-               const struct netns_entry *netns; /* network namespace of the listener*/
-       } settings;                /* all the settings needed for the listening socket */
-};
-
-/* This describes a receiver with all its characteristics (address, status, etc) */
-struct receiver {
-       int fd;                          /* handle we receive from (fd only for now) */
-       unsigned int flags;              /* receiver options (RX_F_*) */
-       struct protocol *proto;          /* protocol this receiver belongs to */
-       struct list proto_list;          /* list in the protocol header */
-       /* warning: this struct is huge, keep it at the bottom */
-       struct sockaddr_storage addr;    /* the address the socket is bound to */
+       struct rx_settings settings; /* all the settings needed for the listening socket */
 };
 
 /* The listener will be directly referenced by the fdtab[] which holds its
diff --git a/include/haproxy/receiver-t.h b/include/haproxy/receiver-t.h
new file mode 100644 (file)
index 0000000..2a52b47
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * include/haproxy/receiver-t.h
+ * This file defines the structures needed to manage receivers.
+ *
+ * Copyright (C) 2000-2020 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 _HAPROXY_RECEIVER_T_H
+#define _HAPROXY_RECEIVER_T_H
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <haproxy/api-t.h>
+#include <haproxy/namespace-t.h>
+#include <haproxy/thread.h>
+
+/* All the settings that are used to configure a receiver */
+struct rx_settings {
+       unsigned long bind_proc;          /* bitmask of processes allowed to use these listeners */
+       unsigned long bind_thread;        /* bitmask of threads allowed to use these listeners */
+       struct {                          /* UNIX socket permissions */
+               uid_t uid;                /* -1 to leave unchanged */
+               gid_t gid;                /* -1 to leave unchanged */
+               mode_t mode;              /* 0 to leave unchanged */
+       } ux;
+       char *interface;                  /* interface name or NULL */
+       const struct netns_entry *netns;  /* network namespace of the listener*/
+};
+
+/* This describes a receiver with all its characteristics (address, options, etc) */
+struct receiver {
+       int fd;                          /* handle we receive from (fd only for now) */
+       unsigned int flags;              /* receiver options (RX_F_*) */
+       struct protocol *proto;          /* protocol this receiver belongs to */
+       struct list proto_list;          /* list in the protocol header */
+       /* warning: this struct is huge, keep it at the bottom */
+       struct sockaddr_storage addr;    /* the address the socket is bound to */
+};
+
+#endif /* _HAPROXY_RECEIVER_T_H */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ * End:
+ */