xref: /onnv-gate/usr/src/uts/common/inet/ip/rts_opt_data.c (revision 11042:2d6e217af1b4)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
53388Skcpoon  * Common Development and Distribution License (the "License").
63388Skcpoon  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
228485SPeter.Memishian@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #include <sys/types.h>
270Sstevel@tonic-gate #include <sys/stream.h>
280Sstevel@tonic-gate #define	_SUN_TPI_VERSION 2
290Sstevel@tonic-gate #include <sys/tihdr.h>
300Sstevel@tonic-gate #include <sys/socket.h>
310Sstevel@tonic-gate #include <sys/xti_xtiopt.h>
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <inet/common.h>
340Sstevel@tonic-gate #include <netinet/ip6.h>
350Sstevel@tonic-gate #include <inet/ip.h>
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #include <netinet/in.h>
380Sstevel@tonic-gate #include <netinet/tcp.h>
390Sstevel@tonic-gate #include <netinet/ip_mroute.h>
400Sstevel@tonic-gate #include <inet/optcom.h>
418348SEric.Yu@Sun.COM #include <inet/rts_impl.h>
420Sstevel@tonic-gate 
43*11042SErik.Nordmark@Sun.COM #include <inet/rts_impl.h>
440Sstevel@tonic-gate /*
450Sstevel@tonic-gate  * Table of all known options handled on a RTS protocol stack.
460Sstevel@tonic-gate  *
470Sstevel@tonic-gate  * Note: This table contains options processed by both RTS and IP levels
480Sstevel@tonic-gate  *       and is the superset of options that can be performed on a RTS over IP
490Sstevel@tonic-gate  *       stack.
500Sstevel@tonic-gate  */
510Sstevel@tonic-gate opdes_t	rts_opt_arr[] = {
520Sstevel@tonic-gate 
53*11042SErik.Nordmark@Sun.COM { SO_DEBUG,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
54*11042SErik.Nordmark@Sun.COM { SO_DONTROUTE,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
55*11042SErik.Nordmark@Sun.COM { SO_USELOOPBACK, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int),
560Sstevel@tonic-gate 	0 },
57*11042SErik.Nordmark@Sun.COM { SO_BROADCAST,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
58*11042SErik.Nordmark@Sun.COM { SO_REUSEADDR,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
59*11042SErik.Nordmark@Sun.COM { SO_TYPE,	SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 },
60*11042SErik.Nordmark@Sun.COM { SO_SNDBUF,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
61*11042SErik.Nordmark@Sun.COM { SO_RCVBUF,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
62*11042SErik.Nordmark@Sun.COM { SO_SNDTIMEO,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
638612SAnders.Persson@Sun.COM 	sizeof (struct timeval), 0 },
64*11042SErik.Nordmark@Sun.COM { SO_RCVTIMEO,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
658612SAnders.Persson@Sun.COM 	sizeof (struct timeval), 0 },
66*11042SErik.Nordmark@Sun.COM { SO_PROTOTYPE,	SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
67*11042SErik.Nordmark@Sun.COM { SO_DOMAIN,	SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 },
688485SPeter.Memishian@Sun.COM { RT_AWARE,	SOL_ROUTE, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
690Sstevel@tonic-gate };
700Sstevel@tonic-gate 
710Sstevel@tonic-gate /*
720Sstevel@tonic-gate  * Table of all supported levels
730Sstevel@tonic-gate  * Note: Some levels (e.g. XTI_GENERIC) may be valid but may not have
740Sstevel@tonic-gate  * any supported options so we need this info separately.
750Sstevel@tonic-gate  *
760Sstevel@tonic-gate  * This is needed only for topmost tpi providers and is used only by
770Sstevel@tonic-gate  * XTI interfaces.
780Sstevel@tonic-gate  */
790Sstevel@tonic-gate optlevel_t	rts_valid_levels_arr[] = {
800Sstevel@tonic-gate 	XTI_GENERIC,
810Sstevel@tonic-gate 	SOL_SOCKET,
820Sstevel@tonic-gate 	IPPROTO_IP,
830Sstevel@tonic-gate 	IPPROTO_IPV6
840Sstevel@tonic-gate };
850Sstevel@tonic-gate 
860Sstevel@tonic-gate #define	RTS_VALID_LEVELS_CNT	A_CNT(rts_valid_levels_arr)
870Sstevel@tonic-gate 
880Sstevel@tonic-gate #define	RTS_OPT_ARR_CNT		A_CNT(rts_opt_arr)
890Sstevel@tonic-gate 
900Sstevel@tonic-gate uint_t rts_max_optsize; /* initialized in _init() */
910Sstevel@tonic-gate 
920Sstevel@tonic-gate /*
930Sstevel@tonic-gate  * Intialize option database object for RTS
940Sstevel@tonic-gate  *
950Sstevel@tonic-gate  * This object represents database of options to search passed to
960Sstevel@tonic-gate  * {sock,tpi}optcom_req() interface routine to take care of option
970Sstevel@tonic-gate  * management and associated methods.
980Sstevel@tonic-gate  */
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate optdb_obj_t rts_opt_obj = {
1010Sstevel@tonic-gate 	rts_opt_default,	/* RTS default value function pointer */
102*11042SErik.Nordmark@Sun.COM 	rts_tpi_opt_get,	/* RTS get function pointer */
103*11042SErik.Nordmark@Sun.COM 	rts_tpi_opt_set,	/* RTS set function pointer */
1040Sstevel@tonic-gate 	RTS_OPT_ARR_CNT,	/* RTS option database count of entries */
1050Sstevel@tonic-gate 	rts_opt_arr,		/* RTS option database */
1060Sstevel@tonic-gate 	RTS_VALID_LEVELS_CNT,	/* RTS valid level count of entries */
1070Sstevel@tonic-gate 	rts_valid_levels_arr	/* RTS valid level array */
1080Sstevel@tonic-gate };
109