sw_result
sw_text_record_iterator_init
(
sw_text_record_iterator * iterator)
sw_result
my_resolve_func(
sw_discovery_resolve_handler handler,
sw_discovery discovery,
sw_discovery_resolve_id id,
sw_const_string name,
sw_const_string type,
sw_const_string domain,
sw_ipv4_address address,
sw_port port,
sw_const_string text_record_string,
sw_octets text_record,
sw_ulong text_record_len,
sw_opaque extra)
{
sw_text_record_iterator it;
if (sw_text_record_iterator_init(&it, text_record, text_record_len) != SW_OKAY)
{
fprintf(stderr, "init failed\n");
return SW_E_FAIL;
}
...
}
sw_text_record_iterator_fina
sw_result
sw_text_record_iterator_fina
(
sw_text_record_iterator iterator)
sw_result
my_resolve_func(
sw_discovery_resolve_handler handler,
sw_discovery discovery,
sw_discovery_resolve_id id,
sw_const_string name,
sw_const_string type,
sw_const_string domain,
sw_ipv4_address address,
sw_port port,
sw_const_string text_record_string,
sw_octets text_record,
sw_ulong text_record_len,
sw_opaque extra)
{
sw_text_record_iterator it;
if (sw_text_record_iterator_init(&it, text_record, text_record_len) != SW_OKAY)
{
fprintf(stderr, "init failed\n");
return SW_E_FAIL;
}
...
sw_text_record_iterator_fina(it);
...
}
sw_text_record_iterator_init
sw_result
sw_text_record_iterator_next
(
sw_text_record_iterator iterator,
sw_char key[255],
sw_octet val[255],
sw_ulong * val_len)
sw_result
my_resolve_func(
sw_discovery_resolve_handler handler,
sw_discovery discovery,
sw_discovery_resolve_id id,
sw_const_string name,
sw_const_string type,
sw_const_string domain,
sw_ipv4_address address,
sw_port port,
sw_const_string text_record_string,
sw_octets text_record,
sw_ulong text_record_len,
sw_opaque extra)
{
sw_text_record_iterator it;
sw_char key[255];
sw_octet val[255];
sw_ulong val_len;
if (sw_text_record_iterator_init(&it, text_record, text_record_len) !=- SW_OKAY)
{
fprintf(stderr, "init failed\n");
return SW_E_FAIL;
}
while (sw_text_record_iterator_next(it, key, val, &val_len) == SW_OKAY)
{
...
}
sw_text_record_iterator_fina(it);
...
}
sw_text_record_iterator_init
, sw_text_record_iterator_fina