]>
Commit | Line | Data |
---|---|---|
a032b68d | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
663996b3 MS |
2 | #pragma once |
3 | ||
1d42b86d MB |
4 | #include <sys/socket.h> |
5 | ||
aa27b158 MP |
6 | #include "string-util.h" |
7 | ||
60f067b4 JS |
8 | const char *af_to_name(int id); |
9 | int af_from_name(const char *name); | |
663996b3 | 10 | |
aa27b158 MP |
11 | static inline const char* af_to_name_short(int id) { |
12 | const char *f; | |
13 | ||
14 | if (id == AF_UNSPEC) | |
15 | return "*"; | |
16 | ||
17 | f = af_to_name(id); | |
18 | if (!f) | |
19 | return "unknown"; | |
20 | ||
21 | assert(startswith(f, "AF_")); | |
22 | return f + 3; | |
23 | } | |
24 | ||
8b3d4ff0 MB |
25 | const char* af_to_ipv4_ipv6(int id); |
26 | int af_from_ipv4_ipv6(const char *af); | |
27 | ||
60f067b4 | 28 | int af_max(void); |