Migrated bridge_t to INIT/METHOD macros.
This commit is contained in:
+19
-26
@@ -37,26 +37,20 @@ struct private_bridge_t {
|
|||||||
*/
|
*/
|
||||||
bool iface_control(char *name, bool up);
|
bool iface_control(char *name, bool up);
|
||||||
|
|
||||||
/**
|
METHOD(bridge_t, get_name, char*,
|
||||||
* Implementation of bridge_t.get_name.
|
private_bridge_t *this)
|
||||||
*/
|
|
||||||
static char* get_name(private_bridge_t *this)
|
|
||||||
{
|
{
|
||||||
return this->name;
|
return this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(bridge_t, create_iface_enumerator, enumerator_t*,
|
||||||
* Implementation of bridge_t.create_iface_enumerator.
|
private_bridge_t *this)
|
||||||
*/
|
|
||||||
static enumerator_t* create_iface_enumerator(private_bridge_t *this)
|
|
||||||
{
|
{
|
||||||
return this->ifaces->create_enumerator(this->ifaces);
|
return this->ifaces->create_enumerator(this->ifaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(bridge_t, disconnect_iface, bool,
|
||||||
* Implementation of bridge_t.disconnect_iface.
|
private_bridge_t *this, iface_t *iface)
|
||||||
*/
|
|
||||||
static bool disconnect_iface(private_bridge_t *this, iface_t *iface)
|
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
iface_t *current = NULL;
|
iface_t *current = NULL;
|
||||||
@@ -90,10 +84,8 @@ static bool disconnect_iface(private_bridge_t *this, iface_t *iface)
|
|||||||
return good;
|
return good;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(bridge_t, connect_iface, bool,
|
||||||
* Implementation of bridge_t.connect_iface.
|
private_bridge_t *this, iface_t *iface)
|
||||||
*/
|
|
||||||
static bool connect_iface(private_bridge_t *this, iface_t *iface)
|
|
||||||
{
|
{
|
||||||
if (br_add_interface(this->name, iface->get_hostif(iface)) != 0)
|
if (br_add_interface(this->name, iface->get_hostif(iface)) != 0)
|
||||||
{
|
{
|
||||||
@@ -111,10 +103,8 @@ static bool connect_iface(private_bridge_t *this, iface_t *iface)
|
|||||||
*/
|
*/
|
||||||
static int instances = 0;
|
static int instances = 0;
|
||||||
|
|
||||||
/**
|
METHOD(bridge_t, destroy, void,
|
||||||
* Implementation of bridge_t.destroy.
|
private_bridge_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_bridge_t *this)
|
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
iface_t *iface;
|
iface_t *iface;
|
||||||
@@ -161,12 +151,15 @@ bridge_t *bridge_create(char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this = malloc_thing(private_bridge_t);
|
INIT(this,
|
||||||
this->public.get_name = (char*(*)(bridge_t*))get_name;
|
.public = {
|
||||||
this->public.create_iface_enumerator = (enumerator_t*(*)(bridge_t*))create_iface_enumerator;
|
.get_name = _get_name,
|
||||||
this->public.disconnect_iface = (bool(*)(bridge_t*, iface_t *iface))disconnect_iface;
|
.create_iface_enumerator = _create_iface_enumerator,
|
||||||
this->public.connect_iface = (bool(*)(bridge_t*, iface_t *iface))connect_iface;
|
.disconnect_iface = _disconnect_iface,
|
||||||
this->public.destroy = (void*)destroy;
|
.connect_iface = _connect_iface,
|
||||||
|
.destroy = _destroy,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (br_add_bridge(name) != 0)
|
if (br_add_bridge(name) != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user