From: Willy Tarreau Date: Tue, 1 Sep 2020 08:37:19 +0000 (+0200) Subject: REORG: listener: move the receiver part to a new file X-Git-Tag: v2.3-dev5~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d45693d85c10557969014e1d4af1122ed95d32be;p=thirdparty%2Fhaproxy.git REORG: listener: move the receiver part to a new file 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. --- diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h index d7c45d5fa3..36c8cbb0b4 100644 --- a/include/haproxy/listener-t.h +++ b/include/haproxy/listener-t.h @@ -29,7 +29,8 @@ #include #include -#include +#include +#include #ifdef USE_OPENSSL #include @@ -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 index 0000000000..2a52b472ef --- /dev/null +++ b/include/haproxy/receiver-t.h @@ -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 +#include + +#include +#include +#include + +/* 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: + */