GInetSocketAddress: add IPv6 flowinfo and scope_id fields

struct sin6_addr has two additional fields that struct sin_addr
doesn't. Add support for those to GInetSocketAddress, and make sure
they don't get lost when converting between glib and native types.

https://bugzilla.gnome.org/show_bug.cgi?id=635554
This commit is contained in:
Dan Winship
2011-12-29 09:42:25 -05:00
parent c71fc7477e
commit bf7408c30b
6 changed files with 162 additions and 10 deletions

View File

@@ -256,7 +256,12 @@ g_socket_address_new_from_native (gpointer native,
iaddr = g_inet_address_new_from_bytes ((guint8 *) &(addr->sin6_addr), AF_INET6);
}
sockaddr = g_inet_socket_address_new (iaddr, g_ntohs (addr->sin6_port));
sockaddr = g_object_new (G_TYPE_INET_SOCKET_ADDRESS,
"address", iaddr,
"port", g_ntohs (addr->sin6_port),
"flowinfo", g_ntohl (addr->sin6_flowinfo),
"scope_id", g_ntohl (addr->sin6_scope_id),
NULL);
g_object_unref (iaddr);
return sockaddr;
}