14bff34e3Sthurlow /* 24bff34e3Sthurlow * Copyright (c) 2000-2001, Boris Popov 34bff34e3Sthurlow * All rights reserved. 44bff34e3Sthurlow * 54bff34e3Sthurlow * Redistribution and use in source and binary forms, with or without 64bff34e3Sthurlow * modification, are permitted provided that the following conditions 74bff34e3Sthurlow * are met: 84bff34e3Sthurlow * 1. Redistributions of source code must retain the above copyright 94bff34e3Sthurlow * notice, this list of conditions and the following disclaimer. 104bff34e3Sthurlow * 2. Redistributions in binary form must reproduce the above copyright 114bff34e3Sthurlow * notice, this list of conditions and the following disclaimer in the 124bff34e3Sthurlow * documentation and/or other materials provided with the distribution. 134bff34e3Sthurlow * 3. All advertising materials mentioning features or use of this software 144bff34e3Sthurlow * must display the following acknowledgement: 154bff34e3Sthurlow * This product includes software developed by Boris Popov. 164bff34e3Sthurlow * 4. Neither the name of the author nor the names of any co-contributors 174bff34e3Sthurlow * may be used to endorse or promote products derived from this software 184bff34e3Sthurlow * without specific prior written permission. 194bff34e3Sthurlow * 204bff34e3Sthurlow * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 214bff34e3Sthurlow * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 224bff34e3Sthurlow * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 234bff34e3Sthurlow * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 244bff34e3Sthurlow * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 254bff34e3Sthurlow * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 264bff34e3Sthurlow * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 274bff34e3Sthurlow * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 284bff34e3Sthurlow * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 294bff34e3Sthurlow * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304bff34e3Sthurlow * SUCH DAMAGE. 314bff34e3Sthurlow * 324bff34e3Sthurlow * $Id: smb_trantcp.h,v 1.8 2004/08/03 23:50:01 lindak Exp $ 334bff34e3Sthurlow */ 343d804dabSGordon Ross /* 35*40c0e231SGordon Ross * Copyright 2018 Nexenta Systems, Inc. All rights reserved. 363d804dabSGordon Ross */ 374bff34e3Sthurlow #ifndef _NETSMB_SMB_TRANTCP_H_ 384bff34e3Sthurlow #define _NETSMB_SMB_TRANTCP_H_ 394bff34e3Sthurlow 404bff34e3Sthurlow enum nbstate { 414bff34e3Sthurlow NBST_CLOSED, 42*40c0e231SGordon Ross NBST_IDLE, 434bff34e3Sthurlow NBST_RQSENT, 444bff34e3Sthurlow NBST_SESSION, 454bff34e3Sthurlow NBST_RETARGET, 464bff34e3Sthurlow NBST_REFUSED 474bff34e3Sthurlow }; 484bff34e3Sthurlow 494bff34e3Sthurlow 504bff34e3Sthurlow /* 514bff34e3Sthurlow * socket specific data 524bff34e3Sthurlow */ 534bff34e3Sthurlow struct nbpcb { 544bff34e3Sthurlow struct smb_vc *nbp_vc; 554bff34e3Sthurlow struct tiuser *nbp_tiptr; /* KTLI transport handle... */ 564bff34e3Sthurlow mblk_t *nbp_frag; /* left-over from last recv */ 574bff34e3Sthurlow 584bff34e3Sthurlow struct sockaddr_nb *nbp_laddr; /* local address */ 594bff34e3Sthurlow struct sockaddr_nb *nbp_paddr; /* peer address */ 603d804dabSGordon Ross void *nbp_selectid; 613d804dabSGordon Ross cred_t *nbp_cred; 624bff34e3Sthurlow 634bff34e3Sthurlow int nbp_flags; 644bff34e3Sthurlow #define NBF_LOCADDR 0x0001 /* has local addr */ 654bff34e3Sthurlow #define NBF_CONNECTED 0x0002 664bff34e3Sthurlow #define NBF_RECVLOCK 0x0004 673d804dabSGordon Ross #define NBF_SENDLOCK 0x0008 683d804dabSGordon Ross #define NBF_LOCKWAIT 0x0010 694bff34e3Sthurlow 703d804dabSGordon Ross ushort_t nbp_fmode; 714bff34e3Sthurlow enum nbstate nbp_state; 724bff34e3Sthurlow struct timespec nbp_timo; 734bff34e3Sthurlow int nbp_sndbuf; 744bff34e3Sthurlow int nbp_rcvbuf; 754bff34e3Sthurlow kmutex_t nbp_lock; 763d804dabSGordon Ross kcondvar_t nbp_cv; 774bff34e3Sthurlow }; 784bff34e3Sthurlow typedef struct nbpcb nbpcb_t; 794bff34e3Sthurlow 804bff34e3Sthurlow /* 814bff34e3Sthurlow * Nominal space allocated per a NETBIOS socket. 824bff34e3Sthurlow */ 834bff34e3Sthurlow #define NB_SNDQ (10 * 1024) 844bff34e3Sthurlow #define NB_RCVQ (20 * 1024) 854bff34e3Sthurlow 864bff34e3Sthurlow /* 874bff34e3Sthurlow * TCP slowstart presents a problem in conjunction with large 884bff34e3Sthurlow * reads. To ensure a steady stream of ACKs while reading using 894bff34e3Sthurlow * large transaction sizes, we call soreceive() with a smaller 904bff34e3Sthurlow * buffer size. See nbssn_recv(). 914bff34e3Sthurlow */ 924bff34e3Sthurlow #define NB_SORECEIVE_CHUNK (8 * 1024) 934bff34e3Sthurlow 944bff34e3Sthurlow #define SMBSBTIMO 15 /* seconds for sockbuf timeouts */ 954bff34e3Sthurlow 964bff34e3Sthurlow #endif /* !_NETSMB_SMB_TRANTCP_H_ */ 97