mirror of
https://github.com/samba-team/samba.git
synced 2025-11-06 08:23:50 +03:00
r2326: remove definition and usage of struct socket_context
metze
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
a06727b792
commit
1854907da8
@@ -51,7 +51,7 @@ struct async_info {
|
||||
static void idle_func(struct smbcli_transport *transport, void *p_private)
|
||||
{
|
||||
struct cvfs_private *private = p_private;
|
||||
if (socket_pending(private->tcon->smb_conn->connection->socket->fde->fd)) {
|
||||
if (socket_pending(private->tcon->smb_conn->connection->event.fde->fd)) {
|
||||
smbd_process_async(private->tcon->smb_conn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ void dcesrv_tcp_accept(struct server_connection *conn)
|
||||
* but the smb server can't handle it yet
|
||||
* --metze
|
||||
*/
|
||||
set_blocking(conn->socket->fde->fd, False);
|
||||
set_blocking(conn->event.fde->fd, False);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ void dcesrv_tcp_recv(struct server_connection *conn, time_t t, uint16_t flags)
|
||||
return;
|
||||
}
|
||||
|
||||
ret = read(conn->socket->fde->fd, blob.data, blob.length);
|
||||
ret = read(conn->event.fde->fd, blob.data, blob.length);
|
||||
if (ret == 0 || (ret == -1 && errno != EINTR)) {
|
||||
data_blob_free(&blob);
|
||||
dcesrv_terminate_connection(dce_conn, "eof on socket");
|
||||
@@ -176,7 +176,7 @@ void dcesrv_tcp_recv(struct server_connection *conn, time_t t, uint16_t flags)
|
||||
data_blob_free(&blob);
|
||||
|
||||
if (dce_conn->call_list && dce_conn->call_list->replies) {
|
||||
conn->socket->fde->flags |= EVENT_FD_WRITE;
|
||||
conn->event.fde->flags |= EVENT_FD_WRITE;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -189,13 +189,13 @@ void dcesrv_tcp_send(struct server_connection *conn, time_t t, uint16_t flags)
|
||||
|
||||
DEBUG(10,("dcesrv_tcp_send\n"));
|
||||
|
||||
status = dcesrv_output(dce_conn, conn->socket->fde, dcerpc_write_fn);
|
||||
status = dcesrv_output(dce_conn, conn->event.fde, dcerpc_write_fn);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
/* TODO: destroy fd_event? */
|
||||
}
|
||||
|
||||
if (!dce_conn->call_list || !dce_conn->call_list->replies) {
|
||||
conn->socket->fde->flags &= ~EVENT_FD_WRITE;
|
||||
conn->event.fde->flags &= ~EVENT_FD_WRITE;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -49,7 +49,7 @@ struct smbsrv_request *init_smb_request(struct smbsrv_connection *smb_conn)
|
||||
{
|
||||
struct smbsrv_request *req;
|
||||
|
||||
smb_conn->connection->socket->pkt_count++;
|
||||
smb_conn->socket.pkt_count++;
|
||||
|
||||
req = talloc_p(smb_conn, struct smbsrv_request);
|
||||
if (!req) {
|
||||
@@ -251,7 +251,7 @@ void req_send_reply_nosign(struct smbsrv_request *req)
|
||||
_smb_setlen(req->out.buffer, req->out.size - NBT_HDR_SIZE);
|
||||
}
|
||||
|
||||
if (write_data(req->smb_conn->connection->socket->fde->fd, req->out.buffer, req->out.size) != req->out.size) {
|
||||
if (write_data(req->smb_conn->connection->event.fde->fd, req->out.buffer, req->out.size) != req->out.size) {
|
||||
smbsrv_terminate_connection(req->smb_conn, "failed to send reply\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,8 @@ close a cnum
|
||||
void close_cnum(struct smbsrv_tcon *tcon)
|
||||
{
|
||||
DEBUG(3,("%s closed connection to service %s\n",
|
||||
tcon->smb_conn->connection->socket->client_addr, lp_servicename(SNUM(tcon))));
|
||||
get_socket_addr(tcon, tcon->smb_conn->connection->event.fde->fd),
|
||||
lp_servicename(SNUM(tcon))));
|
||||
|
||||
/* tell the ntvfs backend that we are disconnecting */
|
||||
tcon->ntvfs_ops->disconnect(tcon);
|
||||
|
||||
@@ -64,7 +64,7 @@ static struct smbsrv_request *receive_smb_request(struct smbsrv_connection *smb_
|
||||
char header[4];
|
||||
struct smbsrv_request *req;
|
||||
|
||||
len = read_data(smb_conn->connection->socket->fde->fd, header, 4);
|
||||
len = read_data(smb_conn->connection->event.fde->fd, header, 4);
|
||||
if (len != 4) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ static struct smbsrv_request *receive_smb_request(struct smbsrv_connection *smb_
|
||||
/* fill in the already received header */
|
||||
memcpy(req->in.buffer, header, 4);
|
||||
|
||||
len2 = read_data(smb_conn->connection->socket->fde->fd, req->in.buffer + NBT_HDR_SIZE, len);
|
||||
len2 = read_data(smb_conn->connection->event.fde->fd, req->in.buffer + NBT_HDR_SIZE, len);
|
||||
if (len2 != len) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -831,7 +831,7 @@ void smbsrv_accept(struct server_connection *conn)
|
||||
|
||||
/* set an initial client name based on its IP address. This will be replaced with
|
||||
the netbios name later if it gives us one */
|
||||
socket_addr = get_socket_addr(smb_conn, conn->socket->fde->fd);
|
||||
socket_addr = get_socket_addr(smb_conn, conn->event.fde->fd);
|
||||
sub_set_remote_machine(socket_addr);
|
||||
|
||||
/* now initialise a few default values associated with this smb socket */
|
||||
|
||||
@@ -210,17 +210,7 @@ struct server_connection *server_setup_connection(struct event_context *ev, stru
|
||||
srv_conn->service = server_socket->service;
|
||||
|
||||
/* TODO: we need a generic socket subsystem */
|
||||
srv_conn->socket = talloc_p(srv_conn->mem_ctx, struct socket_context);
|
||||
if (!srv_conn->socket) {
|
||||
DEBUG(0,("talloc_p(srv_conn->mem_ctx, struct socket_context) failed\n"));
|
||||
talloc_destroy(mem_ctx);
|
||||
return NULL;
|
||||
}
|
||||
srv_conn->socket->private_data = NULL;
|
||||
srv_conn->socket->ops = NULL;
|
||||
srv_conn->socket->client_addr = NULL;
|
||||
srv_conn->socket->pkt_count = 0;
|
||||
srv_conn->socket->fde = srv_conn->event.fde;
|
||||
srv_conn->socket = NULL;
|
||||
|
||||
/* create a smb server context and add it to out event
|
||||
handling */
|
||||
@@ -230,8 +220,6 @@ struct server_connection *server_setup_connection(struct event_context *ev, stru
|
||||
srv_conn->event.fde = event_add_fd(ev,&fde);
|
||||
srv_conn->event.idle = event_add_timed(ev,&idle);
|
||||
|
||||
srv_conn->socket->fde = srv_conn->event.fde;
|
||||
|
||||
return srv_conn;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,17 +63,7 @@ struct server_service_ops {
|
||||
void (*service_exit)(struct server_service *srv_ctx, const char *reason);
|
||||
};
|
||||
|
||||
struct socket_ops {
|
||||
int dummy;
|
||||
};
|
||||
|
||||
struct socket_context {
|
||||
void *private_data;
|
||||
struct socket_ops *ops;
|
||||
const char *client_addr;
|
||||
uint_t pkt_count;
|
||||
struct fd_event *fde;
|
||||
};
|
||||
struct socket_context;
|
||||
|
||||
struct server_socket {
|
||||
struct server_socket *next,*prev;
|
||||
|
||||
Reference in New Issue
Block a user