xref: /titanic_44/usr/src/head/ndpd.h (revision 49b225e1cfa7bbf7738d4df0a03f18e3283426eb)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_NDPD_H
27 #define	_NDPD_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #define	NDPD_SNMP_SOCKET	"/var/run/in.ndpd_mib"
36 #define	NDPD_SNMP_INFO_REQ	1
37 #define	NDPD_SNMP_INFO_RESPONSE	2
38 #define	NDPD_PHYINT_INFO	3
39 #define	NDPD_PREFIX_INFO	4
40 #define	NDPD_ROUTER_INFO	5
41 
42 #define	NDPD_SNMP_INFO_VER	1
43 #define	NDPD_PHYINT_INFO_VER    1
44 #define	NDPD_PREFIX_INFO_VER    1
45 #define	NDPD_ROUTER_INFO_VER	1
46 
47 /*
48  * Data structures used to handle configuration variables set in ndpd.conf.
49  * cf_notdefault is set for variables explicitly set in ndpd.conf.
50  */
51 struct confvar {
52 	uint_t		cf_value;
53 	boolean_t	cf_notdefault;
54 };
55 
56 extern struct confvar ifdefaults[];
57 
58 /*
59  * Interfaces configuration variable indicies
60  */
61 #define	I_DupAddrDetectTransmits	0	/* From RFC 2462 */
62 #define	I_AdvSendAdvertisements		1
63 #define	I_MaxRtrAdvInterval		2	/* In seconds */
64 #define	I_MinRtrAdvInterval		3	/* In seconds */
65 #define	I_AdvManagedFlag		4
66 #define	I_AdvOtherConfigFlag		5
67 #define	I_AdvLinkMTU			6
68 #define	I_AdvReachableTime		7	/* In milliseconds */
69 #define	I_AdvRetransTimer		8	/* In milliseconds */
70 #define	I_AdvCurHopLimit		9
71 #define	I_AdvDefaultLifetime		10	/* In seconds */
72 #define	I_StatelessAddrConf		11
73 #define	I_TmpAddrsEnabled		12	/* From RFC 3041 */
74 #define	I_TmpValidLifetime		13	/* In seconds */
75 #define	I_TmpPreferredLifetime		14	/* In seconds */
76 #define	I_TmpRegenAdvance		15	/* In seconds */
77 #define	I_TmpMaxDesyncFactor		16	/* In seconds */
78 #define	I_StatefulAddrConf		17
79 #define	I_IFSIZE			18	/* # of variables */
80 
81 typedef struct ndpd_info_s {
82 	uint_t	info_type;
83 	uint_t	info_version;
84 	uint_t	info_num_of_phyints;
85 } ndpd_info_t;
86 
87 typedef struct ndpd_prefix_info_s {
88 	uint_t		prefix_info_type;
89 	uint_t		prefix_info_version;
90 	struct in6_addr prefix_prefix;		/* Used to indentify prefix */
91 	uint_t		prefix_len;		/* Num bits valid */
92 	uint_t		prefix_flags;		/* IFF_ flags */
93 	uint_t		prefix_phyint_index;
94 	uint_t		prefix_ValidLifetime;	 /* In ms w/ 2 hour rule */
95 	uint_t		prefix_PreferredLifetime; /* In millseconds */
96 	uint_t		prefix_OnLinkLifetime;	/* ms valid w/o 2 hour rule */
97 	boolean_t	prefix_OnLinkFlag;
98 	boolean_t	prefix_AutonomousFlag;
99 } ndpd_prefix_info_t;
100 
101 typedef struct ndpd_router_info_s {
102 	uint_t		router_info_type;
103 	uint_t		router_info_version;
104 	struct in6_addr	router_address;		/* Used to identify router */
105 	uint_t		router_lifetime;	/* In milliseconds */
106 	uint_t		router_phyint_index;
107 } ndpd_router_info_t;
108 
109 
110 typedef struct ndpd_phyint_info_s {
111 	uint_t		phyint_info_type;
112 	uint_t		phyint_info_version;
113 	int		phyint_index;
114 	struct confvar 	phyint_config[I_IFSIZE];
115 #define	phyint_DupAddrDetectTransmits 	\
116 				phyint_config[I_DupAddrDetectTransmits].cf_value
117 #define	phyint_AdvSendAdvertisements 	\
118 				phyint_config[I_AdvSendAdvertisements].cf_value
119 #define	phyint_MaxRtrAdvInterval	\
120 				phyint_config[I_MaxRtrAdvInterval].cf_value
121 #define	phyint_MinRtrAdvInterval	\
122 				phyint_config[I_MinRtrAdvInterval].cf_value
123 #define	phyint_AdvManagedFlag	phyint_config[I_AdvManagedFlag].cf_value
124 #define	phyint_AdvOtherConfigFlag	\
125 				phyint_config[I_AdvOtherConfigFlag].cf_value
126 #define	phyint_AdvLinkMTU	phyint_config[I_AdvLinkMTU].cf_value
127 #define	phyint_AdvReachableTime	phyint_config[I_AdvReachableTime].cf_value
128 #define	phyint_AdvRetransTimer	phyint_config[I_AdvRetransTimer].cf_value
129 #define	phyint_AdvCurHopLimit	phyint_config[I_AdvCurHopLimit].cf_value
130 #define	phyint_AdvDefaultLifetime	\
131 				phyint_config[I_AdvDefaultLifetime].cf_value
132 #define	phyint_StatelessAddrConf	\
133 				phyint_config[I_StatelessAddrConf].cf_value
134 #define	phyint_TmpAddrsEnabled	phyint_config[I_TmpAddrsEnabled].cf_value
135 #define	phyint_TmpValidLifetime	phyint_config[I_TmpValidLifetime].cf_value
136 #define	phyint_TmpPreferredLifetime	\
137 				phyint_config[I_TmpPreferredLifetime].cf_value
138 #define	phyint_TmpRegenAdvance	phyint_config[I_TmpRegenAdvance].cf_value
139 #define	phyint_TmpMaxDesyncFactor	\
140 				phyint_config[I_TmpMaxDesyncFactor].cf_value
141 #define	phyint_StatefulAddrConf	\
142 				phyint_config[I_StatefulAddrConf].cf_value
143 	uint_t 		phyint_num_of_prefixes;
144 	uint_t 		phyint_num_of_routers;
145 } ndpd_phyint_info_t;
146 
147 #ifdef	__cplusplus
148 }
149 #endif
150 
151 #endif	/* _NDPD_H */
152