xref: /illumos-gate/usr/src/uts/common/sys/t_kuser.h (revision 40c0e231)
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 /*
23ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24ba3594baSGarrett D'Amore  *
257c478bd9Sstevel@tonic-gate  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
307c478bd9Sstevel@tonic-gate /*	  All Rights Reserved	*/
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
347c478bd9Sstevel@tonic-gate  * The Regents of the University of California
357c478bd9Sstevel@tonic-gate  * All Rights Reserved
367c478bd9Sstevel@tonic-gate  *
377c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
387c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
397c478bd9Sstevel@tonic-gate  * contributors.
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifndef	_SYS_T_KUSER_H
437c478bd9Sstevel@tonic-gate #define	_SYS_T_KUSER_H
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #include <sys/types.h>
467c478bd9Sstevel@tonic-gate #include <sys/file.h>
477c478bd9Sstevel@tonic-gate #include <sys/cred.h>
487c478bd9Sstevel@tonic-gate #include <sys/stream.h>
497c478bd9Sstevel@tonic-gate #include <sys/tiuser.h>
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
527c478bd9Sstevel@tonic-gate extern "C" {
537c478bd9Sstevel@tonic-gate #endif
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * Note this structure will need to be expanded to handle data
5781ad62fcSSergio Aguayo  * related to connection oriented transports.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate typedef struct tiuser {
607c478bd9Sstevel@tonic-gate 	struct	file *fp;
617c478bd9Sstevel@tonic-gate 	struct	t_info tp_info;	/* Transport provider Info. */
627c478bd9Sstevel@tonic-gate 	int	flags;
637c478bd9Sstevel@tonic-gate } TIUSER;
647c478bd9Sstevel@tonic-gate #define		TIUSERSZ	sizeof (TIUSER)
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate struct knetbuf {
677c478bd9Sstevel@tonic-gate 	mblk_t   *udata_mp;	/* current receive streams block */
687c478bd9Sstevel@tonic-gate 	unsigned int maxlen;
697c478bd9Sstevel@tonic-gate 	unsigned int len;
707c478bd9Sstevel@tonic-gate 	char	*buf;
717c478bd9Sstevel@tonic-gate };
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate struct t_kunitdata {
747c478bd9Sstevel@tonic-gate 	struct netbuf addr;
757c478bd9Sstevel@tonic-gate 	struct netbuf opt;
767c478bd9Sstevel@tonic-gate 	struct knetbuf udata;
777c478bd9Sstevel@tonic-gate };
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate #ifdef KTLIDEBUG
817c478bd9Sstevel@tonic-gate extern int	ktli_log();
827c478bd9Sstevel@tonic-gate extern int	ktlilog;
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #define		KTLILOG(A, B, C) ((void)((ktlilog) && ktli_log((A), (B), (C))))
857c478bd9Sstevel@tonic-gate #else
867c478bd9Sstevel@tonic-gate #define		KTLILOG(A, B, C)
877c478bd9Sstevel@tonic-gate #endif
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate /*
907c478bd9Sstevel@tonic-gate  * flags
917c478bd9Sstevel@tonic-gate  */
927c478bd9Sstevel@tonic-gate #define		MADE_FP		0x02
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate extern int	t_kalloc(TIUSER *, int, int, char **);
957c478bd9Sstevel@tonic-gate extern int	t_kbind(TIUSER *, struct t_bind *, struct t_bind *);
967c478bd9Sstevel@tonic-gate extern int	t_kclose(TIUSER *, int);
977c478bd9Sstevel@tonic-gate extern int	t_kconnect(TIUSER *, struct t_call *, struct t_call *);
987c478bd9Sstevel@tonic-gate extern int	t_kfree(TIUSER *, char *, int);
997c478bd9Sstevel@tonic-gate extern int	t_kgetstate(TIUSER *, int *);
1007c478bd9Sstevel@tonic-gate extern int	t_kopen(struct file *, dev_t, int, TIUSER **, struct cred *);
101*40c0e231SGordon Ross extern int	t_koptmgmt(TIUSER *, struct t_optmgmt *, struct t_optmgmt *);
1027c478bd9Sstevel@tonic-gate extern int	t_krcvudata(TIUSER *, struct t_kunitdata *, int *, int *);
1037c478bd9Sstevel@tonic-gate extern int	t_ksndudata(TIUSER *, struct t_kunitdata *, frtn_t *);
1047c478bd9Sstevel@tonic-gate extern int	t_kspoll(TIUSER *, int, int, int *);
1057c478bd9Sstevel@tonic-gate extern int	t_kunbind(TIUSER *);
1067c478bd9Sstevel@tonic-gate extern int	tli_send(TIUSER *, mblk_t *, int);
1077c478bd9Sstevel@tonic-gate extern int	tli_recv(TIUSER *, mblk_t **, int);
1087c478bd9Sstevel@tonic-gate extern int	t_tlitosyserr(int);
1097c478bd9Sstevel@tonic-gate extern int	get_ok_ack(TIUSER *, int, int);
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /*
1127c478bd9Sstevel@tonic-gate  * these make life a lot easier
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate #define		TCONNREQSZ	sizeof (struct T_conn_req)
1157c478bd9Sstevel@tonic-gate #define		TCONNRESSZ	sizeof (struct T_conn_res)
1167c478bd9Sstevel@tonic-gate #define		TDISCONREQSZ	sizeof (struct T_discon_req)
1177c478bd9Sstevel@tonic-gate #define		TDATAREQSZ	sizeof (struct T_data_req)
1187c478bd9Sstevel@tonic-gate #define		TEXDATAREQSZ	sizeof (struct T_exdata_req)
1197c478bd9Sstevel@tonic-gate #define		TINFOREQSZ	sizeof (struct T_info_req)
1207c478bd9Sstevel@tonic-gate #define		TBINDREQSZ	sizeof (struct T_bind_req)
1217c478bd9Sstevel@tonic-gate #define		TUNBINDREQSZ	sizeof (struct T_unbind_req)
1227c478bd9Sstevel@tonic-gate #define		TUNITDATAREQSZ	sizeof (struct T_unitdata_req)
1237c478bd9Sstevel@tonic-gate #define		TOPTMGMTREQSZ	sizeof (struct T_optmgmt_req)
1247c478bd9Sstevel@tonic-gate #define		TORDRELREQSZ	sizeof (struct T_ordrel_req)
1257c478bd9Sstevel@tonic-gate #define		TCONNINDSZ	sizeof (struct T_conn_ind)
1267c478bd9Sstevel@tonic-gate #define		TCONNCONSZ	sizeof (struct T_conn_con)
1277c478bd9Sstevel@tonic-gate #define		TDISCONINDSZ	sizeof (struct T_discon_ind)
1287c478bd9Sstevel@tonic-gate #define		TDATAINDSZ	sizeof (struct T_data_ind)
1297c478bd9Sstevel@tonic-gate #define		TEXDATAINDSZ	sizeof (struct T_exdata_ind)
1307c478bd9Sstevel@tonic-gate #define		TINFOACKSZ	sizeof (struct T_info_ack)
1317c478bd9Sstevel@tonic-gate #define		TBINDACKSZ	sizeof (struct T_bind_ack)
1327c478bd9Sstevel@tonic-gate #define		TERRORACKSZ	sizeof (struct T_error_ack)
1337c478bd9Sstevel@tonic-gate #define		TOKACKSZ	sizeof (struct T_ok_ack)
1347c478bd9Sstevel@tonic-gate #define		TUNITDATAINDSZ	sizeof (struct T_unitdata_ind)
1357c478bd9Sstevel@tonic-gate #define		TUDERRORINDSZ	sizeof (struct T_uderror_ind)
1367c478bd9Sstevel@tonic-gate #define		TOPTMGMTACKSZ	sizeof (struct T_optmgmt_ack)
1377c478bd9Sstevel@tonic-gate #define		TORDRELINDSZ	sizeof (struct T_ordrel_ind)
1387c478bd9Sstevel@tonic-gate #define		TPRIMITIVES	sizeof (struct T_primitives)
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1417c478bd9Sstevel@tonic-gate }
1427c478bd9Sstevel@tonic-gate #endif
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate #endif	/* _SYS_T_KUSER_H */
145