summaryrefslogtreecommitdiffstats
path: root/include/haproxy/namespace.h
blob: 2d6b6f8156acfc7f8754e7723ebef178d868e934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * include/haproxy/namespace.h
 * Linux network namespaces management
 *
 * Copyright (C) 2014 Tamas Kovacs, Sarkozi Laszlo, Krisztian Kovacs
 * Copyright (C) 2015-2020 Willy Tarreau
 *
 * 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_NAMESPACE_H
#define _HAPROXY_NAMESPACE_H

#include <sys/types.h>
#include <sys/socket.h>
#include <import/ebistree.h>
#include <haproxy/namespace-t.h>

#ifdef USE_NS

int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol);
struct netns_entry* netns_store_insert(const char *ns_name);
const struct netns_entry* netns_store_lookup(const char *ns_name, size_t ns_name_len);
int netns_init(void);

#else /* no namespace support */

static inline int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol)
{
	return socket(domain, type, protocol);
}

#endif /* USE_NS */

#endif /* _HAPROXY_NAMESPACE_H */