tdb: Add a comment explaining the "check"
[Samba/vl.git] / source4 / ntvfs / ntvfs_interface.c
blob005da0b8e2f14728ee8f11a7f4f66880349d7312
1 /*
2 Unix SMB/CIFS implementation.
3 NTVFS interface functions
5 Copyright (C) Stefan (metze) Metzmacher 2004
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 3 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "ntvfs/ntvfs.h"
23 #include "lib/tsocket/tsocket.h"
25 /* connect/disconnect */
26 NTSTATUS ntvfs_connect(struct ntvfs_request *req, union smb_tcon *tcon)
28 struct ntvfs_module_context *ntvfs = req->ctx->modules;
29 if (!ntvfs->ops->connect_fn) {
30 return NT_STATUS_NOT_IMPLEMENTED;
32 return ntvfs->ops->connect_fn(ntvfs, req, tcon);
35 NTSTATUS ntvfs_disconnect(struct ntvfs_context *ntvfs_ctx)
37 struct ntvfs_module_context *ntvfs;
38 if (ntvfs_ctx == NULL) {
39 return NT_STATUS_INVALID_CONNECTION;
41 ntvfs = ntvfs_ctx->modules;
42 if (!ntvfs->ops->disconnect_fn) {
43 return NT_STATUS_NOT_IMPLEMENTED;
45 return ntvfs->ops->disconnect_fn(ntvfs);
48 /* async setup - called by a backend that wants to setup any state for
49 a async request */
50 NTSTATUS ntvfs_async_setup(struct ntvfs_request *req, void *private_data)
52 struct ntvfs_module_context *ntvfs = req->ctx->modules;
53 if (!ntvfs->ops->async_setup_fn) {
54 return NT_STATUS_NOT_IMPLEMENTED;
56 return ntvfs->ops->async_setup_fn(ntvfs, req, private_data);
59 /* filesystem operations */
60 NTSTATUS ntvfs_fsinfo(struct ntvfs_request *req, union smb_fsinfo *fs)
62 struct ntvfs_module_context *ntvfs = req->ctx->modules;
63 if (!ntvfs->ops->fsinfo_fn) {
64 return NT_STATUS_NOT_IMPLEMENTED;
66 return ntvfs->ops->fsinfo_fn(ntvfs, req, fs);
69 /* path operations */
70 NTSTATUS ntvfs_unlink(struct ntvfs_request *req, union smb_unlink *unl)
72 struct ntvfs_module_context *ntvfs = req->ctx->modules;
73 if (!ntvfs->ops->unlink_fn) {
74 return NT_STATUS_NOT_IMPLEMENTED;
76 return ntvfs->ops->unlink_fn(ntvfs, req, unl);
79 NTSTATUS ntvfs_chkpath(struct ntvfs_request *req, union smb_chkpath *cp)
81 struct ntvfs_module_context *ntvfs = req->ctx->modules;
82 if (!ntvfs->ops->chkpath_fn) {
83 return NT_STATUS_NOT_IMPLEMENTED;
85 return ntvfs->ops->chkpath_fn(ntvfs, req, cp);
88 NTSTATUS ntvfs_qpathinfo(struct ntvfs_request *req, union smb_fileinfo *st)
90 struct ntvfs_module_context *ntvfs = req->ctx->modules;
91 if (!ntvfs->ops->qpathinfo_fn) {
92 return NT_STATUS_NOT_IMPLEMENTED;
94 return ntvfs->ops->qpathinfo_fn(ntvfs, req, st);
97 NTSTATUS ntvfs_setpathinfo(struct ntvfs_request *req, union smb_setfileinfo *st)
99 struct ntvfs_module_context *ntvfs = req->ctx->modules;
100 if (!ntvfs->ops->setpathinfo_fn) {
101 return NT_STATUS_NOT_IMPLEMENTED;
103 return ntvfs->ops->setpathinfo_fn(ntvfs, req, st);
106 NTSTATUS ntvfs_open(struct ntvfs_request *req, union smb_open *oi)
108 struct ntvfs_module_context *ntvfs = req->ctx->modules;
109 if (!ntvfs->ops->open_fn) {
110 return NT_STATUS_NOT_IMPLEMENTED;
112 return ntvfs->ops->open_fn(ntvfs, req, oi);
115 NTSTATUS ntvfs_mkdir(struct ntvfs_request *req, union smb_mkdir *md)
117 struct ntvfs_module_context *ntvfs = req->ctx->modules;
118 if (!ntvfs->ops->mkdir_fn) {
119 return NT_STATUS_NOT_IMPLEMENTED;
121 return ntvfs->ops->mkdir_fn(ntvfs, req, md);
124 NTSTATUS ntvfs_rmdir(struct ntvfs_request *req, struct smb_rmdir *rd)
126 struct ntvfs_module_context *ntvfs = req->ctx->modules;
127 if (!ntvfs->ops->rmdir_fn) {
128 return NT_STATUS_NOT_IMPLEMENTED;
130 return ntvfs->ops->rmdir_fn(ntvfs, req, rd);
133 NTSTATUS ntvfs_rename(struct ntvfs_request *req, union smb_rename *ren)
135 struct ntvfs_module_context *ntvfs = req->ctx->modules;
136 if (!ntvfs->ops->rename_fn) {
137 return NT_STATUS_NOT_IMPLEMENTED;
139 return ntvfs->ops->rename_fn(ntvfs, req, ren);
142 NTSTATUS ntvfs_copy(struct ntvfs_request *req, struct smb_copy *cp)
144 struct ntvfs_module_context *ntvfs = req->ctx->modules;
145 if (!ntvfs->ops->copy_fn) {
146 return NT_STATUS_NOT_IMPLEMENTED;
148 return ntvfs->ops->copy_fn(ntvfs, req, cp);
151 /* directory search */
152 NTSTATUS ntvfs_search_first(struct ntvfs_request *req, union smb_search_first *io, void *private_data,
153 bool ntvfs_callback(void *private_data, const union smb_search_data *file))
155 struct ntvfs_module_context *ntvfs = req->ctx->modules;
156 if (!ntvfs->ops->search_first_fn) {
157 return NT_STATUS_NOT_IMPLEMENTED;
159 return ntvfs->ops->search_first_fn(ntvfs, req, io, private_data, ntvfs_callback);
162 NTSTATUS ntvfs_search_next(struct ntvfs_request *req, union smb_search_next *io, void *private_data,
163 bool ntvfs_callback(void *private_data, const union smb_search_data *file))
165 struct ntvfs_module_context *ntvfs = req->ctx->modules;
166 if (!ntvfs->ops->search_next_fn) {
167 return NT_STATUS_NOT_IMPLEMENTED;
169 return ntvfs->ops->search_next_fn(ntvfs, req, io, private_data, ntvfs_callback);
172 NTSTATUS ntvfs_search_close(struct ntvfs_request *req, union smb_search_close *io)
174 struct ntvfs_module_context *ntvfs = req->ctx->modules;
175 if (!ntvfs->ops->search_close_fn) {
176 return NT_STATUS_NOT_IMPLEMENTED;
178 return ntvfs->ops->search_close_fn(ntvfs, req, io);
181 /* operations on open files */
182 NTSTATUS ntvfs_ioctl(struct ntvfs_request *req, union smb_ioctl *io)
184 struct ntvfs_module_context *ntvfs = req->ctx->modules;
185 if (!ntvfs->ops->ioctl_fn) {
186 return NT_STATUS_NOT_IMPLEMENTED;
188 return ntvfs->ops->ioctl_fn(ntvfs, req, io);
191 NTSTATUS ntvfs_read(struct ntvfs_request *req, union smb_read *io)
193 struct ntvfs_module_context *ntvfs = req->ctx->modules;
194 if (!ntvfs->ops->read_fn) {
195 return NT_STATUS_NOT_IMPLEMENTED;
197 return ntvfs->ops->read_fn(ntvfs, req, io);
200 NTSTATUS ntvfs_write(struct ntvfs_request *req, union smb_write *io)
202 struct ntvfs_module_context *ntvfs = req->ctx->modules;
203 if (!ntvfs->ops->write_fn) {
204 return NT_STATUS_NOT_IMPLEMENTED;
206 return ntvfs->ops->write_fn(ntvfs, req, io);
209 NTSTATUS ntvfs_seek(struct ntvfs_request *req, union smb_seek *io)
211 struct ntvfs_module_context *ntvfs = req->ctx->modules;
212 if (!ntvfs->ops->seek_fn) {
213 return NT_STATUS_NOT_IMPLEMENTED;
215 return ntvfs->ops->seek_fn(ntvfs, req, io);
218 NTSTATUS ntvfs_flush(struct ntvfs_request *req,
219 union smb_flush *flush)
221 struct ntvfs_module_context *ntvfs = req->ctx->modules;
222 if (!ntvfs->ops->flush_fn) {
223 return NT_STATUS_NOT_IMPLEMENTED;
225 return ntvfs->ops->flush_fn(ntvfs, req, flush);
228 NTSTATUS ntvfs_lock(struct ntvfs_request *req, union smb_lock *lck)
230 struct ntvfs_module_context *ntvfs = req->ctx->modules;
231 if (!ntvfs->ops->lock_fn) {
232 return NT_STATUS_NOT_IMPLEMENTED;
234 return ntvfs->ops->lock_fn(ntvfs, req, lck);
237 NTSTATUS ntvfs_qfileinfo(struct ntvfs_request *req, union smb_fileinfo *info)
239 struct ntvfs_module_context *ntvfs = req->ctx->modules;
240 if (!ntvfs->ops->qfileinfo_fn) {
241 return NT_STATUS_NOT_IMPLEMENTED;
243 return ntvfs->ops->qfileinfo_fn(ntvfs, req, info);
246 NTSTATUS ntvfs_setfileinfo(struct ntvfs_request *req, union smb_setfileinfo *info)
248 struct ntvfs_module_context *ntvfs = req->ctx->modules;
249 if (!ntvfs->ops->setfileinfo_fn) {
250 return NT_STATUS_NOT_IMPLEMENTED;
252 return ntvfs->ops->setfileinfo_fn(ntvfs, req, info);
255 NTSTATUS ntvfs_close(struct ntvfs_request *req, union smb_close *io)
257 struct ntvfs_module_context *ntvfs = req->ctx->modules;
258 if (!ntvfs->ops->close_fn) {
259 return NT_STATUS_NOT_IMPLEMENTED;
261 return ntvfs->ops->close_fn(ntvfs, req, io);
264 /* trans interface - used by IPC backend for pipes and RAP calls */
265 NTSTATUS ntvfs_trans(struct ntvfs_request *req, struct smb_trans2 *trans)
267 struct ntvfs_module_context *ntvfs = req->ctx->modules;
268 if (!ntvfs->ops->trans_fn) {
269 return NT_STATUS_NOT_IMPLEMENTED;
271 return ntvfs->ops->trans_fn(ntvfs, req, trans);
274 /* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
275 NTSTATUS ntvfs_trans2(struct ntvfs_request *req, struct smb_trans2 *trans2)
277 struct ntvfs_module_context *ntvfs = req->ctx->modules;
278 if (!ntvfs->ops->trans2_fn) {
279 return NT_STATUS_NOT_IMPLEMENTED;
281 return ntvfs->ops->trans2_fn(ntvfs, req, trans2);
284 /* printing specific operations */
285 NTSTATUS ntvfs_lpq(struct ntvfs_request *req, union smb_lpq *lpq)
287 struct ntvfs_module_context *ntvfs = req->ctx->modules;
288 if (!ntvfs->ops->lpq_fn) {
289 return NT_STATUS_NOT_IMPLEMENTED;
291 return ntvfs->ops->lpq_fn(ntvfs, req, lpq);
294 /* logoff - called when a vuid is closed */
295 NTSTATUS ntvfs_logoff(struct ntvfs_request *req)
297 struct ntvfs_module_context *ntvfs = req->ctx->modules;
298 if (!ntvfs->ops->logoff_fn) {
299 return NT_STATUS_NOT_IMPLEMENTED;
301 return ntvfs->ops->logoff_fn(ntvfs, req);
304 NTSTATUS ntvfs_exit(struct ntvfs_request *req)
306 struct ntvfs_module_context *ntvfs = req->ctx->modules;
307 if (!ntvfs->ops->exit_fn) {
308 return NT_STATUS_NOT_IMPLEMENTED;
310 return ntvfs->ops->exit_fn(ntvfs, req);
314 change notify request
316 NTSTATUS ntvfs_notify(struct ntvfs_request *req, union smb_notify *info)
318 struct ntvfs_module_context *ntvfs = req->ctx->modules;
319 if (!ntvfs->ops->notify_fn) {
320 return NT_STATUS_NOT_IMPLEMENTED;
322 return ntvfs->ops->notify_fn(ntvfs, req, info);
326 cancel an outstanding async request
328 NTSTATUS ntvfs_cancel(struct ntvfs_request *req)
330 struct ntvfs_module_context *ntvfs = req->ctx->modules;
331 if (!ntvfs->ops->cancel_fn) {
332 return NT_STATUS_NOT_IMPLEMENTED;
334 return ntvfs->ops->cancel_fn(ntvfs, req);
337 /* initial setup */
338 NTSTATUS ntvfs_next_connect(struct ntvfs_module_context *ntvfs,
339 struct ntvfs_request *req,
340 union smb_tcon *tcon)
342 if (!ntvfs->next || !ntvfs->next->ops->connect_fn) {
343 return NT_STATUS_NOT_IMPLEMENTED;
345 return ntvfs->next->ops->connect_fn(ntvfs->next, req, tcon);
348 NTSTATUS ntvfs_next_disconnect(struct ntvfs_module_context *ntvfs)
350 if (!ntvfs->next || !ntvfs->next->ops->disconnect_fn) {
351 return NT_STATUS_NOT_IMPLEMENTED;
353 return ntvfs->next->ops->disconnect_fn(ntvfs->next);
356 /* async_setup - called when setting up for a async request */
357 NTSTATUS ntvfs_next_async_setup(struct ntvfs_module_context *ntvfs,
358 struct ntvfs_request *req,
359 void *private_data)
361 if (!ntvfs->next || !ntvfs->next->ops->async_setup_fn) {
362 return NT_STATUS_NOT_IMPLEMENTED;
364 return ntvfs->next->ops->async_setup_fn(ntvfs->next, req, private_data);
367 /* filesystem operations */
368 NTSTATUS ntvfs_next_fsinfo(struct ntvfs_module_context *ntvfs,
369 struct ntvfs_request *req,
370 union smb_fsinfo *fs)
372 if (!ntvfs->next || !ntvfs->next->ops->fsinfo_fn) {
373 return NT_STATUS_NOT_IMPLEMENTED;
375 return ntvfs->next->ops->fsinfo_fn(ntvfs->next, req, fs);
378 /* path operations */
379 NTSTATUS ntvfs_next_unlink(struct ntvfs_module_context *ntvfs,
380 struct ntvfs_request *req,
381 union smb_unlink *unl)
383 if (!ntvfs->next || !ntvfs->next->ops->unlink_fn) {
384 return NT_STATUS_NOT_IMPLEMENTED;
386 return ntvfs->next->ops->unlink_fn(ntvfs->next, req, unl);
389 NTSTATUS ntvfs_next_chkpath(struct ntvfs_module_context *ntvfs,
390 struct ntvfs_request *req,
391 union smb_chkpath *cp)
393 if (!ntvfs->next || !ntvfs->next->ops->chkpath_fn) {
394 return NT_STATUS_NOT_IMPLEMENTED;
396 return ntvfs->next->ops->chkpath_fn(ntvfs->next, req, cp);
399 NTSTATUS ntvfs_next_qpathinfo(struct ntvfs_module_context *ntvfs,
400 struct ntvfs_request *req,
401 union smb_fileinfo *st)
403 if (!ntvfs->next || !ntvfs->next->ops->qpathinfo_fn) {
404 return NT_STATUS_NOT_IMPLEMENTED;
406 return ntvfs->next->ops->qpathinfo_fn(ntvfs->next, req, st);
409 NTSTATUS ntvfs_next_setpathinfo(struct ntvfs_module_context *ntvfs,
410 struct ntvfs_request *req,
411 union smb_setfileinfo *st)
413 if (!ntvfs->next || !ntvfs->next->ops->setpathinfo_fn) {
414 return NT_STATUS_NOT_IMPLEMENTED;
416 return ntvfs->next->ops->setpathinfo_fn(ntvfs->next, req, st);
419 NTSTATUS ntvfs_next_mkdir(struct ntvfs_module_context *ntvfs,
420 struct ntvfs_request *req,
421 union smb_mkdir *md)
423 if (!ntvfs->next || !ntvfs->next->ops->mkdir_fn) {
424 return NT_STATUS_NOT_IMPLEMENTED;
426 return ntvfs->next->ops->mkdir_fn(ntvfs->next, req, md);
429 NTSTATUS ntvfs_next_rmdir(struct ntvfs_module_context *ntvfs,
430 struct ntvfs_request *req,
431 struct smb_rmdir *rd)
433 if (!ntvfs->next || !ntvfs->next->ops->rmdir_fn) {
434 return NT_STATUS_NOT_IMPLEMENTED;
436 return ntvfs->next->ops->rmdir_fn(ntvfs->next, req, rd);
439 NTSTATUS ntvfs_next_rename(struct ntvfs_module_context *ntvfs,
440 struct ntvfs_request *req,
441 union smb_rename *ren)
443 if (!ntvfs->next || !ntvfs->next->ops->rename_fn) {
444 return NT_STATUS_NOT_IMPLEMENTED;
446 return ntvfs->next->ops->rename_fn(ntvfs->next, req, ren);
449 NTSTATUS ntvfs_next_copy(struct ntvfs_module_context *ntvfs,
450 struct ntvfs_request *req,
451 struct smb_copy *cp)
453 if (!ntvfs->next || !ntvfs->next->ops->copy_fn) {
454 return NT_STATUS_NOT_IMPLEMENTED;
456 return ntvfs->next->ops->copy_fn(ntvfs->next, req, cp);
459 NTSTATUS ntvfs_next_open(struct ntvfs_module_context *ntvfs,
460 struct ntvfs_request *req,
461 union smb_open *oi)
463 if (!ntvfs->next || !ntvfs->next->ops->open_fn) {
464 return NT_STATUS_NOT_IMPLEMENTED;
466 return ntvfs->next->ops->open_fn(ntvfs->next, req, oi);
470 /* directory search */
471 NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs,
472 struct ntvfs_request *req,
473 union smb_search_first *io, void *private_data,
474 bool (*callback)(void *private_data, const union smb_search_data *file))
476 if (!ntvfs->next || !ntvfs->next->ops->search_first_fn) {
477 return NT_STATUS_NOT_IMPLEMENTED;
479 return ntvfs->next->ops->search_first_fn(ntvfs->next, req, io, private_data, callback);
482 NTSTATUS ntvfs_next_search_next(struct ntvfs_module_context *ntvfs,
483 struct ntvfs_request *req,
484 union smb_search_next *io, void *private_data,
485 bool (*callback)(void *private_data, const union smb_search_data *file))
487 if (!ntvfs->next || !ntvfs->next->ops->search_next_fn) {
488 return NT_STATUS_NOT_IMPLEMENTED;
490 return ntvfs->next->ops->search_next_fn(ntvfs->next, req, io, private_data, callback);
493 NTSTATUS ntvfs_next_search_close(struct ntvfs_module_context *ntvfs,
494 struct ntvfs_request *req,
495 union smb_search_close *io)
497 if (!ntvfs->next || !ntvfs->next->ops->search_close_fn) {
498 return NT_STATUS_NOT_IMPLEMENTED;
500 return ntvfs->next->ops->search_close_fn(ntvfs->next, req, io);
503 /* operations on open files */
504 NTSTATUS ntvfs_next_ioctl(struct ntvfs_module_context *ntvfs,
505 struct ntvfs_request *req,
506 union smb_ioctl *io)
508 if (!ntvfs->next || !ntvfs->next->ops->ioctl_fn) {
509 return NT_STATUS_NOT_IMPLEMENTED;
511 return ntvfs->next->ops->ioctl_fn(ntvfs->next, req, io);
514 NTSTATUS ntvfs_next_read(struct ntvfs_module_context *ntvfs,
515 struct ntvfs_request *req,
516 union smb_read *io)
518 if (!ntvfs->next || !ntvfs->next->ops->read_fn) {
519 return NT_STATUS_NOT_IMPLEMENTED;
521 return ntvfs->next->ops->read_fn(ntvfs->next, req, io);
524 NTSTATUS ntvfs_next_write(struct ntvfs_module_context *ntvfs,
525 struct ntvfs_request *req,
526 union smb_write *io)
528 if (!ntvfs->next || !ntvfs->next->ops->write_fn) {
529 return NT_STATUS_NOT_IMPLEMENTED;
531 return ntvfs->next->ops->write_fn(ntvfs->next, req, io);
534 NTSTATUS ntvfs_next_seek(struct ntvfs_module_context *ntvfs,
535 struct ntvfs_request *req,
536 union smb_seek *io)
538 if (!ntvfs->next || !ntvfs->next->ops->seek_fn) {
539 return NT_STATUS_NOT_IMPLEMENTED;
541 return ntvfs->next->ops->seek_fn(ntvfs->next, req, io);
544 NTSTATUS ntvfs_next_flush(struct ntvfs_module_context *ntvfs,
545 struct ntvfs_request *req,
546 union smb_flush *flush)
548 if (!ntvfs->next || !ntvfs->next->ops->flush_fn) {
549 return NT_STATUS_NOT_IMPLEMENTED;
551 return ntvfs->next->ops->flush_fn(ntvfs->next, req, flush);
554 NTSTATUS ntvfs_next_lock(struct ntvfs_module_context *ntvfs,
555 struct ntvfs_request *req,
556 union smb_lock *lck)
558 if (!ntvfs->next || !ntvfs->next->ops->lock_fn) {
559 return NT_STATUS_NOT_IMPLEMENTED;
561 return ntvfs->next->ops->lock_fn(ntvfs->next, req, lck);
564 NTSTATUS ntvfs_next_qfileinfo(struct ntvfs_module_context *ntvfs,
565 struct ntvfs_request *req,
566 union smb_fileinfo *info)
568 if (!ntvfs->next || !ntvfs->next->ops->qfileinfo_fn) {
569 return NT_STATUS_NOT_IMPLEMENTED;
571 return ntvfs->next->ops->qfileinfo_fn(ntvfs->next, req, info);
574 NTSTATUS ntvfs_next_setfileinfo(struct ntvfs_module_context *ntvfs,
575 struct ntvfs_request *req,
576 union smb_setfileinfo *info)
578 if (!ntvfs->next || !ntvfs->next->ops->setfileinfo_fn) {
579 return NT_STATUS_NOT_IMPLEMENTED;
581 return ntvfs->next->ops->setfileinfo_fn(ntvfs->next, req, info);
584 NTSTATUS ntvfs_next_close(struct ntvfs_module_context *ntvfs,
585 struct ntvfs_request *req,
586 union smb_close *io)
588 if (!ntvfs->next || !ntvfs->next->ops->close_fn) {
589 return NT_STATUS_NOT_IMPLEMENTED;
591 return ntvfs->next->ops->close_fn(ntvfs->next, req, io);
594 /* trans interface - used by IPC backend for pipes and RAP calls */
595 NTSTATUS ntvfs_next_trans(struct ntvfs_module_context *ntvfs,
596 struct ntvfs_request *req,
597 struct smb_trans2 *trans)
599 if (!ntvfs->next || !ntvfs->next->ops->trans_fn) {
600 return NT_STATUS_NOT_IMPLEMENTED;
602 return ntvfs->next->ops->trans_fn(ntvfs->next, req, trans);
605 /* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
606 NTSTATUS ntvfs_next_trans2(struct ntvfs_module_context *ntvfs,
607 struct ntvfs_request *req,
608 struct smb_trans2 *trans2)
610 if (!ntvfs->next || !ntvfs->next->ops->trans2_fn) {
611 return NT_STATUS_NOT_IMPLEMENTED;
613 return ntvfs->next->ops->trans2_fn(ntvfs->next, req, trans2);
617 change notify request
619 NTSTATUS ntvfs_next_notify(struct ntvfs_module_context *ntvfs,
620 struct ntvfs_request *req,
621 union smb_notify *info)
623 if (!ntvfs->next || !ntvfs->next->ops->notify_fn) {
624 return NT_STATUS_NOT_IMPLEMENTED;
626 return ntvfs->next->ops->notify_fn(ntvfs->next, req, info);
629 /* cancel - called to cancel an outstanding async request */
630 NTSTATUS ntvfs_next_cancel(struct ntvfs_module_context *ntvfs,
631 struct ntvfs_request *req)
633 if (!ntvfs->next || !ntvfs->next->ops->cancel_fn) {
634 return NT_STATUS_NOT_IMPLEMENTED;
636 return ntvfs->next->ops->cancel_fn(ntvfs->next, req);
639 /* printing specific operations */
640 NTSTATUS ntvfs_next_lpq(struct ntvfs_module_context *ntvfs,
641 struct ntvfs_request *req,
642 union smb_lpq *lpq)
644 if (!ntvfs->next || !ntvfs->next->ops->lpq_fn) {
645 return NT_STATUS_NOT_IMPLEMENTED;
647 return ntvfs->next->ops->lpq_fn(ntvfs->next, req, lpq);
651 /* logoff - called when a vuid is closed */
652 NTSTATUS ntvfs_next_logoff(struct ntvfs_module_context *ntvfs,
653 struct ntvfs_request *req)
655 if (!ntvfs->next || !ntvfs->next->ops->logoff_fn) {
656 return NT_STATUS_NOT_IMPLEMENTED;
658 return ntvfs->next->ops->logoff_fn(ntvfs->next, req);
661 NTSTATUS ntvfs_next_exit(struct ntvfs_module_context *ntvfs,
662 struct ntvfs_request *req)
664 if (!ntvfs->next || !ntvfs->next->ops->exit_fn) {
665 return NT_STATUS_NOT_IMPLEMENTED;
667 return ntvfs->next->ops->exit_fn(ntvfs->next, req);
670 /* client connection callback */
671 NTSTATUS ntvfs_set_addresses(struct ntvfs_context *ntvfs,
672 const struct tsocket_address *local_address,
673 const struct tsocket_address *remote_address)
675 ntvfs->client.local_address = tsocket_address_copy(local_address, ntvfs);
676 NT_STATUS_HAVE_NO_MEMORY(ntvfs->client.local_address);
678 ntvfs->client.remote_address = tsocket_address_copy(remote_address, ntvfs);
679 NT_STATUS_HAVE_NO_MEMORY(ntvfs->client.remote_address);
681 return NT_STATUS_OK;
684 const struct tsocket_address *ntvfs_get_local_address(struct ntvfs_module_context *ntvfs)
686 return ntvfs->ctx->client.local_address;
689 const struct tsocket_address *ntvfs_get_remote_address(struct ntvfs_module_context *ntvfs)
691 return ntvfs->ctx->client.remote_address;
694 /* oplock helpers */
695 NTSTATUS ntvfs_set_oplock_handler(struct ntvfs_context *ntvfs,
696 NTSTATUS (*handler)(void *private_data, struct ntvfs_handle *handle, uint8_t level),
697 void *private_data)
699 ntvfs->oplock.handler = handler;
700 ntvfs->oplock.private_data = private_data;
701 return NT_STATUS_OK;
704 NTSTATUS ntvfs_send_oplock_break(struct ntvfs_module_context *ntvfs,
705 struct ntvfs_handle *handle, uint8_t level)
707 if (!ntvfs->ctx->oplock.handler) {
708 return NT_STATUS_OK;
711 return ntvfs->ctx->oplock.handler(ntvfs->ctx->oplock.private_data, handle, level);