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 (c) 1984, 1986, 1987, 1988, 1989 AT&T 24*7c478bd9Sstevel@tonic-gate * All Rights Reserved 25*7c478bd9Sstevel@tonic-gate * 26*7c478bd9Sstevel@tonic-gate */ 27*7c478bd9Sstevel@tonic-gate 28*7c478bd9Sstevel@tonic-gate /* 29*7c478bd9Sstevel@tonic-gate * Copyright 2002 Sun Microsystems, Inc. All rights reserved. 30*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 31*7c478bd9Sstevel@tonic-gate */ 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate #ifndef _SYS_TIUSER_H 34*7c478bd9Sstevel@tonic-gate #define _SYS_TIUSER_H 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 39*7c478bd9Sstevel@tonic-gate /* 40*7c478bd9Sstevel@tonic-gate * The following include file has declarations needed by both the kernel 41*7c478bd9Sstevel@tonic-gate * level transport providers and the user level library. 42*7c478bd9Sstevel@tonic-gate */ 43*7c478bd9Sstevel@tonic-gate #include <sys/tpicommon.h> 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 46*7c478bd9Sstevel@tonic-gate extern "C" { 47*7c478bd9Sstevel@tonic-gate #endif 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* 51*7c478bd9Sstevel@tonic-gate * The following are the events returned by t_look 52*7c478bd9Sstevel@tonic-gate */ 53*7c478bd9Sstevel@tonic-gate #define T_LISTEN 0x0001 /* connection indication received */ 54*7c478bd9Sstevel@tonic-gate #define T_CONNECT 0x0002 /* connect confirmation received */ 55*7c478bd9Sstevel@tonic-gate #define T_DATA 0x0004 /* normal data received */ 56*7c478bd9Sstevel@tonic-gate #define T_EXDATA 0x0008 /* expedited data received */ 57*7c478bd9Sstevel@tonic-gate #define T_DISCONNECT 0x0010 /* disconnect received */ 58*7c478bd9Sstevel@tonic-gate #define T_ERROR 0x0020 /* fatal error occurred */ 59*7c478bd9Sstevel@tonic-gate #define T_UDERR 0x0040 /* data gram error indication */ 60*7c478bd9Sstevel@tonic-gate #define T_ORDREL 0x0080 /* orderly release indication */ 61*7c478bd9Sstevel@tonic-gate #define T_EVENTS 0x00ff /* event mask */ 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate /* 64*7c478bd9Sstevel@tonic-gate * Flags for data primitives. 65*7c478bd9Sstevel@tonic-gate */ 66*7c478bd9Sstevel@tonic-gate #define T_MORE 0x001 /* more data */ 67*7c478bd9Sstevel@tonic-gate #define T_EXPEDITED 0x002 /* expedited data */ 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate /* 71*7c478bd9Sstevel@tonic-gate * protocol specific service limits 72*7c478bd9Sstevel@tonic-gate */ 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate struct t_info { 75*7c478bd9Sstevel@tonic-gate t_scalar_t addr; /* size of protocol address */ 76*7c478bd9Sstevel@tonic-gate t_scalar_t options; /* size of protocol options */ 77*7c478bd9Sstevel@tonic-gate t_scalar_t tsdu; /* size of max transport service data unit */ 78*7c478bd9Sstevel@tonic-gate t_scalar_t etsdu; /* size of max expedited tsdu */ 79*7c478bd9Sstevel@tonic-gate t_scalar_t connect; /* max data for connection primitives */ 80*7c478bd9Sstevel@tonic-gate t_scalar_t discon; /* max data for disconnect primitives */ 81*7c478bd9Sstevel@tonic-gate t_scalar_t servtype; /* provider service type */ 82*7c478bd9Sstevel@tonic-gate }; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate /* 85*7c478bd9Sstevel@tonic-gate * netbuf structure 86*7c478bd9Sstevel@tonic-gate */ 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate struct netbuf { 89*7c478bd9Sstevel@tonic-gate unsigned int maxlen; 90*7c478bd9Sstevel@tonic-gate unsigned int len; 91*7c478bd9Sstevel@tonic-gate char *buf; 92*7c478bd9Sstevel@tonic-gate }; 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 95*7c478bd9Sstevel@tonic-gate struct netbuf32 { 96*7c478bd9Sstevel@tonic-gate uint32_t maxlen; 97*7c478bd9Sstevel@tonic-gate uint32_t len; 98*7c478bd9Sstevel@tonic-gate caddr32_t buf; 99*7c478bd9Sstevel@tonic-gate }; 100*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate /* 103*7c478bd9Sstevel@tonic-gate * t_bind - format of the address and options arguments of bind 104*7c478bd9Sstevel@tonic-gate */ 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate struct t_bind { 107*7c478bd9Sstevel@tonic-gate struct netbuf addr; 108*7c478bd9Sstevel@tonic-gate unsigned int qlen; 109*7c478bd9Sstevel@tonic-gate }; 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate /* 112*7c478bd9Sstevel@tonic-gate * options management 113*7c478bd9Sstevel@tonic-gate */ 114*7c478bd9Sstevel@tonic-gate struct t_optmgmt { 115*7c478bd9Sstevel@tonic-gate struct netbuf opt; 116*7c478bd9Sstevel@tonic-gate t_scalar_t flags; 117*7c478bd9Sstevel@tonic-gate }; 118*7c478bd9Sstevel@tonic-gate 119*7c478bd9Sstevel@tonic-gate /* 120*7c478bd9Sstevel@tonic-gate * disconnect structure 121*7c478bd9Sstevel@tonic-gate */ 122*7c478bd9Sstevel@tonic-gate struct t_discon { 123*7c478bd9Sstevel@tonic-gate struct netbuf udata; /* user data */ 124*7c478bd9Sstevel@tonic-gate int reason; /* reason code */ 125*7c478bd9Sstevel@tonic-gate int sequence; /* sequence number */ 126*7c478bd9Sstevel@tonic-gate }; 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate /* 129*7c478bd9Sstevel@tonic-gate * call structure 130*7c478bd9Sstevel@tonic-gate */ 131*7c478bd9Sstevel@tonic-gate struct t_call { 132*7c478bd9Sstevel@tonic-gate struct netbuf addr; /* address */ 133*7c478bd9Sstevel@tonic-gate struct netbuf opt; /* options */ 134*7c478bd9Sstevel@tonic-gate struct netbuf udata; /* user data */ 135*7c478bd9Sstevel@tonic-gate int sequence; /* sequence number */ 136*7c478bd9Sstevel@tonic-gate }; 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate /* 139*7c478bd9Sstevel@tonic-gate * data gram structure 140*7c478bd9Sstevel@tonic-gate */ 141*7c478bd9Sstevel@tonic-gate struct t_unitdata { 142*7c478bd9Sstevel@tonic-gate struct netbuf addr; /* address */ 143*7c478bd9Sstevel@tonic-gate struct netbuf opt; /* options */ 144*7c478bd9Sstevel@tonic-gate struct netbuf udata; /* user data */ 145*7c478bd9Sstevel@tonic-gate }; 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate /* 148*7c478bd9Sstevel@tonic-gate * unitdata error 149*7c478bd9Sstevel@tonic-gate */ 150*7c478bd9Sstevel@tonic-gate struct t_uderr { 151*7c478bd9Sstevel@tonic-gate struct netbuf addr; /* address */ 152*7c478bd9Sstevel@tonic-gate struct netbuf opt; /* options */ 153*7c478bd9Sstevel@tonic-gate t_scalar_t error; /* error code */ 154*7c478bd9Sstevel@tonic-gate }; 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate /* 157*7c478bd9Sstevel@tonic-gate * The following are structure types used when dynamically 158*7c478bd9Sstevel@tonic-gate * allocating the above structures via t_structalloc(). 159*7c478bd9Sstevel@tonic-gate */ 160*7c478bd9Sstevel@tonic-gate #define T_BIND 1 /* struct t_bind */ 161*7c478bd9Sstevel@tonic-gate #define T_OPTMGMT 2 /* struct t_optmgmt */ 162*7c478bd9Sstevel@tonic-gate #define T_CALL 3 /* struct t_call */ 163*7c478bd9Sstevel@tonic-gate #define T_DIS 4 /* struct t_discon */ 164*7c478bd9Sstevel@tonic-gate #define T_UNITDATA 5 /* struct t_unitdata */ 165*7c478bd9Sstevel@tonic-gate #define T_UDERROR 6 /* struct t_uderr */ 166*7c478bd9Sstevel@tonic-gate #define T_INFO 7 /* struct t_info */ 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate /* 169*7c478bd9Sstevel@tonic-gate * The following bits specify which fields of the above 170*7c478bd9Sstevel@tonic-gate * structures should be allocated by t_structalloc(). 171*7c478bd9Sstevel@tonic-gate */ 172*7c478bd9Sstevel@tonic-gate #define T_ADDR 0x01 /* address */ 173*7c478bd9Sstevel@tonic-gate #define T_OPT 0x02 /* options */ 174*7c478bd9Sstevel@tonic-gate #define T_UDATA 0x04 /* user data */ 175*7c478bd9Sstevel@tonic-gate #define T_ALL 0x07 /* all the above */ 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate /* 178*7c478bd9Sstevel@tonic-gate * the following are the states for the user 179*7c478bd9Sstevel@tonic-gate */ 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate #define T_UNINIT 0 /* uninitialized */ 182*7c478bd9Sstevel@tonic-gate #define T_UNBND 1 /* unbound */ 183*7c478bd9Sstevel@tonic-gate #define T_IDLE 2 /* idle */ 184*7c478bd9Sstevel@tonic-gate #define T_OUTCON 3 /* outgoing connection pending */ 185*7c478bd9Sstevel@tonic-gate #define T_INCON 4 /* incoming connection pending */ 186*7c478bd9Sstevel@tonic-gate #define T_DATAXFER 5 /* data transfer */ 187*7c478bd9Sstevel@tonic-gate #define T_OUTREL 6 /* outgoing release pending */ 188*7c478bd9Sstevel@tonic-gate #define T_INREL 7 /* incoming release pending */ 189*7c478bd9Sstevel@tonic-gate #define T_BADSTATE 8 /* illegal state */ 190*7c478bd9Sstevel@tonic-gate 191*7c478bd9Sstevel@tonic-gate /* 192*7c478bd9Sstevel@tonic-gate * Flags for t_getname. 193*7c478bd9Sstevel@tonic-gate */ 194*7c478bd9Sstevel@tonic-gate #define LOCALNAME 0 195*7c478bd9Sstevel@tonic-gate #define REMOTENAME 1 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate extern int t_accept(int fildes, int resfd, struct t_call *call); 200*7c478bd9Sstevel@tonic-gate extern char *t_alloc(int fildes, int struct_type, int fields); 201*7c478bd9Sstevel@tonic-gate extern int t_bind(int fildes, struct t_bind *req, struct t_bind *ret); 202*7c478bd9Sstevel@tonic-gate extern int t_close(int fildes); 203*7c478bd9Sstevel@tonic-gate extern int t_connect(int fildes, struct t_call *sndcall, 204*7c478bd9Sstevel@tonic-gate struct t_call *rcvcall); 205*7c478bd9Sstevel@tonic-gate extern void t_error(const char *errmsg); 206*7c478bd9Sstevel@tonic-gate extern int t_free(char *ptr, int struct_type); 207*7c478bd9Sstevel@tonic-gate extern int t_getinfo(int fildes, struct t_info *info); 208*7c478bd9Sstevel@tonic-gate extern int t_getname(int fildes, struct netbuf *name, int type); 209*7c478bd9Sstevel@tonic-gate extern int t_getstate(int fildes); 210*7c478bd9Sstevel@tonic-gate extern int t_listen(int fildes, struct t_call *call); 211*7c478bd9Sstevel@tonic-gate extern int t_look(int fildes); 212*7c478bd9Sstevel@tonic-gate extern int t_open(const char *path, int oflag, struct t_info *info); 213*7c478bd9Sstevel@tonic-gate extern int t_optmgmt(int fildes, struct t_optmgmt *req, 214*7c478bd9Sstevel@tonic-gate struct t_optmgmt *ret); 215*7c478bd9Sstevel@tonic-gate extern int t_rcv(int fildes, char *buf, unsigned nbytes, int *flags); 216*7c478bd9Sstevel@tonic-gate extern int t_rcvconnect(int fildes, struct t_call *call); 217*7c478bd9Sstevel@tonic-gate extern int t_rcvdis(int fildes, struct t_discon *discon); 218*7c478bd9Sstevel@tonic-gate extern int t_rcvrel(int fildes); 219*7c478bd9Sstevel@tonic-gate extern int t_rcvudata(int fildes, struct t_unitdata *unitdata, int *flags); 220*7c478bd9Sstevel@tonic-gate extern int t_rcvuderr(int fildes, struct t_uderr *uderr); 221*7c478bd9Sstevel@tonic-gate extern int t_snd(int fildes, char *buf, unsigned nbytes, int flags); 222*7c478bd9Sstevel@tonic-gate extern int t_snddis(int fildes, struct t_call *call); 223*7c478bd9Sstevel@tonic-gate extern int t_sndrel(int fildes); 224*7c478bd9Sstevel@tonic-gate extern int t_sndudata(int fildes, struct t_unitdata *unitdata); 225*7c478bd9Sstevel@tonic-gate extern char *t_strerror(int errnum); 226*7c478bd9Sstevel@tonic-gate extern int t_sync(int fildes); 227*7c478bd9Sstevel@tonic-gate extern int t_unbind(int fildes); 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate /* 230*7c478bd9Sstevel@tonic-gate * N.B.: this interface is deprecated. Use t_strerror() instead. 231*7c478bd9Sstevel@tonic-gate */ 232*7c478bd9Sstevel@tonic-gate extern char *t_errlist[]; 233*7c478bd9Sstevel@tonic-gate extern int t_nerr; 234*7c478bd9Sstevel@tonic-gate 235*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 238*7c478bd9Sstevel@tonic-gate } 239*7c478bd9Sstevel@tonic-gate #endif 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate #endif /* _SYS_TIUSER_H */ 242