r16980: - make struct smb_notify a union and add levels RAW_NOTIFY_NTTRANS,RAW_NOTIFY...
[sfrench/samba-autobuild/.git] / source4 / ntvfs / ntvfs_interface.c
1 /* 
2    Unix SMB/CIFS implementation.
3    NTVFS interface functions
4
5    Copyright (C) Stefan (metze) Metzmacher 2004
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include "includes.h"
23 #include "ntvfs/ntvfs.h"
24
25 /* connect/disconnect */
26 _PUBLIC_ NTSTATUS ntvfs_connect(struct ntvfs_request *req, const char *sharename)
27 {
28         struct ntvfs_module_context *ntvfs = req->ctx->modules;
29         if (!ntvfs->ops->connect) {
30                 return NT_STATUS_NOT_IMPLEMENTED;
31         }
32         return ntvfs->ops->connect(ntvfs, req, sharename);
33 }
34
35 _PUBLIC_ NTSTATUS ntvfs_disconnect(struct ntvfs_context *ntvfs_ctx)
36 {
37         struct ntvfs_module_context *ntvfs;
38         if (ntvfs_ctx == NULL) {
39                 return NT_STATUS_INVALID_CONNECTION;
40         }
41         ntvfs = ntvfs_ctx->modules;
42         if (!ntvfs->ops->disconnect) {
43                 return NT_STATUS_NOT_IMPLEMENTED;
44         }
45         return ntvfs->ops->disconnect(ntvfs);
46 }
47
48 /* async setup - called by a backend that wants to setup any state for
49    a async request */
50 _PUBLIC_ NTSTATUS ntvfs_async_setup(struct ntvfs_request *req, void *private)
51 {
52         struct ntvfs_module_context *ntvfs = req->ctx->modules;
53         if (!ntvfs->ops->async_setup) {
54                 return NT_STATUS_NOT_IMPLEMENTED;
55         }
56         return ntvfs->ops->async_setup(ntvfs, req, private);
57 }
58
59 /* filesystem operations */
60 _PUBLIC_ NTSTATUS ntvfs_fsinfo(struct ntvfs_request *req, union smb_fsinfo *fs)
61 {
62         struct ntvfs_module_context *ntvfs = req->ctx->modules;
63         if (!ntvfs->ops->fsinfo) {
64                 return NT_STATUS_NOT_IMPLEMENTED;
65         }
66         return ntvfs->ops->fsinfo(ntvfs, req, fs);
67 }
68
69 /* path operations */
70 _PUBLIC_ NTSTATUS ntvfs_unlink(struct ntvfs_request *req, union smb_unlink *unl)
71 {
72         struct ntvfs_module_context *ntvfs = req->ctx->modules;
73         if (!ntvfs->ops->unlink) {
74                 return NT_STATUS_NOT_IMPLEMENTED;
75         }
76         return ntvfs->ops->unlink(ntvfs, req, unl);
77 }
78
79 _PUBLIC_ NTSTATUS ntvfs_chkpath(struct ntvfs_request *req, union smb_chkpath *cp)
80 {
81         struct ntvfs_module_context *ntvfs = req->ctx->modules;
82         if (!ntvfs->ops->chkpath) {
83                 return NT_STATUS_NOT_IMPLEMENTED;
84         }
85         return ntvfs->ops->chkpath(ntvfs, req, cp);
86 }
87
88 _PUBLIC_ NTSTATUS ntvfs_qpathinfo(struct ntvfs_request *req, union smb_fileinfo *st)
89 {
90         struct ntvfs_module_context *ntvfs = req->ctx->modules;
91         if (!ntvfs->ops->qpathinfo) {
92                 return NT_STATUS_NOT_IMPLEMENTED;
93         }
94         return ntvfs->ops->qpathinfo(ntvfs, req, st);
95 }
96
97 _PUBLIC_ NTSTATUS ntvfs_setpathinfo(struct ntvfs_request *req, union smb_setfileinfo *st)
98 {
99         struct ntvfs_module_context *ntvfs = req->ctx->modules;
100         if (!ntvfs->ops->setpathinfo) {
101                 return NT_STATUS_NOT_IMPLEMENTED;
102         }
103         return ntvfs->ops->setpathinfo(ntvfs, req, st);
104 }
105
106 _PUBLIC_ NTSTATUS ntvfs_open(struct ntvfs_request *req, union smb_open *oi)
107 {
108         struct ntvfs_module_context *ntvfs = req->ctx->modules;
109         if (!ntvfs->ops->open) {
110                 return NT_STATUS_NOT_IMPLEMENTED;
111         }
112         return ntvfs->ops->open(ntvfs, req, oi);
113 }
114
115 _PUBLIC_ NTSTATUS ntvfs_mkdir(struct ntvfs_request *req, union smb_mkdir *md)
116 {
117         struct ntvfs_module_context *ntvfs = req->ctx->modules;
118         if (!ntvfs->ops->mkdir) {
119                 return NT_STATUS_NOT_IMPLEMENTED;
120         }
121         return ntvfs->ops->mkdir(ntvfs, req, md);
122 }
123
124 _PUBLIC_ NTSTATUS ntvfs_rmdir(struct ntvfs_request *req, struct smb_rmdir *rd)
125 {
126         struct ntvfs_module_context *ntvfs = req->ctx->modules;
127         if (!ntvfs->ops->rmdir) {
128                 return NT_STATUS_NOT_IMPLEMENTED;
129         }
130         return ntvfs->ops->rmdir(ntvfs, req, rd);
131 }
132
133 _PUBLIC_ NTSTATUS ntvfs_rename(struct ntvfs_request *req, union smb_rename *ren)
134 {
135         struct ntvfs_module_context *ntvfs = req->ctx->modules;
136         if (!ntvfs->ops->rename) {
137                 return NT_STATUS_NOT_IMPLEMENTED;
138         }
139         return ntvfs->ops->rename(ntvfs, req, ren);
140 }
141
142 _PUBLIC_ NTSTATUS ntvfs_copy(struct ntvfs_request *req, struct smb_copy *cp)
143 {
144         struct ntvfs_module_context *ntvfs = req->ctx->modules;
145         if (!ntvfs->ops->copy) {
146                 return NT_STATUS_NOT_IMPLEMENTED;
147         }
148         return ntvfs->ops->copy(ntvfs, req, cp);
149 }
150
151 /* directory search */
152 _PUBLIC_ NTSTATUS ntvfs_search_first(struct ntvfs_request *req, union smb_search_first *io, void *private,
153                                      BOOL ntvfs_callback(void *private, union smb_search_data *file))
154 {
155         struct ntvfs_module_context *ntvfs = req->ctx->modules;
156         if (!ntvfs->ops->search_first) {
157                 return NT_STATUS_NOT_IMPLEMENTED;
158         }
159         return ntvfs->ops->search_first(ntvfs, req, io, private, ntvfs_callback);
160 }
161
162 _PUBLIC_ NTSTATUS ntvfs_search_next(struct ntvfs_request *req, union smb_search_next *io, void *private,
163                                     BOOL ntvfs_callback(void *private, union smb_search_data *file))
164 {
165         struct ntvfs_module_context *ntvfs = req->ctx->modules;
166         if (!ntvfs->ops->search_next) {
167                 return NT_STATUS_NOT_IMPLEMENTED;
168         }
169         return ntvfs->ops->search_next(ntvfs, req, io, private, ntvfs_callback);
170 }
171
172 _PUBLIC_ NTSTATUS ntvfs_search_close(struct ntvfs_request *req, union smb_search_close *io)
173 {
174         struct ntvfs_module_context *ntvfs = req->ctx->modules;
175         if (!ntvfs->ops->search_close) {
176                 return NT_STATUS_NOT_IMPLEMENTED;
177         }
178         return ntvfs->ops->search_close(ntvfs, req, io);
179 }
180
181 /* operations on open files */
182 _PUBLIC_ NTSTATUS ntvfs_ioctl(struct ntvfs_request *req, union smb_ioctl *io)
183 {
184         struct ntvfs_module_context *ntvfs = req->ctx->modules;
185         if (!ntvfs->ops->ioctl) {
186                 return NT_STATUS_NOT_IMPLEMENTED;
187         }
188         return ntvfs->ops->ioctl(ntvfs, req, io);
189 }
190
191 _PUBLIC_ NTSTATUS ntvfs_read(struct ntvfs_request *req, union smb_read *io)
192 {
193         struct ntvfs_module_context *ntvfs = req->ctx->modules;
194         if (!ntvfs->ops->read) {
195                 return NT_STATUS_NOT_IMPLEMENTED;
196         }
197         return ntvfs->ops->read(ntvfs, req, io);
198 }
199
200 _PUBLIC_ NTSTATUS ntvfs_write(struct ntvfs_request *req, union smb_write *io)
201 {
202         struct ntvfs_module_context *ntvfs = req->ctx->modules;
203         if (!ntvfs->ops->write) {
204                 return NT_STATUS_NOT_IMPLEMENTED;
205         }
206         return ntvfs->ops->write(ntvfs, req, io);
207 }
208
209 _PUBLIC_ NTSTATUS ntvfs_seek(struct ntvfs_request *req, union smb_seek *io)
210 {
211         struct ntvfs_module_context *ntvfs = req->ctx->modules;
212         if (!ntvfs->ops->seek) {
213                 return NT_STATUS_NOT_IMPLEMENTED;
214         }
215         return ntvfs->ops->seek(ntvfs, req, io);
216 }
217
218 _PUBLIC_ NTSTATUS ntvfs_flush(struct ntvfs_request *req,
219                               union smb_flush *flush)
220 {
221         struct ntvfs_module_context *ntvfs = req->ctx->modules;
222         if (!ntvfs->ops->flush) {
223                 return NT_STATUS_NOT_IMPLEMENTED;
224         }
225         return ntvfs->ops->flush(ntvfs, req, flush);
226 }
227
228 _PUBLIC_ NTSTATUS ntvfs_lock(struct ntvfs_request *req, union smb_lock *lck)
229 {
230         struct ntvfs_module_context *ntvfs = req->ctx->modules;
231         if (!ntvfs->ops->lock) {
232                 return NT_STATUS_NOT_IMPLEMENTED;
233         }
234         return ntvfs->ops->lock(ntvfs, req, lck);
235 }
236
237 _PUBLIC_ NTSTATUS ntvfs_qfileinfo(struct ntvfs_request *req, union smb_fileinfo *info)
238 {
239         struct ntvfs_module_context *ntvfs = req->ctx->modules;
240         if (!ntvfs->ops->qfileinfo) {
241                 return NT_STATUS_NOT_IMPLEMENTED;
242         }
243         return ntvfs->ops->qfileinfo(ntvfs, req, info);
244 }
245
246 _PUBLIC_ NTSTATUS ntvfs_setfileinfo(struct ntvfs_request *req, union smb_setfileinfo *info)
247 {
248         struct ntvfs_module_context *ntvfs = req->ctx->modules;
249         if (!ntvfs->ops->setfileinfo) {
250                 return NT_STATUS_NOT_IMPLEMENTED;
251         }
252         return ntvfs->ops->setfileinfo(ntvfs, req, info);
253 }
254
255 _PUBLIC_ NTSTATUS ntvfs_close(struct ntvfs_request *req, union smb_close *io)
256 {
257         struct ntvfs_module_context *ntvfs = req->ctx->modules;
258         if (!ntvfs->ops->close) {
259                 return NT_STATUS_NOT_IMPLEMENTED;
260         }
261         return ntvfs->ops->close(ntvfs, req, io);
262 }
263
264 /* trans interface - used by IPC backend for pipes and RAP calls */
265 _PUBLIC_ NTSTATUS ntvfs_trans(struct ntvfs_request *req, struct smb_trans2 *trans)
266 {
267         struct ntvfs_module_context *ntvfs = req->ctx->modules;
268         if (!ntvfs->ops->trans) {
269                 return NT_STATUS_NOT_IMPLEMENTED;
270         }
271         return ntvfs->ops->trans(ntvfs, req, trans);
272 }
273
274 /* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
275 _PUBLIC_ NTSTATUS ntvfs_trans2(struct ntvfs_request *req, struct smb_trans2 *trans2)
276 {
277         struct ntvfs_module_context *ntvfs = req->ctx->modules;
278         if (!ntvfs->ops->trans2) {
279                 return NT_STATUS_NOT_IMPLEMENTED;
280         }
281         return ntvfs->ops->trans2(ntvfs, req, trans2);
282 }
283
284 /* printing specific operations */
285 _PUBLIC_ NTSTATUS ntvfs_lpq(struct ntvfs_request *req, union smb_lpq *lpq)
286 {
287         struct ntvfs_module_context *ntvfs = req->ctx->modules;
288         if (!ntvfs->ops->lpq) {
289                 return NT_STATUS_NOT_IMPLEMENTED;
290         }
291         return ntvfs->ops->lpq(ntvfs, req, lpq);
292 }
293
294 /* logoff - called when a vuid is closed */
295 _PUBLIC_ NTSTATUS ntvfs_logoff(struct ntvfs_request *req)
296 {
297         struct ntvfs_module_context *ntvfs = req->ctx->modules;
298         if (!ntvfs->ops->logoff) {
299                 return NT_STATUS_NOT_IMPLEMENTED;
300         }
301         return ntvfs->ops->logoff(ntvfs, req);
302 }
303
304 _PUBLIC_ NTSTATUS ntvfs_exit(struct ntvfs_request *req)
305 {
306         struct ntvfs_module_context *ntvfs = req->ctx->modules;
307         if (!ntvfs->ops->exit) {
308                 return NT_STATUS_NOT_IMPLEMENTED;
309         }
310         return ntvfs->ops->exit(ntvfs, req);
311 }
312
313 /*
314   change notify request
315 */
316 _PUBLIC_ NTSTATUS ntvfs_notify(struct ntvfs_request *req, union smb_notify *info)
317 {
318         struct ntvfs_module_context *ntvfs = req->ctx->modules;
319         if (!ntvfs->ops->notify) {
320                 return NT_STATUS_NOT_IMPLEMENTED;
321         }
322         return ntvfs->ops->notify(ntvfs, req, info);
323 }
324
325 /*
326   cancel an outstanding async request
327 */
328 _PUBLIC_ NTSTATUS ntvfs_cancel(struct ntvfs_request *req)
329 {
330         struct ntvfs_module_context *ntvfs = req->ctx->modules;
331         if (!ntvfs->ops->cancel) {
332                 return NT_STATUS_NOT_IMPLEMENTED;
333         }
334         return ntvfs->ops->cancel(ntvfs, req);
335 }
336
337 /* initial setup */
338 _PUBLIC_ NTSTATUS ntvfs_next_connect(struct ntvfs_module_context *ntvfs, 
339                                      struct ntvfs_request *req, const char *sharename)
340 {
341         if (!ntvfs->next || !ntvfs->next->ops->connect) {
342                 return NT_STATUS_NOT_IMPLEMENTED;
343         }
344         return ntvfs->next->ops->connect(ntvfs->next, req, sharename);
345 }
346
347 _PUBLIC_ NTSTATUS ntvfs_next_disconnect(struct ntvfs_module_context *ntvfs)
348 {
349         if (!ntvfs->next || !ntvfs->next->ops->disconnect) {
350                 return NT_STATUS_NOT_IMPLEMENTED;
351         }
352         return ntvfs->next->ops->disconnect(ntvfs->next);
353 }
354
355 /* async_setup - called when setting up for a async request */
356 _PUBLIC_ NTSTATUS ntvfs_next_async_setup(struct ntvfs_module_context *ntvfs, 
357                                          struct ntvfs_request *req, 
358                                          void *private)
359 {
360         if (!ntvfs->next || !ntvfs->next->ops->async_setup) {
361                 return NT_STATUS_NOT_IMPLEMENTED;
362         }
363         return ntvfs->next->ops->async_setup(ntvfs->next, req, private);
364 }
365
366 /* filesystem operations */
367 _PUBLIC_ NTSTATUS ntvfs_next_fsinfo(struct ntvfs_module_context *ntvfs, 
368                                     struct ntvfs_request *req,
369                                     union smb_fsinfo *fs)
370 {
371         if (!ntvfs->next || !ntvfs->next->ops->fsinfo) {
372                 return NT_STATUS_NOT_IMPLEMENTED;
373         }
374         return ntvfs->next->ops->fsinfo(ntvfs->next, req, fs);
375 }
376
377 /* path operations */
378 _PUBLIC_ NTSTATUS ntvfs_next_unlink(struct ntvfs_module_context *ntvfs, 
379                                     struct ntvfs_request *req,
380                                     union smb_unlink *unl)
381 {
382         if (!ntvfs->next || !ntvfs->next->ops->unlink) {
383                 return NT_STATUS_NOT_IMPLEMENTED;
384         }
385         return ntvfs->next->ops->unlink(ntvfs->next, req, unl);
386 }
387
388 _PUBLIC_ NTSTATUS ntvfs_next_chkpath(struct ntvfs_module_context *ntvfs, 
389                                      struct ntvfs_request *req,
390                                      union smb_chkpath *cp)
391 {
392         if (!ntvfs->next || !ntvfs->next->ops->chkpath) {
393                 return NT_STATUS_NOT_IMPLEMENTED;
394         }
395         return ntvfs->next->ops->chkpath(ntvfs->next, req, cp);
396 }
397
398 _PUBLIC_ NTSTATUS ntvfs_next_qpathinfo(struct ntvfs_module_context *ntvfs, 
399                                        struct ntvfs_request *req,
400                                        union smb_fileinfo *st)
401 {
402         if (!ntvfs->next || !ntvfs->next->ops->qpathinfo) {
403                 return NT_STATUS_NOT_IMPLEMENTED;
404         }
405         return ntvfs->next->ops->qpathinfo(ntvfs->next, req, st);
406 }
407
408 _PUBLIC_ NTSTATUS ntvfs_next_setpathinfo(struct ntvfs_module_context *ntvfs, 
409                                          struct ntvfs_request *req,
410                                          union smb_setfileinfo *st)
411 {
412         if (!ntvfs->next || !ntvfs->next->ops->setpathinfo) {
413                 return NT_STATUS_NOT_IMPLEMENTED;
414         }
415         return ntvfs->next->ops->setpathinfo(ntvfs->next, req, st);
416 }
417
418 _PUBLIC_ NTSTATUS ntvfs_next_mkdir(struct ntvfs_module_context *ntvfs, 
419                                    struct ntvfs_request *req,
420                                    union smb_mkdir *md)
421 {
422         if (!ntvfs->next || !ntvfs->next->ops->mkdir) {
423                 return NT_STATUS_NOT_IMPLEMENTED;
424         }
425         return ntvfs->next->ops->mkdir(ntvfs->next, req, md);
426 }
427
428 _PUBLIC_ NTSTATUS ntvfs_next_rmdir(struct ntvfs_module_context *ntvfs, 
429                                    struct ntvfs_request *req,
430                                    struct smb_rmdir *rd)
431 {
432         if (!ntvfs->next || !ntvfs->next->ops->rmdir) {
433                 return NT_STATUS_NOT_IMPLEMENTED;
434         }
435         return ntvfs->next->ops->rmdir(ntvfs->next, req, rd);
436 }
437
438 _PUBLIC_ NTSTATUS ntvfs_next_rename(struct ntvfs_module_context *ntvfs, 
439                                     struct ntvfs_request *req,
440                                     union smb_rename *ren)
441 {
442         if (!ntvfs->next || !ntvfs->next->ops->rename) {
443                 return NT_STATUS_NOT_IMPLEMENTED;
444         }
445         return ntvfs->next->ops->rename(ntvfs->next, req, ren);
446 }
447
448 _PUBLIC_ NTSTATUS ntvfs_next_copy(struct ntvfs_module_context *ntvfs, 
449                                   struct ntvfs_request *req,
450                                   struct smb_copy *cp)
451 {
452         if (!ntvfs->next || !ntvfs->next->ops->copy) {
453                 return NT_STATUS_NOT_IMPLEMENTED;
454         }
455         return ntvfs->next->ops->copy(ntvfs->next, req, cp);
456 }
457
458 _PUBLIC_ NTSTATUS ntvfs_next_open(struct ntvfs_module_context *ntvfs, 
459                                   struct ntvfs_request *req,
460                                   union smb_open *oi)
461 {
462         if (!ntvfs->next || !ntvfs->next->ops->open) {
463                 return NT_STATUS_NOT_IMPLEMENTED;
464         }
465         return ntvfs->next->ops->open(ntvfs->next, req, oi);
466 }
467
468
469 /* directory search */
470 _PUBLIC_ NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs, 
471                                           struct ntvfs_request *req,
472                                           union smb_search_first *io, void *private,
473                                           BOOL (*callback)(void *private, union smb_search_data *file))
474 {
475         if (!ntvfs->next || !ntvfs->next->ops->search_first) {
476                 return NT_STATUS_NOT_IMPLEMENTED;
477         }
478         return ntvfs->next->ops->search_first(ntvfs->next, req, io, private, callback);
479 }
480
481 _PUBLIC_ NTSTATUS ntvfs_next_search_next(struct ntvfs_module_context *ntvfs, 
482                                          struct ntvfs_request *req,
483                                          union smb_search_next *io, void *private,
484                                          BOOL (*callback)(void *private, union smb_search_data *file))
485 {
486         if (!ntvfs->next || !ntvfs->next->ops->search_next) {
487                 return NT_STATUS_NOT_IMPLEMENTED;
488         }
489         return ntvfs->next->ops->search_next(ntvfs->next, req, io, private, callback);
490 }
491
492 _PUBLIC_ NTSTATUS ntvfs_next_search_close(struct ntvfs_module_context *ntvfs, 
493                                           struct ntvfs_request *req,
494                                           union smb_search_close *io)
495 {
496         if (!ntvfs->next || !ntvfs->next->ops->search_close) {
497                 return NT_STATUS_NOT_IMPLEMENTED;
498         }
499         return ntvfs->next->ops->search_close(ntvfs->next, req, io);
500 }
501
502 /* operations on open files */
503 _PUBLIC_ NTSTATUS ntvfs_next_ioctl(struct ntvfs_module_context *ntvfs, 
504                                    struct ntvfs_request *req,
505                                    union smb_ioctl *io)
506 {
507         if (!ntvfs->next || !ntvfs->next->ops->ioctl) {
508                 return NT_STATUS_NOT_IMPLEMENTED;
509         }
510         return ntvfs->next->ops->ioctl(ntvfs->next, req, io);
511 }
512
513 _PUBLIC_ NTSTATUS ntvfs_next_read(struct ntvfs_module_context *ntvfs, 
514                                   struct ntvfs_request *req,
515                                   union smb_read *io)
516 {
517         if (!ntvfs->next || !ntvfs->next->ops->read) {
518                 return NT_STATUS_NOT_IMPLEMENTED;
519         }
520         return ntvfs->next->ops->read(ntvfs->next, req, io);
521 }
522
523 _PUBLIC_ NTSTATUS ntvfs_next_write(struct ntvfs_module_context *ntvfs, 
524                                    struct ntvfs_request *req,
525                                    union smb_write *io)
526 {
527         if (!ntvfs->next || !ntvfs->next->ops->write) {
528                 return NT_STATUS_NOT_IMPLEMENTED;
529         }
530         return ntvfs->next->ops->write(ntvfs->next, req, io);
531 }
532
533 _PUBLIC_ NTSTATUS ntvfs_next_seek(struct ntvfs_module_context *ntvfs, 
534                                   struct ntvfs_request *req,
535                                   union smb_seek *io)
536 {
537         if (!ntvfs->next || !ntvfs->next->ops->seek) {
538                 return NT_STATUS_NOT_IMPLEMENTED;
539         }
540         return ntvfs->next->ops->seek(ntvfs->next, req, io);
541 }
542
543 _PUBLIC_ NTSTATUS ntvfs_next_flush(struct ntvfs_module_context *ntvfs, 
544                                    struct ntvfs_request *req,
545                                    union smb_flush *flush)
546 {
547         if (!ntvfs->next || !ntvfs->next->ops->flush) {
548                 return NT_STATUS_NOT_IMPLEMENTED;
549         }
550         return ntvfs->next->ops->flush(ntvfs->next, req, flush);
551 }
552
553 _PUBLIC_ NTSTATUS ntvfs_next_lock(struct ntvfs_module_context *ntvfs, 
554                                   struct ntvfs_request *req,
555                                   union smb_lock *lck)
556 {
557         if (!ntvfs->next || !ntvfs->next->ops->lock) {
558                 return NT_STATUS_NOT_IMPLEMENTED;
559         }
560         return ntvfs->next->ops->lock(ntvfs->next, req, lck);
561 }
562
563 _PUBLIC_ NTSTATUS ntvfs_next_qfileinfo(struct ntvfs_module_context *ntvfs, 
564                                        struct ntvfs_request *req,
565                                        union smb_fileinfo *info)
566 {
567         if (!ntvfs->next || !ntvfs->next->ops->qfileinfo) {
568                 return NT_STATUS_NOT_IMPLEMENTED;
569         }
570         return ntvfs->next->ops->qfileinfo(ntvfs->next, req, info);
571 }
572
573 _PUBLIC_ NTSTATUS ntvfs_next_setfileinfo(struct ntvfs_module_context *ntvfs, 
574                                          struct ntvfs_request *req,
575                                          union smb_setfileinfo *info)
576 {
577         if (!ntvfs->next || !ntvfs->next->ops->setfileinfo) {
578                 return NT_STATUS_NOT_IMPLEMENTED;
579         }
580         return ntvfs->next->ops->setfileinfo(ntvfs->next, req, info);
581 }
582
583 _PUBLIC_ NTSTATUS ntvfs_next_close(struct ntvfs_module_context *ntvfs, 
584                                    struct ntvfs_request *req,
585                                    union smb_close *io)
586 {
587         if (!ntvfs->next || !ntvfs->next->ops->close) {
588                 return NT_STATUS_NOT_IMPLEMENTED;
589         }
590         return ntvfs->next->ops->close(ntvfs->next, req, io);
591 }
592
593 /* trans interface - used by IPC backend for pipes and RAP calls */
594 _PUBLIC_ NTSTATUS ntvfs_next_trans(struct ntvfs_module_context *ntvfs, 
595                                    struct ntvfs_request *req,
596                                    struct smb_trans2 *trans)
597 {
598         if (!ntvfs->next || !ntvfs->next->ops->trans) {
599                 return NT_STATUS_NOT_IMPLEMENTED;
600         }
601         return ntvfs->next->ops->trans(ntvfs->next, req, trans);
602 }
603
604 /* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
605 _PUBLIC_ NTSTATUS ntvfs_next_trans2(struct ntvfs_module_context *ntvfs, 
606                                     struct ntvfs_request *req,
607                                     struct smb_trans2 *trans2)
608 {
609         if (!ntvfs->next || !ntvfs->next->ops->trans2) {
610                 return NT_STATUS_NOT_IMPLEMENTED;
611         }
612         return ntvfs->next->ops->trans2(ntvfs->next, req, trans2);
613 }
614
615 /*
616   change notify request
617 */
618 _PUBLIC_ NTSTATUS ntvfs_next_notify(struct ntvfs_module_context *ntvfs,
619                                     struct ntvfs_request *req,
620                                     union smb_notify *info)
621 {
622         if (!ntvfs->next || !ntvfs->next->ops->notify) {
623                 return NT_STATUS_NOT_IMPLEMENTED;
624         }
625         return ntvfs->next->ops->notify(ntvfs->next, req, info);
626 }
627
628 /* cancel - called to cancel an outstanding async request */
629 _PUBLIC_ NTSTATUS ntvfs_next_cancel(struct ntvfs_module_context *ntvfs, 
630                                     struct ntvfs_request *req)
631 {
632         if (!ntvfs->next || !ntvfs->next->ops->cancel) {
633                 return NT_STATUS_NOT_IMPLEMENTED;
634         }
635         return ntvfs->next->ops->cancel(ntvfs->next, req);
636 }
637
638 /* printing specific operations */
639 _PUBLIC_ NTSTATUS ntvfs_next_lpq(struct ntvfs_module_context *ntvfs, 
640                                  struct ntvfs_request *req,
641                                  union smb_lpq *lpq)
642 {
643         if (!ntvfs->next || !ntvfs->next->ops->lpq) {
644                 return NT_STATUS_NOT_IMPLEMENTED;
645         }
646         return ntvfs->next->ops->lpq(ntvfs->next, req, lpq);
647 }
648
649
650 /* logoff - called when a vuid is closed */
651 _PUBLIC_ NTSTATUS ntvfs_next_logoff(struct ntvfs_module_context *ntvfs, 
652                                     struct ntvfs_request *req)
653 {
654         if (!ntvfs->next || !ntvfs->next->ops->logoff) {
655                 return NT_STATUS_NOT_IMPLEMENTED;
656         }
657         return ntvfs->next->ops->logoff(ntvfs->next, req);
658 }
659
660 _PUBLIC_ NTSTATUS ntvfs_next_exit(struct ntvfs_module_context *ntvfs, 
661                                   struct ntvfs_request *req)
662 {
663         if (!ntvfs->next || !ntvfs->next->ops->exit) {
664                 return NT_STATUS_NOT_IMPLEMENTED;
665         }
666         return ntvfs->next->ops->exit(ntvfs->next, req);
667 }
668
669 /* oplock helpers */
670 _PUBLIC_ NTSTATUS ntvfs_set_oplock_handler(struct ntvfs_context *ntvfs,
671                                            NTSTATUS (*handler)(void *private_data, struct ntvfs_handle *handle, uint8_t level),
672                                            void *private_data)
673 {
674         ntvfs->oplock.handler           = handler;
675         ntvfs->oplock.private_data      = private_data;
676         return NT_STATUS_OK;
677 }
678
679 _PUBLIC_ NTSTATUS ntvfs_send_oplock_break(struct ntvfs_module_context *ntvfs,
680                                           struct ntvfs_handle *handle, uint8_t level)
681 {
682         if (!ntvfs->ctx->oplock.handler) {
683                 return NT_STATUS_OK;
684         }
685
686         return ntvfs->ctx->oplock.handler(ntvfs->ctx->oplock.private_data, handle, level);
687 }
688
689 /* client connection callback */
690 _PUBLIC_ NTSTATUS ntvfs_set_addr_callbacks(struct ntvfs_context *ntvfs,
691                                            struct socket_address *(*my_addr)(void *private_data, TALLOC_CTX *mem_ctx),
692                                            struct socket_address *(*peer_addr)(void *private_data, TALLOC_CTX *mem_ctx),
693                                            void *private_data)
694 {
695         ntvfs->client.get_peer_addr     = my_addr;
696         ntvfs->client.get_my_addr       = peer_addr;
697         ntvfs->client.private_data      = private_data;
698         return NT_STATUS_OK;
699 }
700
701 _PUBLIC_ struct socket_address *ntvfs_get_my_addr(struct ntvfs_module_context *ntvfs, TALLOC_CTX *mem_ctx)
702 {
703         if (!ntvfs->ctx->client.get_my_addr) {
704                 return NULL;
705         }
706
707         return ntvfs->ctx->client.get_my_addr(ntvfs->ctx->client.private_data, mem_ctx);
708 }
709
710 _PUBLIC_ struct socket_address *ntvfs_get_peer_addr(struct ntvfs_module_context *ntvfs, TALLOC_CTX *mem_ctx)
711 {
712         if (!ntvfs->ctx->client.get_peer_addr) {
713                 return NULL;
714         }
715
716         return ntvfs->ctx->client.get_peer_addr(ntvfs->ctx->client.private_data, mem_ctx);
717 }