mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-02 01:21:34 +01:00
Now we define a new sock_accept_iocb() for socket-based stream protocols and use it as a wrapper for listener_accept() which now takes a listener and not an FD anymore. This will allow the receiver's I/O cb to be redefined during registration, and more specifically to get rid of the hard-coded hacks in protocol_bind_all() made for syslog. The previous ->accept() callback in the protocol was removed since it doesn't have anything to do with accept() anymore but is more generic. A few places where listener_accept() was compared against the FD's IO callback for debugging purposes on the CLI were updated.
55 lines
1.8 KiB
C
55 lines
1.8 KiB
C
/*
|
|
* include/haproxy/sock.h
|
|
* This file contains declarations for native (BSD-compatible) sockets.
|
|
*
|
|
* 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_SOCK_H
|
|
#define _HAPROXY_SOCK_H
|
|
|
|
#include <sys/socket.h>
|
|
#include <sys/types.h>
|
|
|
|
#include <haproxy/api.h>
|
|
#include <haproxy/connection-t.h>
|
|
#include <haproxy/listener-t.h>
|
|
#include <haproxy/sock-t.h>
|
|
|
|
extern struct xfer_sock_list *xfer_sock_list;
|
|
|
|
int sock_create_server_socket(struct connection *conn);
|
|
void sock_enable(struct receiver *rx);
|
|
void sock_disable(struct receiver *rx);
|
|
void sock_unbind(struct receiver *rx);
|
|
int sock_get_src(int fd, struct sockaddr *sa, socklen_t salen, int dir);
|
|
int sock_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir);
|
|
int sock_get_old_sockets(const char *unixsocket);
|
|
int sock_find_compatible_fd(const struct receiver *rx);
|
|
int sock_accepting_conn(const struct receiver *rx);
|
|
struct connection *sock_accept_conn(struct listener *l, int *status);
|
|
void sock_accept_iocb(int fd);
|
|
|
|
#endif /* _HAPROXY_SOCK_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*/
|