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 1992-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 _TX_H 28*7c478bd9Sstevel@tonic-gate #define _TX_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/uio.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 * This file contains declarations local to the TLI/XTI implmentation 40*7c478bd9Sstevel@tonic-gate */ 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate /* 43*7c478bd9Sstevel@tonic-gate * Look buffer list 44*7c478bd9Sstevel@tonic-gate * Could be multiple buffers for MT case 45*7c478bd9Sstevel@tonic-gate */ 46*7c478bd9Sstevel@tonic-gate struct _ti_lookbufs { 47*7c478bd9Sstevel@tonic-gate struct _ti_lookbufs *tl_next; /* next in list */ 48*7c478bd9Sstevel@tonic-gate int tl_lookclen; /* "look" ctl part length */ 49*7c478bd9Sstevel@tonic-gate char *tl_lookcbuf; /* pointer to "look" ctl */ 50*7c478bd9Sstevel@tonic-gate int tl_lookdlen; /* "look" data length */ 51*7c478bd9Sstevel@tonic-gate char *tl_lookdbuf; /* pointer to "look" data */ 52*7c478bd9Sstevel@tonic-gate }; 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate /* TI interface user level structure - one per open file */ 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate struct _ti_user { 57*7c478bd9Sstevel@tonic-gate struct _ti_user *ti_next; /* next one */ 58*7c478bd9Sstevel@tonic-gate struct _ti_user *ti_prev; /* previous one */ 59*7c478bd9Sstevel@tonic-gate int ti_fd; /* file descriptor */ 60*7c478bd9Sstevel@tonic-gate struct _ti_lookbufs ti_lookbufs; /* head of list of look buffers */ 61*7c478bd9Sstevel@tonic-gate int ti_lookcnt; /* buffered look flag */ 62*7c478bd9Sstevel@tonic-gate ushort_t ti_flags; /* flags */ 63*7c478bd9Sstevel@tonic-gate int ti_rcvsize; /* connect or disconnect data buf size */ 64*7c478bd9Sstevel@tonic-gate char *ti_rcvbuf; /* connect or disconnect data buffer */ 65*7c478bd9Sstevel@tonic-gate int ti_ctlsize; /* ctl buffer size */ 66*7c478bd9Sstevel@tonic-gate char *ti_ctlbuf; /* ctl buffer */ 67*7c478bd9Sstevel@tonic-gate int ti_state; /* user level state */ 68*7c478bd9Sstevel@tonic-gate int ti_ocnt; /* # outstanding connect indications */ 69*7c478bd9Sstevel@tonic-gate t_scalar_t ti_maxpsz; /* TIDU size */ 70*7c478bd9Sstevel@tonic-gate t_scalar_t ti_tsdusize; /* TSDU size */ 71*7c478bd9Sstevel@tonic-gate t_scalar_t ti_etsdusize; /* ETSDU size */ 72*7c478bd9Sstevel@tonic-gate t_scalar_t ti_cdatasize; /* CDATA_size */ 73*7c478bd9Sstevel@tonic-gate t_scalar_t ti_ddatasize; /* DDATA_size */ 74*7c478bd9Sstevel@tonic-gate t_scalar_t ti_servtype; /* service type */ 75*7c478bd9Sstevel@tonic-gate t_scalar_t ti_prov_flag; /* TPI PROVIDER_flag */ 76*7c478bd9Sstevel@tonic-gate uint_t ti_qlen; /* listener backlog limit */ 77*7c478bd9Sstevel@tonic-gate t_uscalar_t acceptor_id; /* Saved acceptor_id value */ 78*7c478bd9Sstevel@tonic-gate dev_t ti_rdev; /* for fd validation */ 79*7c478bd9Sstevel@tonic-gate ino_t ti_ino; /* for fd validation */ 80*7c478bd9Sstevel@tonic-gate mutex_t ti_lock; /* lock to protect this data structure */ 81*7c478bd9Sstevel@tonic-gate }; 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate /* 84*7c478bd9Sstevel@tonic-gate * Local flags used with ti_flags field in instance structure of 85*7c478bd9Sstevel@tonic-gate * type 'struct _ti_user' declared above. Historical note: 86*7c478bd9Sstevel@tonic-gate * This namespace constants were previously declared in a 87*7c478bd9Sstevel@tonic-gate * a very messed up namespace in timod.h 88*7c478bd9Sstevel@tonic-gate */ 89*7c478bd9Sstevel@tonic-gate #define USED 0x0001 /* data structure in use */ 90*7c478bd9Sstevel@tonic-gate #define MORE 0x0008 /* more data */ 91*7c478bd9Sstevel@tonic-gate #define EXPEDITED 0x0010 /* processing expedited TSDU */ 92*7c478bd9Sstevel@tonic-gate #define V_ACCEPTOR_ID 0x0020 /* acceptor_id field is has valid value */ 93*7c478bd9Sstevel@tonic-gate #define TX_TQFULL_NOTIFIED 0x0040 /* TQFULL error has been returned once */ 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate /* 97*7c478bd9Sstevel@tonic-gate * Valid flags that can be passed by user in t_sndv() or t_snd() 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate #define TX_ALL_VALID_FLAGS (T_MORE|T_EXPEDITED|T_PUSH) 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate #define _T_MAX(x, y) ((x) > (y) ? (x) : (y)) 103*7c478bd9Sstevel@tonic-gate 104*7c478bd9Sstevel@tonic-gate /* 105*7c478bd9Sstevel@tonic-gate * Following are used to indicate which API entry point is calling common 106*7c478bd9Sstevel@tonic-gate * routines 107*7c478bd9Sstevel@tonic-gate */ 108*7c478bd9Sstevel@tonic-gate #define TX_TLI_API 1 /* The API semantics is TLI */ 109*7c478bd9Sstevel@tonic-gate #define TX_XTI_XNS4_API 2 /* The API semantics is XTI Unix95 */ 110*7c478bd9Sstevel@tonic-gate #define TX_XTI_XNS5_API 3 /* The API semantics is XTI Unix98 */ 111*7c478bd9Sstevel@tonic-gate #define TX_XTI_API TX_XTI_XNS4_API 112*7c478bd9Sstevel@tonic-gate /* The base XTI semantics is Unix95 */ 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate /* _T_IS_XTI(x) - Is 'x' an XTI inspired api_semantics */ 115*7c478bd9Sstevel@tonic-gate #define _T_IS_XTI(x) ((x) != TX_TLI_API) 116*7c478bd9Sstevel@tonic-gate #define _T_IS_TLI(x) ((x) == TX_TLI_API) 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate /* _T_API_VER_LT(x, y) - Is API version 'x' older than API version 'y' */ 119*7c478bd9Sstevel@tonic-gate #define _T_API_VER_LT(x, y) ((x) < (y)) 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate /* 122*7c478bd9Sstevel@tonic-gate * Note: T_BADSTATE also defined in <sys/tiuser.h> 123*7c478bd9Sstevel@tonic-gate */ 124*7c478bd9Sstevel@tonic-gate #define T_BADSTATE 8 125*7c478bd9Sstevel@tonic-gate 126*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 127*7c478bd9Sstevel@tonic-gate #include <syslog.h> 128*7c478bd9Sstevel@tonic-gate #define _T_TX_SYSLOG2(tiptr, X, Y) if ((tiptr)->ti_state == T_BADSTATE)\ 129*7c478bd9Sstevel@tonic-gate syslog(X, Y) 130*7c478bd9Sstevel@tonic-gate #else 131*7c478bd9Sstevel@tonic-gate #define _T_TX_SYSLOG2(tiptr, X, Y) 132*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate /* 135*7c478bd9Sstevel@tonic-gate * Macro to change state and log invalid state error 136*7c478bd9Sstevel@tonic-gate */ 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate #define _T_TX_NEXTSTATE(event, tiptr, errstr) \ 139*7c478bd9Sstevel@tonic-gate { tiptr->ti_state = tiusr_statetbl[event][(tiptr)->ti_state]; \ 140*7c478bd9Sstevel@tonic-gate _T_TX_SYSLOG2((tiptr), LOG_ERR, errstr); \ 141*7c478bd9Sstevel@tonic-gate } 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate /* 144*7c478bd9Sstevel@tonic-gate * External declarations 145*7c478bd9Sstevel@tonic-gate */ 146*7c478bd9Sstevel@tonic-gate extern mutex_t _ti_userlock; 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate /* 149*7c478bd9Sstevel@tonic-gate * Useful shared local constants 150*7c478bd9Sstevel@tonic-gate */ 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate /* 153*7c478bd9Sstevel@tonic-gate * TX_XTI_LEVEL_MAX_OPTBUF: 154*7c478bd9Sstevel@tonic-gate * Max option buffer requirement reserved for any XTI level options 155*7c478bd9Sstevel@tonic-gate * passed in an option buffer. This is intended as an upper bound. 156*7c478bd9Sstevel@tonic-gate * Regardless of what the providers states in OPT_size of T_info_ack, 157*7c478bd9Sstevel@tonic-gate * XTI level options can also be added to the option buffer and XTI 158*7c478bd9Sstevel@tonic-gate * test suite in particular stuffs XTI level options whether we support 159*7c478bd9Sstevel@tonic-gate * them or not. 160*7c478bd9Sstevel@tonic-gate * 161*7c478bd9Sstevel@tonic-gate * Here is the heuristic used to arrive at a value: 162*7c478bd9Sstevel@tonic-gate * 2* [ // factor of 2 for "repeat options" type testing 163*7c478bd9Sstevel@tonic-gate * (sizeof(struct t_opthdr)+10*sizeof(t_scalar_t)) // XTI_DEBUG 164*7c478bd9Sstevel@tonic-gate * +(sizeof(struct t_opthdr)+ 2*sizeof(t_scalar_t)) // XTI_LINGER 165*7c478bd9Sstevel@tonic-gate * +(sizeof(struct t_opthdr)+ sizeof(t_scalar_t)) // XTI_RCVBUF 166*7c478bd9Sstevel@tonic-gate * +(sizeof(struct t_opthdr)+ sizeof(t_scalar_t)) // XTI_RCVLOWAT 167*7c478bd9Sstevel@tonic-gate * +(sizeof(struct t_opthdr)+ sizeof(t_scalar_t)) // XTI_SNDBUF 168*7c478bd9Sstevel@tonic-gate * +(sizeof(struct t_opthdr)+ sizeof(t_scalar_t)) // XTI_SNDLOWAT 169*7c478bd9Sstevel@tonic-gate * ] 170*7c478bd9Sstevel@tonic-gate * => 2* [ 56+24+20+20+20+20 ] 171*7c478bd9Sstevel@tonic-gate * => 172*7c478bd9Sstevel@tonic-gate */ 173*7c478bd9Sstevel@tonic-gate #define TX_XTI_LEVEL_MAX_OPTBUF 320 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate /* 177*7c478bd9Sstevel@tonic-gate * Historic information note: 178*7c478bd9Sstevel@tonic-gate * The libnsl/nsl code implements TLI and XTI interfaces using common 179*7c478bd9Sstevel@tonic-gate * code. Most data structures are similar in the exposed interfaces for 180*7c478bd9Sstevel@tonic-gate * the two interfaces (<tiuser.h> and <xti.h>). 181*7c478bd9Sstevel@tonic-gate * The common implementation C files include only <xti.h> which is the 182*7c478bd9Sstevel@tonic-gate * superset in terms of the exposed interfaces. However the file <tiuser.h> 183*7c478bd9Sstevel@tonic-gate * exposes (via <sys/tiuser.h>), in the past contained certain declarations 184*7c478bd9Sstevel@tonic-gate * that are strictly internal to the implementation but were exposed through 185*7c478bd9Sstevel@tonic-gate * their presence in the public header (<tiuser.h>). 186*7c478bd9Sstevel@tonic-gate * Since the implmentation still needs these declarations, they follow 187*7c478bd9Sstevel@tonic-gate * in this file and are removed from exposure through the TLI public header 188*7c478bd9Sstevel@tonic-gate * (<tiuser.h>) which exposed them in the past. 189*7c478bd9Sstevel@tonic-gate */ 190*7c478bd9Sstevel@tonic-gate 191*7c478bd9Sstevel@tonic-gate /* 192*7c478bd9Sstevel@tonic-gate * The following are TLI/XTI user level events which cause 193*7c478bd9Sstevel@tonic-gate * state changes. 194*7c478bd9Sstevel@tonic-gate * NOTE: Historical namespace pollution warning. 195*7c478bd9Sstevel@tonic-gate * Some of the event names share the namespace with structure tags 196*7c478bd9Sstevel@tonic-gate * so there are defined inside comments here and exposed through 197*7c478bd9Sstevel@tonic-gate * TLI and XTI headers (<tiuser.h> and <xti.h> 198*7c478bd9Sstevel@tonic-gate */ 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate #define T_OPEN 0 201*7c478bd9Sstevel@tonic-gate /* #define T_BIND 1 */ 202*7c478bd9Sstevel@tonic-gate /* #define T_OPTMGMT 2 */ 203*7c478bd9Sstevel@tonic-gate #define T_UNBIND 3 204*7c478bd9Sstevel@tonic-gate #define T_CLOSE 4 205*7c478bd9Sstevel@tonic-gate #define T_SNDUDATA 5 206*7c478bd9Sstevel@tonic-gate #define T_RCVUDATA 6 207*7c478bd9Sstevel@tonic-gate #define T_RCVUDERR 7 208*7c478bd9Sstevel@tonic-gate #define T_CONNECT1 8 209*7c478bd9Sstevel@tonic-gate #define T_CONNECT2 9 210*7c478bd9Sstevel@tonic-gate #define T_RCVCONNECT 10 211*7c478bd9Sstevel@tonic-gate #define T_LISTN 11 212*7c478bd9Sstevel@tonic-gate #define T_ACCEPT1 12 213*7c478bd9Sstevel@tonic-gate #define T_ACCEPT2 13 214*7c478bd9Sstevel@tonic-gate #define T_ACCEPT3 14 215*7c478bd9Sstevel@tonic-gate #define T_SND 15 216*7c478bd9Sstevel@tonic-gate #define T_RCV 16 217*7c478bd9Sstevel@tonic-gate #define T_SNDDIS1 17 218*7c478bd9Sstevel@tonic-gate #define T_SNDDIS2 18 219*7c478bd9Sstevel@tonic-gate #define T_RCVDIS1 19 220*7c478bd9Sstevel@tonic-gate #define T_RCVDIS2 20 221*7c478bd9Sstevel@tonic-gate #define T_RCVDIS3 21 222*7c478bd9Sstevel@tonic-gate #define T_SNDREL 22 223*7c478bd9Sstevel@tonic-gate #define T_RCVREL 23 224*7c478bd9Sstevel@tonic-gate #define T_PASSCON 24 225*7c478bd9Sstevel@tonic-gate 226*7c478bd9Sstevel@tonic-gate #define T_NOEVENTS 25 227*7c478bd9Sstevel@tonic-gate 228*7c478bd9Sstevel@tonic-gate #define T_NOSTATES 9 /* number of legal states */ 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate extern char tiusr_statetbl[T_NOEVENTS][T_NOSTATES]; 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate /* 233*7c478bd9Sstevel@tonic-gate * Band definitions for data flow. 234*7c478bd9Sstevel@tonic-gate */ 235*7c478bd9Sstevel@tonic-gate #define TI_NORMAL 0 236*7c478bd9Sstevel@tonic-gate #define TI_EXPEDITED 1 237*7c478bd9Sstevel@tonic-gate 238*7c478bd9Sstevel@tonic-gate /* 239*7c478bd9Sstevel@tonic-gate * Bogus states from tiuser.h 240*7c478bd9Sstevel@tonic-gate */ 241*7c478bd9Sstevel@tonic-gate #define T_FAKE 8 /* fake state used when state */ 242*7c478bd9Sstevel@tonic-gate /* cannot be determined */ 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate /* 245*7c478bd9Sstevel@tonic-gate * Flags for t_getname() from tiuser.h 246*7c478bd9Sstevel@tonic-gate * Note: This routine's counterpart in XTI is substatnially modified 247*7c478bd9Sstevel@tonic-gate * (i.e. t_getprotaddr() and does not use these flags) 248*7c478bd9Sstevel@tonic-gate */ 249*7c478bd9Sstevel@tonic-gate #define LOCALNAME 0 250*7c478bd9Sstevel@tonic-gate #define REMOTENAME 1 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate /* 253*7c478bd9Sstevel@tonic-gate * Obsolete error event for t_look() in TLI, still needed for compatibility 254*7c478bd9Sstevel@tonic-gate * to broken apps that are affected (e.g nfsd,lockd) if real error returned. 255*7c478bd9Sstevel@tonic-gate */ 256*7c478bd9Sstevel@tonic-gate #define T_ERROR 0x0020 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate /* 259*7c478bd9Sstevel@tonic-gate * GENERAL UTILITY MACROS 260*7c478bd9Sstevel@tonic-gate */ 261*7c478bd9Sstevel@tonic-gate #define A_CNT(arr) (sizeof (arr)/sizeof (arr[0])) 262*7c478bd9Sstevel@tonic-gate #define A_END(arr) (&arr[A_CNT(arr)]) 263*7c478bd9Sstevel@tonic-gate #define A_LAST(arr) (&arr[A_CNT(arr)-1]) 264*7c478bd9Sstevel@tonic-gate 265*7c478bd9Sstevel@tonic-gate /* 266*7c478bd9Sstevel@tonic-gate * Following macro compares a signed size obtained from TPI primitive 267*7c478bd9Sstevel@tonic-gate * to unsigned size of buffer where it needs to go into passed using 268*7c478bd9Sstevel@tonic-gate * the "struct netbuf" type. 269*7c478bd9Sstevel@tonic-gate * Since many programs are buggy and forget to initialize "netbuf" or 270*7c478bd9Sstevel@tonic-gate * (while unlikely!) allocated buffer can legally even be larger than 271*7c478bd9Sstevel@tonic-gate * max signed integer, we use the following macro to do unsigned comparison 272*7c478bd9Sstevel@tonic-gate * after verifying that signed quantity is positive. 273*7c478bd9Sstevel@tonic-gate */ 274*7c478bd9Sstevel@tonic-gate #define TLEN_GT_NLEN(tpilen, netbuflen) \ 275*7c478bd9Sstevel@tonic-gate (((tpilen) > 0) && ((unsigned int)(tpilen) > (netbuflen))) 276*7c478bd9Sstevel@tonic-gate 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate /* 279*7c478bd9Sstevel@tonic-gate * N.B.: this interface is deprecated. Use t_strerror() instead. 280*7c478bd9Sstevel@tonic-gate */ 281*7c478bd9Sstevel@tonic-gate extern char *t_errlist[]; 282*7c478bd9Sstevel@tonic-gate extern int t_nerr; 283*7c478bd9Sstevel@tonic-gate 284*7c478bd9Sstevel@tonic-gate /* 285*7c478bd9Sstevel@tonic-gate * UTILITY ROUTINES FUNCTION PROTOTYPES 286*7c478bd9Sstevel@tonic-gate */ 287*7c478bd9Sstevel@tonic-gate 288*7c478bd9Sstevel@tonic-gate void _t_adjust_iov(int, struct iovec *, int *); 289*7c478bd9Sstevel@tonic-gate struct _ti_user *_t_checkfd(int, int, int); 290*7c478bd9Sstevel@tonic-gate int _t_delete_tilink(int); 291*7c478bd9Sstevel@tonic-gate int _t_rcv_conn_con(struct _ti_user *, struct t_call *, struct strbuf *, int); 292*7c478bd9Sstevel@tonic-gate int _t_snd_conn_req(struct _ti_user *, const struct t_call *, struct strbuf *); 293*7c478bd9Sstevel@tonic-gate int _t_aligned_copy(struct strbuf *, int, int, char *, t_scalar_t *); 294*7c478bd9Sstevel@tonic-gate struct _ti_user *_t_create(int, struct t_info *, int, int *); 295*7c478bd9Sstevel@tonic-gate int _t_do_ioctl(int, char *, int, int, int *); 296*7c478bd9Sstevel@tonic-gate int _t_is_event(int, struct _ti_user *); 297*7c478bd9Sstevel@tonic-gate int _t_is_ok(int, struct _ti_user *, t_scalar_t); 298*7c478bd9Sstevel@tonic-gate int _t_look_locked(int, struct _ti_user *, int, int); 299*7c478bd9Sstevel@tonic-gate int _t_register_lookevent(struct _ti_user *, caddr_t, int, caddr_t, int); 300*7c478bd9Sstevel@tonic-gate void _t_free_looklist_head(struct _ti_user *); 301*7c478bd9Sstevel@tonic-gate void _t_flush_lookevents(struct _ti_user *); 302*7c478bd9Sstevel@tonic-gate int _t_acquire_ctlbuf(struct _ti_user *, struct strbuf *, int *); 303*7c478bd9Sstevel@tonic-gate int _t_acquire_databuf(struct _ti_user *, struct strbuf *, int *); 304*7c478bd9Sstevel@tonic-gate 305*7c478bd9Sstevel@tonic-gate /* 306*7c478bd9Sstevel@tonic-gate * Core function TLI/XTI routines function prototypes 307*7c478bd9Sstevel@tonic-gate */ 308*7c478bd9Sstevel@tonic-gate extern int _tx_accept(int, int, const struct t_call *, int); 309*7c478bd9Sstevel@tonic-gate extern char *_tx_alloc(int, int, int, int); 310*7c478bd9Sstevel@tonic-gate extern int _tx_bind(int, const struct t_bind *, struct t_bind *, int); 311*7c478bd9Sstevel@tonic-gate extern int _tx_close(int, int); 312*7c478bd9Sstevel@tonic-gate extern int _tx_connect(int, const struct t_call *, struct t_call *, int); 313*7c478bd9Sstevel@tonic-gate extern int _tx_error(const char *, int); 314*7c478bd9Sstevel@tonic-gate extern int _tx_free(char *, int, int); 315*7c478bd9Sstevel@tonic-gate extern int _tx_getinfo(int, struct t_info *, int); 316*7c478bd9Sstevel@tonic-gate extern int _tx_getname(int, struct netbuf *, int, int); 317*7c478bd9Sstevel@tonic-gate extern int _tx_getstate(int, int); 318*7c478bd9Sstevel@tonic-gate extern int _tx_getprotaddr(int, struct t_bind *, struct t_bind *, int); 319*7c478bd9Sstevel@tonic-gate extern int _tx_listen(int, struct t_call *, int); 320*7c478bd9Sstevel@tonic-gate extern int _tx_look(int, int); 321*7c478bd9Sstevel@tonic-gate extern int _tx_open(const char *, int, struct t_info *, int); 322*7c478bd9Sstevel@tonic-gate extern int _tx_optmgmt(int, const struct t_optmgmt *, struct t_optmgmt *, int); 323*7c478bd9Sstevel@tonic-gate extern int _tx_rcv(int, char *, unsigned, int *, int); 324*7c478bd9Sstevel@tonic-gate extern int _tx_rcvconnect(int, struct t_call *, int); 325*7c478bd9Sstevel@tonic-gate extern int _tx_rcvdis(int, struct t_discon *, int); 326*7c478bd9Sstevel@tonic-gate extern int _tx_rcvrel(int, int); 327*7c478bd9Sstevel@tonic-gate extern int _tx_rcvudata(int, struct t_unitdata *, int *, int); 328*7c478bd9Sstevel@tonic-gate extern int _tx_rcvuderr(int, struct t_uderr *, int); 329*7c478bd9Sstevel@tonic-gate extern int _tx_snd(int, char *, unsigned, int, int); 330*7c478bd9Sstevel@tonic-gate extern int _tx_snddis(int, const struct t_call *, int); 331*7c478bd9Sstevel@tonic-gate extern int _tx_sndrel(int, int); 332*7c478bd9Sstevel@tonic-gate extern int _tx_sndudata(int, const struct t_unitdata *, int); 333*7c478bd9Sstevel@tonic-gate extern char *_tx_strerror(int, int); 334*7c478bd9Sstevel@tonic-gate extern int _tx_sync(int, int); 335*7c478bd9Sstevel@tonic-gate extern int _tx_unbind(int, int); 336*7c478bd9Sstevel@tonic-gate extern int _tx_unbind_locked(int, struct _ti_user *, struct strbuf *); 337*7c478bd9Sstevel@tonic-gate extern int _t_expinline_queued(int, int *); 338*7c478bd9Sstevel@tonic-gate extern int _t_do_postconn_sync(int, struct _ti_user *); 339*7c478bd9Sstevel@tonic-gate 340*7c478bd9Sstevel@tonic-gate /* 341*7c478bd9Sstevel@tonic-gate * The following helper functions are used by scatter/gather functions, 342*7c478bd9Sstevel@tonic-gate * which are defined only for XTI and not available in TLI. Moreover 343*7c478bd9Sstevel@tonic-gate * the definition of struct t_iovec which is used below is not visible to 344*7c478bd9Sstevel@tonic-gate * TLI. Hence tli_wrappers.c should not see the prototypes below. 345*7c478bd9Sstevel@tonic-gate */ 346*7c478bd9Sstevel@tonic-gate #ifndef TLI_WRAPPERS 347*7c478bd9Sstevel@tonic-gate unsigned int _t_bytecount_upto_intmax(const struct t_iovec *, unsigned int); 348*7c478bd9Sstevel@tonic-gate void _t_scatter(struct strbuf *, struct t_iovec *, int); 349*7c478bd9Sstevel@tonic-gate void _t_gather(char *, const struct t_iovec *, unsigned int); 350*7c478bd9Sstevel@tonic-gate void _t_copy_tiov_to_iov(const struct t_iovec *, int, struct iovec *, int *); 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate /* 353*7c478bd9Sstevel@tonic-gate * The following scatter/gather and other misc. functions are defined only 354*7c478bd9Sstevel@tonic-gate * for XTI and not available in TLI. Moreover the definition of struct t_iovec 355*7c478bd9Sstevel@tonic-gate * which is used below is not visible to TLI. Hence tli_wrappers.c should not 356*7c478bd9Sstevel@tonic-gate * see the prototypes below. 357*7c478bd9Sstevel@tonic-gate */ 358*7c478bd9Sstevel@tonic-gate extern int _tx_rcvv(int, struct t_iovec *, unsigned int, int *, int); 359*7c478bd9Sstevel@tonic-gate extern int _tx_rcvreldata(int, struct t_discon *, int); 360*7c478bd9Sstevel@tonic-gate extern int _tx_rcvvudata(int, struct t_unitdata *, struct t_iovec *, 361*7c478bd9Sstevel@tonic-gate unsigned int, int *, int); 362*7c478bd9Sstevel@tonic-gate extern int _tx_sndv(int, const struct t_iovec *, unsigned int, int, int); 363*7c478bd9Sstevel@tonic-gate extern int _tx_sndreldata(int, struct t_discon *, int); 364*7c478bd9Sstevel@tonic-gate extern int _tx_sndvudata(int, const struct t_unitdata *, struct t_iovec *, 365*7c478bd9Sstevel@tonic-gate unsigned int, int); 366*7c478bd9Sstevel@tonic-gate extern int _tx_sysconf(int, int); 367*7c478bd9Sstevel@tonic-gate #endif /* TLI_WRAPPERS */ 368*7c478bd9Sstevel@tonic-gate 369*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 370*7c478bd9Sstevel@tonic-gate } 371*7c478bd9Sstevel@tonic-gate #endif 372*7c478bd9Sstevel@tonic-gate 373*7c478bd9Sstevel@tonic-gate #endif /* _TX_H */ 374