xref: /onnv-gate/usr/src/uts/common/inet/ip/keysock_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
5*11042SErik.Nordmark@Sun.COM  * Common Development and Distribution License (the "License").
6*11042SErik.Nordmark@Sun.COM  * 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 /*
22*11042SErik.Nordmark@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 1
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 <inet/optcom.h>
400Sstevel@tonic-gate #include <inet/keysock.h>
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * Table of all known options handled on a keysock (PF_KEY) protocol stack.
440Sstevel@tonic-gate  *
450Sstevel@tonic-gate  * Note: This table contains options processed by both KEYSOCK and IP levels
460Sstevel@tonic-gate  *       and is the superset of options that can be performed on a KEYSOCK over
470Sstevel@tonic-gate  *	 IP stack.
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate 
500Sstevel@tonic-gate opdes_t keysock_opt_arr[] = {
51*11042SErik.Nordmark@Sun.COM 	{ SO_USELOOPBACK, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
520Sstevel@tonic-gate 	    (t_uscalar_t)sizeof (int), 0 },
53*11042SErik.Nordmark@Sun.COM 	{ SO_SNDBUF, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
540Sstevel@tonic-gate 	    (t_uscalar_t)sizeof (int), 0 },
55*11042SErik.Nordmark@Sun.COM 	{ SO_RCVBUF, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
560Sstevel@tonic-gate 	    (t_uscalar_t)sizeof (int), 0 },
570Sstevel@tonic-gate };
580Sstevel@tonic-gate 
590Sstevel@tonic-gate /*
600Sstevel@tonic-gate  * Table of all supported levels
610Sstevel@tonic-gate  * Note: Some levels (e.g. XTI_GENERIC) may be valid but may not have
620Sstevel@tonic-gate  * any supported options so we need this info separately.
630Sstevel@tonic-gate  *
640Sstevel@tonic-gate  * This is needed only for topmost tpi providers.
650Sstevel@tonic-gate  */
660Sstevel@tonic-gate optlevel_t	keysock_valid_levels_arr[] = {
670Sstevel@tonic-gate 	SOL_SOCKET
680Sstevel@tonic-gate };
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #define	KEYSOCK_VALID_LEVELS_CNT	A_CNT(keysock_valid_levels_arr)
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #define	KEYSOCK_OPT_ARR_CNT		A_CNT(keysock_opt_arr)
730Sstevel@tonic-gate 
740Sstevel@tonic-gate uint_t keysock_max_optsize; /* initialized in keysock_ddi_init() */
750Sstevel@tonic-gate 
760Sstevel@tonic-gate /*
770Sstevel@tonic-gate  * Intialize option database object for KEYSOCK
780Sstevel@tonic-gate  *
790Sstevel@tonic-gate  * This object represents database of options to search passed to
800Sstevel@tonic-gate  * {sock,tpi}optcom_req() interface routine to take care of option
810Sstevel@tonic-gate  * management and associated methods.
820Sstevel@tonic-gate  */
830Sstevel@tonic-gate 
840Sstevel@tonic-gate optdb_obj_t keysock_opt_obj = {
850Sstevel@tonic-gate 	NULL,			/* KEYSOCK default value function pointer */
860Sstevel@tonic-gate 	keysock_opt_get,	/* KEYSOCK get function pointer */
870Sstevel@tonic-gate 	keysock_opt_set,	/* KEYSOCK set function pointer */
880Sstevel@tonic-gate 	KEYSOCK_OPT_ARR_CNT,	/* KEYSOCK option database count of entries */
890Sstevel@tonic-gate 	keysock_opt_arr,	/* KEYSOCK option database */
900Sstevel@tonic-gate 	KEYSOCK_VALID_LEVELS_CNT, /* KEYSOCK valid level count of entries */
910Sstevel@tonic-gate 	keysock_valid_levels_arr  /* KEYSOCK valid level array */
920Sstevel@tonic-gate };
93