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