xref: /onnv-gate/usr/src/uts/common/inet/ip/spdsock_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
53448Sdh155122  * Common Development and Distribution License (the "License").
63448Sdh155122  * 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  */
213448Sdh155122 
220Sstevel@tonic-gate /*
23*11042SErik.Nordmark@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
243448Sdh155122  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #include <sys/types.h>
280Sstevel@tonic-gate #include <sys/stream.h>
290Sstevel@tonic-gate #define	_SUN_TPI_VERSION 1
300Sstevel@tonic-gate #include <sys/tihdr.h>
310Sstevel@tonic-gate #include <sys/socket.h>
320Sstevel@tonic-gate #include <sys/xti_xtiopt.h>
330Sstevel@tonic-gate 
343448Sdh155122 #include <net/pfpolicy.h>
350Sstevel@tonic-gate #include <inet/common.h>
360Sstevel@tonic-gate #include <netinet/ip6.h>
370Sstevel@tonic-gate #include <inet/ip.h>
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #include <netinet/in.h>
400Sstevel@tonic-gate #include <netinet/tcp.h>
410Sstevel@tonic-gate #include <inet/optcom.h>
420Sstevel@tonic-gate #include <inet/ipsec_impl.h>
430Sstevel@tonic-gate #include <inet/spdsock.h>
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * Table of all known options handled on a spdsock (PF_KEY) protocol stack.
470Sstevel@tonic-gate  *
480Sstevel@tonic-gate  * Note: This table contains options processed by both SPDSOCK and IP levels
490Sstevel@tonic-gate  *       and is the superset of options that can be performed on a SPDSOCK over
500Sstevel@tonic-gate  *	 IP stack.
510Sstevel@tonic-gate  */
520Sstevel@tonic-gate 
530Sstevel@tonic-gate opdes_t spdsock_opt_arr[] = {
54*11042SErik.Nordmark@Sun.COM 	{ SO_SNDBUF, SOL_SOCKET, OA_RW, OA_RW, 0,
550Sstevel@tonic-gate 	    (t_uscalar_t)sizeof (int), 0 },
56*11042SErik.Nordmark@Sun.COM 	{ SO_RCVBUF, SOL_SOCKET, OA_RW, OA_RW, 0,
570Sstevel@tonic-gate 	    (t_uscalar_t)sizeof (int), 0 },
580Sstevel@tonic-gate };
590Sstevel@tonic-gate 
600Sstevel@tonic-gate /*
610Sstevel@tonic-gate  * Table of all supported levels
620Sstevel@tonic-gate  * Note: Some levels (e.g. XTI_GENERIC) may be valid but may not have
630Sstevel@tonic-gate  * any supported options so we need this info separately.
640Sstevel@tonic-gate  *
650Sstevel@tonic-gate  * This is needed only for topmost tpi providers.
660Sstevel@tonic-gate  */
670Sstevel@tonic-gate optlevel_t	spdsock_valid_levels_arr[] = {
680Sstevel@tonic-gate 	SOL_SOCKET
690Sstevel@tonic-gate };
700Sstevel@tonic-gate 
710Sstevel@tonic-gate #define	SPDSOCK_VALID_LEVELS_CNT	A_CNT(spdsock_valid_levels_arr)
720Sstevel@tonic-gate 
730Sstevel@tonic-gate #define	SPDSOCK_OPT_ARR_CNT		A_CNT(spdsock_opt_arr)
740Sstevel@tonic-gate 
750Sstevel@tonic-gate uint_t spdsock_max_optsize; /* initialized in spdsock_ddi_init() */
760Sstevel@tonic-gate 
770Sstevel@tonic-gate /*
780Sstevel@tonic-gate  * Intialize option database object for SPDSOCK
790Sstevel@tonic-gate  *
800Sstevel@tonic-gate  * This object represents database of options to search passed to
810Sstevel@tonic-gate  * {sock,tpi}optcom_req() interface routine to take care of option
820Sstevel@tonic-gate  * management and associated methods.
830Sstevel@tonic-gate  */
840Sstevel@tonic-gate 
850Sstevel@tonic-gate optdb_obj_t spdsock_opt_obj = {
860Sstevel@tonic-gate 	NULL,			/* SPDSOCK default value function pointer */
870Sstevel@tonic-gate 	spdsock_opt_get,	/* SPDSOCK get function pointer */
880Sstevel@tonic-gate 	spdsock_opt_set,	/* SPDSOCK set function pointer */
890Sstevel@tonic-gate 	SPDSOCK_OPT_ARR_CNT,	/* SPDSOCK option database count of entries */
900Sstevel@tonic-gate 	spdsock_opt_arr,	/* SPDSOCK option database */
910Sstevel@tonic-gate 	SPDSOCK_VALID_LEVELS_CNT, /* SPDSOCK valid level count of entries */
920Sstevel@tonic-gate 	spdsock_valid_levels_arr  /* SPDSOCK valid level array */
930Sstevel@tonic-gate };
94