15240Snordmark /* 25240Snordmark * CDDL HEADER START 35240Snordmark * 45240Snordmark * The contents of this file are subject to the terms of the 55240Snordmark * Common Development and Distribution License (the "License"). 65240Snordmark * You may not use this file except in compliance with the License. 75240Snordmark * 85240Snordmark * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 95240Snordmark * or http://www.opensolaris.org/os/licensing. 105240Snordmark * See the License for the specific language governing permissions 115240Snordmark * and limitations under the License. 125240Snordmark * 135240Snordmark * When distributing Covered Code, include this CDDL HEADER in each 145240Snordmark * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 155240Snordmark * If applicable, add the following below this CDDL HEADER, with the 165240Snordmark * fields enclosed by brackets "[]" replaced with your own identifying 175240Snordmark * information: Portions Copyright [yyyy] [name of copyright owner] 185240Snordmark * 195240Snordmark * CDDL HEADER END 205240Snordmark */ 215240Snordmark /* 22*11042SErik.Nordmark@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 235240Snordmark * Use is subject to license terms. 245240Snordmark */ 255240Snordmark /* Copyright (c) 1990 Mentat Inc. */ 265240Snordmark 275240Snordmark #ifndef _RTS_IMPL_H 285240Snordmark #define _RTS_IMPL_H 295240Snordmark 305240Snordmark #ifdef __cplusplus 315240Snordmark extern "C" { 325240Snordmark #endif 335240Snordmark 345240Snordmark #ifdef _KERNEL 355240Snordmark 365240Snordmark #include <sys/types.h> 375240Snordmark #include <sys/netstack.h> 385240Snordmark 395240Snordmark #include <netinet/in.h> 405240Snordmark #include <netinet/icmp6.h> 415240Snordmark #include <netinet/ip6.h> 425240Snordmark 435240Snordmark #include <inet/common.h> 445240Snordmark #include <inet/ip.h> 458348SEric.Yu@Sun.COM #include <inet/optcom.h> 465240Snordmark 475240Snordmark /* Named Dispatch Parameter Management Structure */ 485240Snordmark typedef struct rtsparam_s { 495240Snordmark uint_t rts_param_min; 505240Snordmark uint_t rts_param_max; 515240Snordmark uint_t rts_param_value; 525240Snordmark char *rts_param_name; 535240Snordmark } rtsparam_t; 545240Snordmark 555240Snordmark /* 565240Snordmark * RTS stack instances 575240Snordmark */ 585240Snordmark struct rts_stack { 595240Snordmark netstack_t *rtss_netstack; /* Common netstack */ 605240Snordmark 615240Snordmark caddr_t rtss_g_nd; 625240Snordmark rtsparam_t *rtss_params; 638348SEric.Yu@Sun.COM 648348SEric.Yu@Sun.COM ldi_ident_t rtss_ldi_ident; 655240Snordmark }; 665240Snordmark typedef struct rts_stack rts_stack_t; 675240Snordmark 685240Snordmark /* Internal routing socket stream control structure, one per open stream */ 695240Snordmark typedef struct rts_s { 705240Snordmark krwlock_t rts_rwlock; /* Protects most of rts_t */ 715240Snordmark uint_t rts_state; /* Provider interface state */ 725240Snordmark uint_t rts_error; /* Routing socket error code */ 735240Snordmark uint_t rts_flag; /* Pending I/O state */ 74*11042SErik.Nordmark@Sun.COM uint_t 755240Snordmark rts_hdrincl : 1, /* IP_HDRINCL option + RAW and IGMP */ 765240Snordmark 775240Snordmark : 0; 785240Snordmark rts_stack_t *rts_rtss; 795240Snordmark 805240Snordmark /* Written to only once at the time of opening the endpoint */ 815240Snordmark conn_t *rts_connp; 828348SEric.Yu@Sun.COM 83*11042SErik.Nordmark@Sun.COM kmutex_t rts_recv_mutex; /* For recv flow control */ 845240Snordmark } rts_t; 855240Snordmark 865240Snordmark #define RTS_WPUT_PENDING 0x1 /* Waiting for write-side to complete */ 875240Snordmark #define RTS_WRW_PENDING 0x2 /* Routing socket write in progress */ 885240Snordmark 895240Snordmark /* 905240Snordmark * Object to represent database of options to search passed to 915240Snordmark * {sock,tpi}optcom_req() interface routine to take care of option 925240Snordmark * management and associated methods. 935240Snordmark */ 945240Snordmark extern optdb_obj_t rts_opt_obj; 955240Snordmark extern uint_t rts_max_optsize; 965240Snordmark 978348SEric.Yu@Sun.COM extern void rts_ddi_g_init(void); 988348SEric.Yu@Sun.COM extern void rts_ddi_g_destroy(void); 998348SEric.Yu@Sun.COM 1008348SEric.Yu@Sun.COM extern int rts_tpi_opt_get(queue_t *, t_scalar_t, t_scalar_t, uchar_t *); 1018348SEric.Yu@Sun.COM extern int rts_tpi_opt_set(queue_t *, uint_t, int, int, uint_t, uchar_t *, 102*11042SErik.Nordmark@Sun.COM uint_t *, uchar_t *, void *, cred_t *); 1038348SEric.Yu@Sun.COM extern int rts_opt_default(queue_t *q, t_scalar_t level, t_scalar_t name, 1048348SEric.Yu@Sun.COM uchar_t *ptr); 1058348SEric.Yu@Sun.COM 1068348SEric.Yu@Sun.COM extern sock_lower_handle_t rts_create(int, int, int, sock_downcalls_t **, 1078348SEric.Yu@Sun.COM uint_t *, int *, int, cred_t *); 1088348SEric.Yu@Sun.COM 1098348SEric.Yu@Sun.COM extern sock_downcalls_t sock_rts_downcalls; 1105240Snordmark 1115240Snordmark #endif /* _KERNEL */ 1125240Snordmark 1135240Snordmark #ifdef __cplusplus 1145240Snordmark } 1155240Snordmark #endif 1165240Snordmark 1175240Snordmark #endif /* _RTS_IMPL_H */ 118