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 /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_TPICOMMON_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_TPICOMMON_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 35*7c478bd9Sstevel@tonic-gate extern "C" { 36*7c478bd9Sstevel@tonic-gate #endif 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate /* 39*7c478bd9Sstevel@tonic-gate * WARNING: This header should not ever be included directly by application 40*7c478bd9Sstevel@tonic-gate * programs. It exists so that common definitions can be included by other 41*7c478bd9Sstevel@tonic-gate * system header files which define a documented interface. The interfaces 42*7c478bd9Sstevel@tonic-gate * that share and expose the definitions in this file are: 43*7c478bd9Sstevel@tonic-gate * 44*7c478bd9Sstevel@tonic-gate * (1) TLI interface <tiuser.h> (which includes <sys/tiuser.h> which 45*7c478bd9Sstevel@tonic-gate * includes this file) 46*7c478bd9Sstevel@tonic-gate * (2) XTI interface <xti.h> 47*7c478bd9Sstevel@tonic-gate * (3) Kernel Streams TPI message based inteface <sys/tihdr.h> 48*7c478bd9Sstevel@tonic-gate */ 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate /* 52*7c478bd9Sstevel@tonic-gate * The following are "t_errno" error codes needed by both the kernel 53*7c478bd9Sstevel@tonic-gate * level transport providers and the user level interfaces. 54*7c478bd9Sstevel@tonic-gate */ 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate #define TBADADDR 1 /* Incorrect address format */ 57*7c478bd9Sstevel@tonic-gate #define TBADOPT 2 /* Incorrect options format */ 58*7c478bd9Sstevel@tonic-gate #define TACCES 3 /* Illegal permissions */ 59*7c478bd9Sstevel@tonic-gate #define TBADF 4 /* Illegal file descriptor */ 60*7c478bd9Sstevel@tonic-gate #define TNOADDR 5 /* Couldn't allocate address */ 61*7c478bd9Sstevel@tonic-gate #define TOUTSTATE 6 /* Routine will place interface out of state */ 62*7c478bd9Sstevel@tonic-gate #define TBADSEQ 7 /* Illegal called/calling sequence number */ 63*7c478bd9Sstevel@tonic-gate #define TSYSERR 8 /* System error */ 64*7c478bd9Sstevel@tonic-gate #define TLOOK 9 /* An event requires attention */ 65*7c478bd9Sstevel@tonic-gate #define TBADDATA 10 /* Illegal amount of data */ 66*7c478bd9Sstevel@tonic-gate #define TBUFOVFLW 11 /* Buffer not large enough */ 67*7c478bd9Sstevel@tonic-gate #define TFLOW 12 /* Can't send message - (blocked) */ 68*7c478bd9Sstevel@tonic-gate #define TNODATA 13 /* No message currently available */ 69*7c478bd9Sstevel@tonic-gate #define TNODIS 14 /* Disconnect message not found */ 70*7c478bd9Sstevel@tonic-gate #define TNOUDERR 15 /* Unitdata error message not found */ 71*7c478bd9Sstevel@tonic-gate #define TBADFLAG 16 /* Incorrect flags specified */ 72*7c478bd9Sstevel@tonic-gate #define TNOREL 17 /* Orderly release message not found */ 73*7c478bd9Sstevel@tonic-gate #define TNOTSUPPORT 18 /* Primitive not supported by provider */ 74*7c478bd9Sstevel@tonic-gate #define TSTATECHNG 19 /* State is in process of changing */ 75*7c478bd9Sstevel@tonic-gate /* 76*7c478bd9Sstevel@tonic-gate * Following new error codes added to namespace with introduction of XTI 77*7c478bd9Sstevel@tonic-gate */ 78*7c478bd9Sstevel@tonic-gate #define TNOSTRUCTYPE 20 /* Unsupported structure type requested */ 79*7c478bd9Sstevel@tonic-gate #define TBADNAME 21 /* Invalid transport provider name */ 80*7c478bd9Sstevel@tonic-gate #define TBADQLEN 22 /* Listener queue length limit is zero */ 81*7c478bd9Sstevel@tonic-gate #define TADDRBUSY 23 /* Transport address is in use */ 82*7c478bd9Sstevel@tonic-gate #define TINDOUT 24 /* Outstanding connection indications */ 83*7c478bd9Sstevel@tonic-gate #define TPROVMISMATCH 25 84*7c478bd9Sstevel@tonic-gate /* Listener-acceptor transport provider mismatch */ 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate #define TRESQLEN 26 87*7c478bd9Sstevel@tonic-gate /* Connection acceptor has listen queue length limit greater than zero */ 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate #define TRESADDR 27 90*7c478bd9Sstevel@tonic-gate /* Connection acceptor-listener addresses not same but required by transport */ 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate #define TQFULL 28 /* Incoming connection queue is full */ 93*7c478bd9Sstevel@tonic-gate #define TPROTO 29 /* Protocol error on transport primitive */ 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate /* 96*7c478bd9Sstevel@tonic-gate * Service type defines - used with T_info_ack 97*7c478bd9Sstevel@tonic-gate */ 98*7c478bd9Sstevel@tonic-gate #define T_COTS 1 /* connection oriented transport service */ 99*7c478bd9Sstevel@tonic-gate #define T_COTS_ORD 2 /* connection oriented w/ orderly release */ 100*7c478bd9Sstevel@tonic-gate #define T_CLTS 3 /* connectionless transport service */ 101*7c478bd9Sstevel@tonic-gate /* 102*7c478bd9Sstevel@tonic-gate * NOT FOR PUBLIC USE, Solaris internal only. 103*7c478bd9Sstevel@tonic-gate * This value of nc_semantics is strictly for use of Remote Direct 104*7c478bd9Sstevel@tonic-gate * Memory Access provider interfaces in Solaris only and not for 105*7c478bd9Sstevel@tonic-gate * general use. Do not use this value for general purpose user or 106*7c478bd9Sstevel@tonic-gate * kernel programming. If used the behavior is undefined. 107*7c478bd9Sstevel@tonic-gate * This is a PRIVATE interface to be used by Solaris kRPC only. 108*7c478bd9Sstevel@tonic-gate */ 109*7c478bd9Sstevel@tonic-gate #define T_RDMA 4 /* rdma transport service */ 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate /* 113*7c478bd9Sstevel@tonic-gate * The following are the flag definitions needed by the 114*7c478bd9Sstevel@tonic-gate * user level library routines. 115*7c478bd9Sstevel@tonic-gate */ 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate /* 118*7c478bd9Sstevel@tonic-gate * flags for option management request primitives 119*7c478bd9Sstevel@tonic-gate * Note: 120*7c478bd9Sstevel@tonic-gate * - This namespace is distinct from the namespace for data 121*7c478bd9Sstevel@tonic-gate * primitives. 122*7c478bd9Sstevel@tonic-gate * - Flags T_NEGOTIATE, T_CHECK, T_DEFAULT, T_CURRENT 123*7c478bd9Sstevel@tonic-gate * are associated with an option request 124*7c478bd9Sstevel@tonic-gate * - Flags T_SUCCESS, T_FAILURE, T_PARTSUCCESS, T_READONLY, 125*7c478bd9Sstevel@tonic-gate * T_NOTSUPPORT are associated with results of option request. 126*7c478bd9Sstevel@tonic-gate */ 127*7c478bd9Sstevel@tonic-gate #define T_NEGOTIATE 0x004 /* set opts request */ 128*7c478bd9Sstevel@tonic-gate #define T_CHECK 0x008 /* check opts request */ 129*7c478bd9Sstevel@tonic-gate #define T_DEFAULT 0x010 /* get default opts request */ 130*7c478bd9Sstevel@tonic-gate #define T_SUCCESS 0x020 /* successful result */ 131*7c478bd9Sstevel@tonic-gate #define T_FAILURE 0x040 /* failure result */ 132*7c478bd9Sstevel@tonic-gate #define T_CURRENT 0x080 /* get current options request */ 133*7c478bd9Sstevel@tonic-gate #define T_PARTSUCCESS 0x100 /* partial success result */ 134*7c478bd9Sstevel@tonic-gate #define T_READONLY 0x200 /* read-only result */ 135*7c478bd9Sstevel@tonic-gate #define T_NOTSUPPORT 0x400 /* not supported result */ 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate /* 139*7c478bd9Sstevel@tonic-gate * General purpose defines - used in multiple options context. 140*7c478bd9Sstevel@tonic-gate * They (T_YES and T_NO) need to be bitwise distinct from T_GARBAGE 141*7c478bd9Sstevel@tonic-gate * used with TCP level options by XTI for historical XTI specification 142*7c478bd9Sstevel@tonic-gate * reasons. 143*7c478bd9Sstevel@tonic-gate * (T_GARBAGE declared in <sys/xti_inet.h> included by <xti.h>). 144*7c478bd9Sstevel@tonic-gate */ 145*7c478bd9Sstevel@tonic-gate #define T_YES 1 146*7c478bd9Sstevel@tonic-gate #define T_NO 0 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate /* 149*7c478bd9Sstevel@tonic-gate * Values used with struct T_info_ack fields 150*7c478bd9Sstevel@tonic-gate */ 151*7c478bd9Sstevel@tonic-gate #define T_INFINITE -1 152*7c478bd9Sstevel@tonic-gate #define T_INVALID -2 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate /* 155*7c478bd9Sstevel@tonic-gate * Constants used with option management "name" or "value" fields. 156*7c478bd9Sstevel@tonic-gate */ 157*7c478bd9Sstevel@tonic-gate 158*7c478bd9Sstevel@tonic-gate /* 159*7c478bd9Sstevel@tonic-gate * XTI defined value reserved for stating 'unspecified' value used 160*7c478bd9Sstevel@tonic-gate * in some option namespaces. 161*7c478bd9Sstevel@tonic-gate */ 162*7c478bd9Sstevel@tonic-gate #define T_UNSPEC (~0-2) /* applicable to ulong_t, long, char */ 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate /* 165*7c478bd9Sstevel@tonic-gate * XTI inspired option management defined an option name T_ALLOPT 166*7c478bd9Sstevel@tonic-gate * to imply all options of a certain level. 167*7c478bd9Sstevel@tonic-gate * No option name (for any level) should be defined with constant value of 168*7c478bd9Sstevel@tonic-gate * T_ALLOPT (0). 169*7c478bd9Sstevel@tonic-gate */ 170*7c478bd9Sstevel@tonic-gate #define T_ALLOPT 0 /* all options at any level */ 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate /* 173*7c478bd9Sstevel@tonic-gate * An option specification consists of an opthdr, followed by the value of 174*7c478bd9Sstevel@tonic-gate * the option. An options buffer contains one or more options. The len 175*7c478bd9Sstevel@tonic-gate * field of opthdr specifies the length of the option value in bytes. This 176*7c478bd9Sstevel@tonic-gate * length must be a multiple of sizeof (t_scalar_t) (use OPTLEN macro). 177*7c478bd9Sstevel@tonic-gate * This is an antique definition which is used (unofficially) by TLI but 178*7c478bd9Sstevel@tonic-gate * superceded in XTI. 179*7c478bd9Sstevel@tonic-gate */ 180*7c478bd9Sstevel@tonic-gate /* 181*7c478bd9Sstevel@tonic-gate * The opthdr types are now t_uscalar_t - inspired by XTI 182*7c478bd9Sstevel@tonic-gate */ 183*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 184*7c478bd9Sstevel@tonic-gate struct opthdr { 185*7c478bd9Sstevel@tonic-gate t_uscalar_t level; /* protocol level affected */ 186*7c478bd9Sstevel@tonic-gate t_uscalar_t name; /* option to modify */ 187*7c478bd9Sstevel@tonic-gate t_uscalar_t len; /* length of option value */ 188*7c478bd9Sstevel@tonic-gate }; 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate #define OPTLEN(x) ((((x) + sizeof (t_uscalar_t) - 1) / \ 191*7c478bd9Sstevel@tonic-gate sizeof (t_uscalar_t)) * sizeof (t_uscalar_t)) 192*7c478bd9Sstevel@tonic-gate #define OPTVAL(opt) ((char *)(opt + 1)) 193*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 194*7c478bd9Sstevel@tonic-gate 195*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 196*7c478bd9Sstevel@tonic-gate } 197*7c478bd9Sstevel@tonic-gate #endif 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate #endif /* _SYS_TPICOMMON_H */ 200