net: Socket implementations report the address families they support

This commit is contained in:
Tobias Brunner
2013-07-05 09:48:01 +02:00
parent ef13480699
commit eafd7ee7e1
5 changed files with 91 additions and 11 deletions
+14
View File
@@ -102,6 +102,19 @@ METHOD(socket_manager_t, get_port, u_int16_t,
return port;
}
METHOD(socket_manager_t, supported_families, socket_family_t,
private_socket_manager_t *this)
{
socket_family_t families = SOCKET_FAMILY_NONE;
this->lock->read_lock(this->lock);
if (this->socket)
{
families = this->socket->supported_families(this->socket);
}
this->lock->unlock(this->lock);
return families;
}
static void create_socket(private_socket_manager_t *this)
{
socket_constructor_t create;
@@ -167,6 +180,7 @@ socket_manager_t *socket_manager_create()
.send = _sender,
.receive = _receiver,
.get_port = _get_port,
.supported_families = _supported_families,
.add_socket = _add_socket,
.remove_socket = _remove_socket,
.destroy = _destroy,