xref: /titanic_41/usr/src/uts/common/inet/rts_impl.h (revision f8919bdadda3ebb97bd55cc14a16e0271ed57615)
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 /* Copyright (c) 1990 Mentat Inc. */
26 
27 #ifndef	_RTS_IMPL_H
28 #define	_RTS_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifdef _KERNEL
37 
38 #include <sys/types.h>
39 #include <sys/netstack.h>
40 
41 #include <netinet/in.h>
42 #include <netinet/icmp6.h>
43 #include <netinet/ip6.h>
44 
45 #include <inet/common.h>
46 #include <inet/ip.h>
47 
48 /* Named Dispatch Parameter Management Structure */
49 typedef struct rtsparam_s {
50 	uint_t	rts_param_min;
51 	uint_t	rts_param_max;
52 	uint_t	rts_param_value;
53 	char	*rts_param_name;
54 } rtsparam_t;
55 
56 /*
57  * RTS stack instances
58  */
59 struct rts_stack {
60 	netstack_t		*rtss_netstack;	/* Common netstack */
61 
62 	caddr_t			rtss_g_nd;
63 	rtsparam_t		*rtss_params;
64 };
65 typedef struct rts_stack rts_stack_t;
66 
67 /* Internal routing socket stream control structure, one per open stream */
68 typedef	struct rts_s {
69 	krwlock_t	rts_rwlock;	/* Protects most of rts_t */
70 	uint_t	rts_state;		/* Provider interface state */
71 	uint_t	rts_error;		/* Routing socket error code */
72 	uint_t	rts_flag;		/* Pending I/O state */
73 	uint_t	rts_proto;		/* SO_PROTOTYPE "socket" option. */
74 	uint_t	rts_debug : 1,		/* SO_DEBUG "socket" option. */
75 		rts_dontroute : 1,	/* SO_DONTROUTE "socket" option. */
76 		rts_broadcast : 1,	/* SO_BROADCAST "socket" option. */
77 		rts_reuseaddr : 1,	/* SO_REUSEADDR "socket" option. */
78 		rts_useloopback : 1,	/* SO_USELOOPBACK "socket" option. */
79 		rts_multicast_loop : 1,	/* IP_MULTICAST_LOOP option */
80 		rts_hdrincl : 1,	/* IP_HDRINCL option + RAW and IGMP */
81 
82 		: 0;
83 	rts_stack_t	*rts_rtss;
84 
85 	/* Written to only once at the time of opening the endpoint */
86 	conn_t		*rts_connp;
87 } rts_t;
88 
89 #define	RTS_WPUT_PENDING	0x1	/* Waiting for write-side to complete */
90 #define	RTS_WRW_PENDING		0x2	/* Routing socket write in progress */
91 
92 /*
93  * Object to represent database of options to search passed to
94  * {sock,tpi}optcom_req() interface routine to take care of option
95  * management and associated methods.
96  * XXX. These and other externs should really move to a rts header.
97  */
98 extern optdb_obj_t	rts_opt_obj;
99 extern uint_t		rts_max_optsize;
100 
101 extern void	rts_ddi_init(void);
102 extern void	rts_ddi_destroy(void);
103 
104 #endif	/* _KERNEL */
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif	/* _RTS_IMPL_H */
111