smb_dev.h revision 1b34bc4aa5ecbd590d45845d21c8478049df6dcf
/*
* Copyright (c) 2000-2001 Boris Popov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Boris Popov.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: smb_dev.h,v 1.10.178.1 2005/05/27 02:35:29 lindak Exp $
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NETSMB_DEV_H_
#define _NETSMB_DEV_H_
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file defines an internal ABI for the "nsmb" driver,
* particularly the various data structures passed to ioctl.
* In order to avoid some messy 32-bit to 64-bit conversions
* in the driver, we take pains to define all data structures
* makes them invariant across 32-bit and 64-bit ABIs.
* This invariance is checked during the driver build
* using a mechanism similar to genassym.h builds.
*
* If you change any of the ioctl data structures in
* this file, YOU MUST ALSO edit this file:
* and then verify the invariance describe above.
*
* Also, remember to "bump" NSMB_VER below when
*/
#ifndef _KERNEL
#endif
#include <sys/socket_impl.h>
#define NSMB_NAME "nsmb"
/*
* associated structures change in ways that would
* make them incompatible with an old driver.
*/
#define NSMB_VERMAJ 1
#define NSMB_VERMIN 3600
#define NSMB_VER_STR "1.36"
#define NSMBFL_OPEN 0x0001
#define NSMBFL_NEWVC 0x0002
/*
* Hack-ish errno values we need to expose to the library.
* EBADRPC is used for message decoding errors.
* EAUTH is used for CIFS authentication errors.
*/
#ifndef EBADRPC
#endif
#ifndef EAUTH
#endif
/*
* "Level" in the connection object hierarchy
*/
#define SMBL_SM 0
#define SMBL_VC 1
#define SMBL_SHARE 2
#define SMBL_NUM 3
#define SMBL_NONE (-1)
/*
*/
#define SMB_CS_NONE 0x0000
/*
* access mode stuff (see also smb_lib.h)
*/
#define SMBM_MASK 0777
#ifdef _KERNEL
/* In-kernel, we prefer the vnode.h names. */
#endif
/*
* Option flags in smbioc_ossn.ioc_opt
* and vcspec.optflags
*/
/* XXX: How about a separate field for these? */
/*
* Option flags in smbioc_oshare.ioc_opt
* and sharespec.optflags
*/
#define SMBSOPT_CREATE SMBVOPT_CREATE
#define SMBSOPT_PERMANENT SMBVOPT_PERMANENT
/*
* We're now using structures that are invariant
* across 32-bit vs 64-bit compilers for all
* member sizes and offsets. Scalar members
* simply have to use fixed-size types.
* Pointers are a little harder...
* We use this union for all pointers that
* must pass between user and kernel.
*/
typedef union lptr {
#ifdef _LP64
void *lp_ptr;
#endif
#ifdef _ILP32
void *_lp_p2[2];
#ifdef _LITTLE_ENDIAN
#else /* _ENDIAN */
#endif /* _ENDIAN */
#endif /* _ILP32 */
} lptr_t;
/*
* Handy union of sockaddr types we use.
* Type discriminator is sa_family
*/
union sockaddr_any {
struct sockaddr_in in;
struct sockaddr_nb nb;
};
/*
* SMBIOC_LOOKUP flags
*/
#define SMBLK_CREATE SMBVOPT_CREATE
#define DEF_SEC_TOKEN_LEN 2048
struct smbioc_ossn {
union sockaddr_any ioc_server;
union sockaddr_any ioc_local;
/* copyout ends at this offset */
};
typedef struct smbioc_ossn smbioc_ossn_t;
struct smbioc_oshare {
/*
* Hack: need the size of this to be 8-byte aligned
* so that the ioc_ossn following it in smbioc_lookup
* is correctly aligned...
*/
};
typedef struct smbioc_oshare smbioc_oshare_t;
typedef struct smbioc_rq {
/*
* Copyout all but the pointers, which
* we may have set to kernel memory.
* See ..._COPYOUT_SIZE
*/
} smbioc_rq_t;
#define SMBIOC_RQ_COPYOUT_SIZE \
typedef struct smbioc_t2rq {
char ioc_name[128];
/*
* Copyout all but the pointers, which
* we may have set to kernel memory.
* See ..._COPYOUT_SIZE
*/
#define SMBIOC_T2RQ_COPYOUT_SIZE \
typedef struct smbioc_flags {
typedef struct smbioc_lookup {
struct smbioc_oshare ioc_sh;
struct smbioc_ossn ioc_ssn;
#define SMBIOC_LOOK_COPYOUT_SIZE \
typedef struct smbioc_rw {
} smbioc_rw_t;
#define SMBIOC_RW_COPYOUT_SIZE \
/* Password Keychain (PK) support. */
#define SMBIOC_PK_MAXLEN 255
typedef struct smbioc_pk {
} smbioc_pk_t;
/*
* Device IOCTLs
*
* Define ioctl codes the way ZFS does.
* The "base" value is arbitrary, and can
* occupy the high word if we like, because
* Keep GETVERS first and use it to verify
* driver compatibility with the library.
*/
typedef enum nsmb_ioc {
/* Password Keychain (PK) support. */
SMBIOC_PK_ADD, /* Add/Modify a password entry */
SMBIOC_PK_CHK, /* Check for a password entry */
SMBIOC_PK_DEL, /* Delete specified password entry */
SMBIOC_PK_DEL_OWNER, /* all owned by the caller */
SMBIOC_PK_DEL_EVERYONE /* all owned by everyone */
} nsmb_ioc_t;
#ifdef _KERNEL
#define SMBST_CONNECTED 1
/* Size of storage for p/w hashes. */
#define SMB_PWH_MAX 24
extern const uint32_t nsmb_version;
struct smb_cred;
struct smb_share;
struct smb_vc;
typedef struct smb_dev {
int sd_opened; /* Opened or not */
int sd_level; /* Future use */
int sd_poll; /* Future use */
int sd_flags; /* State of connection */
void *sd_devfs; /* Dont know how to use this. but */
} smb_dev_t;
/*
* Compound user interface
*/
#endif /* _KERNEL */
#endif /* _NETSMB_DEV_H_ */