diff --git a/include/haproxy/proto_sockpair.h b/include/haproxy/proto_sockpair.h index e012407d7..bb0256e8d 100644 --- a/include/haproxy/proto_sockpair.h +++ b/include/haproxy/proto_sockpair.h @@ -22,6 +22,7 @@ #define _HAPROXY_PROTO_SOCKPAIR_H extern struct proto_fam proto_fam_sockpair; +extern struct protocol proto_sockpair; int recv_fd_uxst(int sock); int send_fd_uxst(int fd, int send_fd); diff --git a/include/haproxy/proto_tcp.h b/include/haproxy/proto_tcp.h index 63bbb5733..52566dbf3 100644 --- a/include/haproxy/proto_tcp.h +++ b/include/haproxy/proto_tcp.h @@ -28,6 +28,9 @@ #include #include +extern struct protocol proto_tcp4; +extern struct protocol proto_tcp6; + int tcp_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct sockaddr_storage *remote); int tcp_connect_server(struct connection *conn, int flags); int tcp_is_foreign(int fd, sa_family_t family); diff --git a/include/haproxy/proto_udp.h b/include/haproxy/proto_udp.h index 25c14235e..7de84130c 100644 --- a/include/haproxy/proto_udp.h +++ b/include/haproxy/proto_udp.h @@ -1,5 +1,5 @@ /* - * include/proto/proto_udp.h + * include/haproxy/proto_udp.h * This file contains UDP socket protocol definitions. * * Copyright 2019 HAProxy Technologies, Frédéric Lécaille @@ -24,6 +24,9 @@ #ifndef _PROTO_PROTO_UDP_H #define _PROTO_PROTO_UDP_H +extern struct protocol proto_udp4; +extern struct protocol proto_udp6; + int udp_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct sockaddr_storage *remote); #endif /* _PROTO_PROTO_UDP_H */ diff --git a/include/haproxy/proto_uxst.h b/include/haproxy/proto_uxst.h new file mode 100644 index 000000000..77caf3dcd --- /dev/null +++ b/include/haproxy/proto_uxst.h @@ -0,0 +1,34 @@ +/* + * include/haproxy/proto_uxst.h + * This file contains UNIX stream socket protocol definitions. + * + * Copyright (C) 2000-2013 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_PROTO_UXST_H +#define _PROTO_PROTO_UXST_H + +extern struct protocol proto_uxst; + +#endif /* _PROTO_PROTO_UXST_H */ + +/* + * Local variables: + * c-indent-level: 8 + * c-basic-offset: 8 + * End: + */ diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c index 2f691f7ec..9d2fb1186 100644 --- a/src/proto_sockpair.c +++ b/src/proto_sockpair.c @@ -63,7 +63,7 @@ struct proto_fam proto_fam_sockpair = { }; /* Note: must not be declared as its list will be overwritten */ -static struct protocol proto_sockpair = { +struct protocol proto_sockpair = { .name = "sockpair", .fam = &proto_fam_sockpair, .ctrl_type = SOCK_STREAM, diff --git a/src/proto_tcp.c b/src/proto_tcp.c index eecb299e6..b3f648efa 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -51,7 +51,7 @@ static void tcp_enable_listener(struct listener *listener); static void tcp_disable_listener(struct listener *listener); /* Note: must not be declared as its list will be overwritten */ -static struct protocol proto_tcpv4 = { +struct protocol proto_tcpv4 = { .name = "tcpv4", .fam = &proto_fam_inet4, .ctrl_type = SOCK_STREAM, @@ -80,7 +80,7 @@ static struct protocol proto_tcpv4 = { INITCALL1(STG_REGISTER, protocol_register, &proto_tcpv4); /* Note: must not be declared as its list will be overwritten */ -static struct protocol proto_tcpv6 = { +struct protocol proto_tcpv6 = { .name = "tcpv6", .fam = &proto_fam_inet6, .ctrl_type = SOCK_STREAM, diff --git a/src/proto_udp.c b/src/proto_udp.c index 12e25afdf..a883967f0 100644 --- a/src/proto_udp.c +++ b/src/proto_udp.c @@ -47,7 +47,7 @@ static void udp_enable_listener(struct listener *listener); static void udp_disable_listener(struct listener *listener); /* Note: must not be declared as its list will be overwritten */ -static struct protocol proto_udp4 = { +struct protocol proto_udp4 = { .name = "udp4", .fam = &proto_fam_inet4, .ctrl_type = SOCK_DGRAM, @@ -72,7 +72,7 @@ static struct protocol proto_udp4 = { INITCALL1(STG_REGISTER, protocol_register, &proto_udp4); /* Note: must not be declared as its list will be overwritten */ -static struct protocol proto_udp6 = { +struct protocol proto_udp6 = { .name = "udp6", .fam = &proto_fam_inet6, .ctrl_type = SOCK_DGRAM, diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 52e90ae4a..8cf541d98 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +48,7 @@ static void uxst_disable_listener(struct listener *listener); static int uxst_suspend_receiver(struct receiver *rx); /* Note: must not be declared as its list will be overwritten */ -static struct protocol proto_unix = { +struct protocol proto_uxst = { .name = "unix_stream", .fam = &proto_fam_unix, .ctrl_type = SOCK_STREAM, @@ -67,11 +68,11 @@ static struct protocol proto_unix = { .rx_listening = sock_accepting_conn, .default_iocb = &sock_accept_iocb, .connect = &uxst_connect_server, - .receivers = LIST_HEAD_INIT(proto_unix.receivers), + .receivers = LIST_HEAD_INIT(proto_uxst.receivers), .nb_receivers = 0, }; -INITCALL1(STG_REGISTER, protocol_register, &proto_unix); +INITCALL1(STG_REGISTER, protocol_register, &proto_uxst); /******************************** * 1) low-level socket functions