aboutsummaryrefslogtreecommitdiff
path: root/slirp/socket.h
diff options
context:
space:
mode:
Diffstat (limited to 'slirp/socket.h')
-rw-r--r--slirp/socket.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/slirp/socket.h b/slirp/socket.h
index 7dca506973..b602e69b95 100644
--- a/slirp/socket.h
+++ b/slirp/socket.h
@@ -122,6 +122,18 @@ static inline int sockaddr_equal(struct sockaddr_storage *a,
return 0;
}
+static inline socklen_t sockaddr_size(struct sockaddr_storage *a)
+{
+ switch (a->ss_family) {
+ case AF_INET:
+ return sizeof(struct sockaddr_in);
+ case AF_INET6:
+ return sizeof(struct sockaddr_in6);
+ default:
+ g_assert_not_reached();
+ }
+}
+
struct socket *solookup(struct socket **, struct socket *,
struct sockaddr_storage *, struct sockaddr_storage *);
struct socket *socreate(Slirp *);