Revision b5a2055f src/charon/plugins/nm/nm_handler.c
| b/src/charon/plugins/nm/nm_handler.c | ||
|---|---|---|
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
/** |
| 71 |
* Implementation of create_attribute_enumerator().enumerate() for WINS |
|
| 72 |
*/ |
|
| 73 |
static bool enumerate_nbns(enumerator_t *this, |
|
| 74 |
configuration_attribute_type_t *type, chunk_t *data) |
|
| 75 |
{
|
|
| 76 |
*type = INTERNAL_IP4_NBNS; |
|
| 77 |
*data = chunk_empty; |
|
| 78 |
/* done */ |
|
| 79 |
this->enumerate = (void*)return_false; |
|
| 80 |
return TRUE; |
|
| 81 |
} |
|
| 82 |
|
|
| 83 |
/** |
|
| 84 |
* Implementation of create_attribute_enumerator().enumerate() for DNS |
|
| 85 |
*/ |
|
| 86 |
static bool enumerate_dns(enumerator_t *this, |
|
| 87 |
configuration_attribute_type_t *type, chunk_t *data) |
|
| 88 |
{
|
|
| 89 |
*type = INTERNAL_IP4_DNS; |
|
| 90 |
*data = chunk_empty; |
|
| 91 |
/* enumerate WINS server as next attribute ... */ |
|
| 92 |
this->enumerate = (void*)enumerate_nbns; |
|
| 93 |
return TRUE; |
|
| 94 |
} |
|
| 95 |
|
|
| 96 |
/** |
|
| 97 |
* Implementation of attribute_handler_t.create_attribute_enumerator |
|
| 98 |
*/ |
|
| 99 |
static enumerator_t* create_attribute_enumerator(private_nm_handler_t *this, |
|
| 100 |
identification_t *server, host_t *vip) |
|
| 101 |
{
|
|
| 102 |
if (vip && vip->get_family(vip) == AF_INET) |
|
| 103 |
{ /* no IPv6 attributes yet */
|
|
| 104 |
enumerator_t *enumerator = malloc_thing(enumerator_t); |
|
| 105 |
/* enumerate DNS attribute first ... */ |
|
| 106 |
enumerator->enumerate = (void*)enumerate_dns; |
|
| 107 |
enumerator->destroy = (void*)free; |
|
| 108 |
|
|
| 109 |
return enumerator; |
|
| 110 |
} |
|
| 111 |
return enumerator_create_empty(); |
|
| 112 |
} |
|
| 113 |
|
|
| 114 |
/** |
|
| 71 | 115 |
* convert plain byte ptrs to handy chunk during enumeration |
| 72 | 116 |
*/ |
| 73 | 117 |
static bool filter_chunks(void* null, char **in, chunk_t *out) |
| ... | ... | |
| 136 | 180 |
|
| 137 | 181 |
this->public.handler.handle = (bool(*)(attribute_handler_t*, identification_t*, configuration_attribute_type_t, chunk_t))handle; |
| 138 | 182 |
this->public.handler.release = (void(*)(attribute_handler_t*, identification_t*, configuration_attribute_type_t, chunk_t))nop; |
| 183 |
this->public.handler.create_attribute_enumerator = (enumerator_t*(*)(attribute_handler_t*, identification_t *server, host_t *vip))create_attribute_enumerator; |
|
| 139 | 184 |
this->public.create_enumerator = (enumerator_t*(*)(nm_handler_t*, configuration_attribute_type_t type))create_enumerator; |
| 140 | 185 |
this->public.reset = (void(*)(nm_handler_t*))reset; |
| 141 | 186 |
this->public.destroy = (void(*)(nm_handler_t*))destroy; |
Also available in: Unified diff