1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2014 Garrett D'Amore <garrett@damore.org> 24 * 25 * Copyright 1998 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms. 27 */ 28 29 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 30 /* All Rights Reserved */ 31 32 /* 33 * University Copyright- Copyright (c) 1982, 1986, 1988 34 * The Regents of the University of California 35 * All Rights Reserved 36 * 37 * University Acknowledgment- Portions of this document are derived from 38 * software developed by the University of California, Berkeley, and its 39 * contributors. 40 */ 41 42 #ifndef _SYS_T_KUSER_H 43 #define _SYS_T_KUSER_H 44 45 #pragma ident "%Z%%M% %I% %E% SMI" 46 47 #include <sys/types.h> 48 #include <sys/file.h> 49 #include <sys/cred.h> 50 #include <sys/stream.h> 51 #include <sys/tiuser.h> 52 53 #ifdef __cplusplus 54 extern "C" { 55 #endif 56 57 /* 58 * Note this structure will need to be expanded to handle data 59 * related to connection orientated transports. 60 */ 61 typedef struct tiuser { 62 struct file *fp; 63 struct t_info tp_info; /* Transport provider Info. */ 64 int flags; 65 } TIUSER; 66 #define TIUSERSZ sizeof (TIUSER) 67 68 struct knetbuf { 69 mblk_t *udata_mp; /* current receive streams block */ 70 unsigned int maxlen; 71 unsigned int len; 72 char *buf; 73 }; 74 75 struct t_kunitdata { 76 struct netbuf addr; 77 struct netbuf opt; 78 struct knetbuf udata; 79 }; 80 81 82 #ifdef KTLIDEBUG 83 extern int ktli_log(); 84 extern int ktlilog; 85 86 #define KTLILOG(A, B, C) ((void)((ktlilog) && ktli_log((A), (B), (C)))) 87 #else 88 #define KTLILOG(A, B, C) 89 #endif 90 91 /* 92 * flags 93 */ 94 #define MADE_FP 0x02 95 96 extern int t_kalloc(TIUSER *, int, int, char **); 97 extern int t_kbind(TIUSER *, struct t_bind *, struct t_bind *); 98 extern int t_kclose(TIUSER *, int); 99 extern int t_kconnect(TIUSER *, struct t_call *, struct t_call *); 100 extern int t_kfree(TIUSER *, char *, int); 101 extern int t_kgetstate(TIUSER *, int *); 102 extern int t_kopen(struct file *, dev_t, int, TIUSER **, struct cred *); 103 extern int t_krcvudata(TIUSER *, struct t_kunitdata *, int *, int *); 104 extern int t_ksndudata(TIUSER *, struct t_kunitdata *, frtn_t *); 105 extern int t_kspoll(TIUSER *, int, int, int *); 106 extern int t_kunbind(TIUSER *); 107 extern int tli_send(TIUSER *, mblk_t *, int); 108 extern int tli_recv(TIUSER *, mblk_t **, int); 109 extern int t_tlitosyserr(int); 110 extern int get_ok_ack(TIUSER *, int, int); 111 112 /* 113 * these make life a lot easier 114 */ 115 #define TCONNREQSZ sizeof (struct T_conn_req) 116 #define TCONNRESSZ sizeof (struct T_conn_res) 117 #define TDISCONREQSZ sizeof (struct T_discon_req) 118 #define TDATAREQSZ sizeof (struct T_data_req) 119 #define TEXDATAREQSZ sizeof (struct T_exdata_req) 120 #define TINFOREQSZ sizeof (struct T_info_req) 121 #define TBINDREQSZ sizeof (struct T_bind_req) 122 #define TUNBINDREQSZ sizeof (struct T_unbind_req) 123 #define TUNITDATAREQSZ sizeof (struct T_unitdata_req) 124 #define TOPTMGMTREQSZ sizeof (struct T_optmgmt_req) 125 #define TORDRELREQSZ sizeof (struct T_ordrel_req) 126 #define TCONNINDSZ sizeof (struct T_conn_ind) 127 #define TCONNCONSZ sizeof (struct T_conn_con) 128 #define TDISCONINDSZ sizeof (struct T_discon_ind) 129 #define TDATAINDSZ sizeof (struct T_data_ind) 130 #define TEXDATAINDSZ sizeof (struct T_exdata_ind) 131 #define TINFOACKSZ sizeof (struct T_info_ack) 132 #define TBINDACKSZ sizeof (struct T_bind_ack) 133 #define TERRORACKSZ sizeof (struct T_error_ack) 134 #define TOKACKSZ sizeof (struct T_ok_ack) 135 #define TUNITDATAINDSZ sizeof (struct T_unitdata_ind) 136 #define TUDERRORINDSZ sizeof (struct T_uderror_ind) 137 #define TOPTMGMTACKSZ sizeof (struct T_optmgmt_ack) 138 #define TORDRELINDSZ sizeof (struct T_ordrel_ind) 139 #define TPRIMITIVES sizeof (struct T_primitives) 140 141 #ifdef __cplusplus 142 } 143 #endif 144 145 #endif /* _SYS_T_KUSER_H */