Print this page
1575 untangle libmlrpc ... (smbsrv)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/smbsrv/smb_xdr.h
+++ new/usr/src/uts/common/smbsrv/smb_xdr.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25
26 26 #ifndef _SMBSRV_SMB_XDR_H
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
27 27 #define _SMBSRV_SMB_XDR_H
28 28
29 29 #ifdef __cplusplus
30 30 extern "C" {
31 31 #endif
32 32
33 33 #include <rpc/xdr.h>
34 34 #include <sys/param.h>
35 35 #include <sys/avl.h>
36 36 #include <sys/list.h>
37 -#include <smbsrv/wintypes.h>
37 +#include <smb/wintypes.h>
38 38 #include <smbsrv/smb_sid.h>
39 39 #include <smbsrv/smbinfo.h>
40 40 #include <smbsrv/smb_ioctl.h>
41 41 #include <smbsrv/smb_sid.h>
42 42 #include <smbsrv/smb_share.h>
43 43 #include <smbsrv/smb_dfs.h>
44 -#include <smbsrv/wintypes.h>
45 44
46 45 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
47 46 #include <sys/sysmacros.h>
48 47 #define xdr_int8_t xdr_char
49 48 #define xdr_uint8_t xdr_u_char
50 49 #define xdr_int16_t xdr_short
51 50 #define xdr_uint16_t xdr_u_short
52 51 #else /* _KERNEL */
53 52 #include <stddef.h> /* offsetof */
54 53 #endif /* _KERNEL */
55 54
56 55 /*
57 56 * null-terminated string
58 57 * See also: smb_string_xdr()
59 58 */
60 59 typedef struct smb_string {
61 60 char *buf;
62 61 } smb_string_t;
63 62
64 63 struct smb_buf32;
65 64
66 65 /*
67 66 * Initial message on server named pipes.
68 67 * Followed by smb_netuserinfo
69 68 */
70 69 typedef struct smb_pipehdr {
71 70 uint32_t ph_magic;
72 71 uint32_t ph_uilen;
73 72 } smb_pipehdr_t;
74 73
75 74 #define SMB_PIPE_HDR_MAGIC 0x50495045 /* PIPE */
76 75
77 76 /*
78 77 * Maximum message size for SMB named pipes.
79 78 * Should be less than PIPE_BUF (5120).
80 79 * Use the same value Windows does.
81 80 */
82 81 #define SMB_PIPE_MAX_MSGSIZE 4280
83 82
84 83 /*
85 84 * Door up-call stuff shared with smbd
86 85 */
87 86
88 87 #define SMB_DOOR_HDR_MAGIC 0x444F4F52 /* DOOR */
89 88
90 89 /*
91 90 * Door header flags.
92 91 */
93 92 #define SMB_DF_ASYNC 0x00000001 /* Asynchronous call */
94 93 #define SMB_DF_SYSSPACE 0x00000002 /* Called from the kernel */
95 94 #define SMB_DF_USERSPACE 0x00000004 /* Called from user space */
96 95 #define SMB_DF_FAKE_KERNEL 0x00000008 /* Called from fake kernel */
97 96
98 97 /*
99 98 * Header for door calls. The op codes and return codes are defined
100 99 * in smb_door.h. The header is here to make it available to XDR.
101 100 *
102 101 * fid For opipe: the pipe identifier.
103 102 * op The door operation being invoked.
104 103 * txid Unique transaction id for the current door call.
105 104 * datalen Bytes of data following the header (excludes the header).
106 105 * resid For opipe: the number of bytes remaining in the server.
107 106 * door_rc Return code provided by the door server.
108 107 * status A pass-through status provided by the door operation.
109 108 *
110 109 * See also: smb_doorhdr_xdr()
111 110 */
112 111 typedef struct smb_doorhdr {
113 112 uint32_t dh_magic;
114 113 uint32_t dh_flags;
115 114 uint32_t dh_fid;
116 115 uint32_t dh_op;
117 116 uint32_t dh_txid;
118 117 uint32_t dh_datalen;
119 118 uint32_t dh_resid;
120 119 uint32_t dh_door_rc;
121 120 uint32_t dh_status;
122 121 } smb_doorhdr_t;
123 122
124 123 /*
125 124 * Information about the client of a named pipe, provided by smbsrv
126 125 * to the server side of the named pipe (the RPC service).
127 126 * See also: smb_netuserinfo_xdr()
128 127 */
129 128 typedef struct smb_netuserinfo {
130 129 uint64_t ui_session_id;
131 130 uint16_t ui_smb_uid;
132 131 uint16_t ui_domain_len;
133 132 char *ui_domain;
134 133 uint16_t ui_account_len;
135 134 char *ui_account;
136 135 uid_t ui_posix_uid;
137 136 uint16_t ui_workstation_len;
138 137 char *ui_workstation;
139 138 smb_inaddr_t ui_ipaddr;
140 139 int32_t ui_native_os;
141 140 int64_t ui_logon_time;
142 141 uint32_t ui_numopens;
143 142 uint32_t ui_flags;
144 143 } smb_netuserinfo_t;
145 144
146 145 typedef struct smb_opennum {
147 146 uint32_t open_users;
148 147 uint32_t open_trees;
149 148 uint32_t open_files;
150 149 uint32_t qualtype;
151 150 char qualifier[MAXNAMELEN];
152 151 } smb_opennum_t;
153 152
154 153 /*
155 154 * SMB (internal) representation of a tree connection (etc.)
156 155 * See also: smb_netconnectinfo_xdr()
157 156 */
158 157 typedef struct smb_netconnectinfo {
159 158 uint32_t ci_id;
160 159 uint32_t ci_type;
161 160 uint32_t ci_numopens;
162 161 uint32_t ci_numusers;
163 162 uint32_t ci_time;
164 163 uint32_t ci_namelen;
165 164 uint32_t ci_sharelen;
166 165 char *ci_username;
167 166 char *ci_share;
168 167 } smb_netconnectinfo_t;
169 168
170 169 /*
171 170 * SMB (internal) representation of an open file.
172 171 * See also: smb_netfileinfo_xdr()
173 172 */
174 173 typedef struct smb_netfileinfo {
175 174 uint16_t fi_fid;
176 175 uint32_t fi_uniqid;
177 176 uint32_t fi_permissions;
178 177 uint32_t fi_numlocks;
179 178 uint32_t fi_pathlen;
180 179 uint32_t fi_namelen;
181 180 char *fi_path;
182 181 char *fi_username;
183 182 } smb_netfileinfo_t;
184 183
185 184 typedef struct smb_netsvcitem {
186 185 list_node_t nsi_lnd;
187 186 union {
188 187 smb_netuserinfo_t nsi_user;
189 188 smb_netconnectinfo_t nsi_tree;
190 189 smb_netfileinfo_t nsi_ofile;
191 190 } nsi_un;
192 191 } smb_netsvcitem_t;
193 192
194 193 typedef struct smb_netsvc {
195 194 list_t ns_list;
196 195 smb_netsvcitem_t *ns_items;
197 196 smb_ioc_svcenum_t *ns_ioc;
198 197 uint32_t ns_ioclen;
199 198 } smb_netsvc_t;
200 199
201 200
202 201 bool_t smb_buf32_xdr(XDR *, struct smb_buf32 *);
203 202 bool_t smb_string_xdr(XDR *, smb_string_t *);
204 203 bool_t smb_inaddr_xdr(XDR *, smb_inaddr_t *);
205 204
206 205 const char *smb_doorhdr_opname(uint32_t);
207 206 int smb_doorhdr_encode(smb_doorhdr_t *, uint8_t *, uint32_t);
208 207 int smb_doorhdr_decode(smb_doorhdr_t *, uint8_t *, uint32_t);
209 208 bool_t smb_doorhdr_xdr(XDR *xdrs, smb_doorhdr_t *objp);
210 209 int smb_netuserinfo_encode(smb_netuserinfo_t *, uint8_t *, uint32_t, uint_t *);
211 210 int smb_netuserinfo_decode(smb_netuserinfo_t *, uint8_t *, uint32_t, uint_t *);
212 211 bool_t smb_netuserinfo_xdr(XDR *, smb_netuserinfo_t *);
213 212 int smb_netconnectinfo_encode(smb_netconnectinfo_t *, uint8_t *, uint32_t,
214 213 uint_t *);
215 214 int smb_netconnectinfo_decode(smb_netconnectinfo_t *, uint8_t *, uint32_t,
216 215 uint_t *);
217 216 bool_t smb_netconnectinfo_xdr(XDR *, smb_netconnectinfo_t *);
218 217 int smb_netfileinfo_encode(smb_netfileinfo_t *, uint8_t *, uint32_t, uint_t *);
219 218 int smb_netfileinfo_decode(smb_netfileinfo_t *, uint8_t *, uint32_t, uint_t *);
220 219 bool_t smb_netfileinfo_xdr(XDR *, smb_netfileinfo_t *);
221 220
222 221 typedef uint16_t sid_type_t;
223 222
224 223 typedef struct lsa_account {
225 224 ntstatus_t a_status;
226 225 sid_type_t a_sidtype;
227 226 char a_domain[MAXNAMELEN];
228 227 char a_name[MAXNAMELEN];
229 228 char a_sid[SMB_SID_STRSZ];
230 229 } lsa_account_t;
231 230
232 231 int lsa_account_encode(lsa_account_t *, uint8_t *, uint32_t);
233 232 int lsa_account_decode(lsa_account_t *, uint8_t *, uint32_t);
234 233 bool_t lsa_account_xdr(XDR *, lsa_account_t *);
235 234
236 235 /*
237 236 * VSS Door Structures
238 237 */
239 238 #define SMB_VSS_GMT_SIZE sizeof ("@GMT-yyyy.mm.dd-hh.mm.ss")
240 239
241 240 /*
242 241 * Args for enumerating "previous versions".
243 242 * See also: smb_gmttoken_query_xdr()
244 243 */
245 244 typedef struct smb_gmttoken_query {
246 245 uint32_t gtq_count;
247 246 char *gtq_path;
248 247 } smb_gmttoken_query_t;
249 248
250 249 /*
251 250 * Part of response for enumerating "previous versions".
252 251 * See also: smb_gmttoken_xdr()
253 252 */
254 253 typedef char *smb_gmttoken_t;
255 254
256 255 /*
257 256 * Response for enumerating "previous versions".
258 257 * See also: smb_gmttoken_response_xdr()
259 258 */
260 259 typedef struct smb_gmttoken_response {
261 260 uint32_t gtr_count;
262 261 struct {
263 262 uint_t gtr_gmttokens_len;
264 263 smb_gmttoken_t *gtr_gmttokens_val;
265 264 } gtr_gmttokens;
266 265 } smb_gmttoken_response_t;
267 266
268 267 /*
269 268 * Args to lookup "previous versions" during open.
270 269 * See also: smb_gmttoken_snapname_xdr()
271 270 */
272 271 typedef struct smb_gmttoken_snapname {
273 272 char *gts_path;
274 273 char *gts_gmttoken;
275 274 uint64_t gts_toktime; /* seconds */
276 275 } smb_gmttoken_snapname_t;
277 276
278 277 bool_t smb_gmttoken_query_xdr(XDR *, smb_gmttoken_query_t *);
279 278 bool_t smb_gmttoken_response_xdr(XDR *, smb_gmttoken_response_t *);
280 279 bool_t smb_gmttoken_snapname_xdr(XDR *, smb_gmttoken_snapname_t *);
281 280
282 281 /*
283 282 * User and Group Quotas
284 283 *
285 284 * SMB User and Group quota values of SMB_QUOTA_UNLIMITED mean
286 285 * No Limit. This maps to 0 (none) on ZFS.
287 286 */
288 287 #define SMB_QUOTA_UNLIMITED 0xFFFFFFFFFFFFFFFF
289 288
290 289 /*
291 290 * SMB (internal) representation of a quota response
292 291 * See also: smb_quota_xdr()
293 292 */
294 293 typedef struct smb_quota {
295 294 list_node_t q_list_node;
296 295 char q_sidstr[SMB_SID_STRSZ];
297 296 uint32_t q_sidtype;
298 297 uint64_t q_used;
299 298 uint64_t q_thresh;
300 299 uint64_t q_limit;
301 300 avl_node_t q_avl_node;
302 301 } smb_quota_t;
303 302
304 303 /*
305 304 * Part of a quota response
306 305 * See also: smb_quota_sid_xdr()
307 306 */
308 307 typedef struct smb_quota_sid {
309 308 list_node_t qs_list_node;
310 309 char qs_sidstr[SMB_SID_STRSZ];
311 310 } smb_quota_sid_t;
312 311
313 312 typedef enum {
314 313 SMB_QUOTA_QUERY_INVALID_OP,
315 314 SMB_QUOTA_QUERY_SIDLIST,
316 315 SMB_QUOTA_QUERY_STARTSID,
317 316 SMB_QUOTA_QUERY_ALL
318 317 } smb_quota_query_op_t;
319 318
320 319 /*
321 320 * SMB (internal) form of a quota lookup
322 321 * See also: smb_quota_query_xdr()
323 322 */
324 323 typedef struct smb_quota_query {
325 324 char *qq_root_path;
326 325 uint32_t qq_query_op; /* smb_quota_query_op_t */
327 326 bool_t qq_single;
328 327 bool_t qq_restart;
329 328 uint32_t qq_max_quota;
330 329 list_t qq_sid_list; /* list of smb_quota_sid_t */
331 330 } smb_quota_query_t;
332 331
333 332 /*
334 333 * The get quota response (list of quota records)
335 334 * See also: smb_quota_response_xdr()
336 335 */
337 336 typedef struct smb_quota_response {
338 337 uint32_t qr_status;
339 338 list_t qr_quota_list; /* list of smb_quota_t */
340 339 } smb_quota_response_t;
341 340
342 341 /*
343 342 * The set quota request (list of quota records)
344 343 * See also: smb_quota_set_xdr()
345 344 */
346 345 typedef struct smb_quota_set {
347 346 char *qs_root_path;
348 347 list_t qs_quota_list; /* list of smb_quota_t */
349 348 } smb_quota_set_t;
350 349
351 350 bool_t smb_quota_query_xdr(XDR *, smb_quota_query_t *);
352 351 bool_t smb_quota_response_xdr(XDR *, smb_quota_response_t *);
353 352 bool_t smb_quota_set_xdr(XDR *, smb_quota_set_t *);
354 353
355 354 typedef struct dfs_referral_query {
356 355 dfs_reftype_t rq_type;
357 356 char *rq_path;
358 357 } dfs_referral_query_t;
359 358
360 359 typedef struct dfs_referral_response {
361 360 dfs_info_t rp_referrals;
362 361 uint32_t rp_status;
363 362 } dfs_referral_response_t;
364 363
365 364 bool_t dfs_referral_query_xdr(XDR *, dfs_referral_query_t *);
366 365 bool_t dfs_referral_response_xdr(XDR *, dfs_referral_response_t *);
367 366
368 367 typedef struct smb_shr_hostaccess_query {
369 368 char *shq_none;
370 369 char *shq_ro;
371 370 char *shq_rw;
372 371 uint32_t shq_flag;
373 372 smb_inaddr_t shq_ipaddr;
374 373 } smb_shr_hostaccess_query_t;
375 374
376 375 bool_t smb_shr_hostaccess_query_xdr(XDR *, smb_shr_hostaccess_query_t *);
377 376 bool_t smb_shr_execinfo_xdr(XDR *, smb_shr_execinfo_t *);
378 377
379 378 #ifdef __cplusplus
380 379 }
381 380 #endif
382 381
383 382 #endif /* _SMBSRV_SMB_XDR_H */
↓ open down ↓ |
329 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX