| 1 | /* 
 | 
|---|
| 2 |    Unix SMB/CIFS implementation.
 | 
|---|
| 3 | 
 | 
|---|
| 4 |    process model manager - structures
 | 
|---|
| 5 | 
 | 
|---|
| 6 |    Copyright (C) Andrew Tridgell 1992-2005
 | 
|---|
| 7 |    Copyright (C) James J Myers 2003 <myersjj@samba.org>
 | 
|---|
| 8 |    Copyright (C) Stefan (metze) Metzmacher 2004-2005
 | 
|---|
| 9 |    
 | 
|---|
| 10 |    This program is free software; you can redistribute it and/or modify
 | 
|---|
| 11 |    it under the terms of the GNU General Public License as published by
 | 
|---|
| 12 |    the Free Software Foundation; either version 3 of the License, or
 | 
|---|
| 13 |    (at your option) any later version.
 | 
|---|
| 14 |    
 | 
|---|
| 15 |    This program is distributed in the hope that it will be useful,
 | 
|---|
| 16 |    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 17 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 18 |    GNU General Public License for more details.
 | 
|---|
| 19 |    
 | 
|---|
| 20 |    You should have received a copy of the GNU General Public License
 | 
|---|
| 21 |    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
|---|
| 22 | */
 | 
|---|
| 23 | 
 | 
|---|
| 24 | #ifndef __PROCESS_MODEL_H__
 | 
|---|
| 25 | #define __PROCESS_MODEL_H__
 | 
|---|
| 26 | 
 | 
|---|
| 27 | #include "lib/socket/socket.h"
 | 
|---|
| 28 | #include "smbd/service.h"
 | 
|---|
| 29 | 
 | 
|---|
| 30 | /* modules can use the following to determine if the interface has changed
 | 
|---|
| 31 |  * please increment the version number after each interface change
 | 
|---|
| 32 |  * with a comment and maybe update struct process_model_critical_sizes.
 | 
|---|
| 33 |  */
 | 
|---|
| 34 | /* version 1 - initial version - metze */
 | 
|---|
| 35 | #define PROCESS_MODEL_VERSION 1
 | 
|---|
| 36 | 
 | 
|---|
| 37 | /* the process model operations structure - contains function pointers to 
 | 
|---|
| 38 |    the model-specific implementations of each operation */
 | 
|---|
| 39 | struct model_ops {
 | 
|---|
| 40 |         /* the name of the process_model */
 | 
|---|
| 41 |         const char *name;
 | 
|---|
| 42 | 
 | 
|---|
| 43 |         /* called at startup when the model is selected */
 | 
|---|
| 44 |         void (*model_init)(struct tevent_context *);
 | 
|---|
| 45 | 
 | 
|---|
| 46 |         /* function to accept new connection */
 | 
|---|
| 47 |         void (*accept_connection)(struct tevent_context *, 
 | 
|---|
| 48 |                                   struct loadparm_context *,
 | 
|---|
| 49 |                                   struct socket_context *, 
 | 
|---|
| 50 |                                   void (*)(struct tevent_context *, 
 | 
|---|
| 51 |                                            struct loadparm_context *,
 | 
|---|
| 52 |                                            struct socket_context *, 
 | 
|---|
| 53 |                                            struct server_id , void *), 
 | 
|---|
| 54 |                                   void *);
 | 
|---|
| 55 | 
 | 
|---|
| 56 |         /* function to create a task */
 | 
|---|
| 57 |         void (*new_task)(struct tevent_context *, 
 | 
|---|
| 58 |                          struct loadparm_context *lp_ctx, 
 | 
|---|
| 59 |                          const char *service_name,
 | 
|---|
| 60 |                          void (*)(struct tevent_context *, 
 | 
|---|
| 61 |                                   struct loadparm_context *, struct server_id, 
 | 
|---|
| 62 |                                   void *),
 | 
|---|
| 63 |                          void *);
 | 
|---|
| 64 | 
 | 
|---|
| 65 |         /* function to terminate a connection or task */
 | 
|---|
| 66 |         void (*terminate)(struct tevent_context *, struct loadparm_context *lp_ctx, 
 | 
|---|
| 67 |                           const char *reason);
 | 
|---|
| 68 | 
 | 
|---|
| 69 |         /* function to set a title for the connection or task */
 | 
|---|
| 70 |         void (*set_title)(struct tevent_context *, const char *title);
 | 
|---|
| 71 | };
 | 
|---|
| 72 | 
 | 
|---|
| 73 | /* this structure is used by modules to determine the size of some critical types */
 | 
|---|
| 74 | struct process_model_critical_sizes {
 | 
|---|
| 75 |         int interface_version;
 | 
|---|
| 76 |         int sizeof_model_ops;
 | 
|---|
| 77 | };
 | 
|---|
| 78 | 
 | 
|---|
| 79 | extern const struct model_ops single_ops;
 | 
|---|
| 80 | 
 | 
|---|
| 81 | const struct model_ops *process_model_startup(struct tevent_context *ev, const char *model);
 | 
|---|
| 82 | NTSTATUS register_process_model(const void *_ops);
 | 
|---|
| 83 | NTSTATUS process_model_init(struct loadparm_context *lp_ctx);
 | 
|---|
| 84 | 
 | 
|---|
| 85 | #endif /* __PROCESS_MODEL_H__ */
 | 
|---|