1c398230bSWarner Losh /*- 2d122d784SJoel Dahl * Copyright (c) 2000-2001 Boris Popov 3681a5bbeSBoris Popov * All rights reserved. 4681a5bbeSBoris Popov * 5681a5bbeSBoris Popov * Redistribution and use in source and binary forms, with or without 6681a5bbeSBoris Popov * modification, are permitted provided that the following conditions 7681a5bbeSBoris Popov * are met: 8681a5bbeSBoris Popov * 1. Redistributions of source code must retain the above copyright 9681a5bbeSBoris Popov * notice, this list of conditions and the following disclaimer. 10681a5bbeSBoris Popov * 2. Redistributions in binary form must reproduce the above copyright 11681a5bbeSBoris Popov * notice, this list of conditions and the following disclaimer in the 12681a5bbeSBoris Popov * documentation and/or other materials provided with the distribution. 13681a5bbeSBoris Popov * 14681a5bbeSBoris Popov * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15681a5bbeSBoris Popov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16681a5bbeSBoris Popov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17681a5bbeSBoris Popov * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18681a5bbeSBoris Popov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19681a5bbeSBoris Popov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20681a5bbeSBoris Popov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21681a5bbeSBoris Popov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22681a5bbeSBoris Popov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23681a5bbeSBoris Popov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24681a5bbeSBoris Popov * SUCH DAMAGE. 25681a5bbeSBoris Popov * 26681a5bbeSBoris Popov * $FreeBSD$ 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 /* 50681a5bbeSBoris Popov * socket specific data 51681a5bbeSBoris Popov */ 52681a5bbeSBoris Popov struct nbpcb { 53681a5bbeSBoris Popov struct smb_vc * nbp_vc; 54681a5bbeSBoris Popov struct socket * nbp_tso; /* transport socket */ 55681a5bbeSBoris Popov struct sockaddr_nb *nbp_laddr; /* local address */ 56681a5bbeSBoris Popov struct sockaddr_nb *nbp_paddr; /* peer address */ 57681a5bbeSBoris Popov 58681a5bbeSBoris Popov int nbp_flags; 59681a5bbeSBoris Popov #define NBF_LOCADDR 0x0001 /* has local addr */ 60681a5bbeSBoris Popov #define NBF_CONNECTED 0x0002 61681a5bbeSBoris Popov #define NBF_RECVLOCK 0x0004 62681a5bbeSBoris Popov 63681a5bbeSBoris Popov enum nbstate nbp_state; 64681a5bbeSBoris Popov struct timespec nbp_timo; 65681a5bbeSBoris Popov int nbp_sndbuf; 66681a5bbeSBoris Popov int nbp_rcvbuf; 67681a5bbeSBoris Popov void * nbp_selectid; 68681a5bbeSBoris Popov 69681a5bbeSBoris Popov /* LIST_ENTRY(nbpcb) nbp_link;*/ 70681a5bbeSBoris Popov }; 71681a5bbeSBoris Popov 72681a5bbeSBoris Popov /* 73681a5bbeSBoris Popov * Nominal space allocated per a NETBIOS socket. 74681a5bbeSBoris Popov */ 753c304004SBoris Popov #define NB_SNDQ (64 * 1024) 763c304004SBoris Popov #define NB_RCVQ (64 * 1024) 773c304004SBoris Popov 783c304004SBoris Popov /* 793c304004SBoris Popov * TCP slowstart presents a problem in conjunction with large 803c304004SBoris Popov * reads. To ensure a steady stream of ACKs while reading using 813c304004SBoris Popov * large transaction sizes, we call soreceive() with a smaller 823c304004SBoris Popov * buffer size. See nbssn_recv(). 833c304004SBoris Popov */ 843c304004SBoris Popov #define NB_SORECEIVE_CHUNK (8 * 1024) 85681a5bbeSBoris Popov 86681a5bbeSBoris Popov extern struct smb_tran_desc smb_tran_nbtcp_desc; 87681a5bbeSBoris Popov 88681a5bbeSBoris Popov #endif /* _KERNEL */ 89681a5bbeSBoris Popov 90681a5bbeSBoris Popov #endif /* !_NETSMB_SMB_TRANTCP_H_ */ 91