torture:smb2:replay: extend CHECK_CREATE_OUT() to know leases
[samba.git] / source4 / smbd / process_model.h
index f56635e62c136759958ed99a8fb927e73f383bde..4399d3689fbe16ec9edb58027ce7b3ce72789ab9 100644 (file)
@@ -1,12 +1,15 @@
 /* 
    Unix SMB/CIFS implementation.
-   process model manager - main loop
-   Copyright (C) Andrew Tridgell 1992-2003
+
+   process model manager - structures
+
+   Copyright (C) Andrew Tridgell 1992-2005
    Copyright (C) James J Myers 2003 <myersjj@samba.org>
+   Copyright (C) Stefan (metze) Metzmacher 2004-2005
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef SAMBA_PROCESS_MODEL_H
-#define SAMBA_PROCESS_MODEL_H
+#ifndef __PROCESS_MODEL_H__
+#define __PROCESS_MODEL_H__
+
+#include "lib/socket/socket.h"
+#include "smbd/service.h"
+#include "smbd/process_model_proto.h"
 
 /* modules can use the following to determine if the interface has changed
  * please increment the version number after each interface change
@@ -36,34 +42,45 @@ struct model_ops {
        const char *name;
 
        /* called at startup when the model is selected */
-       void (*model_startup)(void);
+       void (*model_init)(void);
 
        /* function to accept new connection */
-       void (*accept_connection)(struct event_context *, struct fd_event *, time_t, uint16_t);
+       void (*accept_connection)(struct tevent_context *, 
+                                 struct loadparm_context *,
+                                 struct socket_context *, 
+                                 void (*)(struct tevent_context *, 
+                                          struct loadparm_context *,
+                                          struct socket_context *, 
+                                          struct server_id , void *), 
+                                 void *);
 
-       /* function to accept new rpc over tcp connection */
-       void (*accept_rpc_connection)(struct event_context *, struct fd_event *, time_t, uint16_t);
-                               
-       /* function to terminate a connection */
-       void (*terminate_connection)(struct server_context *smb, const char *reason);
+       /* function to create a task */
+       void (*new_task)(struct tevent_context *, 
+                        struct loadparm_context *lp_ctx,
+                        const char *service_name,
+                        void (*)(struct tevent_context *, 
+                                 struct loadparm_context *, struct server_id, 
+                                 void *),
+                        void *);
 
-       /* function to terminate a connection */
-       void (*terminate_rpc_connection)(void *r, const char *reason);
-       
-       /* function to exit server */
-       void (*exit_server)(struct server_context *smb, const char *reason);
-       
-       /* returns process or thread id */
-       int (*get_id)(struct request_context *req);
+       /* function to terminate a connection or task */
+       void (*terminate)(struct tevent_context *, struct loadparm_context *lp_ctx,
+                         const char *reason);
+
+       /* function to set a title for the connection or task */
+       void (*set_title)(struct tevent_context *, const char *title);
 };
 
 /* this structure is used by modules to determine the size of some critical types */
 struct process_model_critical_sizes {
        int interface_version;
        int sizeof_model_ops;
-       int sizeof_server_context;
-       int sizeof_event_context;
-       int sizeof_fd_event;
 };
 
-#endif /* SAMBA_PROCESS_MODEL_H */
+extern const struct model_ops single_ops;
+
+const struct model_ops *process_model_startup(const char *model);
+NTSTATUS register_process_model(const struct model_ops *ops);
+NTSTATUS process_model_init(struct loadparm_context *lp_ctx);
+
+#endif /* __PROCESS_MODEL_H__ */