r12125: make the deferred connection termination the default,
[kai/samba.git] / source4 / smbd / service_stream.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    structures specific to stream servers
5
6    Copyright (C) Stefan (metze) Metzmacher      2004
7    Copyright (C) Andrew Tridgell                2005
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 /* modules can use the following to determine if the interface has changed
25  * please increment the version number after each interface change
26  * with a comment and maybe update struct stream_connection_critical_sizes.
27  */
28 /* version 0 - initial version - metze */
29 #define SERVER_SERVICE_VERSION 0
30
31 /*
32   top level context for an established stream connection
33 */
34 struct stream_connection {
35         const struct stream_server_ops *ops;
36         const struct model_ops *model_ops;
37         uint32_t server_id;
38         void *private;
39
40         struct {
41                 struct event_context *ctx;
42                 struct fd_event *fde;
43         } event;
44
45         struct socket_context *socket;
46         struct messaging_context *msg_ctx;
47
48         BOOL processing;
49         const char *terminate;
50 };
51
52
53 /* operations passed to the service_stream code */
54 struct stream_server_ops {
55         /* the name of the server_service */
56         const char *name;
57         void (*accept_connection)(struct stream_connection *);
58         void (*recv_handler)(struct stream_connection *, uint16_t);
59         void (*send_handler)(struct stream_connection *, uint16_t);
60 };