diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-10-06 14:44:37 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:39:29 -0500 |
commit | f7cd569828c87a2c4f07b8629878c367b63acf71 (patch) | |
tree | 09e22929c98f6416dfd9d9f0c8d00faf2460b978 /source4/smbd | |
parent | 6799fde75d1ccf93171874fd33f9e89e4472fd81 (diff) | |
download | samba-f7cd569828c87a2c4f07b8629878c367b63acf71.tar.gz samba-f7cd569828c87a2c4f07b8629878c367b63acf71.tar.bz2 samba-f7cd569828c87a2c4f07b8629878c367b63acf71.zip |
r10768: add a function to create a stream_connection from an already
existing socket connection, that's used for protocols
which switch the client/server roles inside a session
metze
(This used to be commit d4b4d963353e6986da5b42680739329069f5affe)
Diffstat (limited to 'source4/smbd')
-rw-r--r-- | source4/smbd/service_stream.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index 1ed8b4d8af..6f78643dae 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -78,6 +78,39 @@ static void stream_io_handler(struct event_context *ev, struct fd_event *fde, } } +/* + this creates a stream_connection from an already existing connection, + used for protocols, where a client connection needs to switched into + a server connection +*/ +NTSTATUS stream_new_connection_merge(struct event_context *ev, + const struct model_ops *model_ops, + struct socket_context *sock, + const struct stream_server_ops *stream_ops, + struct messaging_context *msg_ctx, + void *private_data, + struct stream_connection **_srv_conn) +{ + struct stream_connection *srv_conn; + + srv_conn = talloc_zero(ev, struct stream_connection); + NT_STATUS_HAVE_NO_MEMORY(srv_conn); + + talloc_steal(srv_conn, sock); + + srv_conn->private = private_data; + srv_conn->model_ops = model_ops; + srv_conn->socket = sock; + srv_conn->server_id = 0; + srv_conn->ops = stream_ops; + srv_conn->msg_ctx = msg_ctx; + srv_conn->event.ctx = ev; + srv_conn->event.fde = event_add_fd(ev, srv_conn, socket_get_fd(sock), + EVENT_FD_READ, + stream_io_handler, srv_conn); + *_srv_conn = srv_conn; + return NT_STATUS_OK; +} /* called when a new socket connection has been established. This is called in the process |