Migrated nm_handler_t to INIT/METHOD macros.

This commit is contained in:
Tobias Brunner
2011-10-03 19:13:13 +02:00
parent 673ce4da9b
commit 72f5310087
+26 -33
View File
@@ -40,11 +40,9 @@ struct private_nm_handler_t {
linked_list_t *nbns; linked_list_t *nbns;
}; };
/** METHOD(attribute_handler_t, handle, bool,
* Implementation of attribute_handler_t.handle private_nm_handler_t *this, identification_t *server,
*/ configuration_attribute_type_t type, chunk_t data)
static bool handle(private_nm_handler_t *this, identification_t *server,
configuration_attribute_type_t type, chunk_t data)
{ {
linked_list_t *list; linked_list_t *list;
@@ -93,11 +91,8 @@ static bool enumerate_dns(enumerator_t *this,
return TRUE; return TRUE;
} }
/** METHOD(attribute_handler_t, create_attribute_enumerator, enumerator_t*,
* Implementation of attribute_handler_t.create_attribute_enumerator private_nm_handler_t *this, identification_t *server, host_t *vip)
*/
static enumerator_t* create_attribute_enumerator(private_nm_handler_t *this,
identification_t *server, host_t *vip)
{ {
if (vip && vip->get_family(vip) == AF_INET) if (vip && vip->get_family(vip) == AF_INET)
{ /* no IPv6 attributes yet */ { /* no IPv6 attributes yet */
@@ -120,11 +115,8 @@ static bool filter_chunks(void* null, char **in, chunk_t *out)
return TRUE; return TRUE;
} }
/** METHOD(nm_handler_t, create_enumerator, enumerator_t*,
* Implementation of nm_handler_t.create_enumerator private_nm_handler_t *this, configuration_attribute_type_t type)
*/
static enumerator_t* create_enumerator(private_nm_handler_t *this,
configuration_attribute_type_t type)
{ {
linked_list_t *list; linked_list_t *list;
@@ -143,10 +135,8 @@ static enumerator_t* create_enumerator(private_nm_handler_t *this,
(void*)filter_chunks, NULL, NULL); (void*)filter_chunks, NULL, NULL);
} }
/** METHOD(nm_handler_t, reset, void,
* Implementation of nm_handler_t.reset private_nm_handler_t *this)
*/
static void reset(private_nm_handler_t *this)
{ {
void *data; void *data;
@@ -160,10 +150,8 @@ static void reset(private_nm_handler_t *this)
} }
} }
/** METHOD(nm_handler_t, destroy, void,
* Implementation of nm_handler_t.destroy. private_nm_handler_t *this)
*/
static void destroy(private_nm_handler_t *this)
{ {
reset(this); reset(this);
this->dns->destroy(this->dns); this->dns->destroy(this->dns);
@@ -176,17 +164,22 @@ static void destroy(private_nm_handler_t *this)
*/ */
nm_handler_t *nm_handler_create() nm_handler_t *nm_handler_create()
{ {
private_nm_handler_t *this = malloc_thing(private_nm_handler_t); private_nm_handler_t *this;
this->public.handler.handle = (bool(*)(attribute_handler_t*, identification_t*, configuration_attribute_type_t, chunk_t))handle; INIT(this,
this->public.handler.release = (void(*)(attribute_handler_t*, identification_t*, configuration_attribute_type_t, chunk_t))nop; .public = {
this->public.handler.create_attribute_enumerator = (enumerator_t*(*)(attribute_handler_t*, identification_t *server, host_t *vip))create_attribute_enumerator; .handler = {
this->public.create_enumerator = (enumerator_t*(*)(nm_handler_t*, configuration_attribute_type_t type))create_enumerator; .handle = _handle,
this->public.reset = (void(*)(nm_handler_t*))reset; .release = nop,
this->public.destroy = (void(*)(nm_handler_t*))destroy; .create_attribute_enumerator = _create_attribute_enumerator,
},
this->dns = linked_list_create(); .create_enumerator = _create_enumerator,
this->nbns = linked_list_create(); .reset = _reset,
.destroy = _destroy,
},
.dns = linked_list_create(),
.nbns = linked_list_create(),
);
return &this->public; return &this->public;
} }