blob: 41931ff6d3d935f6bd7fbce067f52d141e921da0 [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
Willy Tarreaue5733232019-05-22 19:24:06 +02007#ifdef USE_NS
KOVACS Krisztianb3e54fe2014-11-17 15:11:45 +01008
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
Willy Tarreaue5733232019-05-22 19:24:06 +020031#endif /* USE_NS */
KOVACS Krisztianb3e54fe2014-11-17 15:11:45 +010032
Willy Tarreau1b905112015-04-07 21:00:08 +020033#endif /* _NAMESPACE_H */