1c398230bSWarner Losh /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3fe267a55SPedro F. Giffuni * 4d122d784SJoel Dahl * Copyright (c) 2000-2001 Boris Popov 5681a5bbeSBoris Popov * All rights reserved. 6681a5bbeSBoris Popov * 7681a5bbeSBoris Popov * Redistribution and use in source and binary forms, with or without 8681a5bbeSBoris Popov * modification, are permitted provided that the following conditions 9681a5bbeSBoris Popov * are met: 10681a5bbeSBoris Popov * 1. Redistributions of source code must retain the above copyright 11681a5bbeSBoris Popov * notice, this list of conditions and the following disclaimer. 12681a5bbeSBoris Popov * 2. Redistributions in binary form must reproduce the above copyright 13681a5bbeSBoris Popov * notice, this list of conditions and the following disclaimer in the 14681a5bbeSBoris Popov * documentation and/or other materials provided with the distribution. 15681a5bbeSBoris Popov * 16681a5bbeSBoris Popov * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17681a5bbeSBoris Popov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18681a5bbeSBoris Popov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19681a5bbeSBoris Popov * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20681a5bbeSBoris Popov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21681a5bbeSBoris Popov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22681a5bbeSBoris Popov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23681a5bbeSBoris Popov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24681a5bbeSBoris Popov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25681a5bbeSBoris Popov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26681a5bbeSBoris Popov * SUCH DAMAGE. 27681a5bbeSBoris Popov */ 28681a5bbeSBoris Popov #ifndef _NETSMB_SMB_TRANTCP_H_ 29681a5bbeSBoris Popov #define _NETSMB_SMB_TRANTCP_H_ 30681a5bbeSBoris Popov 31681a5bbeSBoris Popov #ifdef _KERNEL 32681a5bbeSBoris Popov 33681a5bbeSBoris Popov #ifdef NB_DEBUG 34681a5bbeSBoris Popov #define NBDEBUG(format, args...) printf("%s(%d): "format, \ 356e551fb6SDavid E. O'Brien __func__ , __LINE__ ,## args) 36681a5bbeSBoris Popov #else 37681a5bbeSBoris Popov #define NBDEBUG(format, args...) 38681a5bbeSBoris Popov #endif 39681a5bbeSBoris Popov 40681a5bbeSBoris Popov enum nbstate { 41681a5bbeSBoris Popov NBST_CLOSED, 42681a5bbeSBoris Popov NBST_RQSENT, 43681a5bbeSBoris Popov NBST_SESSION, 44681a5bbeSBoris Popov NBST_RETARGET, 45681a5bbeSBoris Popov NBST_REFUSED 46681a5bbeSBoris Popov }; 47681a5bbeSBoris Popov 48681a5bbeSBoris Popov /* 49681a5bbeSBoris Popov * socket specific data 50681a5bbeSBoris Popov */ 51681a5bbeSBoris Popov struct nbpcb { 52681a5bbeSBoris Popov struct smb_vc * nbp_vc; 53681a5bbeSBoris Popov struct socket * nbp_tso; /* transport socket */ 54681a5bbeSBoris Popov struct sockaddr_nb *nbp_laddr; /* local address */ 55681a5bbeSBoris Popov struct sockaddr_nb *nbp_paddr; /* peer address */ 56681a5bbeSBoris Popov 57681a5bbeSBoris Popov int nbp_flags; 58681a5bbeSBoris Popov #define NBF_LOCADDR 0x0001 /* has local addr */ 59681a5bbeSBoris Popov #define NBF_CONNECTED 0x0002 60681a5bbeSBoris Popov #define NBF_RECVLOCK 0x0004 61681a5bbeSBoris Popov 62681a5bbeSBoris Popov enum nbstate nbp_state; 63681a5bbeSBoris Popov struct timespec nbp_timo; 64681a5bbeSBoris Popov int nbp_sndbuf; 65681a5bbeSBoris Popov int nbp_rcvbuf; 66681a5bbeSBoris Popov void * nbp_selectid; 67681a5bbeSBoris Popov 68681a5bbeSBoris Popov /* LIST_ENTRY(nbpcb) nbp_link;*/ 69681a5bbeSBoris Popov }; 70681a5bbeSBoris Popov 71681a5bbeSBoris Popov /* 72681a5bbeSBoris Popov * Nominal space allocated per a NETBIOS socket. 73681a5bbeSBoris Popov */ 743c304004SBoris Popov #define NB_SNDQ (64 * 1024) 753c304004SBoris Popov #define NB_RCVQ (64 * 1024) 763c304004SBoris Popov 773c304004SBoris Popov /* 783c304004SBoris Popov * TCP slowstart presents a problem in conjunction with large 793c304004SBoris Popov * reads. To ensure a steady stream of ACKs while reading using 803c304004SBoris Popov * large transaction sizes, we call soreceive() with a smaller 813c304004SBoris Popov * buffer size. See nbssn_recv(). 823c304004SBoris Popov */ 833c304004SBoris Popov #define NB_SORECEIVE_CHUNK (8 * 1024) 84681a5bbeSBoris Popov 85681a5bbeSBoris Popov extern struct smb_tran_desc smb_tran_nbtcp_desc; 86681a5bbeSBoris Popov 87681a5bbeSBoris Popov #endif /* _KERNEL */ 88681a5bbeSBoris Popov 89681a5bbeSBoris Popov #endif /* !_NETSMB_SMB_TRANTCP_H_ */ 90