17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T 247c478bd9Sstevel@tonic-gate * All Rights Reserved 257c478bd9Sstevel@tonic-gate * 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate /* 297c478bd9Sstevel@tonic-gate * Copyright 2002 Sun Microsystems, Inc. All rights reserved. 307c478bd9Sstevel@tonic-gate * Use is subject to license terms. 31*9fe74b0bSGary Mills * Copyright 2014 Gary Mills 327c478bd9Sstevel@tonic-gate */ 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifndef _SYS_TIUSER_H 357c478bd9Sstevel@tonic-gate #define _SYS_TIUSER_H 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #include <sys/types.h> 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * The following include file has declarations needed by both the kernel 407c478bd9Sstevel@tonic-gate * level transport providers and the user level library. 417c478bd9Sstevel@tonic-gate */ 427c478bd9Sstevel@tonic-gate #include <sys/tpicommon.h> 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #ifdef __cplusplus 457c478bd9Sstevel@tonic-gate extern "C" { 467c478bd9Sstevel@tonic-gate #endif 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* 507c478bd9Sstevel@tonic-gate * The following are the events returned by t_look 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate #define T_LISTEN 0x0001 /* connection indication received */ 537c478bd9Sstevel@tonic-gate #define T_CONNECT 0x0002 /* connect confirmation received */ 547c478bd9Sstevel@tonic-gate #define T_DATA 0x0004 /* normal data received */ 557c478bd9Sstevel@tonic-gate #define T_EXDATA 0x0008 /* expedited data received */ 567c478bd9Sstevel@tonic-gate #define T_DISCONNECT 0x0010 /* disconnect received */ 577c478bd9Sstevel@tonic-gate #define T_UDERR 0x0040 /* data gram error indication */ 587c478bd9Sstevel@tonic-gate #define T_ORDREL 0x0080 /* orderly release indication */ 597c478bd9Sstevel@tonic-gate #define T_EVENTS 0x00ff /* event mask */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate /* 627c478bd9Sstevel@tonic-gate * Flags for data primitives. 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate #define T_MORE 0x001 /* more data */ 657c478bd9Sstevel@tonic-gate #define T_EXPEDITED 0x002 /* expedited data */ 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * protocol specific service limits 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate struct t_info { 737c478bd9Sstevel@tonic-gate t_scalar_t addr; /* size of protocol address */ 747c478bd9Sstevel@tonic-gate t_scalar_t options; /* size of protocol options */ 757c478bd9Sstevel@tonic-gate t_scalar_t tsdu; /* size of max transport service data unit */ 767c478bd9Sstevel@tonic-gate t_scalar_t etsdu; /* size of max expedited tsdu */ 777c478bd9Sstevel@tonic-gate t_scalar_t connect; /* max data for connection primitives */ 787c478bd9Sstevel@tonic-gate t_scalar_t discon; /* max data for disconnect primitives */ 797c478bd9Sstevel@tonic-gate t_scalar_t servtype; /* provider service type */ 807c478bd9Sstevel@tonic-gate }; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* 837c478bd9Sstevel@tonic-gate * netbuf structure 847c478bd9Sstevel@tonic-gate */ 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate struct netbuf { 877c478bd9Sstevel@tonic-gate unsigned int maxlen; 887c478bd9Sstevel@tonic-gate unsigned int len; 897c478bd9Sstevel@tonic-gate char *buf; 907c478bd9Sstevel@tonic-gate }; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 937c478bd9Sstevel@tonic-gate struct netbuf32 { 947c478bd9Sstevel@tonic-gate uint32_t maxlen; 957c478bd9Sstevel@tonic-gate uint32_t len; 967c478bd9Sstevel@tonic-gate caddr32_t buf; 977c478bd9Sstevel@tonic-gate }; 987c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate /* 1017c478bd9Sstevel@tonic-gate * t_bind - format of the address and options arguments of bind 1027c478bd9Sstevel@tonic-gate */ 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate struct t_bind { 1057c478bd9Sstevel@tonic-gate struct netbuf addr; 1067c478bd9Sstevel@tonic-gate unsigned int qlen; 1077c478bd9Sstevel@tonic-gate }; 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* 1107c478bd9Sstevel@tonic-gate * options management 1117c478bd9Sstevel@tonic-gate */ 1127c478bd9Sstevel@tonic-gate struct t_optmgmt { 1137c478bd9Sstevel@tonic-gate struct netbuf opt; 1147c478bd9Sstevel@tonic-gate t_scalar_t flags; 1157c478bd9Sstevel@tonic-gate }; 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate /* 1187c478bd9Sstevel@tonic-gate * disconnect structure 1197c478bd9Sstevel@tonic-gate */ 1207c478bd9Sstevel@tonic-gate struct t_discon { 1217c478bd9Sstevel@tonic-gate struct netbuf udata; /* user data */ 1227c478bd9Sstevel@tonic-gate int reason; /* reason code */ 1237c478bd9Sstevel@tonic-gate int sequence; /* sequence number */ 1247c478bd9Sstevel@tonic-gate }; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate /* 1277c478bd9Sstevel@tonic-gate * call structure 1287c478bd9Sstevel@tonic-gate */ 1297c478bd9Sstevel@tonic-gate struct t_call { 1307c478bd9Sstevel@tonic-gate struct netbuf addr; /* address */ 1317c478bd9Sstevel@tonic-gate struct netbuf opt; /* options */ 1327c478bd9Sstevel@tonic-gate struct netbuf udata; /* user data */ 1337c478bd9Sstevel@tonic-gate int sequence; /* sequence number */ 1347c478bd9Sstevel@tonic-gate }; 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* 1377c478bd9Sstevel@tonic-gate * data gram structure 1387c478bd9Sstevel@tonic-gate */ 1397c478bd9Sstevel@tonic-gate struct t_unitdata { 1407c478bd9Sstevel@tonic-gate struct netbuf addr; /* address */ 1417c478bd9Sstevel@tonic-gate struct netbuf opt; /* options */ 1427c478bd9Sstevel@tonic-gate struct netbuf udata; /* user data */ 1437c478bd9Sstevel@tonic-gate }; 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* 1467c478bd9Sstevel@tonic-gate * unitdata error 1477c478bd9Sstevel@tonic-gate */ 1487c478bd9Sstevel@tonic-gate struct t_uderr { 1497c478bd9Sstevel@tonic-gate struct netbuf addr; /* address */ 1507c478bd9Sstevel@tonic-gate struct netbuf opt; /* options */ 1517c478bd9Sstevel@tonic-gate t_scalar_t error; /* error code */ 1527c478bd9Sstevel@tonic-gate }; 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate /* 1557c478bd9Sstevel@tonic-gate * The following are structure types used when dynamically 1567c478bd9Sstevel@tonic-gate * allocating the above structures via t_structalloc(). 1577c478bd9Sstevel@tonic-gate */ 1587c478bd9Sstevel@tonic-gate #define T_BIND 1 /* struct t_bind */ 1597c478bd9Sstevel@tonic-gate #define T_OPTMGMT 2 /* struct t_optmgmt */ 1607c478bd9Sstevel@tonic-gate #define T_CALL 3 /* struct t_call */ 1617c478bd9Sstevel@tonic-gate #define T_DIS 4 /* struct t_discon */ 1627c478bd9Sstevel@tonic-gate #define T_UNITDATA 5 /* struct t_unitdata */ 1637c478bd9Sstevel@tonic-gate #define T_UDERROR 6 /* struct t_uderr */ 1647c478bd9Sstevel@tonic-gate #define T_INFO 7 /* struct t_info */ 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate /* 1677c478bd9Sstevel@tonic-gate * The following bits specify which fields of the above 1687c478bd9Sstevel@tonic-gate * structures should be allocated by t_structalloc(). 1697c478bd9Sstevel@tonic-gate */ 1707c478bd9Sstevel@tonic-gate #define T_ADDR 0x01 /* address */ 1717c478bd9Sstevel@tonic-gate #define T_OPT 0x02 /* options */ 1727c478bd9Sstevel@tonic-gate #define T_UDATA 0x04 /* user data */ 1737c478bd9Sstevel@tonic-gate #define T_ALL 0x07 /* all the above */ 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate /* 1767c478bd9Sstevel@tonic-gate * the following are the states for the user 1777c478bd9Sstevel@tonic-gate */ 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate #define T_UNINIT 0 /* uninitialized */ 1807c478bd9Sstevel@tonic-gate #define T_UNBND 1 /* unbound */ 1817c478bd9Sstevel@tonic-gate #define T_IDLE 2 /* idle */ 1827c478bd9Sstevel@tonic-gate #define T_OUTCON 3 /* outgoing connection pending */ 1837c478bd9Sstevel@tonic-gate #define T_INCON 4 /* incoming connection pending */ 1847c478bd9Sstevel@tonic-gate #define T_DATAXFER 5 /* data transfer */ 1857c478bd9Sstevel@tonic-gate #define T_OUTREL 6 /* outgoing release pending */ 1867c478bd9Sstevel@tonic-gate #define T_INREL 7 /* incoming release pending */ 1877c478bd9Sstevel@tonic-gate #define T_BADSTATE 8 /* illegal state */ 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate /* 1907c478bd9Sstevel@tonic-gate * Flags for t_getname. 1917c478bd9Sstevel@tonic-gate */ 1927c478bd9Sstevel@tonic-gate #define LOCALNAME 0 1937c478bd9Sstevel@tonic-gate #define REMOTENAME 1 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate #if defined(__STDC__) 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate extern int t_accept(int fildes, int resfd, struct t_call *call); 1987c478bd9Sstevel@tonic-gate extern char *t_alloc(int fildes, int struct_type, int fields); 1997c478bd9Sstevel@tonic-gate extern int t_bind(int fildes, struct t_bind *req, struct t_bind *ret); 2007c478bd9Sstevel@tonic-gate extern int t_close(int fildes); 2017c478bd9Sstevel@tonic-gate extern int t_connect(int fildes, struct t_call *sndcall, 2027c478bd9Sstevel@tonic-gate struct t_call *rcvcall); 2037c478bd9Sstevel@tonic-gate extern void t_error(const char *errmsg); 2047c478bd9Sstevel@tonic-gate extern int t_free(char *ptr, int struct_type); 2057c478bd9Sstevel@tonic-gate extern int t_getinfo(int fildes, struct t_info *info); 2067c478bd9Sstevel@tonic-gate extern int t_getname(int fildes, struct netbuf *name, int type); 2077c478bd9Sstevel@tonic-gate extern int t_getstate(int fildes); 2087c478bd9Sstevel@tonic-gate extern int t_listen(int fildes, struct t_call *call); 2097c478bd9Sstevel@tonic-gate extern int t_look(int fildes); 2107c478bd9Sstevel@tonic-gate extern int t_open(const char *path, int oflag, struct t_info *info); 2117c478bd9Sstevel@tonic-gate extern int t_optmgmt(int fildes, struct t_optmgmt *req, 2127c478bd9Sstevel@tonic-gate struct t_optmgmt *ret); 2137c478bd9Sstevel@tonic-gate extern int t_rcv(int fildes, char *buf, unsigned nbytes, int *flags); 2147c478bd9Sstevel@tonic-gate extern int t_rcvconnect(int fildes, struct t_call *call); 2157c478bd9Sstevel@tonic-gate extern int t_rcvdis(int fildes, struct t_discon *discon); 2167c478bd9Sstevel@tonic-gate extern int t_rcvrel(int fildes); 2177c478bd9Sstevel@tonic-gate extern int t_rcvudata(int fildes, struct t_unitdata *unitdata, int *flags); 2187c478bd9Sstevel@tonic-gate extern int t_rcvuderr(int fildes, struct t_uderr *uderr); 2197c478bd9Sstevel@tonic-gate extern int t_snd(int fildes, char *buf, unsigned nbytes, int flags); 2207c478bd9Sstevel@tonic-gate extern int t_snddis(int fildes, struct t_call *call); 2217c478bd9Sstevel@tonic-gate extern int t_sndrel(int fildes); 2227c478bd9Sstevel@tonic-gate extern int t_sndudata(int fildes, struct t_unitdata *unitdata); 2237c478bd9Sstevel@tonic-gate extern char *t_strerror(int errnum); 2247c478bd9Sstevel@tonic-gate extern int t_sync(int fildes); 2257c478bd9Sstevel@tonic-gate extern int t_unbind(int fildes); 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate /* 2287c478bd9Sstevel@tonic-gate * N.B.: this interface is deprecated. Use t_strerror() instead. 2297c478bd9Sstevel@tonic-gate */ 2307c478bd9Sstevel@tonic-gate extern char *t_errlist[]; 2317c478bd9Sstevel@tonic-gate extern int t_nerr; 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 2347c478bd9Sstevel@tonic-gate 2357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2367c478bd9Sstevel@tonic-gate } 2377c478bd9Sstevel@tonic-gate #endif 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate #endif /* _SYS_TIUSER_H */ 240