1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate /* 27*7c478bd9Sstevel@tonic-gate * Copyright (c) 1995,1996 by Sun Microsystems, Inc. 28*7c478bd9Sstevel@tonic-gate * All rights reserved. 29*7c478bd9Sstevel@tonic-gate */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifndef _SYS_TIHDR_H 32*7c478bd9Sstevel@tonic-gate #define _SYS_TIHDR_H 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* from SVr4.0 11.4 */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 37*7c478bd9Sstevel@tonic-gate /* 38*7c478bd9Sstevel@tonic-gate * Include declarations implicit to TPI and shared with user level code 39*7c478bd9Sstevel@tonic-gate */ 40*7c478bd9Sstevel@tonic-gate #include <sys/tpicommon.h> 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 43*7c478bd9Sstevel@tonic-gate extern "C" { 44*7c478bd9Sstevel@tonic-gate #endif 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * The feature test macro, _SUN_TPI_VERSION makes some of additional 48*7c478bd9Sstevel@tonic-gate * declarations available and changes some existing ones. There was 49*7c478bd9Sstevel@tonic-gate * some changes done to this interface and this feature test macro 50*7c478bd9Sstevel@tonic-gate * enables transitioning to those changes while maintaining retaining 51*7c478bd9Sstevel@tonic-gate * backward compatibility. 52*7c478bd9Sstevel@tonic-gate * 53*7c478bd9Sstevel@tonic-gate * The following is all the information 54*7c478bd9Sstevel@tonic-gate * needed by the Transport Service Interface. 55*7c478bd9Sstevel@tonic-gate */ 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate /* 58*7c478bd9Sstevel@tonic-gate * The following are the definitions of the Transport 59*7c478bd9Sstevel@tonic-gate * Service Interface primitives. 60*7c478bd9Sstevel@tonic-gate */ 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate /* 63*7c478bd9Sstevel@tonic-gate * Primitives that are initiated by the transport user. 64*7c478bd9Sstevel@tonic-gate */ 65*7c478bd9Sstevel@tonic-gate #define T_CONN_REQ 0 /* connection request */ 66*7c478bd9Sstevel@tonic-gate #if _SUN_TPI_VERSION > 1 67*7c478bd9Sstevel@tonic-gate #define O_T_CONN_RES 1 /* old connection response */ 68*7c478bd9Sstevel@tonic-gate #else 69*7c478bd9Sstevel@tonic-gate #define T_CONN_RES 1 /* connection response */ 70*7c478bd9Sstevel@tonic-gate #endif /* _SUN_TPI_VERSION > 1 */ 71*7c478bd9Sstevel@tonic-gate #define T_DISCON_REQ 2 /* disconnect request */ 72*7c478bd9Sstevel@tonic-gate #define T_DATA_REQ 3 /* data request */ 73*7c478bd9Sstevel@tonic-gate #define T_EXDATA_REQ 4 /* expedited data request */ 74*7c478bd9Sstevel@tonic-gate #define T_INFO_REQ 5 /* information request */ 75*7c478bd9Sstevel@tonic-gate /* 76*7c478bd9Sstevel@tonic-gate * Bind Request primitive (TLI inspired 77*7c478bd9Sstevel@tonic-gate * address binding semantics). If requested address is 78*7c478bd9Sstevel@tonic-gate * found to be busy, an alternative free address is 79*7c478bd9Sstevel@tonic-gate * returned. (Requires comparison of requested address to 80*7c478bd9Sstevel@tonic-gate * returned address to verify if the requested address was 81*7c478bd9Sstevel@tonic-gate * bound) 82*7c478bd9Sstevel@tonic-gate * 83*7c478bd9Sstevel@tonic-gate */ 84*7c478bd9Sstevel@tonic-gate #if _SUN_TPI_VERSION > 0 85*7c478bd9Sstevel@tonic-gate #define O_T_BIND_REQ 6 86*7c478bd9Sstevel@tonic-gate #else 87*7c478bd9Sstevel@tonic-gate #define T_BIND_REQ 6 88*7c478bd9Sstevel@tonic-gate #endif /* _SUN_TPI_VERSION > 0 */ 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate #define T_UNBIND_REQ 7 /* unbind request */ 91*7c478bd9Sstevel@tonic-gate #define T_UNITDATA_REQ 8 /* unitdata request */ 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate /* 94*7c478bd9Sstevel@tonic-gate * Option management request (with TLI inspired semantics ) 95*7c478bd9Sstevel@tonic-gate * The preferred name for this primitive in new code is T_SVR4_OPTMGMT_REQ. 96*7c478bd9Sstevel@tonic-gate * This primitive had the name T_OPTMGMT_REQ in old SVR4 derived TPI. 97*7c478bd9Sstevel@tonic-gate * This primitive is used for TLI and Socket API support. 98*7c478bd9Sstevel@tonic-gate * The packing of options in option buffer is private contract 99*7c478bd9Sstevel@tonic-gate * between transport provider and its users and can differ 100*7c478bd9Sstevel@tonic-gate * between different transports. 101*7c478bd9Sstevel@tonic-gate * (The name O_T_OPTMGMT_REQ continues to exist for Solaris 2.6 102*7c478bd9Sstevel@tonic-gate * compilation environment compatibility only) 103*7c478bd9Sstevel@tonic-gate * 104*7c478bd9Sstevel@tonic-gate */ 105*7c478bd9Sstevel@tonic-gate #define T_SVR4_OPTMGMT_REQ 9 106*7c478bd9Sstevel@tonic-gate #if _SUN_TPI_VERSION > 0 107*7c478bd9Sstevel@tonic-gate #define O_T_OPTMGMT_REQ T_SVR4_OPTMGMT_REQ 108*7c478bd9Sstevel@tonic-gate #else 109*7c478bd9Sstevel@tonic-gate #define T_OPTMGMT_REQ T_SVR4_OPTMGMT_REQ 110*7c478bd9Sstevel@tonic-gate #endif /* _SUN_TPI_VERSION > 0 */ 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate #define T_ORDREL_REQ 10 /* orderly release req */ 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate /* 115*7c478bd9Sstevel@tonic-gate * Primitives that are initiated by the transport provider. 116*7c478bd9Sstevel@tonic-gate */ 117*7c478bd9Sstevel@tonic-gate #define T_CONN_IND 11 /* connection indication */ 118*7c478bd9Sstevel@tonic-gate #define T_CONN_CON 12 /* connection confirmation */ 119*7c478bd9Sstevel@tonic-gate #define T_DISCON_IND 13 /* disconnect indication */ 120*7c478bd9Sstevel@tonic-gate #define T_DATA_IND 14 /* data indication */ 121*7c478bd9Sstevel@tonic-gate #define T_EXDATA_IND 15 /* expeditied data indication */ 122*7c478bd9Sstevel@tonic-gate #define T_INFO_ACK 16 /* information acknowledgment */ 123*7c478bd9Sstevel@tonic-gate #define T_BIND_ACK 17 /* bind acknowledment */ 124*7c478bd9Sstevel@tonic-gate #define T_ERROR_ACK 18 /* error acknowledgment */ 125*7c478bd9Sstevel@tonic-gate #define T_OK_ACK 19 /* ok acknowledgment */ 126*7c478bd9Sstevel@tonic-gate #define T_UNITDATA_IND 20 /* unitdata indication */ 127*7c478bd9Sstevel@tonic-gate #define T_UDERROR_IND 21 /* unitdata error indication */ 128*7c478bd9Sstevel@tonic-gate #define T_OPTMGMT_ACK 22 /* manage options ack */ 129*7c478bd9Sstevel@tonic-gate #define T_ORDREL_IND 23 /* orderly release ind */ 130*7c478bd9Sstevel@tonic-gate /* 131*7c478bd9Sstevel@tonic-gate * Primitives added to namespace and contain a mix of ones 132*7c478bd9Sstevel@tonic-gate * initiated by transport user or provider. 133*7c478bd9Sstevel@tonic-gate */ 134*7c478bd9Sstevel@tonic-gate #define T_ADDR_REQ 24 /* address request */ 135*7c478bd9Sstevel@tonic-gate #define T_ADDR_ACK 25 /* address acknowledgement */ 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate #if _SUN_TPI_VERSION > 0 138*7c478bd9Sstevel@tonic-gate /* 139*7c478bd9Sstevel@tonic-gate * Bind request primitive with better address 140*7c478bd9Sstevel@tonic-gate * binding semantics. (XTI inspired) 141*7c478bd9Sstevel@tonic-gate * If the requested address is found to be busy, 142*7c478bd9Sstevel@tonic-gate * an error is returned. (No need to compare addresses on successful 143*7c478bd9Sstevel@tonic-gate * bind acknowledgement). 144*7c478bd9Sstevel@tonic-gate */ 145*7c478bd9Sstevel@tonic-gate #define T_BIND_REQ 26 /* bind request */ 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate /* 148*7c478bd9Sstevel@tonic-gate * Option management request (with XTI inspired semantics) 149*7c478bd9Sstevel@tonic-gate * The packing of options in option buffer is required to 150*7c478bd9Sstevel@tonic-gate * be with 'struct T_opthdr' data structure defined later in 151*7c478bd9Sstevel@tonic-gate * this header. 152*7c478bd9Sstevel@tonic-gate */ 153*7c478bd9Sstevel@tonic-gate #define T_OPTMGMT_REQ 27 /* manage options req - T_opthdr option header */ 154*7c478bd9Sstevel@tonic-gate #endif /* _SUN_TPI_VERSION > 0 */ 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate #if _SUN_TPI_VERSION > 1 157*7c478bd9Sstevel@tonic-gate /* 158*7c478bd9Sstevel@tonic-gate * The connection response that expects its ACCEPTOR_id to have been 159*7c478bd9Sstevel@tonic-gate * filled in from the value supplied via a T_CAPABILITY_ACK. 160*7c478bd9Sstevel@tonic-gate */ 161*7c478bd9Sstevel@tonic-gate #define T_CONN_RES 28 /* connection response */ 162*7c478bd9Sstevel@tonic-gate 163*7c478bd9Sstevel@tonic-gate /* 164*7c478bd9Sstevel@tonic-gate * Capability request and ack. These primitives are optional and 165*7c478bd9Sstevel@tonic-gate * subsume the functionality of T_INFO_{REQ,ACK}. 166*7c478bd9Sstevel@tonic-gate */ 167*7c478bd9Sstevel@tonic-gate #define T_CAPABILITY_REQ 30 168*7c478bd9Sstevel@tonic-gate #define T_CAPABILITY_ACK 31 169*7c478bd9Sstevel@tonic-gate #endif /* _SUN_TPI_VERSION > 1 */ 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 172*7c478bd9Sstevel@tonic-gate /* 173*7c478bd9Sstevel@tonic-gate * Sun private TPI extensions. They are currently used for transparently 174*7c478bd9Sstevel@tonic-gate * passing options through the connection-oriented loopback transport. 175*7c478bd9Sstevel@tonic-gate * Values assigned to them may change. 176*7c478bd9Sstevel@tonic-gate * 177*7c478bd9Sstevel@tonic-gate * T_EXTCONN_IND (extended T_CONN_IND) is used to return dst as well as 178*7c478bd9Sstevel@tonic-gate * src addr/port. 179*7c478bd9Sstevel@tonic-gate */ 180*7c478bd9Sstevel@tonic-gate #define T_OPTDATA_REQ 0x1001 /* data (with options) request */ 181*7c478bd9Sstevel@tonic-gate #define T_OPTDATA_IND 0x1002 /* data (with options) indication */ 182*7c478bd9Sstevel@tonic-gate #define T_EXTCONN_IND 0x1003 /* extended T_CONN_IND to return dst as well */ 183*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate /* 186*7c478bd9Sstevel@tonic-gate * The following are the events that drive the state machine 187*7c478bd9Sstevel@tonic-gate */ 188*7c478bd9Sstevel@tonic-gate /* Initialization events */ 189*7c478bd9Sstevel@tonic-gate #define TE_BIND_REQ 0 /* bind request */ 190*7c478bd9Sstevel@tonic-gate #define TE_UNBIND_REQ 1 /* unbind request */ 191*7c478bd9Sstevel@tonic-gate #define TE_OPTMGMT_REQ 2 /* manage options req */ 192*7c478bd9Sstevel@tonic-gate #define TE_BIND_ACK 3 /* bind acknowledment */ 193*7c478bd9Sstevel@tonic-gate #define TE_OPTMGMT_ACK 4 /* manage options ack */ 194*7c478bd9Sstevel@tonic-gate #define TE_ERROR_ACK 5 /* error acknowledgment */ 195*7c478bd9Sstevel@tonic-gate #define TE_OK_ACK1 6 /* ok ack seqcnt == 0 */ 196*7c478bd9Sstevel@tonic-gate #define TE_OK_ACK2 7 /* ok ack seqcnt == 1, q == resq */ 197*7c478bd9Sstevel@tonic-gate #define TE_OK_ACK3 8 /* ok ack seqcnt == 1, q != resq */ 198*7c478bd9Sstevel@tonic-gate #define TE_OK_ACK4 9 /* ok ack seqcnt > 1 */ 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate /* Connection oriented events */ 201*7c478bd9Sstevel@tonic-gate #define TE_CONN_REQ 10 /* connection request */ 202*7c478bd9Sstevel@tonic-gate #define TE_CONN_RES 11 /* connection response */ 203*7c478bd9Sstevel@tonic-gate #define TE_DISCON_REQ 12 /* disconnect request */ 204*7c478bd9Sstevel@tonic-gate #define TE_DATA_REQ 13 /* data request */ 205*7c478bd9Sstevel@tonic-gate #define TE_EXDATA_REQ 14 /* expedited data request */ 206*7c478bd9Sstevel@tonic-gate #define TE_ORDREL_REQ 15 /* orderly release req */ 207*7c478bd9Sstevel@tonic-gate #define TE_CONN_IND 16 /* connection indication */ 208*7c478bd9Sstevel@tonic-gate #define TE_CONN_CON 17 /* connection confirmation */ 209*7c478bd9Sstevel@tonic-gate #define TE_DATA_IND 18 /* data indication */ 210*7c478bd9Sstevel@tonic-gate #define TE_EXDATA_IND 19 /* expedited data indication */ 211*7c478bd9Sstevel@tonic-gate #define TE_ORDREL_IND 20 /* orderly release ind */ 212*7c478bd9Sstevel@tonic-gate #define TE_DISCON_IND1 21 /* disconnect indication seq == 0 */ 213*7c478bd9Sstevel@tonic-gate #define TE_DISCON_IND2 22 /* disconnect indication seq == 1 */ 214*7c478bd9Sstevel@tonic-gate #define TE_DISCON_IND3 23 /* disconnect indication seq > 1 */ 215*7c478bd9Sstevel@tonic-gate #define TE_PASS_CONN 24 /* pass connection */ 216*7c478bd9Sstevel@tonic-gate 217*7c478bd9Sstevel@tonic-gate /* Unit data events */ 218*7c478bd9Sstevel@tonic-gate #define TE_UNITDATA_REQ 25 /* unitdata request */ 219*7c478bd9Sstevel@tonic-gate #define TE_UNITDATA_IND 26 /* unitdata indication */ 220*7c478bd9Sstevel@tonic-gate #define TE_UDERROR_IND 27 /* unitdata error indication */ 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate #define TE_NOEVENTS 28 223*7c478bd9Sstevel@tonic-gate /* 224*7c478bd9Sstevel@tonic-gate * The following are the possible states of the Transport 225*7c478bd9Sstevel@tonic-gate * Service Interface 226*7c478bd9Sstevel@tonic-gate */ 227*7c478bd9Sstevel@tonic-gate 228*7c478bd9Sstevel@tonic-gate #define TS_UNBND 0 /* unbound */ 229*7c478bd9Sstevel@tonic-gate #define TS_WACK_BREQ 1 /* waiting ack of BIND_REQ */ 230*7c478bd9Sstevel@tonic-gate #define TS_WACK_UREQ 2 /* waiting ack of UNBIND_REQ */ 231*7c478bd9Sstevel@tonic-gate #define TS_IDLE 3 /* idle */ 232*7c478bd9Sstevel@tonic-gate #define TS_WACK_OPTREQ 4 /* wait ack options request */ 233*7c478bd9Sstevel@tonic-gate #define TS_WACK_CREQ 5 /* waiting ack of CONN_REQ */ 234*7c478bd9Sstevel@tonic-gate #define TS_WCON_CREQ 6 /* waiting confirm of CONN_REQ */ 235*7c478bd9Sstevel@tonic-gate #define TS_WRES_CIND 7 /* waiting response of CONN_IND */ 236*7c478bd9Sstevel@tonic-gate #define TS_WACK_CRES 8 /* waiting ack of CONN_RES */ 237*7c478bd9Sstevel@tonic-gate #define TS_DATA_XFER 9 /* data transfer */ 238*7c478bd9Sstevel@tonic-gate #define TS_WIND_ORDREL 10 /* releasing rd but not wr */ 239*7c478bd9Sstevel@tonic-gate #define TS_WREQ_ORDREL 11 /* wait to release wr but not rd */ 240*7c478bd9Sstevel@tonic-gate #define TS_WACK_DREQ6 12 /* waiting ack of DISCON_REQ */ 241*7c478bd9Sstevel@tonic-gate #define TS_WACK_DREQ7 13 /* waiting ack of DISCON_REQ */ 242*7c478bd9Sstevel@tonic-gate #define TS_WACK_DREQ9 14 /* waiting ack of DISCON_REQ */ 243*7c478bd9Sstevel@tonic-gate #define TS_WACK_DREQ10 15 /* waiting ack of DISCON_REQ */ 244*7c478bd9Sstevel@tonic-gate #define TS_WACK_DREQ11 16 /* waiting ack of DISCON_REQ */ 245*7c478bd9Sstevel@tonic-gate 246*7c478bd9Sstevel@tonic-gate #define TS_NOSTATES 17 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate /* 250*7c478bd9Sstevel@tonic-gate * The following structure definitions define the format of the 251*7c478bd9Sstevel@tonic-gate * stream message block of the above primitives. 252*7c478bd9Sstevel@tonic-gate * (everything is declared t_scalar_t to ensure proper alignment 253*7c478bd9Sstevel@tonic-gate * across different machines) 254*7c478bd9Sstevel@tonic-gate */ 255*7c478bd9Sstevel@tonic-gate 256*7c478bd9Sstevel@tonic-gate /* connection request */ 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate struct T_conn_req { 259*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_CONN_REQ */ 260*7c478bd9Sstevel@tonic-gate t_scalar_t DEST_length; /* dest addr length */ 261*7c478bd9Sstevel@tonic-gate t_scalar_t DEST_offset; /* dest addr offset */ 262*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 263*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 264*7c478bd9Sstevel@tonic-gate }; 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate /* connect response */ 267*7c478bd9Sstevel@tonic-gate 268*7c478bd9Sstevel@tonic-gate /* 269*7c478bd9Sstevel@tonic-gate * Historical compatibility note for "struct T_conn_res" usage. 270*7c478bd9Sstevel@tonic-gate * "QUEUE_ptr" field of type "queue_t" is obsolete to support 271*7c478bd9Sstevel@tonic-gate * code portability and application binary compatibility 272*7c478bd9Sstevel@tonic-gate * between ILP32(32-bit) and LP64 (64-bit) environments. 273*7c478bd9Sstevel@tonic-gate * Use field "ACCEPTOR_id" instead. 274*7c478bd9Sstevel@tonic-gate * For compatibility, drivers using (_SUN_TPI_VERSION >= 2) interface 275*7c478bd9Sstevel@tonic-gate * can support treating ACCEPTOR_id content as queue pointer 276*7c478bd9Sstevel@tonic-gate * only when PRIM_type is O_T_CONN_RES. 277*7c478bd9Sstevel@tonic-gate */ 278*7c478bd9Sstevel@tonic-gate struct T_conn_res { 279*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* T_CONN_RES (or O_T_CONN_RES) */ 280*7c478bd9Sstevel@tonic-gate t_uscalar_t ACCEPTOR_id; /* id of accepting endpoint */ 281*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 282*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 283*7c478bd9Sstevel@tonic-gate t_scalar_t SEQ_number; /* sequence number */ 284*7c478bd9Sstevel@tonic-gate }; 285*7c478bd9Sstevel@tonic-gate 286*7c478bd9Sstevel@tonic-gate /* disconnect request */ 287*7c478bd9Sstevel@tonic-gate 288*7c478bd9Sstevel@tonic-gate struct T_discon_req { 289*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_DISCON_REQ */ 290*7c478bd9Sstevel@tonic-gate t_scalar_t SEQ_number; /* sequnce number */ 291*7c478bd9Sstevel@tonic-gate }; 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate /* data request */ 294*7c478bd9Sstevel@tonic-gate 295*7c478bd9Sstevel@tonic-gate struct T_data_req { 296*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_DATA_REQ */ 297*7c478bd9Sstevel@tonic-gate t_scalar_t MORE_flag; /* more data */ 298*7c478bd9Sstevel@tonic-gate }; 299*7c478bd9Sstevel@tonic-gate 300*7c478bd9Sstevel@tonic-gate /* expedited data request */ 301*7c478bd9Sstevel@tonic-gate 302*7c478bd9Sstevel@tonic-gate struct T_exdata_req { 303*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_EXDATA_REQ */ 304*7c478bd9Sstevel@tonic-gate t_scalar_t MORE_flag; /* more data */ 305*7c478bd9Sstevel@tonic-gate }; 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate /* information request */ 308*7c478bd9Sstevel@tonic-gate 309*7c478bd9Sstevel@tonic-gate struct T_info_req { 310*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_INFO_REQ */ 311*7c478bd9Sstevel@tonic-gate }; 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate /* bind request */ 314*7c478bd9Sstevel@tonic-gate 315*7c478bd9Sstevel@tonic-gate struct T_bind_req { 316*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* T_BIND_REQ (or O_T_BIND_REQ) */ 317*7c478bd9Sstevel@tonic-gate t_scalar_t ADDR_length; /* addr length */ 318*7c478bd9Sstevel@tonic-gate t_scalar_t ADDR_offset; /* addr offset */ 319*7c478bd9Sstevel@tonic-gate t_uscalar_t CONIND_number; /* connect indications requested */ 320*7c478bd9Sstevel@tonic-gate }; 321*7c478bd9Sstevel@tonic-gate 322*7c478bd9Sstevel@tonic-gate /* unbind request */ 323*7c478bd9Sstevel@tonic-gate 324*7c478bd9Sstevel@tonic-gate struct T_unbind_req { 325*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_UNBIND_REQ */ 326*7c478bd9Sstevel@tonic-gate }; 327*7c478bd9Sstevel@tonic-gate 328*7c478bd9Sstevel@tonic-gate /* unitdata request */ 329*7c478bd9Sstevel@tonic-gate 330*7c478bd9Sstevel@tonic-gate struct T_unitdata_req { 331*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_UNITDATA_REQ */ 332*7c478bd9Sstevel@tonic-gate t_scalar_t DEST_length; /* dest addr length */ 333*7c478bd9Sstevel@tonic-gate t_scalar_t DEST_offset; /* dest addr offset */ 334*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 335*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 336*7c478bd9Sstevel@tonic-gate }; 337*7c478bd9Sstevel@tonic-gate 338*7c478bd9Sstevel@tonic-gate /* manage options request */ 339*7c478bd9Sstevel@tonic-gate 340*7c478bd9Sstevel@tonic-gate struct T_optmgmt_req { 341*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* T_OPTMGMT_REQ or */ 342*7c478bd9Sstevel@tonic-gate /* T_SVR4_OPTMGMT_REQ */ 343*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 344*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 345*7c478bd9Sstevel@tonic-gate t_scalar_t MGMT_flags; /* options flags */ 346*7c478bd9Sstevel@tonic-gate }; 347*7c478bd9Sstevel@tonic-gate 348*7c478bd9Sstevel@tonic-gate /* orderly release request */ 349*7c478bd9Sstevel@tonic-gate 350*7c478bd9Sstevel@tonic-gate struct T_ordrel_req { 351*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_ORDREL_REQ */ 352*7c478bd9Sstevel@tonic-gate }; 353*7c478bd9Sstevel@tonic-gate 354*7c478bd9Sstevel@tonic-gate /* protocol address request */ 355*7c478bd9Sstevel@tonic-gate 356*7c478bd9Sstevel@tonic-gate struct T_addr_req { 357*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_ADDR_REQ */ 358*7c478bd9Sstevel@tonic-gate }; 359*7c478bd9Sstevel@tonic-gate 360*7c478bd9Sstevel@tonic-gate /* connect indication */ 361*7c478bd9Sstevel@tonic-gate 362*7c478bd9Sstevel@tonic-gate struct T_conn_ind { 363*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_CONN_IND */ 364*7c478bd9Sstevel@tonic-gate t_scalar_t SRC_length; /* src addr length */ 365*7c478bd9Sstevel@tonic-gate t_scalar_t SRC_offset; /* src addr offset */ 366*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* option length */ 367*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* option offset */ 368*7c478bd9Sstevel@tonic-gate t_scalar_t SEQ_number; /* sequnce number */ 369*7c478bd9Sstevel@tonic-gate }; 370*7c478bd9Sstevel@tonic-gate 371*7c478bd9Sstevel@tonic-gate /* connect confirmation */ 372*7c478bd9Sstevel@tonic-gate 373*7c478bd9Sstevel@tonic-gate struct T_conn_con { 374*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_CONN_CON */ 375*7c478bd9Sstevel@tonic-gate t_scalar_t RES_length; /* responding addr length */ 376*7c478bd9Sstevel@tonic-gate t_scalar_t RES_offset; /* responding addr offset */ 377*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* option length */ 378*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* option offset */ 379*7c478bd9Sstevel@tonic-gate }; 380*7c478bd9Sstevel@tonic-gate 381*7c478bd9Sstevel@tonic-gate /* disconnect indication */ 382*7c478bd9Sstevel@tonic-gate 383*7c478bd9Sstevel@tonic-gate struct T_discon_ind { 384*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_DISCON_IND */ 385*7c478bd9Sstevel@tonic-gate t_scalar_t DISCON_reason; /* disconnect reason */ 386*7c478bd9Sstevel@tonic-gate t_scalar_t SEQ_number; /* sequnce number */ 387*7c478bd9Sstevel@tonic-gate }; 388*7c478bd9Sstevel@tonic-gate 389*7c478bd9Sstevel@tonic-gate /* data indication */ 390*7c478bd9Sstevel@tonic-gate 391*7c478bd9Sstevel@tonic-gate struct T_data_ind { 392*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_DATA_IND */ 393*7c478bd9Sstevel@tonic-gate t_scalar_t MORE_flag; /* more data */ 394*7c478bd9Sstevel@tonic-gate }; 395*7c478bd9Sstevel@tonic-gate 396*7c478bd9Sstevel@tonic-gate /* expedited data indication */ 397*7c478bd9Sstevel@tonic-gate 398*7c478bd9Sstevel@tonic-gate struct T_exdata_ind { 399*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_EXDATA_IND */ 400*7c478bd9Sstevel@tonic-gate t_scalar_t MORE_flag; /* more data */ 401*7c478bd9Sstevel@tonic-gate }; 402*7c478bd9Sstevel@tonic-gate 403*7c478bd9Sstevel@tonic-gate /* information acknowledgment */ 404*7c478bd9Sstevel@tonic-gate 405*7c478bd9Sstevel@tonic-gate struct T_info_ack { 406*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_INFO_ACK */ 407*7c478bd9Sstevel@tonic-gate t_scalar_t TSDU_size; /* max TSDU size */ 408*7c478bd9Sstevel@tonic-gate t_scalar_t ETSDU_size; /* max ETSDU size */ 409*7c478bd9Sstevel@tonic-gate t_scalar_t CDATA_size; /* max connect data size */ 410*7c478bd9Sstevel@tonic-gate t_scalar_t DDATA_size; /* max discon data size */ 411*7c478bd9Sstevel@tonic-gate t_scalar_t ADDR_size; /* address size */ 412*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_size; /* options size */ 413*7c478bd9Sstevel@tonic-gate t_scalar_t TIDU_size; /* max TIDU size */ 414*7c478bd9Sstevel@tonic-gate t_scalar_t SERV_type; /* provider service type */ 415*7c478bd9Sstevel@tonic-gate t_scalar_t CURRENT_state; /* current state */ 416*7c478bd9Sstevel@tonic-gate t_scalar_t PROVIDER_flag; /* provider flags */ 417*7c478bd9Sstevel@tonic-gate }; 418*7c478bd9Sstevel@tonic-gate 419*7c478bd9Sstevel@tonic-gate /* 420*7c478bd9Sstevel@tonic-gate * The following are definitions of flags available to the transport 421*7c478bd9Sstevel@tonic-gate * provider to set in the PROVIDER_flag field of the T_info_ack 422*7c478bd9Sstevel@tonic-gate * structure. 423*7c478bd9Sstevel@tonic-gate */ 424*7c478bd9Sstevel@tonic-gate 425*7c478bd9Sstevel@tonic-gate #if _SUN_TPI_VERSION > 0 426*7c478bd9Sstevel@tonic-gate #define SENDZERO 0x0001 /* provider can handle --length TSDUs */ 427*7c478bd9Sstevel@tonic-gate 428*7c478bd9Sstevel@tonic-gate #define OLD_SENDZERO 0x1000 /* reserved for compatibility with */ 429*7c478bd9Sstevel@tonic-gate /* old providers- old value of */ 430*7c478bd9Sstevel@tonic-gate /* SENDZERO defined in <sys/timod.h> */ 431*7c478bd9Sstevel@tonic-gate #else 432*7c478bd9Sstevel@tonic-gate #define SENDZERO 0x1000 /* old SENDZERO value */ 433*7c478bd9Sstevel@tonic-gate #endif /* _SUN_TPI_VERSION > 0 */ 434*7c478bd9Sstevel@tonic-gate 435*7c478bd9Sstevel@tonic-gate #define EXPINLINE 0x0002 /* provider wants ETSDUs in band 0 */ 436*7c478bd9Sstevel@tonic-gate /* 437*7c478bd9Sstevel@tonic-gate * Flag XPG4_1: 438*7c478bd9Sstevel@tonic-gate * transport provider supports TPI modifications motivated by and 439*7c478bd9Sstevel@tonic-gate * in conjunction with XTI inspired TPI support and all the 440*7c478bd9Sstevel@tonic-gate * compatibility baggage that implies. 441*7c478bd9Sstevel@tonic-gate * It implies, - primitives T_ADDR_REQ & T_ADDR_ACK supported 442*7c478bd9Sstevel@tonic-gate * - primitives O_T_BIND_REQ & T_BIND_REQ separately supported 443*7c478bd9Sstevel@tonic-gate * - primitives T_SVR4_OPTMGMT_REQ & T_OPTMGMT_REQ separately 444*7c478bd9Sstevel@tonic-gate * supported. 445*7c478bd9Sstevel@tonic-gate */ 446*7c478bd9Sstevel@tonic-gate #define XPG4_1 0x0004 447*7c478bd9Sstevel@tonic-gate 448*7c478bd9Sstevel@tonic-gate /* bind acknowledgment */ 449*7c478bd9Sstevel@tonic-gate 450*7c478bd9Sstevel@tonic-gate struct T_bind_ack { 451*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_BIND_ACK */ 452*7c478bd9Sstevel@tonic-gate t_scalar_t ADDR_length; /* addr length */ 453*7c478bd9Sstevel@tonic-gate t_scalar_t ADDR_offset; /* addr offset */ 454*7c478bd9Sstevel@tonic-gate t_uscalar_t CONIND_number; /* connect ind to be queued */ 455*7c478bd9Sstevel@tonic-gate }; 456*7c478bd9Sstevel@tonic-gate 457*7c478bd9Sstevel@tonic-gate /* error acknowledgment */ 458*7c478bd9Sstevel@tonic-gate 459*7c478bd9Sstevel@tonic-gate struct T_error_ack { 460*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_ERROR_ACK */ 461*7c478bd9Sstevel@tonic-gate t_scalar_t ERROR_prim; /* primitive in error */ 462*7c478bd9Sstevel@tonic-gate t_scalar_t TLI_error; /* TLI error code */ 463*7c478bd9Sstevel@tonic-gate t_scalar_t UNIX_error; /* UNIX error code */ 464*7c478bd9Sstevel@tonic-gate }; 465*7c478bd9Sstevel@tonic-gate 466*7c478bd9Sstevel@tonic-gate /* ok acknowledgment */ 467*7c478bd9Sstevel@tonic-gate 468*7c478bd9Sstevel@tonic-gate struct T_ok_ack { 469*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_OK_ACK */ 470*7c478bd9Sstevel@tonic-gate t_scalar_t CORRECT_prim; /* correct primitive */ 471*7c478bd9Sstevel@tonic-gate }; 472*7c478bd9Sstevel@tonic-gate 473*7c478bd9Sstevel@tonic-gate /* unitdata indication */ 474*7c478bd9Sstevel@tonic-gate 475*7c478bd9Sstevel@tonic-gate struct T_unitdata_ind { 476*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_UNITDATA_IND */ 477*7c478bd9Sstevel@tonic-gate t_scalar_t SRC_length; /* source addr length */ 478*7c478bd9Sstevel@tonic-gate t_scalar_t SRC_offset; /* source addr offset */ 479*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 480*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 481*7c478bd9Sstevel@tonic-gate }; 482*7c478bd9Sstevel@tonic-gate 483*7c478bd9Sstevel@tonic-gate /* unitdata error indication */ 484*7c478bd9Sstevel@tonic-gate 485*7c478bd9Sstevel@tonic-gate struct T_uderror_ind { 486*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_UDERROR_IND */ 487*7c478bd9Sstevel@tonic-gate t_scalar_t DEST_length; /* dest addr length */ 488*7c478bd9Sstevel@tonic-gate t_scalar_t DEST_offset; /* dest addr offset */ 489*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 490*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 491*7c478bd9Sstevel@tonic-gate t_scalar_t ERROR_type; /* error type */ 492*7c478bd9Sstevel@tonic-gate }; 493*7c478bd9Sstevel@tonic-gate 494*7c478bd9Sstevel@tonic-gate /* manage options ack */ 495*7c478bd9Sstevel@tonic-gate 496*7c478bd9Sstevel@tonic-gate struct T_optmgmt_ack { 497*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_OPTMGMT_ACK */ 498*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 499*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 500*7c478bd9Sstevel@tonic-gate t_scalar_t MGMT_flags; /* managment flags */ 501*7c478bd9Sstevel@tonic-gate }; 502*7c478bd9Sstevel@tonic-gate 503*7c478bd9Sstevel@tonic-gate /* orderly release indication */ 504*7c478bd9Sstevel@tonic-gate 505*7c478bd9Sstevel@tonic-gate struct T_ordrel_ind { 506*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_ORDREL_IND */ 507*7c478bd9Sstevel@tonic-gate }; 508*7c478bd9Sstevel@tonic-gate 509*7c478bd9Sstevel@tonic-gate 510*7c478bd9Sstevel@tonic-gate /* protocol address acknowledgment */ 511*7c478bd9Sstevel@tonic-gate 512*7c478bd9Sstevel@tonic-gate struct T_addr_ack { 513*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_ADDR_ACK */ 514*7c478bd9Sstevel@tonic-gate t_scalar_t LOCADDR_length; /* length of local address */ 515*7c478bd9Sstevel@tonic-gate t_scalar_t LOCADDR_offset; /* offset of local address */ 516*7c478bd9Sstevel@tonic-gate t_scalar_t REMADDR_length; /* length of remote address */ 517*7c478bd9Sstevel@tonic-gate t_scalar_t REMADDR_offset; /* offset of remote address */ 518*7c478bd9Sstevel@tonic-gate }; 519*7c478bd9Sstevel@tonic-gate 520*7c478bd9Sstevel@tonic-gate #if _SUN_TPI_VERSION > 1 521*7c478bd9Sstevel@tonic-gate /* 522*7c478bd9Sstevel@tonic-gate * Capability request and ack. These primitives are optional and 523*7c478bd9Sstevel@tonic-gate * subsume the functionality of T_INFO_{REQ,ACK}. 524*7c478bd9Sstevel@tonic-gate */ 525*7c478bd9Sstevel@tonic-gate struct T_capability_req { 526*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_CAPABILITY_REQ */ 527*7c478bd9Sstevel@tonic-gate t_uscalar_t CAP_bits1; /* capability bits #1 */ 528*7c478bd9Sstevel@tonic-gate }; 529*7c478bd9Sstevel@tonic-gate 530*7c478bd9Sstevel@tonic-gate struct T_capability_ack { 531*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_CAPABILITY_ACK */ 532*7c478bd9Sstevel@tonic-gate t_uscalar_t CAP_bits1; /* capability bits #1 */ 533*7c478bd9Sstevel@tonic-gate struct T_info_ack 534*7c478bd9Sstevel@tonic-gate INFO_ack; /* info acknowledgement */ 535*7c478bd9Sstevel@tonic-gate t_uscalar_t ACCEPTOR_id; /* accepting endpoint id */ 536*7c478bd9Sstevel@tonic-gate }; 537*7c478bd9Sstevel@tonic-gate 538*7c478bd9Sstevel@tonic-gate #define TC1_INFO (1u << 0) /* Info request/ack */ 539*7c478bd9Sstevel@tonic-gate #define TC1_ACCEPTOR_ID (1u << 1) /* Acceptor_id request/ack */ 540*7c478bd9Sstevel@tonic-gate #define TC1_CAP_BITS2 (1u << 31) /* Reserved for future use */ 541*7c478bd9Sstevel@tonic-gate 542*7c478bd9Sstevel@tonic-gate #endif /* _SUN_TPI_VERSION > 1 */ 543*7c478bd9Sstevel@tonic-gate 544*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 545*7c478bd9Sstevel@tonic-gate /* 546*7c478bd9Sstevel@tonic-gate * Private Sun TPI extensions. 547*7c478bd9Sstevel@tonic-gate */ 548*7c478bd9Sstevel@tonic-gate 549*7c478bd9Sstevel@tonic-gate /* data (with options) request */ 550*7c478bd9Sstevel@tonic-gate struct T_optdata_req { 551*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_OPTDATA_REQ */ 552*7c478bd9Sstevel@tonic-gate t_scalar_t DATA_flag; /* flags like "more data" */ 553*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 554*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 555*7c478bd9Sstevel@tonic-gate }; 556*7c478bd9Sstevel@tonic-gate 557*7c478bd9Sstevel@tonic-gate /* data (with options) indication */ 558*7c478bd9Sstevel@tonic-gate struct T_optdata_ind { 559*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_OPTDATA_IND */ 560*7c478bd9Sstevel@tonic-gate t_scalar_t DATA_flag; /* flags like "more data" */ 561*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* options length */ 562*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* options offset */ 563*7c478bd9Sstevel@tonic-gate }; 564*7c478bd9Sstevel@tonic-gate 565*7c478bd9Sstevel@tonic-gate /* extended connect indication to return dst addr/port as well as src */ 566*7c478bd9Sstevel@tonic-gate struct T_extconn_ind { 567*7c478bd9Sstevel@tonic-gate t_scalar_t PRIM_type; /* always T_EXTCONN_IND */ 568*7c478bd9Sstevel@tonic-gate t_scalar_t SRC_length; /* src addr length */ 569*7c478bd9Sstevel@tonic-gate t_scalar_t SRC_offset; /* src addr offset */ 570*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_length; /* option length */ 571*7c478bd9Sstevel@tonic-gate t_scalar_t OPT_offset; /* option offset */ 572*7c478bd9Sstevel@tonic-gate t_scalar_t SEQ_number; /* sequnce number */ 573*7c478bd9Sstevel@tonic-gate t_scalar_t DEST_length; /* dest addr length */ 574*7c478bd9Sstevel@tonic-gate t_scalar_t DEST_offset; /* dest addr offset */ 575*7c478bd9Sstevel@tonic-gate }; 576*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 577*7c478bd9Sstevel@tonic-gate 578*7c478bd9Sstevel@tonic-gate /* 579*7c478bd9Sstevel@tonic-gate * The following is a union of the primitives 580*7c478bd9Sstevel@tonic-gate */ 581*7c478bd9Sstevel@tonic-gate union T_primitives { 582*7c478bd9Sstevel@tonic-gate t_scalar_t type; /* primitive type */ 583*7c478bd9Sstevel@tonic-gate struct T_conn_req conn_req; /* connect request */ 584*7c478bd9Sstevel@tonic-gate struct T_conn_res conn_res; /* connect response */ 585*7c478bd9Sstevel@tonic-gate struct T_discon_req discon_req; /* disconnect request */ 586*7c478bd9Sstevel@tonic-gate struct T_data_req data_req; /* data request */ 587*7c478bd9Sstevel@tonic-gate struct T_exdata_req exdata_req; /* expedited data req */ 588*7c478bd9Sstevel@tonic-gate struct T_info_req info_req; /* information req */ 589*7c478bd9Sstevel@tonic-gate struct T_bind_req bind_req; /* bind request */ 590*7c478bd9Sstevel@tonic-gate struct T_unbind_req unbind_req; /* unbind request */ 591*7c478bd9Sstevel@tonic-gate struct T_unitdata_req unitdata_req; /* unitdata requset */ 592*7c478bd9Sstevel@tonic-gate struct T_optmgmt_req optmgmt_req; /* manage opt req */ 593*7c478bd9Sstevel@tonic-gate struct T_ordrel_req ordrel_req; /* orderly rel req */ 594*7c478bd9Sstevel@tonic-gate struct T_addr_req addr_req; /* address request */ 595*7c478bd9Sstevel@tonic-gate struct T_conn_ind conn_ind; /* connect indication */ 596*7c478bd9Sstevel@tonic-gate struct T_conn_con conn_con; /* connect corfirm */ 597*7c478bd9Sstevel@tonic-gate struct T_discon_ind discon_ind; /* discon indication */ 598*7c478bd9Sstevel@tonic-gate struct T_data_ind data_ind; /* data indication */ 599*7c478bd9Sstevel@tonic-gate struct T_exdata_ind exdata_ind; /* expedited data ind */ 600*7c478bd9Sstevel@tonic-gate struct T_info_ack info_ack; /* info ack */ 601*7c478bd9Sstevel@tonic-gate struct T_bind_ack bind_ack; /* bind ack */ 602*7c478bd9Sstevel@tonic-gate struct T_error_ack error_ack; /* error ack */ 603*7c478bd9Sstevel@tonic-gate struct T_ok_ack ok_ack; /* ok ack */ 604*7c478bd9Sstevel@tonic-gate struct T_unitdata_ind unitdata_ind; /* unitdata ind */ 605*7c478bd9Sstevel@tonic-gate struct T_uderror_ind uderror_ind; /* unitdata error ind */ 606*7c478bd9Sstevel@tonic-gate struct T_optmgmt_ack optmgmt_ack; /* manage opt ack */ 607*7c478bd9Sstevel@tonic-gate struct T_ordrel_ind ordrel_ind; /* orderly rel ind */ 608*7c478bd9Sstevel@tonic-gate struct T_addr_ack addr_ack; /* address ack */ 609*7c478bd9Sstevel@tonic-gate #if _SUN_TPI_VERSION > 1 610*7c478bd9Sstevel@tonic-gate struct T_capability_req capability_req; /* capability req */ 611*7c478bd9Sstevel@tonic-gate struct T_capability_ack capability_ack; /* capability ack */ 612*7c478bd9Sstevel@tonic-gate #endif /* _SUN_TPI_VERSION > 1 */ 613*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 614*7c478bd9Sstevel@tonic-gate struct T_optdata_req optdata_req; /* option data request */ 615*7c478bd9Sstevel@tonic-gate struct T_optdata_ind optdata_ind; /* option data ind */ 616*7c478bd9Sstevel@tonic-gate struct T_extconn_ind extconn_ind; /* above plus dst addr */ 617*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 618*7c478bd9Sstevel@tonic-gate }; 619*7c478bd9Sstevel@tonic-gate 620*7c478bd9Sstevel@tonic-gate /* 621*7c478bd9Sstevel@tonic-gate * TPI specification is not clear on how to pack options in option 622*7c478bd9Sstevel@tonic-gate * buffers. What follows is the Solaris TPI interpretation of it. 623*7c478bd9Sstevel@tonic-gate * 624*7c478bd9Sstevel@tonic-gate * struct T_opthdr data structure is used to pack options in T_OPTMGMT_{REQ,ACK} 625*7c478bd9Sstevel@tonic-gate * message primitives in buffer delimited by [OPT_offset, OPT_length] fields in 626*7c478bd9Sstevel@tonic-gate * struct T_optmgmt_req/T_optmgmt_ack data structures. 627*7c478bd9Sstevel@tonic-gate * 628*7c478bd9Sstevel@tonic-gate * It is also used to pack options in similar buffers for data structures in 629*7c478bd9Sstevel@tonic-gate * T_CONN_{REQ,IND,RES,CONN} primitives and T_UNITDATA_{REQ,IND} primitives 630*7c478bd9Sstevel@tonic-gate * Needs to be on t_uscalar_t (32-bit word) aligned boundary. 631*7c478bd9Sstevel@tonic-gate * 632*7c478bd9Sstevel@tonic-gate * Note: T_SVR4_OPTMGMT_REQ primitive can, but need not, use this data 633*7c478bd9Sstevel@tonic-gate * structure for packing options. The format of option buffer for 634*7c478bd9Sstevel@tonic-gate * T_SVR4_OPTMGMT_REQ primitive is undefined and is a private contract 635*7c478bd9Sstevel@tonic-gate * between transport provider and its users. 636*7c478bd9Sstevel@tonic-gate * 637*7c478bd9Sstevel@tonic-gate * |<--------------first option---------------->| |<--second option--... 638*7c478bd9Sstevel@tonic-gate * ______________________________________ _ _ _ ____________________________ 639*7c478bd9Sstevel@tonic-gate * | len | level | name | status | value.......| / / | len ... 640*7c478bd9Sstevel@tonic-gate * -------------------------------------- - - - ---------------------------- 641*7c478bd9Sstevel@tonic-gate * |32bit| 32bit |32bit | 32bit | ^ | 32bit... 642*7c478bd9Sstevel@tonic-gate * | 643*7c478bd9Sstevel@tonic-gate * | 644*7c478bd9Sstevel@tonic-gate * alignment characters 645*7c478bd9Sstevel@tonic-gate */ 646*7c478bd9Sstevel@tonic-gate struct T_opthdr { 647*7c478bd9Sstevel@tonic-gate t_uscalar_t len; /* total length of option (header+value) */ 648*7c478bd9Sstevel@tonic-gate t_uscalar_t level; /* protocol level */ 649*7c478bd9Sstevel@tonic-gate t_uscalar_t name; /* option name */ 650*7c478bd9Sstevel@tonic-gate t_uscalar_t status; /* status value */ 651*7c478bd9Sstevel@tonic-gate /* option value aligned on t_uscalar_t (32-bit) alignment boundary */ 652*7c478bd9Sstevel@tonic-gate }; 653*7c478bd9Sstevel@tonic-gate 654*7c478bd9Sstevel@tonic-gate /* 655*7c478bd9Sstevel@tonic-gate * ------------------------------------------------------------------------ 656*7c478bd9Sstevel@tonic-gate * Common experimental private TPI alignment related macros. Not for 657*7c478bd9Sstevel@tonic-gate * use outside Solaris bundled code and can change in any release. 658*7c478bd9Sstevel@tonic-gate * The alignment boundary _TPI_ALIGN_SIZE represents an implementation 659*7c478bd9Sstevel@tonic-gate * choice for aligning many data objects which are directly or indirectly 660*7c478bd9Sstevel@tonic-gate * associated with Solaris TPI implementation. 661*7c478bd9Sstevel@tonic-gate * ------------------------------------------------------------------------ 662*7c478bd9Sstevel@tonic-gate */ 663*7c478bd9Sstevel@tonic-gate 664*7c478bd9Sstevel@tonic-gate #define __TPI_ALIGN_SIZE (sizeof (t_scalar_t)) 665*7c478bd9Sstevel@tonic-gate #define __TPI_ALIGN(x) \ 666*7c478bd9Sstevel@tonic-gate (((uintptr_t)(x) + __TPI_ALIGN_SIZE - 1) & ~(__TPI_ALIGN_SIZE - 1)) 667*7c478bd9Sstevel@tonic-gate #define __TPI_SIZE_ISALIGNED(x) \ 668*7c478bd9Sstevel@tonic-gate (((uintptr_t)(x) & (__TPI_ALIGN_SIZE - 1)) == 0) 669*7c478bd9Sstevel@tonic-gate 670*7c478bd9Sstevel@tonic-gate /* 671*7c478bd9Sstevel@tonic-gate * TPI primitive in message must be aligned at _TPI_ALIGN_SIZE boundary 672*7c478bd9Sstevel@tonic-gate */ 673*7c478bd9Sstevel@tonic-gate #define __TPI_PRIM_ISALIGNED(x) __TPI_SIZE_ISALIGNED(x) 674*7c478bd9Sstevel@tonic-gate 675*7c478bd9Sstevel@tonic-gate /* 676*7c478bd9Sstevel@tonic-gate * TPI option header "struct opthdr" objects must be aligned 677*7c478bd9Sstevel@tonic-gate * at __TPI_ALIGN_SIZE boundary. 678*7c478bd9Sstevel@tonic-gate */ 679*7c478bd9Sstevel@tonic-gate #define __TPI_OPT_ISALIGNED(x) __TPI_SIZE_ISALIGNED(x) 680*7c478bd9Sstevel@tonic-gate #define _TPI_ALIGN_OPT(x) __TPI_ALIGN(x) 681*7c478bd9Sstevel@tonic-gate 682*7c478bd9Sstevel@tonic-gate /* 683*7c478bd9Sstevel@tonic-gate * TPI option header "struct T_opthdr" objects must be aligned 684*7c478bd9Sstevel@tonic-gate * at __TPI_ALIGN_SIZE boundary. 685*7c478bd9Sstevel@tonic-gate */ 686*7c478bd9Sstevel@tonic-gate #define __TPI_TOPT_ISALIGNED(x) __TPI_SIZE_ISALIGNED(x) 687*7c478bd9Sstevel@tonic-gate #define _TPI_ALIGN_TOPT(x) __TPI_ALIGN(x) 688*7c478bd9Sstevel@tonic-gate 689*7c478bd9Sstevel@tonic-gate /* 690*7c478bd9Sstevel@tonic-gate * -------------------------------------------------------------------- 691*7c478bd9Sstevel@tonic-gate * Private experimental macros. Not for use outside Solaris bundled 692*7c478bd9Sstevel@tonic-gate * source code and can change in any release. 693*7c478bd9Sstevel@tonic-gate * Macros that operate on struct T_opthdr. These are roughly modelled 694*7c478bd9Sstevel@tonic-gate * after the corresponding Socket CMSG_*() and XTI T_OPT_*() macros, but 695*7c478bd9Sstevel@tonic-gate * are applied to TPI option buffers. 696*7c478bd9Sstevel@tonic-gate * -------------------------------------------------------------------- 697*7c478bd9Sstevel@tonic-gate * 698*7c478bd9Sstevel@tonic-gate * unsigned char * 699*7c478bd9Sstevel@tonic-gate * _TPI_TOPT_DATA(struct T_opthdr *tohp): 700*7c478bd9Sstevel@tonic-gate * Get start of data part after option header 701*7c478bd9Sstevel@tonic-gate */ 702*7c478bd9Sstevel@tonic-gate #define _TPI_TOPT_DATA(tohp) \ 703*7c478bd9Sstevel@tonic-gate ((unsigned char *)((char *)(tohp) + sizeof (struct T_opthdr))) 704*7c478bd9Sstevel@tonic-gate 705*7c478bd9Sstevel@tonic-gate /* 706*7c478bd9Sstevel@tonic-gate * t_uscalar_t 707*7c478bd9Sstevel@tonic-gate * _TPI_TOPT_DATALEN(tohp) 708*7c478bd9Sstevel@tonic-gate * Get length of contents of option data excluding header (and 709*7c478bd9Sstevel@tonic-gate * padding etc if any). 710*7c478bd9Sstevel@tonic-gate */ 711*7c478bd9Sstevel@tonic-gate #define _TPI_TOPT_DATALEN(tohp) ((tohp)->len - sizeof (struct T_opthdr)) 712*7c478bd9Sstevel@tonic-gate 713*7c478bd9Sstevel@tonic-gate /* 714*7c478bd9Sstevel@tonic-gate * struct T_opthdr * 715*7c478bd9Sstevel@tonic-gate * _TPI_TOPT_FIRSTHDR(char *pbuf, t_scalar_t buflen): 716*7c478bd9Sstevel@tonic-gate * Get pointer to the first option header in buffer 'pbuf' 717*7c478bd9Sstevel@tonic-gate * Return NULL if there is not enough room for the header 718*7c478bd9Sstevel@tonic-gate * 719*7c478bd9Sstevel@tonic-gate * struct T_opthdr * 720*7c478bd9Sstevel@tonic-gate * _TPI_TOPT_NEXTHDR(char *pbuf, t_scalar_t buflen, 721*7c478bd9Sstevel@tonic-gate * struct T_opthdr *popt): 722*7c478bd9Sstevel@tonic-gate * Skip to next option header 723*7c478bd9Sstevel@tonic-gate * 724*7c478bd9Sstevel@tonic-gate * Notes: _TPI_TOPT_NEXTHDR performs the roundup of the length. 725*7c478bd9Sstevel@tonic-gate * 726*7c478bd9Sstevel@tonic-gate * If _TPI_TOPT_{FIRST,NEXT}HDR returns a non-null value, the user of 727*7c478bd9Sstevel@tonic-gate * _TPI_TOPT_{FIRST,NEXT}HDR must still verify that the resulting pointer 728*7c478bd9Sstevel@tonic-gate * is valid, by making a call to _TPI_TOPT_VALID. The _TPI_TOPT_VALID 729*7c478bd9Sstevel@tonic-gate * macro does not assume that the last option buffer is padded. 730*7c478bd9Sstevel@tonic-gate */ 731*7c478bd9Sstevel@tonic-gate #define _TPI_TOPT_FIRSTHDR(pbuf, buflen) \ 732*7c478bd9Sstevel@tonic-gate ((((buflen) >= (unsigned int) sizeof (struct T_opthdr)) && \ 733*7c478bd9Sstevel@tonic-gate __TPI_TOPT_ISALIGNED(pbuf)) ? \ 734*7c478bd9Sstevel@tonic-gate (struct T_opthdr *)(pbuf) : (struct T_opthdr *)0) 735*7c478bd9Sstevel@tonic-gate 736*7c478bd9Sstevel@tonic-gate #define _TPI_TOPT_NEXTHDR(pbuf, buflen, popt) \ 737*7c478bd9Sstevel@tonic-gate (((char *)(popt) + _TPI_ALIGN_TOPT((popt)->len)) < \ 738*7c478bd9Sstevel@tonic-gate ((char *)(pbuf) + (buflen)) ? \ 739*7c478bd9Sstevel@tonic-gate (struct T_opthdr *)((char *)(popt) + _TPI_ALIGN_TOPT((popt)->len)) : \ 740*7c478bd9Sstevel@tonic-gate (struct T_opthdr *)0) 741*7c478bd9Sstevel@tonic-gate 742*7c478bd9Sstevel@tonic-gate /* 743*7c478bd9Sstevel@tonic-gate * bool_t 744*7c478bd9Sstevel@tonic-gate * _TPI_TOPT_VALID(struct T_opthdr *tohp, char *start, char *end) 745*7c478bd9Sstevel@tonic-gate * Validate the option header at tohp, for its alignment and length. 746*7c478bd9Sstevel@tonic-gate * 1. check that tohp is aligned at t_scalar_t boundary 747*7c478bd9Sstevel@tonic-gate * 2. check that start <= tohp < end 748*7c478bd9Sstevel@tonic-gate * 3. validate the length, should be >= sizeof(T_opthdr) and 749*7c478bd9Sstevel@tonic-gate * check that there is no pointer arithmetic overflow. 750*7c478bd9Sstevel@tonic-gate * (could be caused by a very large value for tohp->len) 751*7c478bd9Sstevel@tonic-gate */ 752*7c478bd9Sstevel@tonic-gate 753*7c478bd9Sstevel@tonic-gate #define _TPI_TOPT_VALID(tohp, start, end) \ 754*7c478bd9Sstevel@tonic-gate (__TPI_TOPT_ISALIGNED(tohp) && \ 755*7c478bd9Sstevel@tonic-gate ((uintptr_t)(tohp) >= (uintptr_t)(start)) && \ 756*7c478bd9Sstevel@tonic-gate ((uintptr_t)(tohp) < (uintptr_t)(end)) && \ 757*7c478bd9Sstevel@tonic-gate ((ssize_t)(tohp)->len >= sizeof (struct T_opthdr)) && \ 758*7c478bd9Sstevel@tonic-gate ((uintptr_t)(tohp) + (tohp)->len <= (uintptr_t)(end)) && \ 759*7c478bd9Sstevel@tonic-gate ((uintptr_t)(tohp) + (tohp)->len >= (uintptr_t)(tohp) + \ 760*7c478bd9Sstevel@tonic-gate sizeof (struct T_opthdr))) 761*7c478bd9Sstevel@tonic-gate 762*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 763*7c478bd9Sstevel@tonic-gate } 764*7c478bd9Sstevel@tonic-gate #endif 765*7c478bd9Sstevel@tonic-gate 766*7c478bd9Sstevel@tonic-gate #endif /* _SYS_TIHDR_H */ 767