zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: dc_get_hostids_by_functionids                                    *
 *                                                                            *
 * Purpose: get host identifiers for the specified list of functions          *
 *                                                                            *
 * Parameters: functionids     - [IN] the function ids                        *
 *             functionids_num - [IN] the number of function ids              *
 *             hostids         - [OUT] the host ids                           *
 *                                                                            *
 * Comments: this function must be used only by configuration syncer          *
 *                                                                            *
 ******************************************************************************/
dc_get_hostids_by_functionids

Purpose: get host identifiers for the specified list of functions

Parameters: functionids     - [IN] the function ids
functionids_num - [IN] the number of function ids
hostids         - [OUT] the host ids

Comments: this function must be used only by configuration syncer
dc_get_hostids_by_functionids Purpose : get host identifiers for the specified list of functions Parameters : functionids - [ IN ] the function ids functionids_num - [ IN ] the number of function ids hostids - [ OUT ] the host ids Comments : this function must be used only by configuration syncer
void	dc_get_hostids_by_functionids(const zbx_uint64_t *functionids, int functionids_num,
		zbx_vector_uint64_t *hostids)
{
	const ZBX_DC_FUNCTION	*function;
	const ZBX_DC_ITEM	*item;
	int			i;
	for (i = 0; i < functionids_num; i++)
	{
		if (NULL == (function = (const ZBX_DC_FUNCTION *)zbx_hashset_search(&config->functions, &functionids[i])))
				continue;
		if (NULL != (item = (const ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &function->itemid)))
			zbx_vector_uint64_append(hostids, item->hostid);
	}
	zbx_vector_uint64_sort(hostids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
	zbx_vector_uint64_uniq(hostids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
}
void dc_get_hostids_by_functionids ( const zbx_uint64_t * functionids , int functionids_num , zbx_vector_uint64_t * hostids ) { const ZBX_DC_FUNCTION * function ; const ZBX_DC_ITEM * item ; int i ; for ( i = 0 ; i < functionids_num ; i ++ ) { if ( NULL == ( function = ( const ZBX_DC_FUNCTION * ) zbx_hashset_search ( & config -> functions , & functionids [ i ] ) ) ) continue ; if ( NULL != ( item = ( const ZBX_DC_ITEM * ) zbx_hashset_search ( & config -> items , & function -> itemid ) ) ) zbx_vector_uint64_append ( hostids , item -> hostid ) ; } zbx_vector_uint64_sort ( hostids , ZBX_DEFAULT_UINT64_COMPARE_FUNC ) ; zbx_vector_uint64_uniq ( hostids , ZBX_DEFAULT_UINT64_COMPARE_FUNC ) ; }
Function: dc_get_hostids_by_functionids                                    
                                                                            
 Purpose: get host identifiers for the specified list of functions          
                                                                            
 Parameters: functionids     - [IN] the function ids                        
             functionids_num - [IN] the number of function ids              
             hostids         - [OUT] the host ids                           
                                                                            
 Comments: this function must be used only by configuration syncer
Function : dc_get_hostids_by_functionids Purpose : get host identifiers for the specified list of functions Parameters : functionids - [ IN ] the function ids functionids_num - [ IN ] the number of function ids hostids - [ OUT ] the host ids Comments : this function must be used only by configuration syncer