chiark / gitweb /
nss-myhostname: move local address listing logic into shared, so that we can make...
[elogind.git] / src / shared / socket-util.h
index 25c4a7e4f96a05e996c921e6af167fd7ec08610a..8d521ae1a0e85d0e41b1ca3924b8af7d8709e30e 100644 (file)
@@ -118,3 +118,8 @@ int in_addr_prefix_intersect(unsigned family, const union in_addr_union *a, unsi
 int in_addr_prefix_next(unsigned family, union in_addr_union *u, unsigned prefixlen);
 int in_addr_to_string(unsigned family, const union in_addr_union *u, char **ret);
 int in_addr_from_string(unsigned family, const char *s, union in_addr_union *ret);
+
+static inline size_t PROTO_ADDRESS_SIZE(int proto) {
+        assert(proto == AF_INET || proto == AF_INET6);
+        return proto == AF_INET6 ? 16 : 4;
+}