zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: DCinterface_set_availability                                     *
 *                                                                            *
 * Purpose: set interface availability data in configuration cache            *
 *                                                                            *
 * Parameters: dc_interface - [OUT] the interface                             *
 *             ia           - [IN/OUT] the interface availability data        *
 *                                                                            *
 * Return value: SUCCEED - at least one availability field was updated        *
 *               FAIL    - no availability fields were updated                *
 *                                                                            *
 * Comments: The configuration cache must be locked already.                  *
 *                                                                            *
 *           This function clears availability flags of non updated fields    *
 *           updated leaving only flags identifying changed fields.           *
 *                                                                            *
 ******************************************************************************/
DCinterface_set_availability

Purpose: set interface availability data in configuration cache

Parameters: dc_interface - [OUT] the interface
ia           - [IN/OUT] the interface availability data

Return value: SUCCEED - at least one availability field was updated
FAIL    - no availability fields were updated

Comments: The configuration cache must be locked already.

This function clears availability flags of non updated fields
updated leaving only flags identifying changed fields.
DCinterface_set_availability Purpose : set interface availability data in configuration cache Parameters : dc_interface - [ OUT ] the interface ia - [ IN / OUT ] the interface availability data Return value : SUCCEED - at least one availability field was updated FAIL - no availability fields were updated Comments : The configuration cache must be locked already . This function clears availability flags of non updated fields updated leaving only flags identifying changed fields .
static int	DCinterface_set_availability(ZBX_DC_INTERFACE *dc_interface, int now, zbx_interface_availability_t *ia)
{
	unsigned char	flags = ZBX_FLAGS_AGENT_STATUS_NONE;
	DCagent_set_availability(&ia->agent, &dc_interface->available, &dc_interface->error,
			&dc_interface->errors_from, &dc_interface->disable_until);
	flags |= ia->agent.flags;
	if (ZBX_FLAGS_AGENT_STATUS_NONE == flags)
		return FAIL;
	if (0 != (flags & (ZBX_FLAGS_AGENT_STATUS_AVAILABLE | ZBX_FLAGS_AGENT_STATUS_ERROR)))
		dc_interface->availability_ts = now;
	return SUCCEED;
}
static int DCinterface_set_availability ( ZBX_DC_INTERFACE * dc_interface , int now , zbx_interface_availability_t * ia ) { unsigned char flags = ZBX_FLAGS_AGENT_STATUS_NONE ; DCagent_set_availability ( & ia -> agent , & dc_interface -> available , & dc_interface -> error , & dc_interface -> errors_from , & dc_interface -> disable_until ) ; flags |= ia -> agent . flags ; if ( ZBX_FLAGS_AGENT_STATUS_NONE == flags ) return FAIL ; if ( 0 != ( flags & ( ZBX_FLAGS_AGENT_STATUS_AVAILABLE | ZBX_FLAGS_AGENT_STATUS_ERROR ) ) ) dc_interface -> availability_ts = now ; return SUCCEED ; }
Function: DCinterface_set_availability                                     
                                                                            
 Purpose: set interface availability data in configuration cache            
                                                                            
 Parameters: dc_interface - [OUT] the interface                             
             ia           - [IN/OUT] the interface availability data        
                                                                            
 Return value: SUCCEED - at least one availability field was updated        
               FAIL    - no availability fields were updated                
                                                                            
 Comments: The configuration cache must be locked already.
Function : DCinterface_set_availability Purpose : set interface availability data in configuration cache Parameters : dc_interface - [ OUT ] the interface ia - [ IN / OUT ] the interface availability data Return value : SUCCEED - at least one availability field was updated FAIL - no availability fields were updated Comments : The configuration cache must be locked already .