r1277: rename struct server_context to smbsrv_ontext
[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    
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 #ifndef SAMBA_PROCESS_MODEL_H
23 #define SAMBA_PROCESS_MODEL_H
24
25 /* modules can use the following to determine if the interface has changed
26  * please increment the version number after each interface change
27  * with a comment and maybe update struct process_model_critical_sizes.
28  */
29 /* version 1 - initial version - metze */
30 #define PROCESS_MODEL_VERSION 1
31
32 /* the process model operations structure - contains function pointers to 
33    the model-specific implementations of each operation */
34 struct model_ops {
35         /* the name of the process_model */
36         const char *name;
37
38         /* called at startup when the model is selected */
39         void (*model_startup)(void);
40
41         /* function to accept new connection */
42         void (*accept_connection)(struct event_context *, struct fd_event *, time_t, uint16_t);
43
44         /* function to accept new rpc over tcp connection */
45         void (*accept_rpc_connection)(struct event_context *, struct fd_event *, time_t, uint16_t);
46                                 
47         /* function to terminate a connection */
48         void (*terminate_connection)(struct smbsrv_context *smb, const char *reason);
49
50         /* function to terminate a connection */
51         void (*terminate_rpc_connection)(void *r, const char *reason);
52         
53         /* function to exit server */
54         void (*exit_server)(struct smbsrv_context *smb, const char *reason);
55         
56         /* returns process or thread id */
57         int (*get_id)(struct request_context *req);
58 };
59
60 /* this structure is used by modules to determine the size of some critical types */
61 struct process_model_critical_sizes {
62         int interface_version;
63         int sizeof_model_ops;
64         int sizeof_server_context;
65         int sizeof_event_context;
66         int sizeof_fd_event;
67 };
68
69 #endif /* SAMBA_PROCESS_MODEL_H */