blob: 7aacff968170e38bab1d1e66f818b685a37649e8 [file] [log] [blame]
Willy Tarreau1b905112015-04-07 21:00:08 +02001#ifndef _NAMESPACE_H
2#define _NAMESPACE_H
KOVACS Krisztianb3e54fe2014-11-17 15:11:45 +01003
4#include <stdlib.h>
5#include <ebistree.h>
6
KOVACS Krisztianb3e54fe2014-11-17 15:11:45 +01007#ifdef CONFIG_HAP_NS
8
9struct netns_entry
10{
11 struct ebpt_node node;
12 size_t name_len;
13 int fd;
14};
15
Willy Tarreau7520e4f2018-11-11 14:38:09 +010016int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol);
KOVACS Krisztianb3e54fe2014-11-17 15:11:45 +010017struct netns_entry* netns_store_insert(const char *ns_name);
18const struct netns_entry* netns_store_lookup(const char *ns_name, size_t ns_name_len);
19
20int netns_init(void);
Willy Tarreau7520e4f2018-11-11 14:38:09 +010021
22#else /* no namespace support */
23
24struct netns_entry;
25
26static inline int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol)
27{
28 return socket(domain, type, protocol);
29}
30
KOVACS Krisztianb3e54fe2014-11-17 15:11:45 +010031#endif /* CONFIG_HAP_NS */
32
Willy Tarreau1b905112015-04-07 21:00:08 +020033#endif /* _NAMESPACE_H */