17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
58121d73fSseb  * Common Development and Distribution License (the "License").
68121d73fSseb  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
228121d73fSseb  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_NDPD_TABLES_H
277c478bd9Sstevel@tonic-gate #define	_NDPD_TABLES_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
35*3173664eSapersson #include <protocols/ndpd.h>
36*3173664eSapersson 
377c478bd9Sstevel@tonic-gate enum adv_states { NO_ADV = 0, REG_ADV, INIT_ADV, SOLICIT_ADV, FINAL_ADV };
387c478bd9Sstevel@tonic-gate enum adv_events { ADV_OFF, START_INIT_ADV, START_FINAL_ADV, RECEIVED_SOLICIT,
397c478bd9Sstevel@tonic-gate 			ADV_TIMER };
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate enum solicit_states { NO_SOLICIT = 0, INIT_SOLICIT, DONE_SOLICIT };
427c478bd9Sstevel@tonic-gate enum solicit_events { SOLICIT_OFF, START_INIT_SOLICIT, SOL_TIMER,
437c478bd9Sstevel@tonic-gate 			SOLICIT_DONE };
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * A doubly linked list of all physical interfaces that each contain a
467c478bd9Sstevel@tonic-gate  * doubly linked list of prefixes (i.e. logical interfaces) and default
477c478bd9Sstevel@tonic-gate  * routers.
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate struct phyint {
507c478bd9Sstevel@tonic-gate 	struct phyint	*pi_next;
517c478bd9Sstevel@tonic-gate 	struct phyint	*pi_prev;
527c478bd9Sstevel@tonic-gate 	struct prefix	*pi_prefix_list;	/* Doubly linked prefixes */
537c478bd9Sstevel@tonic-gate 	struct router	*pi_router_list;	/* Doubly linked routers */
547c478bd9Sstevel@tonic-gate 	struct adv_prefix *pi_adv_prefix_list;	/* Doubly linked adv.prefixes */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate 	uint_t		pi_index;		/* Identifier > 0 */
577c478bd9Sstevel@tonic-gate 	char		pi_name[LIFNAMSIZ];	/* Used to identify it */
587c478bd9Sstevel@tonic-gate 	int		pi_sock;		/* For sending and receiving */
597c478bd9Sstevel@tonic-gate 	struct in6_addr	pi_ifaddr;		/* Local address */
607c478bd9Sstevel@tonic-gate 	uint_t		pi_flags;		/* IFF_* flags */
617c478bd9Sstevel@tonic-gate 	uint_t		pi_hdw_addr_len;
627c478bd9Sstevel@tonic-gate 	uchar_t		pi_hdw_addr[ND_MAX_HDW_LEN];
637c478bd9Sstevel@tonic-gate 	uint_t		pi_mtu;			/* From SIOCGLIFMTU */
647c478bd9Sstevel@tonic-gate 	struct in6_addr pi_token;
657c478bd9Sstevel@tonic-gate 	uint_t		pi_token_length;
667c478bd9Sstevel@tonic-gate 	struct in6_addr	pi_tmp_token;		/* For RFC3041 addrs */
677c478bd9Sstevel@tonic-gate 	struct in6_addr	pi_dst_token;		/* For POINTOPOINT */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate 	uint_t		pi_state;		/* PI_* below */
707c478bd9Sstevel@tonic-gate 	uint_t		pi_kernel_state;	/* PI_* below */
717c478bd9Sstevel@tonic-gate 	uint_t		pi_num_k_routers;	/* # routers in kernel */
727c478bd9Sstevel@tonic-gate 	uint_t		pi_reach_time_since_random;	/* In milliseconds */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate 	/* Applies if pi_AdvSendAdvertisements */
757c478bd9Sstevel@tonic-gate 	uint_t		pi_adv_time_left;	/* In milliseconds */
767c478bd9Sstevel@tonic-gate 	uint_t		pi_adv_time_since_sent;	/* In milliseconds */
777c478bd9Sstevel@tonic-gate 	enum adv_states	pi_adv_state;
787c478bd9Sstevel@tonic-gate 	uint_t		pi_adv_count;
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate 	/* Applies if not pi_AdvSendAdvertisements */
817c478bd9Sstevel@tonic-gate 	uint_t		pi_sol_time_left;	/* In milliseconds */
827c478bd9Sstevel@tonic-gate 	enum solicit_states pi_sol_state;
837c478bd9Sstevel@tonic-gate 	uint_t		pi_sol_count;
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate 	/* Interface specific configurable variables */
867c478bd9Sstevel@tonic-gate 	struct confvar	pi_config[I_IFSIZE];
877c478bd9Sstevel@tonic-gate #define	pi_DupAddrDetectTransmits pi_config[I_DupAddrDetectTransmits].cf_value
887c478bd9Sstevel@tonic-gate #define	pi_AdvSendAdvertisements pi_config[I_AdvSendAdvertisements].cf_value
897c478bd9Sstevel@tonic-gate #define	pi_MaxRtrAdvInterval	pi_config[I_MaxRtrAdvInterval].cf_value
907c478bd9Sstevel@tonic-gate #define	pi_MinRtrAdvInterval	pi_config[I_MinRtrAdvInterval].cf_value
917c478bd9Sstevel@tonic-gate #define	pi_AdvManagedFlag	pi_config[I_AdvManagedFlag].cf_value
927c478bd9Sstevel@tonic-gate #define	pi_AdvOtherConfigFlag	pi_config[I_AdvOtherConfigFlag].cf_value
937c478bd9Sstevel@tonic-gate #define	pi_AdvLinkMTU		pi_config[I_AdvLinkMTU].cf_value
947c478bd9Sstevel@tonic-gate #define	pi_AdvReachableTime	pi_config[I_AdvReachableTime].cf_value
957c478bd9Sstevel@tonic-gate #define	pi_AdvRetransTimer	pi_config[I_AdvRetransTimer].cf_value
967c478bd9Sstevel@tonic-gate #define	pi_AdvCurHopLimit	pi_config[I_AdvCurHopLimit].cf_value
977c478bd9Sstevel@tonic-gate #define	pi_AdvDefaultLifetime	pi_config[I_AdvDefaultLifetime].cf_value
987c478bd9Sstevel@tonic-gate #define	pi_StatelessAddrConf	pi_config[I_StatelessAddrConf].cf_value
997c478bd9Sstevel@tonic-gate #define	pi_TmpAddrsEnabled	pi_config[I_TmpAddrsEnabled].cf_value
1007c478bd9Sstevel@tonic-gate #define	pi_TmpValidLifetime	pi_config[I_TmpValidLifetime].cf_value
1017c478bd9Sstevel@tonic-gate #define	pi_TmpPreferredLifetime	pi_config[I_TmpPreferredLifetime].cf_value
1027c478bd9Sstevel@tonic-gate #define	pi_TmpRegenAdvance	pi_config[I_TmpRegenAdvance].cf_value
1037c478bd9Sstevel@tonic-gate #define	pi_TmpMaxDesyncFactor	pi_config[I_TmpMaxDesyncFactor].cf_value
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate 	/* Recorded variables for RFC3041 addresses */
1067c478bd9Sstevel@tonic-gate 	uint_t		pi_TmpDesyncFactor;		/* In milliseconds */
1077c478bd9Sstevel@tonic-gate 	uint_t		pi_TmpRegenCountdown;		/* In milliseconds */
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate 	/* Recorded variables on node/host */
1107c478bd9Sstevel@tonic-gate 	uint_t		pi_LinkMTU;
1117c478bd9Sstevel@tonic-gate 	uint_t		pi_CurHopLimit;
1127c478bd9Sstevel@tonic-gate 	uint_t		pi_BaseReachableTime;		/* In milliseconds */
1137c478bd9Sstevel@tonic-gate 	uint_t		pi_ReachableTime;		/* In milliseconds */
1147c478bd9Sstevel@tonic-gate 	/*
1157c478bd9Sstevel@tonic-gate 	 * The above value should be a uniformly-distributed random
1167c478bd9Sstevel@tonic-gate 	 * value between ND_MIN_RANDOM_FACTOR and
1177c478bd9Sstevel@tonic-gate 	 * ND_MAX_RANDOM_FACTOR times BaseReachableTime
1187c478bd9Sstevel@tonic-gate 	 * milliseconds.  A new random value should be
1197c478bd9Sstevel@tonic-gate 	 * calculated when BaseReachableTime changes (due to
1207c478bd9Sstevel@tonic-gate 	 * Router Advertisements) or at least every few hours
1217c478bd9Sstevel@tonic-gate 	 * even if no Router Advertisements are received.
1227c478bd9Sstevel@tonic-gate 	 * Tracked using pi_each_time_since_random.
1237c478bd9Sstevel@tonic-gate 	 */
1247c478bd9Sstevel@tonic-gate 	uint_t		pi_RetransTimer;		/* In milliseconds */
1257c478bd9Sstevel@tonic-gate 	char		*pi_group_name;
1267c478bd9Sstevel@tonic-gate };
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /*
1297c478bd9Sstevel@tonic-gate  * pi_state/pr_kernel_state values
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate #define	PI_PRESENT		0x01
1327c478bd9Sstevel@tonic-gate #define	PI_JOINED_ALLNODES	0x02	/* allnodes multicast joined */
1337c478bd9Sstevel@tonic-gate #define	PI_JOINED_ALLROUTERS	0x04	/* allrouters multicast joined */
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate /*
1367c478bd9Sstevel@tonic-gate  * Prefix configuration variable indices
1377c478bd9Sstevel@tonic-gate  */
1387c478bd9Sstevel@tonic-gate #define	I_AdvValidLifetime	0	/* In seconds */
1397c478bd9Sstevel@tonic-gate #define	I_AdvOnLinkFlag		1
1407c478bd9Sstevel@tonic-gate #define	I_AdvPreferredLifetime	2	/* In seconds */
1417c478bd9Sstevel@tonic-gate #define	I_AdvAutonomousFlag	3
1427c478bd9Sstevel@tonic-gate #define	I_AdvValidExpiration	4	/* Seconds left */
1437c478bd9Sstevel@tonic-gate #define	I_AdvPreferredExpiration 5	/* Seconds left */
1447c478bd9Sstevel@tonic-gate #define	I_PREFIXSIZE		6	/* # of variables */
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate /*
1477c478bd9Sstevel@tonic-gate  * A doubly linked list of prefixes for onlink and addrconf.
1487c478bd9Sstevel@tonic-gate  */
1497c478bd9Sstevel@tonic-gate struct prefix {
1507c478bd9Sstevel@tonic-gate 	struct prefix	*pr_next;	/* Next prefix for this physical */
1517c478bd9Sstevel@tonic-gate 	struct prefix	*pr_prev;	/* Prev prefix for this physical */
1527c478bd9Sstevel@tonic-gate 	struct phyint	*pr_physical;	/* Back pointer */
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate 	struct in6_addr	pr_prefix;	/* Used to indentify prefix */
1557c478bd9Sstevel@tonic-gate 	uint_t		pr_prefix_len;	/* Num bits valid */
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate 	char		pr_name[LIFNAMSIZ];
1587c478bd9Sstevel@tonic-gate 	struct in6_addr	pr_address;
1597c478bd9Sstevel@tonic-gate 	uint64_t	pr_flags;	/* IFF_* flags */
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate 	uint_t		pr_state;	/* PR_ONLINK | PR_AUTO etc */
1627c478bd9Sstevel@tonic-gate 	uint_t		pr_kernel_state; /* PR_ONLINK | PR_AUTO etc */
1637c478bd9Sstevel@tonic-gate 	boolean_t	pr_in_use;	/* To detect removed prefixes */
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate 	/* Recorded variables on node/host */
1667c478bd9Sstevel@tonic-gate 	uint_t		pr_ValidLifetime;	/* In ms w/ 2 hour rule */
1677c478bd9Sstevel@tonic-gate 	uint_t		pr_PreferredLifetime;	/* In millseconds */
1687c478bd9Sstevel@tonic-gate 	uint_t		pr_OnLinkLifetime;	/* ms valid w/o 2 hour rule */
1697c478bd9Sstevel@tonic-gate 	boolean_t	pr_OnLinkFlag;
1707c478bd9Sstevel@tonic-gate 	boolean_t	pr_AutonomousFlag;
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate 	uint_t		pr_CreateTime;		/* tmpaddr creation time */
1737c478bd9Sstevel@tonic-gate 						/* in SECONDS */
17469bb4bb4Scarlsonj 	uint_t		pr_attempts;	/* attempts to configure */
1757c478bd9Sstevel@tonic-gate };
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * Flags used for pr_kernel_state and pr_state where the latter is
1797c478bd9Sstevel@tonic-gate  * user-level state.
1807c478bd9Sstevel@tonic-gate  */
1817c478bd9Sstevel@tonic-gate #define	PR_ONLINK	0x01		/* On-link */
1827c478bd9Sstevel@tonic-gate #define	PR_AUTO		0x02		/* Stateless addrconf */
1837c478bd9Sstevel@tonic-gate #define	PR_DEPRECATED	0x04		/* Address is deprecated */
1847c478bd9Sstevel@tonic-gate #define	PR_STATIC	0x08		/* Not created by ndpd */
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * The sum of all possible state string lengths, plus terminating
1887c478bd9Sstevel@tonic-gate  * null character; if new states are added, this needs to be updated.
1897c478bd9Sstevel@tonic-gate  * Useful for passing an appropriately sized buffer to prefix_print_state().
1907c478bd9Sstevel@tonic-gate  *
1917c478bd9Sstevel@tonic-gate  * Current strings: "ONLINK ", "AUTO ", "DEPRECATED ", "STATIC ", "\n"
1927c478bd9Sstevel@tonic-gate  *                      7     +   5    +     11       +    7     +  1
1937c478bd9Sstevel@tonic-gate  */
1947c478bd9Sstevel@tonic-gate #define	PREFIX_STATESTRLEN	31
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate /* Prefix used for storing advertisement specific stuff */
1977c478bd9Sstevel@tonic-gate struct adv_prefix {
1987c478bd9Sstevel@tonic-gate 	struct adv_prefix	*adv_pr_next;	/* Next prefix */
1997c478bd9Sstevel@tonic-gate 	struct adv_prefix	*adv_pr_prev;	/* Prev prefix */
2007c478bd9Sstevel@tonic-gate 	struct phyint		*adv_pr_physical;	/* Back pointer */
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate 	struct in6_addr		adv_pr_prefix;	/* Used to indentify prefix */
2037c478bd9Sstevel@tonic-gate 	uint_t			adv_pr_prefix_len;	/* Num bits valid */
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate 	/* Used when sending advertisements */
2067c478bd9Sstevel@tonic-gate 	struct confvar		adv_pr_config[I_PREFIXSIZE];
2077c478bd9Sstevel@tonic-gate #define	adv_pr_AdvValidLifetime	adv_pr_config[I_AdvValidLifetime].cf_value
2087c478bd9Sstevel@tonic-gate #define	adv_pr_AdvOnLinkFlag	adv_pr_config[I_AdvOnLinkFlag].cf_value
2097c478bd9Sstevel@tonic-gate #define	adv_pr_AdvPreferredLifetime	\
2107c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredLifetime].cf_value
2117c478bd9Sstevel@tonic-gate #define	adv_pr_AdvAutonomousFlag	\
2127c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvAutonomousFlag].cf_value
2137c478bd9Sstevel@tonic-gate #define	adv_pr_AdvValidExpiration	\
2147c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvValidExpiration].cf_value
2157c478bd9Sstevel@tonic-gate #define	adv_pr_AdvPreferredExpiration	\
2167c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredExpiration].cf_value
2177c478bd9Sstevel@tonic-gate 	/* The two below are set if the timers decrement in real time */
2187c478bd9Sstevel@tonic-gate #define	adv_pr_AdvValidRealTime		\
2197c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvValidExpiration].cf_notdefault
2207c478bd9Sstevel@tonic-gate #define	adv_pr_AdvPreferredRealTime	\
2217c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredExpiration].cf_notdefault
2227c478bd9Sstevel@tonic-gate };
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate /*
2257c478bd9Sstevel@tonic-gate  * Doubly-linked list of default routers on a phyint.
2267c478bd9Sstevel@tonic-gate  */
2277c478bd9Sstevel@tonic-gate struct router {
2287c478bd9Sstevel@tonic-gate 	struct router	*dr_next;	/* Next router for this physical */
2297c478bd9Sstevel@tonic-gate 	struct router	*dr_prev;	/* Prev router for this physical */
2307c478bd9Sstevel@tonic-gate 	struct phyint	*dr_physical;	/* Back pointer */
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate 	struct in6_addr	dr_address;	/* Used to identify the router */
2337c478bd9Sstevel@tonic-gate 	uint_t		dr_lifetime;	/* In milliseconds */
2347c478bd9Sstevel@tonic-gate 	boolean_t	dr_inkernel;	/* Route added to kernel */
2357c478bd9Sstevel@tonic-gate };
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate /*
2387c478bd9Sstevel@tonic-gate  * Globals
2397c478bd9Sstevel@tonic-gate  */
2407c478bd9Sstevel@tonic-gate extern struct phyint *phyints;
241*3173664eSapersson extern int num_of_phyints;
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate /*
2457c478bd9Sstevel@tonic-gate  * Functions
2467c478bd9Sstevel@tonic-gate  */
2477c478bd9Sstevel@tonic-gate extern uint_t		getcurrenttime(void);
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate extern struct phyint	*phyint_lookup(char *name);
2507c478bd9Sstevel@tonic-gate extern struct phyint	*phyint_lookup_on_index(uint_t ifindex);
2517c478bd9Sstevel@tonic-gate extern struct phyint	*phyint_create(char *name);
2527c478bd9Sstevel@tonic-gate extern int		phyint_init_from_k(struct phyint *pi);
2537c478bd9Sstevel@tonic-gate extern void		phyint_delete(struct phyint *pi);
2547c478bd9Sstevel@tonic-gate extern uint_t		phyint_timer(struct phyint *pi, uint_t elapsed);
2557c478bd9Sstevel@tonic-gate extern void		phyint_print_all(void);
2567c478bd9Sstevel@tonic-gate extern void		phyint_reach_random(struct phyint *pi,
2577c478bd9Sstevel@tonic-gate 			    boolean_t set_needed);
2587c478bd9Sstevel@tonic-gate extern void		phyint_cleanup(struct phyint *pi);
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate extern boolean_t	tmptoken_create(struct phyint *pi);
2617c478bd9Sstevel@tonic-gate extern void		tmptoken_delete(struct phyint *pi);
2627c478bd9Sstevel@tonic-gate extern uint_t		tmptoken_timer(struct phyint *pi, uint_t elapsed);
2637c478bd9Sstevel@tonic-gate extern boolean_t	token_equal(struct in6_addr t1, struct in6_addr t2,
2647c478bd9Sstevel@tonic-gate 			    int bits);
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_create(struct phyint *pi, struct in6_addr addr,
2677c478bd9Sstevel@tonic-gate 			    int addrlen, uint64_t flags);
2687c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_lookup_name(struct phyint *pi, char *name);
2697c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_lookup_addr_match(struct prefix *pr);
2707c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_create_name(struct phyint *pi, char *name);
2717c478bd9Sstevel@tonic-gate extern int		prefix_init_from_k(struct prefix *pr);
2727c478bd9Sstevel@tonic-gate extern void		prefix_delete(struct prefix *pr);
2737c478bd9Sstevel@tonic-gate extern boolean_t	prefix_equal(struct in6_addr p1, struct in6_addr p2,
2747c478bd9Sstevel@tonic-gate 			    int bits);
2757c478bd9Sstevel@tonic-gate extern void		prefix_update_k(struct prefix *pr);
2767c478bd9Sstevel@tonic-gate extern uint_t		prefix_timer(struct prefix *pr, uint_t elapsed);
2777c478bd9Sstevel@tonic-gate extern uint_t		adv_prefix_timer(struct adv_prefix *adv_pr,
2787c478bd9Sstevel@tonic-gate 			    uint_t elapsed);
2797c478bd9Sstevel@tonic-gate extern boolean_t	prefix_token_match(struct phyint *pi,
2807c478bd9Sstevel@tonic-gate 			    struct prefix *pr, uint64_t flags);
2817c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_lookup_addr(struct phyint *pi,
2827c478bd9Sstevel@tonic-gate 			    struct in6_addr prefix);
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate extern struct adv_prefix *adv_prefix_lookup(struct phyint *pi,
2857c478bd9Sstevel@tonic-gate 			    struct in6_addr addr, int addrlen);
2867c478bd9Sstevel@tonic-gate extern struct adv_prefix *adv_prefix_create(struct phyint *pi,
2877c478bd9Sstevel@tonic-gate 			    struct in6_addr addr, int addrlen);
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate extern struct router	*router_lookup(struct phyint *pi, struct in6_addr addr);
2907c478bd9Sstevel@tonic-gate extern struct router	*router_create(struct phyint *pi, struct in6_addr addr,
2917c478bd9Sstevel@tonic-gate 			    uint_t lifetime);
2927c478bd9Sstevel@tonic-gate extern void		router_update_k(struct router *dr);
2937c478bd9Sstevel@tonic-gate extern uint_t		router_timer(struct router *dr, uint_t elapsed);
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate 
2967c478bd9Sstevel@tonic-gate extern void	check_to_advertise(struct phyint *pi, enum adv_events event);
2977c478bd9Sstevel@tonic-gate extern void	check_to_solicit(struct phyint *pi,
2987c478bd9Sstevel@tonic-gate 		    enum solicit_events event);
2997c478bd9Sstevel@tonic-gate extern uint_t	advertise_event(struct phyint *pi, enum adv_events event,
3007c478bd9Sstevel@tonic-gate 		    uint_t elapsed);
3017c478bd9Sstevel@tonic-gate extern uint_t	solicit_event(struct phyint *pi, enum solicit_events event,
3027c478bd9Sstevel@tonic-gate 		    uint_t elapsed);
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate extern void	print_route_sol(char *str, struct phyint *pi,
3057c478bd9Sstevel@tonic-gate 		    struct nd_router_solicit *rs, int len,
3067c478bd9Sstevel@tonic-gate 		    struct sockaddr_in6 *addr);
3077c478bd9Sstevel@tonic-gate extern void	print_route_adv(char *str, struct phyint *pi,
3087c478bd9Sstevel@tonic-gate 		    struct nd_router_advert *ra, int len,
3097c478bd9Sstevel@tonic-gate 		    struct sockaddr_in6 *addr);
3107c478bd9Sstevel@tonic-gate extern void	print_iflist(struct confvar *confvar);
3117c478bd9Sstevel@tonic-gate extern void	print_prefixlist(struct confvar *confvar);
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate extern void	in_data(struct phyint *pi);
3147c478bd9Sstevel@tonic-gate 
3157c478bd9Sstevel@tonic-gate extern void	incoming_ra(struct phyint *pi, struct nd_router_advert *ra,
3167c478bd9Sstevel@tonic-gate 		    int len, struct sockaddr_in6 *from, boolean_t loopback);
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate extern boolean_t incoming_prefix_addrconf_process(struct phyint *pi,
3197c478bd9Sstevel@tonic-gate 		    struct prefix *pr, uchar_t *opt,
3207c478bd9Sstevel@tonic-gate 		    struct sockaddr_in6 *from, boolean_t loopback,
3217c478bd9Sstevel@tonic-gate 		    boolean_t new_prefix);
3227c478bd9Sstevel@tonic-gate 
3237c478bd9Sstevel@tonic-gate extern void	incoming_prefix_onlink_process(struct prefix *pr,
3247c478bd9Sstevel@tonic-gate 		    uchar_t *opt);
3257c478bd9Sstevel@tonic-gate 
3267c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3277c478bd9Sstevel@tonic-gate }
3287c478bd9Sstevel@tonic-gate #endif
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate #endif	/* _NDPD_TABLES_H */
331