17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 588cda078Skcpoon * Common Development and Distribution License (the "License"). 688cda078Skcpoon * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22e11c3f44Smeem * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #include <sys/types.h> 277c478bd9Sstevel@tonic-gate #include <sys/stream.h> 287c478bd9Sstevel@tonic-gate #define _SUN_TPI_VERSION 2 297c478bd9Sstevel@tonic-gate #include <sys/tihdr.h> 307c478bd9Sstevel@tonic-gate #include <sys/socket.h> 317c478bd9Sstevel@tonic-gate #include <sys/xti_xtiopt.h> 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <inet/common.h> 347c478bd9Sstevel@tonic-gate #include <netinet/ip6.h> 357c478bd9Sstevel@tonic-gate #include <inet/ip.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #include <netinet/in.h> 387c478bd9Sstevel@tonic-gate #include <netinet/tcp.h> 397c478bd9Sstevel@tonic-gate #include <netinet/ip_mroute.h> 407c478bd9Sstevel@tonic-gate #include <inet/optcom.h> 410f1702c5SYu Xiangning #include <inet/rts_impl.h> 427c478bd9Sstevel@tonic-gate 43*bd670b35SErik Nordmark #include <inet/rts_impl.h> 447c478bd9Sstevel@tonic-gate /* 457c478bd9Sstevel@tonic-gate * Table of all known options handled on a RTS protocol stack. 467c478bd9Sstevel@tonic-gate * 477c478bd9Sstevel@tonic-gate * Note: This table contains options processed by both RTS and IP levels 487c478bd9Sstevel@tonic-gate * and is the superset of options that can be performed on a RTS over IP 497c478bd9Sstevel@tonic-gate * stack. 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate opdes_t rts_opt_arr[] = { 527c478bd9Sstevel@tonic-gate 53*bd670b35SErik Nordmark { SO_DEBUG, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, 54*bd670b35SErik Nordmark { SO_DONTROUTE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, 55*bd670b35SErik Nordmark { SO_USELOOPBACK, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 567c478bd9Sstevel@tonic-gate 0 }, 57*bd670b35SErik Nordmark { SO_BROADCAST, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, 58*bd670b35SErik Nordmark { SO_REUSEADDR, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, 59*bd670b35SErik Nordmark { SO_TYPE, SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 }, 60*bd670b35SErik Nordmark { SO_SNDBUF, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, 61*bd670b35SErik Nordmark { SO_RCVBUF, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, 62*bd670b35SErik Nordmark { SO_SNDTIMEO, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, 633986c91eSanders sizeof (struct timeval), 0 }, 64*bd670b35SErik Nordmark { SO_RCVTIMEO, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, 653986c91eSanders sizeof (struct timeval), 0 }, 66*bd670b35SErik Nordmark { SO_PROTOTYPE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, 67*bd670b35SErik Nordmark { SO_DOMAIN, SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 }, 68e11c3f44Smeem { RT_AWARE, SOL_ROUTE, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, 697c478bd9Sstevel@tonic-gate }; 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate /* 727c478bd9Sstevel@tonic-gate * Table of all supported levels 737c478bd9Sstevel@tonic-gate * Note: Some levels (e.g. XTI_GENERIC) may be valid but may not have 747c478bd9Sstevel@tonic-gate * any supported options so we need this info separately. 757c478bd9Sstevel@tonic-gate * 767c478bd9Sstevel@tonic-gate * This is needed only for topmost tpi providers and is used only by 777c478bd9Sstevel@tonic-gate * XTI interfaces. 787c478bd9Sstevel@tonic-gate */ 797c478bd9Sstevel@tonic-gate optlevel_t rts_valid_levels_arr[] = { 807c478bd9Sstevel@tonic-gate XTI_GENERIC, 817c478bd9Sstevel@tonic-gate SOL_SOCKET, 827c478bd9Sstevel@tonic-gate IPPROTO_IP, 837c478bd9Sstevel@tonic-gate IPPROTO_IPV6 847c478bd9Sstevel@tonic-gate }; 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #define RTS_VALID_LEVELS_CNT A_CNT(rts_valid_levels_arr) 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate #define RTS_OPT_ARR_CNT A_CNT(rts_opt_arr) 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate uint_t rts_max_optsize; /* initialized in _init() */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /* 937c478bd9Sstevel@tonic-gate * Intialize option database object for RTS 947c478bd9Sstevel@tonic-gate * 957c478bd9Sstevel@tonic-gate * This object represents database of options to search passed to 967c478bd9Sstevel@tonic-gate * {sock,tpi}optcom_req() interface routine to take care of option 977c478bd9Sstevel@tonic-gate * management and associated methods. 987c478bd9Sstevel@tonic-gate */ 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate optdb_obj_t rts_opt_obj = { 1017c478bd9Sstevel@tonic-gate rts_opt_default, /* RTS default value function pointer */ 102*bd670b35SErik Nordmark rts_tpi_opt_get, /* RTS get function pointer */ 103*bd670b35SErik Nordmark rts_tpi_opt_set, /* RTS set function pointer */ 1047c478bd9Sstevel@tonic-gate RTS_OPT_ARR_CNT, /* RTS option database count of entries */ 1057c478bd9Sstevel@tonic-gate rts_opt_arr, /* RTS option database */ 1067c478bd9Sstevel@tonic-gate RTS_VALID_LEVELS_CNT, /* RTS valid level count of entries */ 1077c478bd9Sstevel@tonic-gate rts_valid_levels_arr /* RTS valid level array */ 1087c478bd9Sstevel@tonic-gate }; 109