zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: dc_preproc_item_init                                             *
 *                                                                            *
 * Purpose: initialize new preprocessor item from configuration cache         *
 *                                                                            *
 * Parameters: item   - [OUT] the item to initialize                          *
 *             itemid - [IN] the item identifier                              *
 *                                                                            *
 * Return value: SUCCEED - the item was initialized successfully              *
 *               FAIL    - item with the specified itemid is not cached or    *
 *                         monitored                                          *
 *                                                                            *
 ******************************************************************************/
dc_preproc_item_init

Purpose: initialize new preprocessor item from configuration cache

Parameters: item   - [OUT] the item to initialize
itemid - [IN] the item identifier

Return value: SUCCEED - the item was initialized successfully
FAIL    - item with the specified itemid is not cached or
monitored
dc_preproc_item_init Purpose : initialize new preprocessor item from configuration cache Parameters : item - [ OUT ] the item to initialize itemid - [ IN ] the item identifier Return value : SUCCEED - the item was initialized successfully FAIL - item with the specified itemid is not cached or monitored
static int	dc_preproc_item_init(zbx_preproc_item_t *item, zbx_uint64_t itemid)
{
	const ZBX_DC_ITEM	*dc_item;
	const ZBX_DC_HOST	*dc_host;
	if (NULL == (dc_item = (const ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemid)))
		return FAIL;
	if (ITEM_STATUS_ACTIVE != dc_item->status)
		return FAIL;
	if (NULL == (dc_host = (const ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
		return FAIL;
	if (HOST_STATUS_MONITORED != dc_host->status)
		return FAIL;
	item->itemid = itemid;
	item->type = dc_item->type;
	item->value_type = dc_item->value_type;
	item->dep_itemids = NULL;
	item->dep_itemids_num = 0;
	item->preproc_ops = NULL;
	item->preproc_ops_num = 0;
	item->update_time = 0;
	return SUCCEED;
}
static int dc_preproc_item_init ( zbx_preproc_item_t * item , zbx_uint64_t itemid ) { const ZBX_DC_ITEM * dc_item ; const ZBX_DC_HOST * dc_host ; if ( NULL == ( dc_item = ( const ZBX_DC_ITEM * ) zbx_hashset_search ( & config -> items , & itemid ) ) ) return FAIL ; if ( ITEM_STATUS_ACTIVE != dc_item -> status ) return FAIL ; if ( NULL == ( dc_host = ( const ZBX_DC_HOST * ) zbx_hashset_search ( & config -> hosts , & dc_item -> hostid ) ) ) return FAIL ; if ( HOST_STATUS_MONITORED != dc_host -> status ) return FAIL ; item -> itemid = itemid ; item -> type = dc_item -> type ; item -> value_type = dc_item -> value_type ; item -> dep_itemids = NULL ; item -> dep_itemids_num = 0 ; item -> preproc_ops = NULL ; item -> preproc_ops_num = 0 ; item -> update_time = 0 ; return SUCCEED ; }
Function: dc_preproc_item_init                                             
                                                                            
 Purpose: initialize new preprocessor item from configuration cache         
                                                                            
 Parameters: item   - [OUT] the item to initialize                          
             itemid - [IN] the item identifier                              
                                                                            
 Return value: SUCCEED - the item was initialized successfully              
               FAIL    - item with the specified itemid is not cached or    
                         monitored
Function : dc_preproc_item_init Purpose : initialize new preprocessor item from configuration cache Parameters : item - [ OUT ] the item to initialize itemid - [ IN ] the item identifier Return value : SUCCEED - the item was initialized successfully FAIL - item with the specified itemid is not cached or monitored