Calculate the timeout time once when the async is created.
[wine] / server / request.h
1 /*
2  * Wine server requests
3  *
4  * Copyright (C) 1999 Alexandre Julliard
5  */
6
7 #ifndef __WINE_SERVER_REQUEST_H
8 #define __WINE_SERVER_REQUEST_H
9
10 #ifndef __WINE_SERVER__
11 #error This file can only be used in the Wine server
12 #endif
13
14 #include "thread.h"
15
16 /* max request length */
17 #define MAX_REQUEST_LENGTH  8192
18
19 /* request handler definition */
20 #define DECL_HANDLER(name) void req_##name( struct name##_request *req )
21
22 /* request functions */
23
24 #ifdef __GNUC__
25 extern void fatal_protocol_error( struct thread *thread,
26                                   const char *err, ... ) __attribute__((format (printf,2,3)));
27 #else
28 extern void fatal_protocol_error( struct thread *thread, const char *err, ... );
29 #endif
30
31 extern void fatal_error( const char *err, ... ) WINE_NORETURN;
32 extern void fatal_perror( const char *err, ... ) WINE_NORETURN;
33 extern const char *get_config_dir(void);
34 extern void read_request( struct thread *thread );
35 extern int write_request( struct thread *thread );
36 extern int send_client_fd( struct thread *thread, int fd, handle_t handle );
37 extern void send_reply( struct thread *thread );
38 extern void open_master_socket(void);
39 extern void close_master_socket(void);
40 extern void lock_master_socket( int locked );
41 extern struct object *create_request_socket( struct thread *thread );
42
43 extern void trace_request( enum request req );
44 extern void trace_reply( struct thread *thread );
45
46 /* get the request buffer */
47 static inline void *get_req_ptr( struct thread *thread )
48 {
49     return thread->buffer;
50 }
51
52 /* get the request vararg data */
53 inline static void *get_req_data( const void *req )
54 {
55     return ((union generic_request *)req + 1);
56 }
57
58 /* get the request vararg size */
59 inline static size_t get_req_data_size( const void *req )
60 {
61     return ((struct request_header *)req)->var_size;
62 }
63
64 /* set the request vararg size */
65 inline static void set_req_data_size( const void *req, size_t size )
66 {
67     ((struct request_header *)req)->var_size = size;
68 }
69
70 /* Everything below this line is generated automatically by tools/make_requests */
71 /* ### make_requests begin ### */
72
73 DECL_HANDLER(new_process);
74 DECL_HANDLER(wait_process);
75 DECL_HANDLER(new_thread);
76 DECL_HANDLER(boot_done);
77 DECL_HANDLER(init_process);
78 DECL_HANDLER(init_process_done);
79 DECL_HANDLER(init_thread);
80 DECL_HANDLER(get_thread_buffer);
81 DECL_HANDLER(terminate_process);
82 DECL_HANDLER(terminate_thread);
83 DECL_HANDLER(get_process_info);
84 DECL_HANDLER(set_process_info);
85 DECL_HANDLER(get_thread_info);
86 DECL_HANDLER(set_thread_info);
87 DECL_HANDLER(suspend_thread);
88 DECL_HANDLER(resume_thread);
89 DECL_HANDLER(load_dll);
90 DECL_HANDLER(unload_dll);
91 DECL_HANDLER(queue_apc);
92 DECL_HANDLER(get_apc);
93 DECL_HANDLER(close_handle);
94 DECL_HANDLER(set_handle_info);
95 DECL_HANDLER(dup_handle);
96 DECL_HANDLER(open_process);
97 DECL_HANDLER(select);
98 DECL_HANDLER(create_event);
99 DECL_HANDLER(event_op);
100 DECL_HANDLER(open_event);
101 DECL_HANDLER(create_mutex);
102 DECL_HANDLER(release_mutex);
103 DECL_HANDLER(open_mutex);
104 DECL_HANDLER(create_semaphore);
105 DECL_HANDLER(release_semaphore);
106 DECL_HANDLER(open_semaphore);
107 DECL_HANDLER(create_file);
108 DECL_HANDLER(alloc_file_handle);
109 DECL_HANDLER(get_handle_fd);
110 DECL_HANDLER(set_file_pointer);
111 DECL_HANDLER(truncate_file);
112 DECL_HANDLER(set_file_time);
113 DECL_HANDLER(flush_file);
114 DECL_HANDLER(get_file_info);
115 DECL_HANDLER(lock_file);
116 DECL_HANDLER(unlock_file);
117 DECL_HANDLER(create_pipe);
118 DECL_HANDLER(create_socket);
119 DECL_HANDLER(accept_socket);
120 DECL_HANDLER(set_socket_event);
121 DECL_HANDLER(get_socket_event);
122 DECL_HANDLER(enable_socket_event);
123 DECL_HANDLER(alloc_console);
124 DECL_HANDLER(free_console);
125 DECL_HANDLER(open_console);
126 DECL_HANDLER(set_console_fd);
127 DECL_HANDLER(get_console_mode);
128 DECL_HANDLER(set_console_mode);
129 DECL_HANDLER(set_console_info);
130 DECL_HANDLER(get_console_info);
131 DECL_HANDLER(write_console_input);
132 DECL_HANDLER(read_console_input);
133 DECL_HANDLER(create_change_notification);
134 DECL_HANDLER(create_mapping);
135 DECL_HANDLER(open_mapping);
136 DECL_HANDLER(get_mapping_info);
137 DECL_HANDLER(create_device);
138 DECL_HANDLER(create_snapshot);
139 DECL_HANDLER(next_process);
140 DECL_HANDLER(next_thread);
141 DECL_HANDLER(next_module);
142 DECL_HANDLER(wait_debug_event);
143 DECL_HANDLER(exception_event);
144 DECL_HANDLER(output_debug_string);
145 DECL_HANDLER(continue_debug_event);
146 DECL_HANDLER(debug_process);
147 DECL_HANDLER(read_process_memory);
148 DECL_HANDLER(write_process_memory);
149 DECL_HANDLER(create_key);
150 DECL_HANDLER(open_key);
151 DECL_HANDLER(delete_key);
152 DECL_HANDLER(enum_key);
153 DECL_HANDLER(set_key_value);
154 DECL_HANDLER(get_key_value);
155 DECL_HANDLER(enum_key_value);
156 DECL_HANDLER(delete_key_value);
157 DECL_HANDLER(load_registry);
158 DECL_HANDLER(save_registry);
159 DECL_HANDLER(save_registry_atexit);
160 DECL_HANDLER(set_registry_levels);
161 DECL_HANDLER(create_timer);
162 DECL_HANDLER(open_timer);
163 DECL_HANDLER(set_timer);
164 DECL_HANDLER(cancel_timer);
165 DECL_HANDLER(get_thread_context);
166 DECL_HANDLER(set_thread_context);
167 DECL_HANDLER(get_selector_entry);
168 DECL_HANDLER(add_atom);
169 DECL_HANDLER(delete_atom);
170 DECL_HANDLER(find_atom);
171 DECL_HANDLER(get_atom_name);
172 DECL_HANDLER(init_atom_table);
173 DECL_HANDLER(get_msg_queue);
174 DECL_HANDLER(wake_queue);
175 DECL_HANDLER(wait_input_idle);
176 DECL_HANDLER(create_serial);
177 DECL_HANDLER(get_serial_info);
178 DECL_HANDLER(set_serial_info);
179 DECL_HANDLER(create_async);
180 DECL_HANDLER(async_result);
181
182 #ifdef WANT_REQUEST_HANDLERS
183
184 typedef void (*req_handler)( void *req );
185 static const req_handler req_handlers[REQ_NB_REQUESTS] =
186 {
187     (req_handler)req_new_process,
188     (req_handler)req_wait_process,
189     (req_handler)req_new_thread,
190     (req_handler)req_boot_done,
191     (req_handler)req_init_process,
192     (req_handler)req_init_process_done,
193     (req_handler)req_init_thread,
194     (req_handler)req_get_thread_buffer,
195     (req_handler)req_terminate_process,
196     (req_handler)req_terminate_thread,
197     (req_handler)req_get_process_info,
198     (req_handler)req_set_process_info,
199     (req_handler)req_get_thread_info,
200     (req_handler)req_set_thread_info,
201     (req_handler)req_suspend_thread,
202     (req_handler)req_resume_thread,
203     (req_handler)req_load_dll,
204     (req_handler)req_unload_dll,
205     (req_handler)req_queue_apc,
206     (req_handler)req_get_apc,
207     (req_handler)req_close_handle,
208     (req_handler)req_set_handle_info,
209     (req_handler)req_dup_handle,
210     (req_handler)req_open_process,
211     (req_handler)req_select,
212     (req_handler)req_create_event,
213     (req_handler)req_event_op,
214     (req_handler)req_open_event,
215     (req_handler)req_create_mutex,
216     (req_handler)req_release_mutex,
217     (req_handler)req_open_mutex,
218     (req_handler)req_create_semaphore,
219     (req_handler)req_release_semaphore,
220     (req_handler)req_open_semaphore,
221     (req_handler)req_create_file,
222     (req_handler)req_alloc_file_handle,
223     (req_handler)req_get_handle_fd,
224     (req_handler)req_set_file_pointer,
225     (req_handler)req_truncate_file,
226     (req_handler)req_set_file_time,
227     (req_handler)req_flush_file,
228     (req_handler)req_get_file_info,
229     (req_handler)req_lock_file,
230     (req_handler)req_unlock_file,
231     (req_handler)req_create_pipe,
232     (req_handler)req_create_socket,
233     (req_handler)req_accept_socket,
234     (req_handler)req_set_socket_event,
235     (req_handler)req_get_socket_event,
236     (req_handler)req_enable_socket_event,
237     (req_handler)req_alloc_console,
238     (req_handler)req_free_console,
239     (req_handler)req_open_console,
240     (req_handler)req_set_console_fd,
241     (req_handler)req_get_console_mode,
242     (req_handler)req_set_console_mode,
243     (req_handler)req_set_console_info,
244     (req_handler)req_get_console_info,
245     (req_handler)req_write_console_input,
246     (req_handler)req_read_console_input,
247     (req_handler)req_create_change_notification,
248     (req_handler)req_create_mapping,
249     (req_handler)req_open_mapping,
250     (req_handler)req_get_mapping_info,
251     (req_handler)req_create_device,
252     (req_handler)req_create_snapshot,
253     (req_handler)req_next_process,
254     (req_handler)req_next_thread,
255     (req_handler)req_next_module,
256     (req_handler)req_wait_debug_event,
257     (req_handler)req_exception_event,
258     (req_handler)req_output_debug_string,
259     (req_handler)req_continue_debug_event,
260     (req_handler)req_debug_process,
261     (req_handler)req_read_process_memory,
262     (req_handler)req_write_process_memory,
263     (req_handler)req_create_key,
264     (req_handler)req_open_key,
265     (req_handler)req_delete_key,
266     (req_handler)req_enum_key,
267     (req_handler)req_set_key_value,
268     (req_handler)req_get_key_value,
269     (req_handler)req_enum_key_value,
270     (req_handler)req_delete_key_value,
271     (req_handler)req_load_registry,
272     (req_handler)req_save_registry,
273     (req_handler)req_save_registry_atexit,
274     (req_handler)req_set_registry_levels,
275     (req_handler)req_create_timer,
276     (req_handler)req_open_timer,
277     (req_handler)req_set_timer,
278     (req_handler)req_cancel_timer,
279     (req_handler)req_get_thread_context,
280     (req_handler)req_set_thread_context,
281     (req_handler)req_get_selector_entry,
282     (req_handler)req_add_atom,
283     (req_handler)req_delete_atom,
284     (req_handler)req_find_atom,
285     (req_handler)req_get_atom_name,
286     (req_handler)req_init_atom_table,
287     (req_handler)req_get_msg_queue,
288     (req_handler)req_wake_queue,
289     (req_handler)req_wait_input_idle,
290     (req_handler)req_create_serial,
291     (req_handler)req_get_serial_info,
292     (req_handler)req_set_serial_info,
293     (req_handler)req_create_async,
294     (req_handler)req_async_result,
295 };
296 #endif  /* WANT_REQUEST_HANDLERS */
297
298 /* ### make_requests end ### */
299 /* Everything above this line is generated automatically by tools/make_requests */
300
301 #endif  /* __WINE_SERVER_REQUEST_H */