vrrpd_impl.h revision 1cb875ae88fb9463b368e725c2444776595895cb
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _VRRPD_IMPL_H
#define _VRRPD_IMPL_H
#include <libinetutil.h>
#include <libvrrpadm.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Internal data structs to store VRRP instance configuration information
* and run-time state information.
*/
typedef useconds_t vrrp_timeout_t;
typedef struct vrrp_vr_s {
char vvr_vnic[MAXLINKNAMELEN];
struct vrrp_intf_s *vvr_pif;
struct vrrp_intf_s *vvr_vif;
/*
* Master: The Advertisement_Interval (Adver_Timer)
* Backup: The Master_Down_Intervel (Master_Down_timer)
*/
/*
* Peer information, got from the last adv message received
*/
/*
* Record the reason why the virtual router stays at the INIT
* state, for the diagnose purpose.
*/
} vrrp_vr_t;
typedef enum {
NODE_STATE_NONE = 0,
NODE_STATE_STALE = 1,
NODE_STATE_NEW = 2
} node_state_t;
/*
* The ifindex is get by the SIOCGLIFINDEX ioctl, easy to make it part of
* vrrp_ip_t instead of vrrp_intf_t
*/
typedef struct vrrp_ip_s {
char vip_lifname[LIFNAMSIZ];
} vrrp_ip_t;
/*
* Used for primary interfaces
*/
typedef struct vrrp_primary_ifinfo {
/* non-zero on the primary if */
/*
* Used for virtual interfaces
*/
typedef struct vrrp_virtual_ifinfo {
/*
* state of the virtual IP addresses
*/
/*
* VRRP interface structure
*
* An interface is either the primary interface which owns the primary IP
* address or a VNIC interface which owns the virtual IP addresses.
* As the primary interface, it can be shared by several VRRP routers.
*/
typedef struct vrrp_intf_s {
char vvi_ifname[LIFNAMSIZ];
int vvi_af; /* address family */
/*
* Socket fd.
* - physical interfaces: used to receive the VRRP packet, and shared
* by all virtual routers on this physical interface.
* - vnic interfaces: used to send the VRRP packet.
*/
int vvi_sockfd;
} vrrp_intf_t;
#define IS_PRIMARY_INTF(intf) \
#define IS_VIRTUAL_INTF(intf) \
#define VRRP_ERR 0 /* error message */
#define VRRP_WARNING 1
#define VRRP_NOTICE 2
#define VRRP_INFO 3
/*
* The primary IP address must be brought up; further, in the case of IPv6,
* the link-local IP address is used as the primary IP address.
*/
#ifdef __cplusplus
}
#endif
#endif /* _VRRPD_IMPL_H */