1fc80c0dfSnordmark /* 2fc80c0dfSnordmark * CDDL HEADER START 3fc80c0dfSnordmark * 4fc80c0dfSnordmark * The contents of this file are subject to the terms of the 5fc80c0dfSnordmark * Common Development and Distribution License (the "License"). 6fc80c0dfSnordmark * You may not use this file except in compliance with the License. 7fc80c0dfSnordmark * 8fc80c0dfSnordmark * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fc80c0dfSnordmark * or http://www.opensolaris.org/os/licensing. 10fc80c0dfSnordmark * See the License for the specific language governing permissions 11fc80c0dfSnordmark * and limitations under the License. 12fc80c0dfSnordmark * 13fc80c0dfSnordmark * When distributing Covered Code, include this CDDL HEADER in each 14fc80c0dfSnordmark * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fc80c0dfSnordmark * If applicable, add the following below this CDDL HEADER, with the 16fc80c0dfSnordmark * fields enclosed by brackets "[]" replaced with your own identifying 17fc80c0dfSnordmark * information: Portions Copyright [yyyy] [name of copyright owner] 18fc80c0dfSnordmark * 19fc80c0dfSnordmark * CDDL HEADER END 20fc80c0dfSnordmark */ 21fc80c0dfSnordmark /* 22*bd670b35SErik Nordmark * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23fc80c0dfSnordmark * Use is subject to license terms. 24fc80c0dfSnordmark */ 25fc80c0dfSnordmark /* Copyright (c) 1990 Mentat Inc. */ 26fc80c0dfSnordmark 27fc80c0dfSnordmark #ifndef _RTS_IMPL_H 28fc80c0dfSnordmark #define _RTS_IMPL_H 29fc80c0dfSnordmark 30fc80c0dfSnordmark #ifdef __cplusplus 31fc80c0dfSnordmark extern "C" { 32fc80c0dfSnordmark #endif 33fc80c0dfSnordmark 34fc80c0dfSnordmark #ifdef _KERNEL 35fc80c0dfSnordmark 36fc80c0dfSnordmark #include <sys/types.h> 37fc80c0dfSnordmark #include <sys/netstack.h> 38fc80c0dfSnordmark 39fc80c0dfSnordmark #include <netinet/in.h> 40fc80c0dfSnordmark #include <netinet/icmp6.h> 41fc80c0dfSnordmark #include <netinet/ip6.h> 42fc80c0dfSnordmark 43fc80c0dfSnordmark #include <inet/common.h> 44fc80c0dfSnordmark #include <inet/ip.h> 450f1702c5SYu Xiangning #include <inet/optcom.h> 46fc80c0dfSnordmark 47fc80c0dfSnordmark /* Named Dispatch Parameter Management Structure */ 48fc80c0dfSnordmark typedef struct rtsparam_s { 49fc80c0dfSnordmark uint_t rts_param_min; 50fc80c0dfSnordmark uint_t rts_param_max; 51fc80c0dfSnordmark uint_t rts_param_value; 52fc80c0dfSnordmark char *rts_param_name; 53fc80c0dfSnordmark } rtsparam_t; 54fc80c0dfSnordmark 55fc80c0dfSnordmark /* 56fc80c0dfSnordmark * RTS stack instances 57fc80c0dfSnordmark */ 58fc80c0dfSnordmark struct rts_stack { 59fc80c0dfSnordmark netstack_t *rtss_netstack; /* Common netstack */ 60fc80c0dfSnordmark 61fc80c0dfSnordmark caddr_t rtss_g_nd; 62fc80c0dfSnordmark rtsparam_t *rtss_params; 630f1702c5SYu Xiangning 640f1702c5SYu Xiangning ldi_ident_t rtss_ldi_ident; 65fc80c0dfSnordmark }; 66fc80c0dfSnordmark typedef struct rts_stack rts_stack_t; 67fc80c0dfSnordmark 68fc80c0dfSnordmark /* Internal routing socket stream control structure, one per open stream */ 69fc80c0dfSnordmark typedef struct rts_s { 70fc80c0dfSnordmark krwlock_t rts_rwlock; /* Protects most of rts_t */ 71fc80c0dfSnordmark uint_t rts_state; /* Provider interface state */ 72fc80c0dfSnordmark uint_t rts_error; /* Routing socket error code */ 73fc80c0dfSnordmark uint_t rts_flag; /* Pending I/O state */ 74*bd670b35SErik Nordmark uint_t 75fc80c0dfSnordmark rts_hdrincl : 1, /* IP_HDRINCL option + RAW and IGMP */ 76fc80c0dfSnordmark 77fc80c0dfSnordmark : 0; 78fc80c0dfSnordmark rts_stack_t *rts_rtss; 79fc80c0dfSnordmark 80fc80c0dfSnordmark /* Written to only once at the time of opening the endpoint */ 81fc80c0dfSnordmark conn_t *rts_connp; 820f1702c5SYu Xiangning 83*bd670b35SErik Nordmark kmutex_t rts_recv_mutex; /* For recv flow control */ 84fc80c0dfSnordmark } rts_t; 85fc80c0dfSnordmark 86fc80c0dfSnordmark #define RTS_WPUT_PENDING 0x1 /* Waiting for write-side to complete */ 87fc80c0dfSnordmark #define RTS_WRW_PENDING 0x2 /* Routing socket write in progress */ 88fc80c0dfSnordmark 89fc80c0dfSnordmark /* 90fc80c0dfSnordmark * Object to represent database of options to search passed to 91fc80c0dfSnordmark * {sock,tpi}optcom_req() interface routine to take care of option 92fc80c0dfSnordmark * management and associated methods. 93fc80c0dfSnordmark */ 94fc80c0dfSnordmark extern optdb_obj_t rts_opt_obj; 95fc80c0dfSnordmark extern uint_t rts_max_optsize; 96fc80c0dfSnordmark 970f1702c5SYu Xiangning extern void rts_ddi_g_init(void); 980f1702c5SYu Xiangning extern void rts_ddi_g_destroy(void); 990f1702c5SYu Xiangning 1000f1702c5SYu Xiangning extern int rts_tpi_opt_get(queue_t *, t_scalar_t, t_scalar_t, uchar_t *); 1010f1702c5SYu Xiangning extern int rts_tpi_opt_set(queue_t *, uint_t, int, int, uint_t, uchar_t *, 102*bd670b35SErik Nordmark uint_t *, uchar_t *, void *, cred_t *); 1030f1702c5SYu Xiangning extern int rts_opt_default(queue_t *q, t_scalar_t level, t_scalar_t name, 1040f1702c5SYu Xiangning uchar_t *ptr); 1050f1702c5SYu Xiangning 1060f1702c5SYu Xiangning extern sock_lower_handle_t rts_create(int, int, int, sock_downcalls_t **, 1070f1702c5SYu Xiangning uint_t *, int *, int, cred_t *); 1080f1702c5SYu Xiangning 1090f1702c5SYu Xiangning extern sock_downcalls_t sock_rts_downcalls; 110fc80c0dfSnordmark 111fc80c0dfSnordmark #endif /* _KERNEL */ 112fc80c0dfSnordmark 113fc80c0dfSnordmark #ifdef __cplusplus 114fc80c0dfSnordmark } 115fc80c0dfSnordmark #endif 116fc80c0dfSnordmark 117fc80c0dfSnordmark #endif /* _RTS_IMPL_H */ 118