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_tran.h,v 1.2 2001/12/21 02:41:30 conrad Exp $
334bff34e3Sthurlow  */
344bff34e3Sthurlow 
35613a2f6bSGordon Ross /*
36613a2f6bSGordon Ross  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
37613a2f6bSGordon Ross  * Use is subject to license terms.
388329232eSGordon Ross  *
3940c0e231SGordon Ross  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
40613a2f6bSGordon Ross  */
41613a2f6bSGordon Ross 
424bff34e3Sthurlow #ifndef _NETSMB_SMB_TRAN_H_
434bff34e3Sthurlow #define	_NETSMB_SMB_TRAN_H_
444bff34e3Sthurlow 
454bff34e3Sthurlow #include <sys/socket.h>
4633697085SGordon Ross #include <sys/stream.h>
478329232eSGordon Ross #ifndef _KERNEL
488329232eSGordon Ross struct file;
498329232eSGordon Ross #endif
504bff34e3Sthurlow 
514bff34e3Sthurlow /*
524bff34e3Sthurlow  * Known transports
534bff34e3Sthurlow  */
544bff34e3Sthurlow #define	SMBT_NBTCP	1
554bff34e3Sthurlow 
564bff34e3Sthurlow /*
5740c0e231SGordon Ross  * Transport parameters, for tr_getparam/tr_setparam
584bff34e3Sthurlow  */
5940c0e231SGordon Ross #define	SMBTP_TCP_NODELAY	0x01		/* RW - int */
6040c0e231SGordon Ross #define	SMBTP_TCP_CON_TMO	0x13		/* RW - int */
6140c0e231SGordon Ross #define	SMBTP_KEEPALIVE		SO_KEEPALIVE	/* RW - int */
6240c0e231SGordon Ross #define	SMBTP_SNDBUF		SO_SNDBUF	/* RW - int */
6340c0e231SGordon Ross #define	SMBTP_RCVBUF		SO_RCVBUF	/* RW - int */
6440c0e231SGordon Ross #define	SMBTP_RCVTIMEO		SO_RCVTIMEO	/* RW - int? */
654bff34e3Sthurlow 
664bff34e3Sthurlow struct smb_tran_ops;
674bff34e3Sthurlow 
684bff34e3Sthurlow struct smb_tran_desc {
694bff34e3Sthurlow 	sa_family_t	tr_type;
70613a2f6bSGordon Ross 	int	(*tr_create)(struct smb_vc *vcp, cred_t *cr);
71613a2f6bSGordon Ross 	int	(*tr_done)(struct smb_vc *vcp);
72613a2f6bSGordon Ross 	int	(*tr_bind)(struct smb_vc *vcp, struct sockaddr *sap);
73*adee6784SGordon Ross 	int	(*tr_unbind)(struct smb_vc *vcp);
74613a2f6bSGordon Ross 	int	(*tr_connect)(struct smb_vc *vcp, struct sockaddr *sap);
75613a2f6bSGordon Ross 	int	(*tr_disconnect)(struct smb_vc *vcp);
76613a2f6bSGordon Ross 	int	(*tr_send)(struct smb_vc *vcp, mblk_t *m);
77613a2f6bSGordon Ross 	int	(*tr_recv)(struct smb_vc *vcp, mblk_t **mpp);
78613a2f6bSGordon Ross 	int	(*tr_poll)(struct smb_vc *vcp, int ticks);
794bff34e3Sthurlow 	int	(*tr_getparam)(struct smb_vc *vcp, int param, void *data);
804bff34e3Sthurlow 	int	(*tr_setparam)(struct smb_vc *vcp, int param, void *data);
814bff34e3Sthurlow 	int	(*tr_fatal)(struct smb_vc *vcp, int error);
824bff34e3Sthurlow 	LIST_ENTRY(smb_tran_desc)	tr_link;
834bff34e3Sthurlow };
844bff34e3Sthurlow typedef struct smb_tran_desc smb_tran_desc_t;
854bff34e3Sthurlow 
86613a2f6bSGordon Ross #define	SMB_TRAN_CREATE(vcp, cr)	(vcp)->vc_tdesc->tr_create(vcp, cr)
87613a2f6bSGordon Ross #define	SMB_TRAN_DONE(vcp)		(vcp)->vc_tdesc->tr_done(vcp)
88613a2f6bSGordon Ross #define	SMB_TRAN_BIND(vcp, sap)		(vcp)->vc_tdesc->tr_bind(vcp, sap)
89*adee6784SGordon Ross #define	SMB_TRAN_UNBIND(vcp)		(vcp)->vc_tdesc->tr_unbind(vcp)
90613a2f6bSGordon Ross #define	SMB_TRAN_CONNECT(vcp, sap)	(vcp)->vc_tdesc->tr_connect(vcp, sap)
91613a2f6bSGordon Ross #define	SMB_TRAN_DISCONNECT(vcp)	(vcp)->vc_tdesc->tr_disconnect(vcp)
92613a2f6bSGordon Ross #define	SMB_TRAN_SEND(vcp, m)		(vcp)->vc_tdesc->tr_send(vcp, m)
93613a2f6bSGordon Ross #define	SMB_TRAN_RECV(vcp, m)		(vcp)->vc_tdesc->tr_recv(vcp, m)
94613a2f6bSGordon Ross #define	SMB_TRAN_POLL(vcp, t)		(vcp)->vc_tdesc->tr_poll(vcp, t)
954bff34e3Sthurlow #define	SMB_TRAN_GETPARAM(vcp, par, data)	\
964bff34e3Sthurlow 	(vcp)->vc_tdesc->tr_getparam(vcp, par, data)
974bff34e3Sthurlow #define	SMB_TRAN_SETPARAM(vcp, par, data)	\
984bff34e3Sthurlow 	(vcp)->vc_tdesc->tr_setparam(vcp, par, data)
994bff34e3Sthurlow #define	SMB_TRAN_FATAL(vcp, error)	(vcp)->vc_tdesc->tr_fatal(vcp, error)
1004bff34e3Sthurlow 
1014bff34e3Sthurlow /* Ops vectors for each transport. */
1024bff34e3Sthurlow extern struct smb_tran_desc smb_tran_nbtcp_desc;
1034bff34e3Sthurlow 
1044bff34e3Sthurlow #endif /* _NETSMB_SMB_TRAN_H_ */
105