xref: /illumos-gate/usr/src/lib/libnsl/nsl/tx.h (revision 09b0d01c)
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  */
2261961e0fSrobinson 
237c478bd9Sstevel@tonic-gate /*
24*09b0d01cSGary Mills  * Copyright 2014 Gary Mills
2561961e0fSrobinson  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifndef	_TX_H
307c478bd9Sstevel@tonic-gate #define	_TX_H
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/uio.h>
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
357c478bd9Sstevel@tonic-gate extern "C" {
367c478bd9Sstevel@tonic-gate #endif
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate /*
397c478bd9Sstevel@tonic-gate  * This file contains declarations local to the TLI/XTI implmentation
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Look buffer list
447c478bd9Sstevel@tonic-gate  * Could be multiple buffers for MT case
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate struct _ti_lookbufs {
477c478bd9Sstevel@tonic-gate 	struct _ti_lookbufs *tl_next; /* next in list   */
487c478bd9Sstevel@tonic-gate 	int	tl_lookclen;	/* "look" ctl part length */
497c478bd9Sstevel@tonic-gate 	char	*tl_lookcbuf;	/* pointer to "look" ctl	*/
507c478bd9Sstevel@tonic-gate 	int	tl_lookdlen;	/* "look" data length	*/
517c478bd9Sstevel@tonic-gate 	char	*tl_lookdbuf;	/* pointer to "look" data */
527c478bd9Sstevel@tonic-gate };
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /* TI interface user level structure - one per open file */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate struct _ti_user {
577c478bd9Sstevel@tonic-gate 	struct _ti_user	*ti_next; 	/* next one		*/
587c478bd9Sstevel@tonic-gate 	struct _ti_user	*ti_prev; 	/* previous one	*/
597c478bd9Sstevel@tonic-gate 	int	ti_fd;			/* file descriptor	*/
607c478bd9Sstevel@tonic-gate 	struct  _ti_lookbufs ti_lookbufs; /* head of list of look buffers */
617c478bd9Sstevel@tonic-gate 	int	ti_lookcnt;		/* buffered look flag	*/
627c478bd9Sstevel@tonic-gate 	ushort_t ti_flags;		/* flags		*/
637c478bd9Sstevel@tonic-gate 	int	ti_rcvsize;	/* connect or disconnect data buf size */
647c478bd9Sstevel@tonic-gate 	char	*ti_rcvbuf;		/* connect or disconnect data buffer */
657c478bd9Sstevel@tonic-gate 	int	ti_ctlsize;		/* ctl buffer size	*/
667c478bd9Sstevel@tonic-gate 	char	*ti_ctlbuf;		/* ctl buffer		*/
677c478bd9Sstevel@tonic-gate 	int	ti_state;		/* user level state	*/
687c478bd9Sstevel@tonic-gate 	int	ti_ocnt;		/* # outstanding connect indications */
697c478bd9Sstevel@tonic-gate 	t_scalar_t	ti_maxpsz;	/* TIDU size		*/
707c478bd9Sstevel@tonic-gate 	t_scalar_t	ti_tsdusize;	/* TSDU size		*/
717c478bd9Sstevel@tonic-gate 	t_scalar_t	ti_etsdusize;	/* ETSDU size		*/
727c478bd9Sstevel@tonic-gate 	t_scalar_t	ti_cdatasize;	/* CDATA_size		*/
737c478bd9Sstevel@tonic-gate 	t_scalar_t	ti_ddatasize;	/* DDATA_size		*/
747c478bd9Sstevel@tonic-gate 	t_scalar_t	ti_servtype;	/* service type		*/
757c478bd9Sstevel@tonic-gate 	t_scalar_t	ti_prov_flag;	/* TPI PROVIDER_flag	*/
767c478bd9Sstevel@tonic-gate 	uint_t	ti_qlen;	/* listener backlog limit */
777c478bd9Sstevel@tonic-gate 	t_uscalar_t	acceptor_id;	/* Saved acceptor_id value */
787c478bd9Sstevel@tonic-gate 	dev_t	ti_rdev;		/* for fd validation */
797c478bd9Sstevel@tonic-gate 	ino_t	ti_ino;			/* for fd validation */
807c478bd9Sstevel@tonic-gate 	mutex_t ti_lock;	/* lock to protect this data structure */
817c478bd9Sstevel@tonic-gate };
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate /*
847c478bd9Sstevel@tonic-gate  * Local flags used with ti_flags field in instance structure of
857c478bd9Sstevel@tonic-gate  * type 'struct _ti_user' declared above. Historical note:
867c478bd9Sstevel@tonic-gate  * This namespace constants were previously declared in a
877c478bd9Sstevel@tonic-gate  * a very messed up namespace in timod.h
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate #define	USED		0x0001	/* data structure in use		*/
907c478bd9Sstevel@tonic-gate #define	MORE		0x0008	/* more data				*/
917c478bd9Sstevel@tonic-gate #define	EXPEDITED	0x0010	/* processing expedited TSDU		*/
927c478bd9Sstevel@tonic-gate #define	V_ACCEPTOR_ID	0x0020	/* acceptor_id field is has valid value	*/
937c478bd9Sstevel@tonic-gate #define	TX_TQFULL_NOTIFIED 0x0040  /* TQFULL error has been returned once  */
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  * Valid flags that can be passed by user in t_sndv() or t_snd()
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate #define	TX_ALL_VALID_FLAGS (T_MORE|T_EXPEDITED|T_PUSH)
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate #define	_T_MAX(x, y) 		((x) > (y) ? (x) : (y))
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /*
1057c478bd9Sstevel@tonic-gate  * Following are used to indicate which API entry point is calling common
1067c478bd9Sstevel@tonic-gate  * routines
1077c478bd9Sstevel@tonic-gate  */
1087c478bd9Sstevel@tonic-gate #define		TX_TLI_API	1	/* The API semantics is TLI */
1097c478bd9Sstevel@tonic-gate #define		TX_XTI_XNS4_API	2	/* The API semantics is XTI Unix95 */
1107c478bd9Sstevel@tonic-gate #define		TX_XTI_XNS5_API	3	/* The API semantics is XTI Unix98 */
1117c478bd9Sstevel@tonic-gate #define		TX_XTI_API	TX_XTI_XNS4_API
1127c478bd9Sstevel@tonic-gate 					/* The base XTI semantics is Unix95 */
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /* _T_IS_XTI(x) - Is 'x' an XTI inspired api_semantics */
1157c478bd9Sstevel@tonic-gate #define		_T_IS_XTI(x)	((x) != TX_TLI_API)
1167c478bd9Sstevel@tonic-gate #define		_T_IS_TLI(x)	((x) == TX_TLI_API)
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate /* _T_API_VER_LT(x, y) - Is API version 'x' older than API version 'y' */
1197c478bd9Sstevel@tonic-gate #define		_T_API_VER_LT(x, y)	((x) < (y))
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate  * Note: T_BADSTATE also defined in <sys/tiuser.h>
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate #define	T_BADSTATE 8
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate #ifdef DEBUG
1277c478bd9Sstevel@tonic-gate #include <syslog.h>
1287c478bd9Sstevel@tonic-gate #define	_T_TX_SYSLOG2(tiptr, X, Y) if ((tiptr)->ti_state == T_BADSTATE)\
1297c478bd9Sstevel@tonic-gate 	syslog(X, Y)
1307c478bd9Sstevel@tonic-gate #else
1317c478bd9Sstevel@tonic-gate #define	_T_TX_SYSLOG2(tiptr, X, Y)
1327c478bd9Sstevel@tonic-gate #endif	/* DEBUG */
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate /*
1357c478bd9Sstevel@tonic-gate  * Macro to change state and log invalid state error
1367c478bd9Sstevel@tonic-gate  */
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate #define	_T_TX_NEXTSTATE(event, tiptr, errstr)	\
1397c478bd9Sstevel@tonic-gate 	{	tiptr->ti_state = tiusr_statetbl[event][(tiptr)->ti_state]; \
1407c478bd9Sstevel@tonic-gate 		_T_TX_SYSLOG2((tiptr), LOG_ERR, errstr); \
1417c478bd9Sstevel@tonic-gate 	}
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate /*
1447c478bd9Sstevel@tonic-gate  * External declarations
1457c478bd9Sstevel@tonic-gate  */
1467c478bd9Sstevel@tonic-gate extern mutex_t _ti_userlock;
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate /*
1497c478bd9Sstevel@tonic-gate  * Useful shared local constants
1507c478bd9Sstevel@tonic-gate  */
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate /*
1537c478bd9Sstevel@tonic-gate  * TX_XTI_LEVEL_MAX_OPTBUF:
1547c478bd9Sstevel@tonic-gate  * 	Max option buffer requirement reserved for any XTI level options
1557c478bd9Sstevel@tonic-gate  *	passed in an option buffer. This is intended as an upper bound.
1567c478bd9Sstevel@tonic-gate  *	Regardless of what the providers states in OPT_size of T_info_ack,
1577c478bd9Sstevel@tonic-gate  *	XTI level options can also be added to the option buffer and XTI
1587c478bd9Sstevel@tonic-gate  *	test suite in particular stuffs XTI level options whether we support
1597c478bd9Sstevel@tonic-gate  *	them or not.
1607c478bd9Sstevel@tonic-gate  *
1617c478bd9Sstevel@tonic-gate  * Here is the heuristic used to arrive at a value:
1627c478bd9Sstevel@tonic-gate  *	2* [		// factor of 2 for "repeat options" type testing
1637c478bd9Sstevel@tonic-gate  *		(sizeof(struct t_opthdr)+10*sizeof(t_scalar_t))	// XTI_DEBUG
1647c478bd9Sstevel@tonic-gate  *	       +(sizeof(struct t_opthdr)+ 2*sizeof(t_scalar_t))	// XTI_LINGER
1657c478bd9Sstevel@tonic-gate  *	       +(sizeof(struct t_opthdr)+ sizeof(t_scalar_t))	// XTI_RCVBUF
1667c478bd9Sstevel@tonic-gate  *	       +(sizeof(struct t_opthdr)+ sizeof(t_scalar_t))	// XTI_RCVLOWAT
1677c478bd9Sstevel@tonic-gate  *	       +(sizeof(struct t_opthdr)+ sizeof(t_scalar_t))	// XTI_SNDBUF
1687c478bd9Sstevel@tonic-gate  *	       +(sizeof(struct t_opthdr)+ sizeof(t_scalar_t))	// XTI_SNDLOWAT
1697c478bd9Sstevel@tonic-gate  *	   ]
1707c478bd9Sstevel@tonic-gate  * => 2* [ 56+24+20+20+20+20 ]
1717c478bd9Sstevel@tonic-gate  * =>
1727c478bd9Sstevel@tonic-gate  */
1737c478bd9Sstevel@tonic-gate #define	TX_XTI_LEVEL_MAX_OPTBUF	320
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate /*
1777c478bd9Sstevel@tonic-gate  * Historic information note:
1787c478bd9Sstevel@tonic-gate  * The libnsl/nsl code implements TLI and XTI interfaces using common
1797c478bd9Sstevel@tonic-gate  * code. Most data structures are similar in the exposed interfaces for
1807c478bd9Sstevel@tonic-gate  * the two interfaces (<tiuser.h> and <xti.h>).
1817c478bd9Sstevel@tonic-gate  * The common implementation C files include only <xti.h> which is the
1827c478bd9Sstevel@tonic-gate  * superset in terms of the exposed interfaces. However the file <tiuser.h>
1837c478bd9Sstevel@tonic-gate  * exposes (via <sys/tiuser.h>), in the past contained certain declarations
1847c478bd9Sstevel@tonic-gate  * that are strictly internal to the implementation but were exposed through
1857c478bd9Sstevel@tonic-gate  * their presence in the public header (<tiuser.h>).
1867c478bd9Sstevel@tonic-gate  * Since the implmentation still needs these declarations, they follow
1877c478bd9Sstevel@tonic-gate  * in this file and are removed from exposure through the TLI public header
1887c478bd9Sstevel@tonic-gate  * (<tiuser.h>) which exposed them in the past.
1897c478bd9Sstevel@tonic-gate  */
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate /*
1927c478bd9Sstevel@tonic-gate  * The following are TLI/XTI user level events which cause
1937c478bd9Sstevel@tonic-gate  * state changes.
1947c478bd9Sstevel@tonic-gate  * NOTE: Historical namespace pollution warning.
1957c478bd9Sstevel@tonic-gate  * Some of the event names share the namespace with structure tags
1967c478bd9Sstevel@tonic-gate  * so there are defined inside comments here and exposed through
1977c478bd9Sstevel@tonic-gate  * TLI and XTI headers (<tiuser.h> and <xti.h>
1987c478bd9Sstevel@tonic-gate  */
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate #define	T_OPEN 		0
2017c478bd9Sstevel@tonic-gate /* #define	T_BIND		1 */
2027c478bd9Sstevel@tonic-gate /* #define	T_OPTMGMT	2 */
2037c478bd9Sstevel@tonic-gate #define	T_UNBIND	3
2047c478bd9Sstevel@tonic-gate #define	T_CLOSE		4
2057c478bd9Sstevel@tonic-gate #define	T_SNDUDATA	5
2067c478bd9Sstevel@tonic-gate #define	T_RCVUDATA	6
2077c478bd9Sstevel@tonic-gate #define	T_RCVUDERR	7
2087c478bd9Sstevel@tonic-gate #define	T_CONNECT1	8
2097c478bd9Sstevel@tonic-gate #define	T_CONNECT2	9
2107c478bd9Sstevel@tonic-gate #define	T_RCVCONNECT	10
2117c478bd9Sstevel@tonic-gate #define	T_LISTN		11
2127c478bd9Sstevel@tonic-gate #define	T_ACCEPT1	12
2137c478bd9Sstevel@tonic-gate #define	T_ACCEPT2	13
2147c478bd9Sstevel@tonic-gate #define	T_ACCEPT3	14
2157c478bd9Sstevel@tonic-gate #define	T_SND		15
2167c478bd9Sstevel@tonic-gate #define	T_RCV		16
2177c478bd9Sstevel@tonic-gate #define	T_SNDDIS1	17
2187c478bd9Sstevel@tonic-gate #define	T_SNDDIS2	18
2197c478bd9Sstevel@tonic-gate #define	T_RCVDIS1	19
2207c478bd9Sstevel@tonic-gate #define	T_RCVDIS2	20
2217c478bd9Sstevel@tonic-gate #define	T_RCVDIS3	21
2227c478bd9Sstevel@tonic-gate #define	T_SNDREL	22
2237c478bd9Sstevel@tonic-gate #define	T_RCVREL	23
2247c478bd9Sstevel@tonic-gate #define	T_PASSCON	24
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate #define	T_NOEVENTS	25
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate #define	T_NOSTATES 	9	/* number of legal states */
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate extern char tiusr_statetbl[T_NOEVENTS][T_NOSTATES];
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate /*
2337c478bd9Sstevel@tonic-gate  * Band definitions for data flow.
2347c478bd9Sstevel@tonic-gate  */
2357c478bd9Sstevel@tonic-gate #define	TI_NORMAL	0
2367c478bd9Sstevel@tonic-gate #define	TI_EXPEDITED	1
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate /*
2397c478bd9Sstevel@tonic-gate  * Bogus states from tiuser.h
2407c478bd9Sstevel@tonic-gate  */
2417c478bd9Sstevel@tonic-gate #define	T_FAKE		8	/* fake state used when state	*/
2427c478bd9Sstevel@tonic-gate 				/* cannot be determined		*/
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate /*
2457c478bd9Sstevel@tonic-gate  * Flags for t_getname() from tiuser.h
2467c478bd9Sstevel@tonic-gate  * Note: This routine's counterpart in XTI is substatnially modified
2477c478bd9Sstevel@tonic-gate  * (i.e. t_getprotaddr() and does not use these flags)
2487c478bd9Sstevel@tonic-gate  */
2497c478bd9Sstevel@tonic-gate #define	LOCALNAME	0
2507c478bd9Sstevel@tonic-gate #define	REMOTENAME	1
2517c478bd9Sstevel@tonic-gate 
2527c478bd9Sstevel@tonic-gate /*
2537c478bd9Sstevel@tonic-gate  * GENERAL UTILITY MACROS
2547c478bd9Sstevel@tonic-gate  */
2557c478bd9Sstevel@tonic-gate #define	A_CNT(arr)	(sizeof (arr)/sizeof (arr[0]))
2567c478bd9Sstevel@tonic-gate #define	A_END(arr)	(&arr[A_CNT(arr)])
2577c478bd9Sstevel@tonic-gate #define	A_LAST(arr)	(&arr[A_CNT(arr)-1])
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate /*
2607c478bd9Sstevel@tonic-gate  * Following macro compares a signed size obtained from TPI primitive
2617c478bd9Sstevel@tonic-gate  * to unsigned size of buffer where it needs to go into passed using
2627c478bd9Sstevel@tonic-gate  * the "struct netbuf" type.
2637c478bd9Sstevel@tonic-gate  * Since many programs are buggy and forget to initialize "netbuf" or
2647c478bd9Sstevel@tonic-gate  * (while unlikely!) allocated buffer can legally even be larger than
2657c478bd9Sstevel@tonic-gate  * max signed integer, we use the following macro to do unsigned comparison
2667c478bd9Sstevel@tonic-gate  * after verifying that signed quantity is positive.
2677c478bd9Sstevel@tonic-gate  */
2687c478bd9Sstevel@tonic-gate #define	TLEN_GT_NLEN(tpilen, netbuflen) \
2697c478bd9Sstevel@tonic-gate 	(((tpilen) > 0) && ((unsigned int)(tpilen) > (netbuflen)))
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate /*
2737c478bd9Sstevel@tonic-gate  *	N.B.:  this interface is deprecated.  Use t_strerror() instead.
2747c478bd9Sstevel@tonic-gate  */
2757c478bd9Sstevel@tonic-gate extern char *t_errlist[];
2767c478bd9Sstevel@tonic-gate extern int t_nerr;
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate /*
2797c478bd9Sstevel@tonic-gate  * UTILITY ROUTINES FUNCTION PROTOTYPES
2807c478bd9Sstevel@tonic-gate  */
2817c478bd9Sstevel@tonic-gate 
28261961e0fSrobinson extern void _t_adjust_iov(int, struct iovec *, int *);
28361961e0fSrobinson extern struct _ti_user *_t_checkfd(int, int, int);
28461961e0fSrobinson extern int _t_delete_tilink(int);
28561961e0fSrobinson extern int _t_rcv_conn_con(struct _ti_user *, struct t_call *, struct strbuf *,
28661961e0fSrobinson 							int);
28761961e0fSrobinson extern int _t_snd_conn_req(struct _ti_user *, const struct t_call *,
28861961e0fSrobinson 							struct strbuf *);
28961961e0fSrobinson extern int _t_aligned_copy(struct strbuf *, int, int, char *, t_scalar_t *);
29061961e0fSrobinson extern struct _ti_user *_t_create(int, struct t_info *, int, int *);
29161961e0fSrobinson extern int _t_do_ioctl(int, char *, int, int, int *);
29261961e0fSrobinson extern int _t_is_event(int, struct _ti_user *);
29361961e0fSrobinson extern int _t_is_ok(int, struct _ti_user *, t_scalar_t);
29461961e0fSrobinson extern int _t_look_locked(int, struct _ti_user *, int, int);
29561961e0fSrobinson extern int _t_register_lookevent(struct _ti_user *, caddr_t, int, caddr_t, int);
29661961e0fSrobinson extern void _t_free_looklist_head(struct _ti_user *);
29761961e0fSrobinson extern void _t_flush_lookevents(struct _ti_user *);
29861961e0fSrobinson extern int _t_acquire_ctlbuf(struct _ti_user *, struct strbuf *, int *);
29961961e0fSrobinson extern int _t_acquire_databuf(struct _ti_user *, struct strbuf *, int *);
3007c478bd9Sstevel@tonic-gate 
3017c478bd9Sstevel@tonic-gate /*
3027c478bd9Sstevel@tonic-gate  * Core function TLI/XTI routines function prototypes
3037c478bd9Sstevel@tonic-gate  */
3047c478bd9Sstevel@tonic-gate extern int _tx_accept(int, int, const struct t_call *, int);
3057c478bd9Sstevel@tonic-gate extern char *_tx_alloc(int, int, int, int);
3067c478bd9Sstevel@tonic-gate extern int _tx_bind(int, const struct t_bind *, struct t_bind *, int);
3077c478bd9Sstevel@tonic-gate extern int _tx_close(int, int);
3087c478bd9Sstevel@tonic-gate extern int _tx_connect(int, const struct t_call *, struct t_call *, int);
3097c478bd9Sstevel@tonic-gate extern int _tx_error(const char *, int);
3107c478bd9Sstevel@tonic-gate extern int _tx_free(char *, int, int);
3117c478bd9Sstevel@tonic-gate extern int _tx_getinfo(int, struct t_info *, int);
3127c478bd9Sstevel@tonic-gate extern int _tx_getname(int, struct netbuf *, int, int);
3137c478bd9Sstevel@tonic-gate extern int _tx_getstate(int, int);
3147c478bd9Sstevel@tonic-gate extern int _tx_getprotaddr(int, struct t_bind *, struct t_bind *, int);
3157c478bd9Sstevel@tonic-gate extern int _tx_listen(int, struct t_call *, int);
3167c478bd9Sstevel@tonic-gate extern int _tx_look(int, int);
3177c478bd9Sstevel@tonic-gate extern int _tx_open(const char *, int, struct t_info *, int);
3187c478bd9Sstevel@tonic-gate extern int _tx_optmgmt(int, const struct t_optmgmt *, struct t_optmgmt *, int);
3197c478bd9Sstevel@tonic-gate extern int _tx_rcv(int, char *, unsigned, int *, int);
3207c478bd9Sstevel@tonic-gate extern int _tx_rcvconnect(int, struct t_call *, int);
3217c478bd9Sstevel@tonic-gate extern int _tx_rcvdis(int, struct t_discon *, int);
3227c478bd9Sstevel@tonic-gate extern int _tx_rcvrel(int, int);
3237c478bd9Sstevel@tonic-gate extern int _tx_rcvudata(int, struct t_unitdata *, int *, int);
3247c478bd9Sstevel@tonic-gate extern int _tx_rcvuderr(int, struct t_uderr *, int);
3257c478bd9Sstevel@tonic-gate extern int _tx_snd(int, char *, unsigned, int, int);
3267c478bd9Sstevel@tonic-gate extern int _tx_snddis(int, const struct t_call *, int);
3277c478bd9Sstevel@tonic-gate extern int _tx_sndrel(int, int);
3287c478bd9Sstevel@tonic-gate extern int _tx_sndudata(int, const struct t_unitdata *, int);
3297c478bd9Sstevel@tonic-gate extern char *_tx_strerror(int, int);
3307c478bd9Sstevel@tonic-gate extern int _tx_sync(int, int);
3317c478bd9Sstevel@tonic-gate extern int _tx_unbind(int, int);
3327c478bd9Sstevel@tonic-gate extern int _tx_unbind_locked(int, struct _ti_user *, struct strbuf *);
3337c478bd9Sstevel@tonic-gate extern int _t_expinline_queued(int, int *);
3347c478bd9Sstevel@tonic-gate extern int _t_do_postconn_sync(int, struct _ti_user *);
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate /*
3377c478bd9Sstevel@tonic-gate  * The following helper functions are used by scatter/gather functions,
3387c478bd9Sstevel@tonic-gate  * which are defined only for XTI and not available in TLI. Moreover
3397c478bd9Sstevel@tonic-gate  * the definition of struct t_iovec which is used below is not visible to
3407c478bd9Sstevel@tonic-gate  * TLI. Hence tli_wrappers.c should not see the prototypes below.
3417c478bd9Sstevel@tonic-gate  */
3427c478bd9Sstevel@tonic-gate #ifndef TLI_WRAPPERS
3437c478bd9Sstevel@tonic-gate unsigned int _t_bytecount_upto_intmax(const struct t_iovec *, unsigned int);
3447c478bd9Sstevel@tonic-gate void _t_scatter(struct strbuf *, struct t_iovec *, int);
3457c478bd9Sstevel@tonic-gate void _t_gather(char *, const struct t_iovec *, unsigned int);
3467c478bd9Sstevel@tonic-gate void _t_copy_tiov_to_iov(const struct t_iovec *, int, struct iovec *, int *);
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate /*
3497c478bd9Sstevel@tonic-gate  * The following scatter/gather and other misc. functions are defined only
3507c478bd9Sstevel@tonic-gate  * for XTI and not available in TLI. Moreover the definition of struct t_iovec
3517c478bd9Sstevel@tonic-gate  * which is used below is not visible to TLI. Hence tli_wrappers.c should not
3527c478bd9Sstevel@tonic-gate  * see the prototypes below.
3537c478bd9Sstevel@tonic-gate  */
3547c478bd9Sstevel@tonic-gate extern int _tx_rcvv(int, struct t_iovec *, unsigned int,  int *, int);
3557c478bd9Sstevel@tonic-gate extern int _tx_rcvreldata(int, struct t_discon *, int);
3567c478bd9Sstevel@tonic-gate extern int _tx_rcvvudata(int, struct t_unitdata *, struct t_iovec *,
3577c478bd9Sstevel@tonic-gate     unsigned int, int *, int);
3587c478bd9Sstevel@tonic-gate extern int _tx_sndv(int, const struct t_iovec *, unsigned int, int, int);
3597c478bd9Sstevel@tonic-gate extern int _tx_sndreldata(int, struct t_discon *, int);
3607c478bd9Sstevel@tonic-gate extern int _tx_sndvudata(int, const struct t_unitdata *, struct t_iovec *,
3617c478bd9Sstevel@tonic-gate     unsigned int, int);
3627c478bd9Sstevel@tonic-gate extern int _tx_sysconf(int, int);
3637c478bd9Sstevel@tonic-gate #endif /* TLI_WRAPPERS */
3647c478bd9Sstevel@tonic-gate 
3657c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3667c478bd9Sstevel@tonic-gate }
3677c478bd9Sstevel@tonic-gate #endif
3687c478bd9Sstevel@tonic-gate 
3697c478bd9Sstevel@tonic-gate #endif	/* _TX_H */
370