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 2975374Sbp#ifndef _NETSMB_SMB_TRAN_H_ 3075374Sbp#define _NETSMB_SMB_TRAN_H_ 3175374Sbp 3275374Sbp#include <sys/socket.h> 3375374Sbp 3475374Sbp/* 3575374Sbp * Known transports 3675374Sbp */ 3775374Sbp#define SMBT_NBTCP 1 3875374Sbp 3975374Sbp/* 4075374Sbp * Transport parameters 4175374Sbp */ 4275374Sbp#define SMBTP_SNDSZ 1 /* R - int */ 4375374Sbp#define SMBTP_RCVSZ 2 /* R - int */ 4475374Sbp#define SMBTP_TIMEOUT 3 /* RW - struct timespec */ 4575374Sbp#define SMBTP_SELECTID 4 /* RW - (void *) */ 46103397Sbp#define SMBTP_UPCALL 5 /* RW - (* void)(void *) */ 4775374Sbp 4875374Sbpstruct smb_tran_ops; 4975374Sbp 5075374Sbpstruct smb_tran_desc { 5175374Sbp sa_family_t tr_type; 5287192Sbp int (*tr_create)(struct smb_vc *vcp, struct thread *td); 5387192Sbp int (*tr_done)(struct smb_vc *vcp, struct thread *td); 5487192Sbp int (*tr_bind)(struct smb_vc *vcp, struct sockaddr *sap, struct thread *td); 5587192Sbp int (*tr_connect)(struct smb_vc *vcp, struct sockaddr *sap, struct thread *td); 5687192Sbp int (*tr_disconnect)(struct smb_vc *vcp, struct thread *td); 5787192Sbp int (*tr_send)(struct smb_vc *vcp, struct mbuf *m0, struct thread *td); 5887192Sbp int (*tr_recv)(struct smb_vc *vcp, struct mbuf **mpp, struct thread *td); 5975374Sbp void (*tr_timo)(struct smb_vc *vcp); 6075374Sbp void (*tr_intr)(struct smb_vc *vcp); 6175374Sbp int (*tr_getparam)(struct smb_vc *vcp, int param, void *data); 6275374Sbp int (*tr_setparam)(struct smb_vc *vcp, int param, void *data); 6375374Sbp int (*tr_fatal)(struct smb_vc *vcp, int error); 6475374Sbp#ifdef notyet 6587192Sbp int (*tr_poll)(struct smb_vc *vcp, struct thread *td); 6675374Sbp int (*tr_cmpaddr)(void *addr1, void *addr2); 6775374Sbp#endif 6875374Sbp LIST_ENTRY(smb_tran_desc) tr_link; 6975374Sbp}; 7075374Sbp 7175374Sbp#define SMB_TRAN_CREATE(vcp,p) (vcp)->vc_tdesc->tr_create(vcp,p) 7275374Sbp#define SMB_TRAN_DONE(vcp,p) (vcp)->vc_tdesc->tr_done(vcp,p) 7375374Sbp#define SMB_TRAN_BIND(vcp,sap,p) (vcp)->vc_tdesc->tr_bind(vcp,sap,p) 7475374Sbp#define SMB_TRAN_CONNECT(vcp,sap,p) (vcp)->vc_tdesc->tr_connect(vcp,sap,p) 7575374Sbp#define SMB_TRAN_DISCONNECT(vcp,p) (vcp)->vc_tdesc->tr_disconnect(vcp,p) 7675374Sbp#define SMB_TRAN_SEND(vcp,m0,p) (vcp)->vc_tdesc->tr_send(vcp,m0,p) 7775374Sbp#define SMB_TRAN_RECV(vcp,m,p) (vcp)->vc_tdesc->tr_recv(vcp,m,p) 7875374Sbp#define SMB_TRAN_TIMO(vcp) (vcp)->vc_tdesc->tr_timo(vcp) 7975374Sbp#define SMB_TRAN_INTR(vcp) (vcp)->vc_tdesc->tr_intr(vcp) 8075374Sbp#define SMB_TRAN_GETPARAM(vcp,par,data) (vcp)->vc_tdesc->tr_getparam(vcp, par, data) 8175374Sbp#define SMB_TRAN_SETPARAM(vcp,par,data) (vcp)->vc_tdesc->tr_setparam(vcp, par, data) 8275374Sbp#define SMB_TRAN_FATAL(vcp, error) (vcp)->vc_tdesc->tr_fatal(vcp, error) 8375374Sbp 8475374Sbp#endif /* _NETSMB_SMB_TRAN_H_ */ 85