VRRP Library Functions vrrp_query(3VRRP) NAME vrrp_query - get the properties and status of a VRRP instance SYNOPSIS cc [ flag ... ] file ... -lvrrp [ library ... ] #include vrrp_ret_t vrrp_query(const char *name, vrrp_inst_t *inst, vrrp_status_t *stat, vrrp_adv_info_t *adv); DESCRIPTION The function vrrp_query() is used to get VRRP instance's properties and status. The configuration of the instance with the specified name will be returned in the output parameter inst. The caller should allocate a vrrp_inst_t structure to be passed in. If the required instance does not exist, the function will return VRRP_ENOINST. typedef uint8_t vrrp_state_t; /* VRRP state */ typedef struct vrrp_status { vrrp_state_t vs_cur_state; vrrp_state_t vs_prev_state; struct timeval vs_st_time; /* timestamp of last state trans */ } vrrp_status_t; typedef struct vrrp_adv_info { vrrp_addr_t vai_addr; /* Source IP address of the message */ vrpri_t vai_prio; /* priority in adv message */ struct timeval vai_time; /* timestamp of the adv message */ struct timeval vai_age; /* time since the adv message */ struct timeval vai_intv; /* adv interval in adv message */ /* The following information are not available for MASTER state */ struct timeval vai_skew_time; /* skew time computed for master */ struct timeval vai_down_intv; /* down interval computed for mas*/ struct timeval vai_down_timer; /* down timer computed for master*/ } vrrp_adv_info_t; The output parameter stat and adv are used to return the current status of the instance and information of the last seen advertisement. The caller should allocate a vrrp_status_t structure and a vrrp_adv_info_t structure to be passed in, or pass a NULL to skip returning the status and advertisement information. The returned status includes the current state and previous state and the timestamp when last state transition occurs. The returned vrrp_adv_info_t stores the information of the last advertisement this instance has seen. The returned adv could be set all zero, which indicates that this instance never received any advertisement. Note that an instance in MASTER state could have this last seen advertisement information returned. In that case this last seen advertisement message could be the one received before last time this instance takes over or preempts from BACKUP state. It could also indicate a network error where there is another router sending advertisements using the same VRID, if the timestamp of that advertisement is later than the state_trans_time of this instance. This function doesn't require extra privileges. RETURN VALUES Upon success, VRRP_SUCCESS is returned. If VRRP_ESYS is returned, errno contains the specific UNIX system error value. Otherwise, a VRRP error value defined in or listed in the following section is returned. ERRORS VRRP_ENOINST VRRP instance does not exist ATTRIBUTES See attributes(5) for description of the following attri- butes: ____________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | Interface Stability | Project Private | |_____________________________|_____________________________| | MT-Level | Safe | |_____________________________|_____________________________| SEE ALSO libvrrp(3LIB), vrrpadm(1M), vrrpd(1M)