blob: 044de2c1920a9738802f62fcdc809dbbd795ee67 [file] [log] [blame]
Willy Tarreau0d06df62020-08-28 15:10:11 +02001/*
2 * include/haproxy/sock_inet.h
3 * This file contains declarations for AF_INET & AF_INET6 sockets.
4 *
5 * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef _HAPROXY_SOCK_INET_H
23#define _HAPROXY_SOCK_INET_H
24
25#include <sys/socket.h>
26#include <sys/types.h>
27
28#include <haproxy/api.h>
29
Willy Tarreaud88e8c02020-08-28 16:06:01 +020030extern int sock_inet6_v6only_default;
Willy Tarreaue5bdc512020-08-28 18:03:10 +020031extern int sock_inet_tcp_maxseg_default;
32extern int sock_inet6_tcp_maxseg_default;
Willy Tarreaud88e8c02020-08-28 16:06:01 +020033
Willy Tarreaub0254cb2020-09-04 08:07:11 +020034extern struct proto_fam proto_fam_inet4;
35extern struct proto_fam proto_fam_inet6;
36
Willy Tarreau0d06df62020-08-28 15:10:11 +020037int sock_inet4_addrcmp(const struct sockaddr_storage *a, const struct sockaddr_storage *b);
38int sock_inet6_addrcmp(const struct sockaddr_storage *a, const struct sockaddr_storage *b);
Willy Tarreau73bed9f2020-12-04 14:43:36 +010039void sock_inet_set_port(struct sockaddr_storage *addr, int port);
Willy Tarreauc5a94c92020-08-28 15:19:45 +020040int sock_inet_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir);
Willy Tarreau25140cc2020-08-28 15:40:33 +020041int sock_inet_is_foreign(int fd, sa_family_t family);
Willy Tarreau37bafdc2020-08-28 17:23:40 +020042int sock_inet4_make_foreign(int fd);
43int sock_inet6_make_foreign(int fd);
Willy Tarreau233ad282020-10-15 21:45:15 +020044int sock_inet_bind_receiver(struct receiver *rx, char **errmsg);
Willy Tarreau0d06df62020-08-28 15:10:11 +020045
46#endif /* _HAPROXY_SOCK_INET_H */