[BACK]Return to smb_dev.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / netsmb

File: [cvs.NetBSD.org] / src / sys / netsmb / Attic / smb_dev.h (download)

Revision 1.6, Sun May 14 21:20:13 2006 UTC (13 years, 10 months ago) by elad
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3, yamt-x86pmap-base2, yamt-x86pmap-base, yamt-x86pmap, yamt-splraiseipl-base5, yamt-splraiseipl-base4, yamt-splraiseipl-base3, yamt-splraiseipl-base2, yamt-splraiseipl-base, yamt-splraiseipl, yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, yamt-pdpolicy-base9, yamt-pdpolicy-base8, yamt-pdpolicy-base7, yamt-pdpolicy-base6, yamt-pdpolicy-base5, yamt-nfs-mp-base9, yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, yamt-nfs-mp-base4, yamt-nfs-mp-base3, yamt-nfs-mp-base2, yamt-nfs-mp-base, yamt-lazymbuf-base15, yamt-lazymbuf-base14, yamt-kmem-base3, yamt-kmem-base2, yamt-kmem-base, yamt-kmem, yamt-idlelwp-base8, yamt-idlelwp, wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, vmlocking2-base3, vmlocking2-base2, vmlocking2-base1, vmlocking2, vmlocking-nbase, vmlocking-base, vmlocking, uebayasi-xip-base1, uebayasi-xip-base, thorpej-atomic-base, thorpej-atomic, simonb-wapbl-nbase, simonb-wapbl-base, simonb-wapbl, simonb-timecounters-base, rpaulo-netinet-merge-pcb-base, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, reinoud-bufcleanup, post-newlock2-merge, nick-net80211-sync-base, nick-net80211-sync, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, nick-hppapmap, nick-csl-alignment-base5, nick-csl-alignment-base, nick-csl-alignment, newlock2-nbase, newlock2-base, newlock2, netbsd-5-base, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, mjf-ufs-trans-base, mjf-ufs-trans, mjf-devfs2-base, mjf-devfs2, mjf-devfs-base, mjf-devfs, matt-premerge-20091211, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb4-mips64-k7-u2a-k9b, matt-nb4-arm-base, matt-nb4-arm, matt-mips64-base2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, jymxensuspend-base, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, jmcneill-pm-base, jmcneill-pm, jmcneill-base, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, haad-nbase2, haad-dm-base2, haad-dm-base1, haad-dm-base, haad-dm, gdamore-uart-base, gdamore-uart, cube-autoconf-base, cube-autoconf, chap-midi-nbase, chap-midi-base, chap-midi, bouyer-xeni386-nbase, bouyer-xeni386-merge1, bouyer-xeni386-base, bouyer-xeni386, bouyer-xenamd64-base2, bouyer-xenamd64-base, bouyer-xenamd64, ad-socklock-base1, ad-audiomp2-base, ad-audiomp2, ad-audiomp-base, ad-audiomp, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: yamt-nfs-mp, uebayasi-xip, rmind-uvmplock, netbsd-5-0, netbsd-5, netbsd-4-0, netbsd-4, matt-nb5-mips64
Changes since 1.5: +2 -2 lines

integrate kauth.

/*	$NetBSD: smb_dev.h,v 1.6 2006/05/14 21:20:13 elad Exp $	*/

/*
 * 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
 *    documentation and/or other materials provided with the distribution.
 * 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.
 *
 * FreeBSD: src/sys/netsmb/smb_dev.h,v 1.3 2001/04/13 10:50:48 bp Exp
 */
#ifndef _NETSMB_DEV_H_
#define _NETSMB_DEV_H_

#ifndef _KERNEL
#include <sys/types.h>
#endif
#include <sys/ioccom.h>

#include <netsmb/smb.h>

#define	NSMB_NAME		"nsmb"
#define	NSMB_MAJOR		144

#define NSMB_VERMAJ	1
#define NSMB_VERMIN	3006
#define NSMB_VERSION	(NSMB_VERMAJ * 100000 + NSMB_VERMIN)

#define NSMBFL_OPEN		0x0001

#define	SMBVOPT_CREATE		0x0001	/* create object if necessary */
#define	SMBVOPT_PRIVATE		0x0002	/* connection should be private */
#define	SMBVOPT_SINGLESHARE	0x0004	/* keep only one share at this VC */
#define	SMBVOPT_PERMANENT	0x0010	/* object will keep last reference */

#define	SMBSOPT_CREATE		0x0001	/* create object if necessary */
#define	SMBSOPT_PERMANENT	0x0010	/* object will keep last reference */

/*
 * SMBIOC_LOOKUP flags
 */
#define SMBLK_CREATE		0x0001

