Migrate remaining traffic selector methods to METHOD macro
This commit is contained in:
@@ -174,7 +174,8 @@ static u_int8_t calc_netbits(private_traffic_selector_t *this)
|
|||||||
/**
|
/**
|
||||||
* internal generic constructor
|
* internal generic constructor
|
||||||
*/
|
*/
|
||||||
static private_traffic_selector_t *traffic_selector_create(u_int8_t protocol, ts_type_t type, u_int16_t from_port, u_int16_t to_port);
|
static private_traffic_selector_t *traffic_selector_create(u_int8_t protocol,
|
||||||
|
ts_type_t type, u_int16_t from_port, u_int16_t to_port);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Described in header.
|
* Described in header.
|
||||||
@@ -305,11 +306,12 @@ int traffic_selector_printf_hook(printf_hook_data_t *data,
|
|||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(traffic_selector_t, get_subset, traffic_selector_t*,
|
||||||
* Implements traffic_selector_t.get_subset
|
private_traffic_selector_t *this, traffic_selector_t *other_public)
|
||||||
*/
|
|
||||||
static traffic_selector_t *get_subset(private_traffic_selector_t *this, private_traffic_selector_t *other)
|
|
||||||
{
|
{
|
||||||
|
private_traffic_selector_t *other;
|
||||||
|
|
||||||
|
other = (private_traffic_selector_t*)other_public;
|
||||||
if (this->dynamic || other->dynamic)
|
if (this->dynamic || other->dynamic)
|
||||||
{ /* no set_address() applied, TS has no subset */
|
{ /* no set_address() applied, TS has no subset */
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -379,11 +381,12 @@ static traffic_selector_t *get_subset(private_traffic_selector_t *this, private_
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(traffic_selector_t, equals, bool,
|
||||||
* Implements traffic_selector_t.equals
|
private_traffic_selector_t *this, traffic_selector_t *other_public)
|
||||||
*/
|
|
||||||
static bool equals(private_traffic_selector_t *this, private_traffic_selector_t *other)
|
|
||||||
{
|
{
|
||||||
|
private_traffic_selector_t *other;
|
||||||
|
|
||||||
|
other = (private_traffic_selector_t*)other_public;
|
||||||
if (this->type != other->type)
|
if (this->type != other->type)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -535,11 +538,8 @@ METHOD(traffic_selector_t, set_address, void,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(traffic_selector_t, is_contained_in, bool,
|
||||||
* Implements traffic_selector_t.is_contained_in.
|
private_traffic_selector_t *this, traffic_selector_t *other)
|
||||||
*/
|
|
||||||
static bool is_contained_in(private_traffic_selector_t *this,
|
|
||||||
private_traffic_selector_t *other)
|
|
||||||
{
|
{
|
||||||
private_traffic_selector_t *subset;
|
private_traffic_selector_t *subset;
|
||||||
bool contained_in = FALSE;
|
bool contained_in = FALSE;
|
||||||
@@ -548,7 +548,7 @@ static bool is_contained_in(private_traffic_selector_t *this,
|
|||||||
|
|
||||||
if (subset)
|
if (subset)
|
||||||
{
|
{
|
||||||
if (equals(subset, this))
|
if (equals(subset, &this->public))
|
||||||
{
|
{
|
||||||
contained_in = TRUE;
|
contained_in = TRUE;
|
||||||
}
|
}
|
||||||
@@ -859,8 +859,8 @@ static private_traffic_selector_t *traffic_selector_create(u_int8_t protocol,
|
|||||||
|
|
||||||
INIT(this,
|
INIT(this,
|
||||||
.public = {
|
.public = {
|
||||||
.get_subset = (traffic_selector_t*(*)(traffic_selector_t*,traffic_selector_t*))get_subset,
|
.get_subset = _get_subset,
|
||||||
.equals = (bool(*)(traffic_selector_t*,traffic_selector_t*))equals,
|
.equals = _equals,
|
||||||
.get_from_address = _get_from_address,
|
.get_from_address = _get_from_address,
|
||||||
.get_to_address = _get_to_address,
|
.get_to_address = _get_to_address,
|
||||||
.get_from_port = _get_from_port,
|
.get_from_port = _get_from_port,
|
||||||
@@ -869,7 +869,7 @@ static private_traffic_selector_t *traffic_selector_create(u_int8_t protocol,
|
|||||||
.get_protocol = _get_protocol,
|
.get_protocol = _get_protocol,
|
||||||
.is_host = _is_host,
|
.is_host = _is_host,
|
||||||
.is_dynamic = _is_dynamic,
|
.is_dynamic = _is_dynamic,
|
||||||
.is_contained_in = (bool(*)(traffic_selector_t*,traffic_selector_t*))is_contained_in,
|
.is_contained_in = _is_contained_in,
|
||||||
.includes = _includes,
|
.includes = _includes,
|
||||||
.set_address = _set_address,
|
.set_address = _set_address,
|
||||||
.to_subnet = _to_subnet,
|
.to_subnet = _to_subnet,
|
||||||
@@ -884,4 +884,3 @@ static private_traffic_selector_t *traffic_selector_create(u_int8_t protocol,
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user