xref: /illumos-gate/usr/src/uts/common/sys/tiuser.h (revision ba3594ba)
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 /*
29*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
30*ba3594baSGarrett D'Amore  *
317c478bd9Sstevel@tonic-gate  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
327c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
3309b0d01cSGary Mills  * Copyright 2014 Gary Mills
347c478bd9Sstevel@tonic-gate  */
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifndef _SYS_TIUSER_H
377c478bd9Sstevel@tonic-gate #define	_SYS_TIUSER_H
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #include <sys/types.h>
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * The following include file has declarations needed by both the kernel
427c478bd9Sstevel@tonic-gate  * level transport providers and the user level library.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate #include <sys/tpicommon.h>
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
477c478bd9Sstevel@tonic-gate extern "C" {
487c478bd9Sstevel@tonic-gate #endif
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
527c478bd9Sstevel@tonic-gate  * The following are the events returned by t_look
537c478bd9Sstevel@tonic-gate  */
547c478bd9Sstevel@tonic-gate #define	T_LISTEN	0x0001	/* connection indication received	*/
557c478bd9Sstevel@tonic-gate #define	T_CONNECT	0x0002	/* connect confirmation received	*/
567c478bd9Sstevel@tonic-gate #define	T_DATA		0x0004	/* normal data received			*/
577c478bd9Sstevel@tonic-gate #define	T_EXDATA	0x0008	/* expedited data received		*/
587c478bd9Sstevel@tonic-gate #define	T_DISCONNECT	0x0010	/* disconnect received			*/
597c478bd9Sstevel@tonic-gate #define	T_UDERR		0x0040	/* data gram error indication		*/
607c478bd9Sstevel@tonic-gate #define	T_ORDREL	0x0080	/* orderly release indication		*/
617c478bd9Sstevel@tonic-gate #define	T_EVENTS	0x00ff	/* event mask				*/
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * Flags for data primitives.
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate #define	T_MORE		0x001	/* more data		*/
677c478bd9Sstevel@tonic-gate #define	T_EXPEDITED	0x002	/* expedited data	*/
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * protocol specific service limits
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate struct t_info {
757c478bd9Sstevel@tonic-gate 	t_scalar_t addr;	/* size of protocol address		*/
767c478bd9Sstevel@tonic-gate 	t_scalar_t options;	/* size of protocol options		*/
777c478bd9Sstevel@tonic-gate 	t_scalar_t tsdu;	/* size of max transport service data unit */
787c478bd9Sstevel@tonic-gate 	t_scalar_t etsdu;	/* size of max expedited tsdu		*/
797c478bd9Sstevel@tonic-gate 	t_scalar_t connect;	/* max data for connection primitives	*/
807c478bd9Sstevel@tonic-gate 	t_scalar_t discon;	/* max data for disconnect primitives	*/
817c478bd9Sstevel@tonic-gate 	t_scalar_t servtype;	/* provider service type		*/
827c478bd9Sstevel@tonic-gate };
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate /*
857c478bd9Sstevel@tonic-gate  * netbuf structure
867c478bd9Sstevel@tonic-gate  */
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate struct netbuf {
897c478bd9Sstevel@tonic-gate 	unsigned int	maxlen;
907c478bd9Sstevel@tonic-gate 	unsigned int	len;
917c478bd9Sstevel@tonic-gate 	char		*buf;
927c478bd9Sstevel@tonic-gate };
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
957c478bd9Sstevel@tonic-gate struct netbuf32 {
967c478bd9Sstevel@tonic-gate 	uint32_t	maxlen;
977c478bd9Sstevel@tonic-gate 	uint32_t	len;
987c478bd9Sstevel@tonic-gate 	caddr32_t	buf;
997c478bd9Sstevel@tonic-gate };
1007c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /*
1037c478bd9Sstevel@tonic-gate  * t_bind - format of the address and options arguments of bind
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate struct t_bind {
1077c478bd9Sstevel@tonic-gate 	struct netbuf	addr;
1087c478bd9Sstevel@tonic-gate 	unsigned int	qlen;
1097c478bd9Sstevel@tonic-gate };
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /*
1127c478bd9Sstevel@tonic-gate  * options management
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate struct t_optmgmt {
1157c478bd9Sstevel@tonic-gate 	struct netbuf	opt;
1167c478bd9Sstevel@tonic-gate 	t_scalar_t	flags;
1177c478bd9Sstevel@tonic-gate };
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  * disconnect structure
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate struct t_discon {
1237c478bd9Sstevel@tonic-gate 	struct netbuf	udata;		/* user data		*/
1247c478bd9Sstevel@tonic-gate 	int		reason;		/* reason code		*/
1257c478bd9Sstevel@tonic-gate 	int		sequence;	/* sequence number	*/
1267c478bd9Sstevel@tonic-gate };
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /*
1297c478bd9Sstevel@tonic-gate  * call structure
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate struct t_call {
1327c478bd9Sstevel@tonic-gate 	struct netbuf	addr;		/*  address		*/
1337c478bd9Sstevel@tonic-gate 	struct netbuf	opt;		/* options		*/
1347c478bd9Sstevel@tonic-gate 	struct netbuf	udata;		/* user data		*/
1357c478bd9Sstevel@tonic-gate 	int		sequence;	/* sequence number	*/
1367c478bd9Sstevel@tonic-gate };
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate /*
1397c478bd9Sstevel@tonic-gate  * data gram structure
1407c478bd9Sstevel@tonic-gate  */
1417c478bd9Sstevel@tonic-gate struct t_unitdata {
1427c478bd9Sstevel@tonic-gate 	struct netbuf	addr;		/*  address		*/
1437c478bd9Sstevel@tonic-gate 	struct netbuf	opt;		/* options		*/
1447c478bd9Sstevel@tonic-gate 	struct netbuf	udata;		/* user data		*/
1457c478bd9Sstevel@tonic-gate };
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * unitdata error
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate struct t_uderr {
1517c478bd9Sstevel@tonic-gate 	struct netbuf	addr;		/* address		*/
1527c478bd9Sstevel@tonic-gate 	struct netbuf	opt;		/* options 		*/
1537c478bd9Sstevel@tonic-gate 	t_scalar_t	error;		/* error code		*/
1547c478bd9Sstevel@tonic-gate };
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate  * The following are structure types used when dynamically
1587c478bd9Sstevel@tonic-gate  * allocating the above structures via t_structalloc().
1597c478bd9Sstevel@tonic-gate  */
1607c478bd9Sstevel@tonic-gate #define	T_BIND		1		/* struct t_bind	*/
1617c478bd9Sstevel@tonic-gate #define	T_OPTMGMT	2		/* struct t_optmgmt	*/
1627c478bd9Sstevel@tonic-gate #define	T_CALL		3		/* struct t_call	*/
1637c478bd9Sstevel@tonic-gate #define	T_DIS		4		/* struct t_discon	*/
1647c478bd9Sstevel@tonic-gate #define	T_UNITDATA	5		/* struct t_unitdata	*/
1657c478bd9Sstevel@tonic-gate #define	T_UDERROR	6		/* struct t_uderr	*/
1667c478bd9Sstevel@tonic-gate #define	T_INFO		7		/* struct t_info	*/
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate /*
1697c478bd9Sstevel@tonic-gate  * The following bits specify which fields of the above
1707c478bd9Sstevel@tonic-gate  * structures should be allocated by t_structalloc().
1717c478bd9Sstevel@tonic-gate  */
1727c478bd9Sstevel@tonic-gate #define	T_ADDR	0x01			/* address		*/
1737c478bd9Sstevel@tonic-gate #define	T_OPT	0x02			/* options		*/
1747c478bd9Sstevel@tonic-gate #define	T_UDATA	0x04			/* user data		*/
1757c478bd9Sstevel@tonic-gate #define	T_ALL	0x07			/* all the above	*/
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * the following are the states for the user
1797c478bd9Sstevel@tonic-gate  */
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate #define	T_UNINIT	0		/* uninitialized		*/
1827c478bd9Sstevel@tonic-gate #define	T_UNBND		1		/* unbound			*/
1837c478bd9Sstevel@tonic-gate #define	T_IDLE		2		/* idle				*/
1847c478bd9Sstevel@tonic-gate #define	T_OUTCON	3		/* outgoing connection pending 	*/
1857c478bd9Sstevel@tonic-gate #define	T_INCON		4		/* incoming connection pending	*/
1867c478bd9Sstevel@tonic-gate #define	T_DATAXFER	5		/* data transfer		*/
1877c478bd9Sstevel@tonic-gate #define	T_OUTREL	6		/* outgoing release pending	*/
1887c478bd9Sstevel@tonic-gate #define	T_INREL		7		/* incoming release pending	*/
1897c478bd9Sstevel@tonic-gate #define	T_BADSTATE	8		/* illegal state */
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate /*
1927c478bd9Sstevel@tonic-gate  * Flags for t_getname.
1937c478bd9Sstevel@tonic-gate  */
1947c478bd9Sstevel@tonic-gate #define	LOCALNAME	0
1957c478bd9Sstevel@tonic-gate #define	REMOTENAME	1
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 #ifdef	__cplusplus
2347c478bd9Sstevel@tonic-gate }
2357c478bd9Sstevel@tonic-gate #endif
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate #endif	/* _SYS_TIUSER_H */
238