zbx_discoverer_job_t *discoverer_job_create(zbx_dc_drule_t *drule, zbx_vector_ds_dcheck_ptr_t *ds_dchecks_common,
#include "discoverer_job.h"
#include "discoverer_queue.h"
#include "discoverer_int.h"
#include "zbx_discoverer_constants.h"
ZBX_VECTOR_IMPL(iprange, zbx_iprange_t)
int discoverer_range_check_iter(zbx_discoverer_task_t *task)
zbx_ds_dcheck_t *dcheck = task->ds_dchecks.values[task->range.state.index_dcheck];
if (0 == task->range.state.count)
ret = zbx_portrange_uniq_iter(dcheck->portranges.values, dcheck->portranges.values_num,
&task->range.state.index_port, &task->range.state.port);
task->range.state.count--;
return 0 == task->range.state.count ? FAIL : SUCCEED;
task->range.state.port = ZBX_PORTRANGE_INIT_PORT;
if (++(task->range.state.index_dcheck) < task->ds_dchecks.values_num)
return discoverer_range_check_iter(task);
task->range.state.index_dcheck = 0;
if (SUCCEED == zbx_iprange_uniq_iter(task->range.ipranges->values,
task->range.ipranges->values_num, &task->range.state.index_ip,
task->range.state.ipaddress))
return discoverer_range_check_iter(task);
task->range.state.count--;
#include "zbxdiscovery.h"
zbx_hash_t discoverer_task_hash(const void *data)
const zbx_discoverer_task_t *task = (const zbx_discoverer_task_t *)data;
hash = ZBX_DEFAULT_UINT64_HASH_FUNC(&task->range.id);
hash = ZBX_DEFAULT_STRING_HASH_ALGO(&task->ds_dchecks.values[0]->dcheck.type,
sizeof(task->ds_dchecks.values[0]->dcheck.type), hash);
int discoverer_task_compare(const void *d1, const void *d2)
const zbx_discoverer_task_t *task1 = (const zbx_discoverer_task_t *)d1;
const zbx_discoverer_task_t *task2 = (const zbx_discoverer_task_t *)d2;
ZBX_RETURN_IF_NOT_EQUAL(task1->range.id, task2->range.id);
ZBX_RETURN_IF_NOT_EQUAL(GET_DTYPE(task1), GET_DTYPE(task2));
void discoverer_task_clear(zbx_discoverer_task_t *task)
zbx_vector_ds_dcheck_ptr_destroy(&task->ds_dchecks);
void discoverer_task_free(zbx_discoverer_task_t *task)