FreeBSD/Linux Kernel Cross Reference
sys/netsmb/smb_dev.h
1 /*
2 * Copyright (c) 2000-2001 Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Boris Popov.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD$
33 */
34 #ifndef _NETSMB_DEV_H_
35 #define _NETSMB_DEV_H_
36
37 #ifndef _KERNEL
38 #include <sys/types.h>
39 #endif
40 #include <sys/ioccom.h>
41
42 #include <netsmb/smb.h>
43
44 #define NSMB_NAME "nsmb"
45 #define NSMB_MAJOR 144
46
47 #define NSMB_VERMAJ 1
48 #define NSMB_VERMIN 3006
49 #define NSMB_VERSION (NSMB_VERMAJ * 100000 + NSMB_VERMIN)
50
51 #define NSMBFL_OPEN 0x0001
52
53 #define SMBVOPT_CREATE 0x0001 /* create object if necessary */
54 #define SMBVOPT_PRIVATE 0x0002 /* connection should be private */
55 #define SMBVOPT_SINGLESHARE 0x0004 /* keep only one share at this VC */
56 #define SMBVOPT_PERMANENT 0x0010 /* object will keep last reference */
57
58 #define SMBSOPT_CREATE 0x0001 /* create object if necessary */
59 #define SMBSOPT_PERMANENT 0x0010 /* object will keep last reference */
60
61 /*
62 * SMBIOC_LOOKUP flags
63 */
64 #define SMBLK_CREATE 0x0001
65
66 struct smbioc_ossn {
67 int ioc_opt;
68 int ioc_svlen; /* size of ioc_server address */
69 struct sockaddr*ioc_server;
70 int ioc_lolen; /* size of ioc_local address */
71 struct sockaddr*ioc_local;
72 char ioc_srvname[SMB_MAXSRVNAMELEN + 1];
73 int ioc_timeout;
74 int ioc_retrycount; /* number of retries before giveup */
75 char ioc_localcs[16];/* local charset */
76 char ioc_servercs[16];/* server charset */
77 char ioc_user[SMB_MAXUSERNAMELEN + 1];
78 char ioc_workgroup[SMB_MAXUSERNAMELEN + 1];
79 char ioc_password[SMB_MAXPASSWORDLEN + 1];
80 uid_t ioc_owner; /* proposed owner */
81 gid_t ioc_group; /* proposed group */
82 mode_t ioc_mode; /* desired access mode */
83 mode_t ioc_rights; /* SMBM_* */
84 };
85
86 struct smbioc_oshare {
87 int ioc_opt;
88 int ioc_stype; /* share type */
89 char ioc_share[SMB_MAXSHARENAMELEN + 1];
90 char ioc_password[SMB_MAXPASSWORDLEN + 1];
91 uid_t ioc_owner; /* proposed owner of share */
92 gid_t ioc_group; /* proposed group of share */
93 mode_t ioc_mode; /* desired access mode to share */
94 mode_t ioc_rights; /* SMBM_* */
95 };
96
97 struct smbioc_rq {
98 u_char ioc_cmd;
99 u_char ioc_twc;
100 void * ioc_twords;
101 u_short ioc_tbc;
102 void * ioc_tbytes;
103 int ioc_rpbufsz;
104 char * ioc_rpbuf;
105 u_char ioc_rwc;
106 u_short ioc_rbc;
107 u_int8_t ioc_errclass;
108 u_int16_t ioc_serror;
109 u_int32_t ioc_error;
110 };
111
112 struct smbioc_t2rq {
113 u_int16_t ioc_setup[3];
114 int ioc_setupcnt;
115 char * ioc_name;
116 u_short ioc_tparamcnt;
117 void * ioc_tparam;
118 u_short ioc_tdatacnt;
119 void * ioc_tdata;
120 u_short ioc_rparamcnt;
121 void * ioc_rparam;
122 u_short ioc_rdatacnt;
123 void * ioc_rdata;
124 };
125
126 struct smbioc_flags {
127 int ioc_level; /* 0 - session, 1 - share */
128 int ioc_mask;
129 int ioc_flags;
130 };
131
132 struct smbioc_lookup {
133 int ioc_level;
134 int ioc_flags;
135 struct smbioc_ossn ioc_ssn;
136 struct smbioc_oshare ioc_sh;
137 };
138
139 struct smbioc_rw {
140 smbfh ioc_fh;
141 char * ioc_base;
142 off_t ioc_offset;
143 int ioc_cnt;
144 };
145
146 /*
147 * Device IOCTLs
148 */
149 #define SMBIOC_OPENSESSION _IOW('n', 100, struct smbioc_ossn)
150 #define SMBIOC_OPENSHARE _IOW('n', 101, struct smbioc_oshare)
151 #define SMBIOC_REQUEST _IOWR('n', 102, struct smbioc_rq)
152 #define SMBIOC_T2RQ _IOWR('n', 103, struct smbioc_t2rq)
153 #define SMBIOC_SETFLAGS _IOW('n', 104, struct smbioc_flags)
154 #define SMBIOC_LOOKUP _IOW('n', 106, struct smbioc_lookup)
155 #define SMBIOC_READ _IOWR('n', 107, struct smbioc_rw)
156 #define SMBIOC_WRITE _IOWR('n', 108, struct smbioc_rw)
157
158 #ifdef _KERNEL
159
160 #define SMBST_CONNECTED 1
161
162 STAILQ_HEAD(smbrqh, smb_rq);
163
164 struct smb_dev {
165 int sd_opened;
166 int sd_level;
167 struct smb_vc * sd_vc; /* reference to VC */
168 struct smb_share *sd_share; /* reference to share if any */
169 int sd_poll;
170 int sd_seq;
171 /* struct ifqueue sd_rdqueue;
172 struct ifqueue sd_wrqueue;
173 struct selinfo sd_pollinfo;
174 struct smbrqh sd_rqlist;
175 struct smbrqh sd_rplist;
176 struct ucred *sd_owner;*/
177 int sd_flags;
178 };
179
180 struct smb_cred;
181 /*
182 * Compound user interface
183 */
184 int smb_usr_lookup(struct smbioc_lookup *dp, struct smb_cred *scred,
185 struct smb_vc **vcpp, struct smb_share **sspp);
186 int smb_usr_opensession(struct smbioc_ossn *data,
187 struct smb_cred *scred, struct smb_vc **vcpp);
188 int smb_usr_openshare(struct smb_vc *vcp, struct smbioc_oshare *data,
189 struct smb_cred *scred, struct smb_share **sspp);
190 int smb_usr_simplerequest(struct smb_share *ssp, struct smbioc_rq *data,
191 struct smb_cred *scred);
192 int smb_usr_t2request(struct smb_share *ssp, struct smbioc_t2rq *data,
193 struct smb_cred *scred);
194 int smb_dev2share(int fd, int mode, struct smb_cred *scred,
195 struct smb_share **sspp);
196
197
198 #endif /* _KERNEL */
199
200 #endif /* _NETSMB_DEV_H_ */
Cache object: 47bbf934bd650c0d6681a10b64693fbd
|