smb_tran.h revision 87192
175374Sbp/* 275374Sbp * 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 * 3. All advertising materials mentioning features or use of this software 1475374Sbp * must display the following acknowledgement: 1575374Sbp * This product includes software developed by Boris Popov. 1675374Sbp * 4. Neither the name of the author nor the names of any co-contributors 1775374Sbp * may be used to endorse or promote products derived from this software 1875374Sbp * without specific prior written permission. 1975374Sbp * 2075374Sbp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2175374Sbp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2275374Sbp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2375374Sbp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2475374Sbp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2575374Sbp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2675374Sbp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2775374Sbp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2875374Sbp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2975374Sbp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3075374Sbp * SUCH DAMAGE. 3175374Sbp * 3275374Sbp * $FreeBSD: head/sys/netsmb/smb_tran.h 87192 2001-12-02 08:47:29Z bp $ 3375374Sbp */ 3475374Sbp 3575374Sbp#ifndef _NETSMB_SMB_TRAN_H_ 3675374Sbp#define _NETSMB_SMB_TRAN_H_ 3775374Sbp 3875374Sbp#include <sys/socket.h> 3975374Sbp 4075374Sbp/* 4175374Sbp * Known transports 4275374Sbp */ 4375374Sbp#define SMBT_NBTCP 1 4475374Sbp 4575374Sbp/* 4675374Sbp * Transport parameters 4775374Sbp */ 4875374Sbp#define SMBTP_SNDSZ 1 /* R - int */ 4975374Sbp#define SMBTP_RCVSZ 2 /* R - int */ 5075374Sbp#define SMBTP_TIMEOUT 3 /* RW - struct timespec */ 5175374Sbp#define SMBTP_SELECTID 4 /* RW - (void *) */ 5275374Sbp 5375374Sbpstruct smb_tran_ops; 5475374Sbp 5575374Sbpstruct smb_tran_desc { 5675374Sbp sa_family_t tr_type; 5787192Sbp int (*tr_create)(struct smb_vc *vcp, struct thread *td); 5887192Sbp int (*tr_done)(struct smb_vc *vcp, struct thread *td); 5987192Sbp int (*tr_bind)(struct smb_vc *vcp, struct sockaddr *sap, struct thread *td); 6087192Sbp int (*tr_connect)(struct smb_vc *vcp, struct sockaddr *sap, struct thread *td); 6187192Sbp int (*tr_disconnect)(struct smb_vc *vcp, struct thread *td); 6287192Sbp int (*tr_send)(struct smb_vc *vcp, struct mbuf *m0, struct thread *td); 6387192Sbp int (*tr_recv)(struct smb_vc *vcp, struct mbuf **mpp, struct thread *td); 6475374Sbp void (*tr_timo)(struct smb_vc *vcp); 6575374Sbp void (*tr_intr)(struct smb_vc *vcp); 6675374Sbp int (*tr_getparam)(struct smb_vc *vcp, int param, void *data); 6775374Sbp int (*tr_setparam)(struct smb_vc *vcp, int param, void *data); 6875374Sbp int (*tr_fatal)(struct smb_vc *vcp, int error); 6975374Sbp#ifdef notyet 7087192Sbp int (*tr_poll)(struct smb_vc *vcp, struct thread *td); 7175374Sbp int (*tr_cmpaddr)(void *addr1, void *addr2); 7275374Sbp#endif 7375374Sbp LIST_ENTRY(smb_tran_desc) tr_link; 7475374Sbp}; 7575374Sbp 7675374Sbp#define SMB_TRAN_CREATE(vcp,p) (vcp)->vc_tdesc->tr_create(vcp,p) 7775374Sbp#define SMB_TRAN_DONE(vcp,p) (vcp)->vc_tdesc->tr_done(vcp,p) 7875374Sbp#define SMB_TRAN_BIND(vcp,sap,p) (vcp)->vc_tdesc->tr_bind(vcp,sap,p) 7975374Sbp#define SMB_TRAN_CONNECT(vcp,sap,p) (vcp)->vc_tdesc->tr_connect(vcp,sap,p) 8075374Sbp#define SMB_TRAN_DISCONNECT(vcp,p) (vcp)->vc_tdesc->tr_disconnect(vcp,p) 8175374Sbp#define SMB_TRAN_SEND(vcp,m0,p) (vcp)->vc_tdesc->tr_send(vcp,m0,p) 8275374Sbp#define SMB_TRAN_RECV(vcp,m,p) (vcp)->vc_tdesc->tr_recv(vcp,m,p) 8375374Sbp#define SMB_TRAN_TIMO(vcp) (vcp)->vc_tdesc->tr_timo(vcp) 8475374Sbp#define SMB_TRAN_INTR(vcp) (vcp)->vc_tdesc->tr_intr(vcp) 8575374Sbp#define SMB_TRAN_GETPARAM(vcp,par,data) (vcp)->vc_tdesc->tr_getparam(vcp, par, data) 8675374Sbp#define SMB_TRAN_SETPARAM(vcp,par,data) (vcp)->vc_tdesc->tr_setparam(vcp, par, data) 8775374Sbp#define SMB_TRAN_FATAL(vcp, error) (vcp)->vc_tdesc->tr_fatal(vcp, error) 8875374Sbp 8975374Sbp#endif /* _NETSMB_SMB_TRAN_H_ */ 90