struct smbioc_ossn {
	int		ioc_opt;
	int		ioc_svlen;	/* size of ioc_server address */
	struct sockaddr*ioc_server;
	int		ioc_lolen;	/* size of ioc_local address */
	struct sockaddr*ioc_local;
	char		ioc_srvname[SMB_MAXSRVNAMELEN + 1];
	int		ioc_timeout;
	int		ioc_retrycount;	/* number of retries before giveup */
	char		ioc_localcs[16];/* local charset */
	char		ioc_servercs[16];/* server charset */
	char		ioc_user[SMB_MAXUSERNAMELEN + 1];
	char		ioc_workgroup[SMB_MAXUSERNAMELEN + 1];
	char		ioc_password[SMB_MAXPASSWORDLEN + 1];
	uid_t		ioc_owner;	/* proposed owner */
	gid_t		ioc_group;	/* proposed group */
	mode_t		ioc_mode;	/* desired access mode */
	mode_t		ioc_rights;	/* SMBM_* */
};

struct smbioc_oshare {
	int		ioc_opt;
	int		ioc_stype;	/* share type */
	char		ioc_share[SMB_MAXSHARENAMELEN + 1];
	char		ioc_password[SMB_MAXPASSWORDLEN + 1];
	uid_t		ioc_owner;	/* proposed owner of share */
	gid_t		ioc_group;	/* proposed group of share */
	mode_t		ioc_mode;	/* desired access mode to share */
	mode_t		ioc_rights;	/* SMBM_* */
};

struct smbioc_rq {
	u_char		ioc_cmd;
	u_char		ioc_twc;
	void *		ioc_twords;
	u_short		ioc_tbc;
	void *		ioc_tbytes;
	int		ioc_rpbufsz;
	char *		ioc_rpbuf;
	u_char		ioc_rwc;
	u_short		ioc_rbc;
};

struct smbioc_t2rq {
	u_int16_t	ioc_setup[3];
	int		ioc_setupcnt;
	char *		ioc_name;
	u_short		ioc_tparamcnt;
	void *		ioc_tparam;
	u_short		ioc_tdatacnt;
	void *		ioc_tdata;
	u_short		ioc_rparamcnt;
	void *		ioc_rparam;
	u_short		ioc_rdatacnt;
	void *		ioc_rdata;
};

struct smbioc_flags {
	int		ioc_level;	/* 0 - session, 1 - share */
	int		ioc_mask;
	int		ioc_flags;
};

struct smbioc_lookup {
	int		ioc_level;
	int		ioc_flags;
	struct smbioc_ossn	ioc_ssn;
	struct smbioc_oshare	ioc_sh;
};

struct smbioc_rw {
	smbfh	ioc_fh;
	char *	ioc_base;
	off_t	ioc_offset;
	int	ioc_cnt;
};

/*
 * Device IOCTLs
 */
#define	SMBIOC_OPENSESSION	_IOW('n',  100, struct smbioc_ossn)
#define	SMBIOC_OPENSHARE	_IOW('n',  101, struct smbioc_oshare)
#define	SMBIOC_REQUEST		_IOWR('n', 102, struct smbioc_rq)
#define	SMBIOC_T2RQ		_IOWR('n', 103, struct smbioc_t2rq)
#define	SMBIOC_SETFLAGS		_IOW('n',  104, struct smbioc_flags)
#define	SMBIOC_LOOKUP		_IOW('n',  106, struct smbioc_lookup)
#define	SMBIOC_READ		_IOWR('n', 107, struct smbioc_rw)
#define	SMBIOC_WRITE		_IOWR('n', 108, struct smbioc_rw)

#ifdef _KERNEL

#define SMBST_CONNECTED	1

SIMPLEQ_HEAD(smbrqh, smb_rq);

struct smb_dev {
	int		sd_opened;
	int		sd_level;
	struct smb_vc * sd_vc;		/* reference to VC */
	struct smb_share *sd_share;	/* reference to share if any */
	int		sd_poll;
	int		sd_seq;
/*	struct ifqueue	sd_rdqueue;
	struct ifqueue	sd_wrqueue;
	struct selinfo	sd_pollinfo;
	struct smbrqh	sd_rqlist;
	struct smbrqh	sd_rplist;
	kauth_cred_t	sd_owner;*/
	int		sd_flags;
};

struct smb_cred;
/*
 * Compound user interface
 */
int  smb_usr_lookup(struct smbioc_lookup *dp, struct smb_cred *scred,
	struct smb_vc **vcpp, struct smb_share **sspp);
int  smb_usr_opensession(struct smbioc_ossn *data,
	struct smb_cred *scred,	struct smb_vc **vcpp);
int  smb_usr_openshare(struct smb_vc *vcp, struct smbioc_oshare *data,
	struct smb_cred *scred, struct smb_share **sspp);
int  smb_usr_simplerequest(struct smb_share *ssp, struct smbioc_rq *data,
	struct smb_cred *scred);
int  smb_usr_t2request(struct smb_share *ssp, struct smbioc_t2rq *data,
	struct smb_cred *scred);
int  smb_dev2share(int fd, int mode, struct smb_cred *scred,
	struct smb_share **sspp);


#endif /* _KERNEL */

#endif /* !_NETSMB_DEV_H_ */