s4:rpc_server Add a 'if_version' parameter to the bind operation.
[abartlet/samba.git/.git] / source4 / rpc_server / dcerpc_server.h
index 59a4bab083e2d599f14ade1e1a1b101e0c541743..0628730f263af70057708475511a74804e29a406 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef SAMBA_DCERPC_SERVER_H
 #define SAMBA_DCERPC_SERVER_H
 
-#include "librpc/gen_ndr/security.h"
+#include "librpc/gen_ndr/server_id.h"
 #include "librpc/rpc/dcerpc.h"
 #include "librpc/ndr/libndr.h"
 
@@ -44,7 +44,7 @@ struct dcesrv_interface {
        struct ndr_syntax_id syntax_id;
 
        /* this function is called when the client binds to this interface  */
-       NTSTATUS (*bind)(struct dcesrv_call_state *, const struct dcesrv_interface *);
+       NTSTATUS (*bind)(struct dcesrv_call_state *, const struct dcesrv_interface *, uint32_t if_version);
 
        /* this function is called when the client disconnects the endpoint */
        void (*unbind)(struct dcesrv_connection_context *, const struct dcesrv_interface *);
@@ -66,7 +66,7 @@ struct dcesrv_interface {
        NTSTATUS (*ndr_push)(struct dcesrv_call_state *, TALLOC_CTX *, struct ndr_push *, const void *);
 
        /* for any private use by the interface code */
-       const void *private;
+       const void *private_data;
 };
 
 enum dcesrv_call_list {
@@ -108,7 +108,7 @@ struct dcesrv_call_state {
        struct timeval time;
 
        /* the backend can use this event context for async replies */
-       struct event_context *event_ctx;
+       struct tevent_context *event_ctx;
 
        /* the message_context that will be used for async replies */
        struct messaging_context *msg_ctx;
@@ -136,8 +136,10 @@ struct dcesrv_call_state {
 /* a dcerpc handle in internal format */
 struct dcesrv_handle {
        struct dcesrv_handle *next, *prev;
-       struct dcesrv_connection_context *context;
+       struct dcesrv_assoc_group *assoc_group;
        struct policy_handle wire_handle;
+       struct dom_sid *sid;
+       const struct dcesrv_interface *iface;
        void *data;
 };
 
@@ -153,6 +155,8 @@ struct dcesrv_connection_context {
        struct dcesrv_connection_context *next, *prev;
        uint32_t context_id;
 
+       struct dcesrv_assoc_group *assoc_group;
+
        /* the connection this is on */
        struct dcesrv_connection *conn;
 
@@ -160,11 +164,7 @@ struct dcesrv_connection_context {
        const struct dcesrv_interface *iface;
 
        /* private data for the interface implementation */
-       void *private;
-
-       /* current rpc handles - this is really the wrong scope for
-          them, but it will do for now */
-       struct dcesrv_handle *handles;
+       void *private_data;
 };
 
 
@@ -197,7 +197,7 @@ struct dcesrv_connection {
        struct dcesrv_auth auth_state;
 
        /* the event_context that will be used for this connection */
-       struct event_context *event_ctx;
+       struct tevent_context *event_ctx;
 
        /* the message_context that will be used for this connection */
        struct messaging_context *msg_ctx;
@@ -210,6 +210,8 @@ struct dcesrv_connection {
 
        bool processing;
 
+       const char *packet_log_dir;
+
        /* this is the default state_flags for dcesrv_call_state structs */
        uint32_t state_flags;
 
@@ -219,6 +221,9 @@ struct dcesrv_connection {
                struct socket_address *(*get_my_addr)(struct dcesrv_connection *, TALLOC_CTX *mem_ctx);
                struct socket_address *(*get_peer_addr)(struct dcesrv_connection *, TALLOC_CTX *mem_ctx);
        } transport;
+
+       struct tstream_context *stream;
+       struct tevent_queue *send_queue;
 };
 
 
@@ -245,6 +250,21 @@ struct dcesrv_endpoint_server {
 };
 
 
+/* one association groups */
+struct dcesrv_assoc_group {
+       /* the wire id */
+       uint32_t id;
+       
+       /* list of handles in this association group */
+       struct dcesrv_handle *handles;
+
+       /* parent context */
+       struct dcesrv_context *dce_ctx;
+
+       /* Remote association group ID (if proxied) */
+       uint32_t proxied_id;
+};
+
 /* server-wide context information for the dcerpc server */
 struct dcesrv_context {
        /* the list of endpoints that have registered 
@@ -265,6 +285,8 @@ struct dcesrv_context {
 
        /* loadparm context to use for this connection */
        struct loadparm_context *lp_ctx;
+
+       struct idr_context *assoc_groups_idr;
 };
 
 /* this structure is used by modules to determine the size of some critical types */
@@ -291,26 +313,11 @@ NTSTATUS dcerpc_register_ep_server(const void *_ep_server);
 NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx, 
                                      struct loadparm_context *lp_ctx,
                                      const char **endpoint_servers, struct dcesrv_context **_dce_ctx);
-NTSTATUS dcesrv_init_ipc_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
-                                         struct dcesrv_context **_dce_ctx);
-NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx,
-                                       TALLOC_CTX *mem_ctx,
-                                       const struct dcerpc_binding *ep_description,
-                                       struct auth_session_info *session_info,
-                                       struct event_context *event_ctx,
-                                       struct messaging_context *msg_ctx,
-                                       struct server_id server_id,
-                                       uint32_t state_flags,
-                                       struct dcesrv_connection **dce_conn_p);
-NTSTATUS dcesrv_output(struct dcesrv_connection *dce_conn, 
-                      void *private_data,
-                      NTSTATUS (*write_fn)(void *private_data, DATA_BLOB *output, size_t *nwritten));
-NTSTATUS dcesrv_input(struct dcesrv_connection *dce_conn, const DATA_BLOB *data);
 NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx,
                                 TALLOC_CTX *mem_ctx,
                                 const struct dcesrv_endpoint *ep,
                                 struct auth_session_info *session_info,
-                                struct event_context *event_ctx,
+                                struct tevent_context *event_ctx,
                                 struct messaging_context *msg_ctx,
                                 struct server_id server_id,
                                 uint32_t state_flags,