Home | History | Annotate | Download | only in ip
      1      0    stevel /*
      2      0    stevel  * CDDL HEADER START
      3      0    stevel  *
      4      0    stevel  * The contents of this file are subject to the terms of the
      5   3448  dh155122  * Common Development and Distribution License (the "License").
      6   3448  dh155122  * You may not use this file except in compliance with the License.
      7      0    stevel  *
      8      0    stevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9      0    stevel  * or http://www.opensolaris.org/os/licensing.
     10      0    stevel  * See the License for the specific language governing permissions
     11      0    stevel  * and limitations under the License.
     12      0    stevel  *
     13      0    stevel  * When distributing Covered Code, include this CDDL HEADER in each
     14      0    stevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15      0    stevel  * If applicable, add the following below this CDDL HEADER, with the
     16      0    stevel  * fields enclosed by brackets "[]" replaced with your own identifying
     17      0    stevel  * information: Portions Copyright [yyyy] [name of copyright owner]
     18      0    stevel  *
     19      0    stevel  * CDDL HEADER END
     20      0    stevel  */
     21   3448  dh155122 
     22      0    stevel /*
     23  11042      Erik  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     24   3448  dh155122  * Use is subject to license terms.
     25      0    stevel  */
     26      0    stevel 
     27      0    stevel #include <sys/types.h>
     28      0    stevel #include <sys/stream.h>
     29      0    stevel #define	_SUN_TPI_VERSION 1
     30      0    stevel #include <sys/tihdr.h>
     31      0    stevel #include <sys/socket.h>
     32      0    stevel #include <sys/xti_xtiopt.h>
     33      0    stevel 
     34   3448  dh155122 #include <net/pfpolicy.h>
     35      0    stevel #include <inet/common.h>
     36      0    stevel #include <netinet/ip6.h>
     37      0    stevel #include <inet/ip.h>
     38      0    stevel 
     39      0    stevel #include <netinet/in.h>
     40      0    stevel #include <netinet/tcp.h>
     41      0    stevel #include <inet/optcom.h>
     42      0    stevel #include <inet/ipsec_impl.h>
     43      0    stevel #include <inet/spdsock.h>
     44      0    stevel 
     45      0    stevel /*
     46      0    stevel  * Table of all known options handled on a spdsock (PF_KEY) protocol stack.
     47      0    stevel  *
     48      0    stevel  * Note: This table contains options processed by both SPDSOCK and IP levels
     49      0    stevel  *       and is the superset of options that can be performed on a SPDSOCK over
     50      0    stevel  *	 IP stack.
     51      0    stevel  */
     52      0    stevel 
     53      0    stevel opdes_t spdsock_opt_arr[] = {
     54  11042      Erik 	{ SO_SNDBUF, SOL_SOCKET, OA_RW, OA_RW, 0,
     55      0    stevel 	    (t_uscalar_t)sizeof (int), 0 },
     56  11042      Erik 	{ SO_RCVBUF, SOL_SOCKET, OA_RW, OA_RW, 0,
     57      0    stevel 	    (t_uscalar_t)sizeof (int), 0 },
     58      0    stevel };
     59      0    stevel 
     60      0    stevel /*
     61      0    stevel  * Table of all supported levels
     62      0    stevel  * Note: Some levels (e.g. XTI_GENERIC) may be valid but may not have
     63      0    stevel  * any supported options so we need this info separately.
     64      0    stevel  *
     65      0    stevel  * This is needed only for topmost tpi providers.
     66      0    stevel  */
     67      0    stevel optlevel_t	spdsock_valid_levels_arr[] = {
     68      0    stevel 	SOL_SOCKET
     69      0    stevel };
     70      0    stevel 
     71      0    stevel #define	SPDSOCK_VALID_LEVELS_CNT	A_CNT(spdsock_valid_levels_arr)
     72      0    stevel 
     73      0    stevel #define	SPDSOCK_OPT_ARR_CNT		A_CNT(spdsock_opt_arr)
     74      0    stevel 
     75      0    stevel uint_t spdsock_max_optsize; /* initialized in spdsock_ddi_init() */
     76      0    stevel 
     77      0    stevel /*
     78      0    stevel  * Intialize option database object for SPDSOCK
     79      0    stevel  *
     80      0    stevel  * This object represents database of options to search passed to
     81      0    stevel  * {sock,tpi}optcom_req() interface routine to take care of option
     82      0    stevel  * management and associated methods.
     83      0    stevel  */
     84      0    stevel 
     85      0    stevel optdb_obj_t spdsock_opt_obj = {
     86      0    stevel 	NULL,			/* SPDSOCK default value function pointer */
     87      0    stevel 	spdsock_opt_get,	/* SPDSOCK get function pointer */
     88      0    stevel 	spdsock_opt_set,	/* SPDSOCK set function pointer */
     89      0    stevel 	SPDSOCK_OPT_ARR_CNT,	/* SPDSOCK option database count of entries */
     90      0    stevel 	spdsock_opt_arr,	/* SPDSOCK option database */
     91      0    stevel 	SPDSOCK_VALID_LEVELS_CNT, /* SPDSOCK valid level count of entries */
     92      0    stevel 	spdsock_valid_levels_arr  /* SPDSOCK valid level array */
     93      0    stevel };
     94