]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
4298d0b5 LP |
2 | #pragma once |
3 | ||
dccca82b LP |
4 | #include <sys/socket.h> |
5 | ||
202b76ae ZJS |
6 | #include "string-util.h" |
7 | ||
bfd5a068 | 8 | const char* af_to_name(int id); |
4298d0b5 LP |
9 | int af_from_name(const char *name); |
10 | ||
202b76ae ZJS |
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 | ||
23118193 LP |
25 | const char* af_to_ipv4_ipv6(int id); |
26 | int af_from_ipv4_ipv6(const char *af); | |
27 | ||
4298d0b5 | 28 | int af_max(void); |