r3463: separated out some more headers (asn_1.h, messages.h, dlinklist.h and ioctl.h)
[kai/samba.git] / source4 / smbd / process_model.h
1 /* 
2    Unix SMB/CIFS implementation.
3    process model manager - main loop
4    Copyright (C) Andrew Tridgell 1992-2003
5    Copyright (C) James J Myers 2003 <myersjj@samba.org>
6    Copyright (C) Stefan (metze) Metzmacher 2004
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #ifndef SAMBA_PROCESS_MODEL_H
24 #define SAMBA_PROCESS_MODEL_H
25
26 /* modules can use the following to determine if the interface has changed
27  * please increment the version number after each interface change
28  * with a comment and maybe update struct process_model_critical_sizes.
29  */
30 /* version 1 - initial version - metze */
31 #define PROCESS_MODEL_VERSION 1
32
33 /* the process model operations structure - contains function pointers to 
34    the model-specific implementations of each operation */
35 struct model_ops {
36         /* the name of the process_model */
37         const char *name;
38
39         /* called at startup when the model is selected */
40         void (*model_startup)(void);
41
42         /* function to accept new connection */
43         void (*accept_connection)(struct event_context *, struct fd_event *, time_t, uint16_t);
44                         
45         /* function to terminate a connection */
46         void (*terminate_connection)(struct server_connection *srv_conn, const char *reason);
47
48         /* function to exit server */
49         void (*exit_server)(struct server_context *srv_ctx, const char *reason);
50
51         /* returns process or thread id */
52         int (*get_id)(struct smbsrv_request *req);
53 };
54
55 /* this structure is used by modules to determine the size of some critical types */
56 struct process_model_critical_sizes {
57         int interface_version;
58         int sizeof_model_ops;
59         int sizeof_server_context;
60         int sizeof_event_context;
61         int sizeof_fd_event;
62 };
63
64 #endif /* SAMBA_PROCESS_MODEL_H */