xref: /titanic_51/usr/src/lib/libvrrpadm/common/netinet/vrrp.h (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_VRRP_H
28 #define	_VRRP_H
29 
30 #include <stdint.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct vrrp_pkt_s {
37 	uint8_t		vp_vers_type;
38 	uint8_t		vp_vrid;
39 	uint8_t		vp_prio;
40 	uint8_t		vp_ipnum;
41 	uint16_t	vp_rsvd_adver_int;
42 	uint16_t	vp_chksum;
43 	/* then follows <vp_ipnum> IPvX addresses */
44 	/* then follows NO authentification data */
45 } vrrp_pkt_t;
46 
47 #define	IPPROTO_VRRP		112	/* IP protocol number */
48 #define	VRRP_AUTH_LEN		0	/* XXX length of a chunk of Auth Data */
49 
50 #define	VRRP_IP_TTL		255	/* IPv4 TTL, IPv6 hop limit */
51 #define	VRRP_VERSION		3	/* current version */
52 #define	VRRP_PKT_ADVERT		1	/* packet type */
53 #define	VRRP_VER_MASK		0xf0	/* version mask */
54 #define	VRRP_TYPE_MASK		0x0f	/* packet type mask */
55 
56 #define	VRRP_PRI_OWNER		255	/* priority of IP address owner */
57 #define	VRRP_PRI_MIN		1	/* minimum priority */
58 #define	VRRP_PRIO_ZERO		0	/* stop participating VRRP */
59 #define	VRRP_PRI_DEFAULT	VRRP_PRI_OWNER	/* default priority */
60 
61 #define	VRRP_VRID_NONE		0
62 #define	VRRP_VRID_MIN		1
63 #define	VRRP_VRID_MAX		255
64 
65 #define	CENTISEC2MSEC(centisec)	((centisec) * 10)
66 #define	MSEC2CENTISEC(msec)	((msec) / 10)
67 
68 /* Max advertisement interval, in msec */
69 #define	VRRP_MAX_ADVER_INT_MIN	CENTISEC2MSEC(1)
70 #define	VRRP_MAX_ADVER_INT_MAX	CENTISEC2MSEC(4095)	/* (2^12 -1) */
71 #define	VRRP_MAX_ADVER_INT_DFLT	CENTISEC2MSEC(100)	/* 1 sec */
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif	/* _VRRP_H */
78