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);
}
}
* 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;
}
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");
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;
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;
{
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) {
_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");
}
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);
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;
}
/* 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;
}
/* 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 */
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 */
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;
}
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;