1139823Simp/*-
2206361Sjoel * Copyright (c) 2000-2001 Boris Popov
375374Sbp * All rights reserved.
475374Sbp *
575374Sbp * Redistribution and use in source and binary forms, with or without
675374Sbp * modification, are permitted provided that the following conditions
775374Sbp * are met:
875374Sbp * 1. Redistributions of source code must retain the above copyright
975374Sbp *    notice, this list of conditions and the following disclaimer.
1075374Sbp * 2. Redistributions in binary form must reproduce the above copyright
1175374Sbp *    notice, this list of conditions and the following disclaimer in the
1275374Sbp *    documentation and/or other materials provided with the distribution.
1375374Sbp *
1475374Sbp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1575374Sbp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1675374Sbp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1775374Sbp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1875374Sbp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1975374Sbp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2075374Sbp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2175374Sbp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2275374Sbp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2375374Sbp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2475374Sbp * SUCH DAMAGE.
2575374Sbp *
2675374Sbp * $FreeBSD$
2775374Sbp */
2875374Sbp#ifndef _NETSMB_SMB_TRANTCP_H_
2975374Sbp#define	_NETSMB_SMB_TRANTCP_H_
3075374Sbp
3175374Sbp#ifdef _KERNEL
3275374Sbp
3375374Sbp#ifdef NB_DEBUG
3475374Sbp#define NBDEBUG(format, args...)	 printf("%s(%d): "format,	\
3587599Sobrien					    __func__ , __LINE__ ,## args)
3675374Sbp#else
3775374Sbp#define NBDEBUG(format, args...)
3875374Sbp#endif
3975374Sbp
4075374Sbpenum nbstate {
4175374Sbp	NBST_CLOSED,
4275374Sbp	NBST_RQSENT,
4375374Sbp	NBST_SESSION,
4475374Sbp	NBST_RETARGET,
4575374Sbp	NBST_REFUSED
4675374Sbp};
4775374Sbp
4875374Sbp
4975374Sbp/*
5075374Sbp * socket specific data
5175374Sbp */
5275374Sbpstruct nbpcb {
5375374Sbp	struct smb_vc *	nbp_vc;
5475374Sbp	struct socket *	nbp_tso;	/* transport socket */
5575374Sbp	struct sockaddr_nb *nbp_laddr;	/* local address */
5675374Sbp	struct sockaddr_nb *nbp_paddr;	/* peer address */
5775374Sbp
5875374Sbp	int		nbp_flags;
5975374Sbp#define	NBF_LOCADDR	0x0001		/* has local addr */
6075374Sbp#define	NBF_CONNECTED	0x0002
6175374Sbp#define	NBF_RECVLOCK	0x0004
6275374Sbp
6375374Sbp	enum nbstate	nbp_state;
6475374Sbp	struct timespec	nbp_timo;
6575374Sbp	int		nbp_sndbuf;
6675374Sbp	int		nbp_rcvbuf;
6775374Sbp	void *		nbp_selectid;
6875374Sbp
6975374Sbp/*	LIST_ENTRY(nbpcb) nbp_link;*/
7075374Sbp};
7175374Sbp
7275374Sbp/*
7375374Sbp * Nominal space allocated per a NETBIOS socket.
7475374Sbp */
75103528Sbp#define	NB_SNDQ		(64 * 1024)
76103528Sbp#define	NB_RCVQ		(64 * 1024)
7775374Sbp
78103528Sbp/*
79103528Sbp * TCP slowstart presents a problem in conjunction with large
80103528Sbp * reads.  To ensure a steady stream of ACKs while reading using
81103528Sbp * large transaction sizes, we call soreceive() with a smaller
82103528Sbp * buffer size.  See nbssn_recv().
83103528Sbp */
84103528Sbp#define NB_SORECEIVE_CHUNK	(8 * 1024)
85103528Sbp
8675374Sbpextern struct smb_tran_desc smb_tran_nbtcp_desc;
8775374Sbp
8875374Sbp#endif /* _KERNEL */
8975374Sbp
9075374Sbp#endif /* !_NETSMB_SMB_TRANTCP_H_ */
91