2 Unix SMB/CIFS implementation.
6 Copyright (C) Stefan (metze) Metzmacher 2004
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef _SERVER_SERVICE_H
24 #define _SERVER_SERVICE_H
28 struct server_context;
30 struct server_connection;
31 struct server_service;
33 /* modules can use the following to determine if the interface has changed
34 * please increment the version number after each interface change
35 * with a comment and maybe update struct process_model_critical_sizes.
37 /* version 1 - initial version - metze */
38 #define SERVER_SERVICE_VERSION 1
40 struct server_service_ops {
41 /* the name of the server_service */
44 /* called at startup when the server_service is selected */
45 void (*service_init)(struct server_service *service, const struct model_ops *ops);
47 /* function to accept new connection */
48 void (*accept_connection)(struct server_connection *);
50 void (*recv_handler)(struct server_connection *, struct timeval, uint16_t);
52 void (*send_handler)(struct server_connection *, struct timeval, uint16_t);
54 /* function to be called when the server is idle */
55 void (*idle_handler)(struct server_connection *, struct timeval);
57 /* function to close a connection */
58 void (*close_connection)(struct server_connection *, const char *reason);
60 /* function to exit server */
61 void (*service_exit)(struct server_service *srv_ctx, const char *reason);
64 struct socket_context;
66 struct server_socket {
67 struct server_socket *next,*prev;
71 struct event_context *ctx;
75 struct socket_context *socket;
77 struct server_service *service;
79 struct server_connection *connection_list;
82 struct server_service {
83 struct server_service *next,*prev;
85 const struct server_service_ops *ops;
87 const struct model_ops *model_ops;
89 struct server_socket *socket_list;
91 struct server_context *srv_ctx;
94 /* the concept of whether two operations are on the same server
95 connection or different connections is an important one in SMB, especially
96 for locking and share modes. We will use a servid_t to distinguish different
99 this means that (for example) a unique open file is distinguished by the triple
105 typedef uint32_t servid_t;
107 struct server_connection {
108 struct server_connection *next,*prev;
112 struct event_context *ctx;
113 struct fd_event *fde;
114 struct timed_event *idle;
115 struct timeval idle_time;
120 struct socket_context *socket;
122 struct server_socket *server_socket;
124 struct server_service *service;
126 struct messaging_context *messaging_ctx;
129 #endif /* _SERVER_SERVICE_H */