Fixed ANSI C related compile problems.
[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 read_request( struct thread *thread );
32 extern int write_request( struct thread *thread );
33 extern void set_reply_fd( struct thread *thread, int pass_fd );
34 extern void send_reply( struct thread *thread );
35 extern void open_master_socket(void);
36 extern void close_master_socket(void);
37 extern void lock_master_socket( int locked );
38
39 extern void trace_request( enum request req );
40 extern void trace_reply( struct thread *thread );
41
42 /* get the request buffer */
43 static inline void *get_req_ptr( struct thread *thread )
44 {
45     return thread->buffer;
46 }
47
48 /* get the remaining size in the request buffer for object of a given size */
49 static inline int get_req_size( const void *ptr, size_t typesize )
50 {
51     return ((char *)current->buffer + MAX_REQUEST_LENGTH - (char *)ptr) / typesize;
52 }
53
54 /* get the length of a request string, without going past the end of the request */
55 static inline size_t get_req_strlen( const char *str )
56 {
57     const char *p = str;
58     while (*p && (p < (char *)current->buffer + MAX_REQUEST_LENGTH - 1)) p++;
59     return p - str;
60 }
61
62 /* same as above for Unicode */
63 static inline size_t get_req_strlenW( const WCHAR *str )
64 {
65     const WCHAR *p = str;
66     while (*p && ((char *)p < (char *)current->buffer + MAX_REQUEST_LENGTH - 2)) p++;
67     return p - str;
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(new_thread);
75 DECL_HANDLER(boot_done);
76 DECL_HANDLER(init_process);
77 DECL_HANDLER(init_process_done);
78 DECL_HANDLER(init_thread);
79 DECL_HANDLER(get_thread_buffer);
80 DECL_HANDLER(terminate_process);
81 DECL_HANDLER(terminate_thread);
82 DECL_HANDLER(get_process_info);
83 DECL_HANDLER(set_process_info);
84 DECL_HANDLER(get_thread_info);
85 DECL_HANDLER(set_thread_info);
86 DECL_HANDLER(suspend_thread);
87 DECL_HANDLER(resume_thread);
88 DECL_HANDLER(load_dll);
89 DECL_HANDLER(unload_dll);
90 DECL_HANDLER(queue_apc);
91 DECL_HANDLER(get_apcs);
92 DECL_HANDLER(close_handle);
93 DECL_HANDLER(get_handle_info);
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_read_fd);
110 DECL_HANDLER(get_write_fd);
111 DECL_HANDLER(set_file_pointer);
112 DECL_HANDLER(truncate_file);
113 DECL_HANDLER(set_file_time);
114 DECL_HANDLER(flush_file);
115 DECL_HANDLER(get_file_info);
116 DECL_HANDLER(lock_file);
117 DECL_HANDLER(unlock_file);
118 DECL_HANDLER(create_pipe);
119 DECL_HANDLER(create_socket);
120 DECL_HANDLER(accept_socket);
121 DECL_HANDLER(set_socket_event);
122 DECL_HANDLER(get_socket_event);
123 DECL_HANDLER(enable_socket_event);
124 DECL_HANDLER(alloc_console);
125 DECL_HANDLER(free_console);
126 DECL_HANDLER(open_console);
127 DECL_HANDLER(set_console_fd);
128 DECL_HANDLER(get_console_mode);
129 DECL_HANDLER(set_console_mode);
130 DECL_HANDLER(set_console_info);
131 DECL_HANDLER(get_console_info);
132 DECL_HANDLER(write_console_input);
133 DECL_HANDLER(read_console_input);
134 DECL_HANDLER(create_change_notification);
135 DECL_HANDLER(create_mapping);
136 DECL_HANDLER(open_mapping);
137 DECL_HANDLER(get_mapping_info);
138 DECL_HANDLER(create_device);
139 DECL_HANDLER(create_snapshot);
140 DECL_HANDLER(next_process);
141 DECL_HANDLER(wait_debug_event);
142 DECL_HANDLER(exception_event);
143 DECL_HANDLER(output_debug_string);
144 DECL_HANDLER(continue_debug_event);
145 DECL_HANDLER(debug_process);
146 DECL_HANDLER(read_process_memory);
147 DECL_HANDLER(write_process_memory);
148 DECL_HANDLER(create_key);
149 DECL_HANDLER(open_key);
150 DECL_HANDLER(delete_key);
151 DECL_HANDLER(close_key);
152 DECL_HANDLER(enum_key);
153 DECL_HANDLER(query_key_info);
154 DECL_HANDLER(set_key_value);
155 DECL_HANDLER(get_key_value);
156 DECL_HANDLER(enum_key_value);
157 DECL_HANDLER(delete_key_value);
158 DECL_HANDLER(load_registry);
159 DECL_HANDLER(save_registry);
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
173 #ifdef WANT_REQUEST_HANDLERS
174
175 typedef void (*req_handler)( void *req );
176 static const req_handler req_handlers[REQ_NB_REQUESTS] =
177 {
178     (req_handler)req_new_process,
179     (req_handler)req_new_thread,
180     (req_handler)req_boot_done,
181     (req_handler)req_init_process,
182     (req_handler)req_init_process_done,
183     (req_handler)req_init_thread,
184     (req_handler)req_get_thread_buffer,
185     (req_handler)req_terminate_process,
186     (req_handler)req_terminate_thread,
187     (req_handler)req_get_process_info,
188     (req_handler)req_set_process_info,
189     (req_handler)req_get_thread_info,
190     (req_handler)req_set_thread_info,
191     (req_handler)req_suspend_thread,
192     (req_handler)req_resume_thread,
193     (req_handler)req_load_dll,
194     (req_handler)req_unload_dll,
195     (req_handler)req_queue_apc,
196     (req_handler)req_get_apcs,
197     (req_handler)req_close_handle,
198     (req_handler)req_get_handle_info,
199     (req_handler)req_set_handle_info,
200     (req_handler)req_dup_handle,
201     (req_handler)req_open_process,
202     (req_handler)req_select,
203     (req_handler)req_create_event,
204     (req_handler)req_event_op,
205     (req_handler)req_open_event,
206     (req_handler)req_create_mutex,
207     (req_handler)req_release_mutex,
208     (req_handler)req_open_mutex,
209     (req_handler)req_create_semaphore,
210     (req_handler)req_release_semaphore,
211     (req_handler)req_open_semaphore,
212     (req_handler)req_create_file,
213     (req_handler)req_alloc_file_handle,
214     (req_handler)req_get_read_fd,
215     (req_handler)req_get_write_fd,
216     (req_handler)req_set_file_pointer,
217     (req_handler)req_truncate_file,
218     (req_handler)req_set_file_time,
219     (req_handler)req_flush_file,
220     (req_handler)req_get_file_info,
221     (req_handler)req_lock_file,
222     (req_handler)req_unlock_file,
223     (req_handler)req_create_pipe,
224     (req_handler)req_create_socket,
225     (req_handler)req_accept_socket,
226     (req_handler)req_set_socket_event,
227     (req_handler)req_get_socket_event,
228     (req_handler)req_enable_socket_event,
229     (req_handler)req_alloc_console,
230     (req_handler)req_free_console,
231     (req_handler)req_open_console,
232     (req_handler)req_set_console_fd,
233     (req_handler)req_get_console_mode,
234     (req_handler)req_set_console_mode,
235     (req_handler)req_set_console_info,
236     (req_handler)req_get_console_info,
237     (req_handler)req_write_console_input,
238     (req_handler)req_read_console_input,
239     (req_handler)req_create_change_notification,
240     (req_handler)req_create_mapping,
241     (req_handler)req_open_mapping,
242     (req_handler)req_get_mapping_info,
243     (req_handler)req_create_device,
244     (req_handler)req_create_snapshot,
245     (req_handler)req_next_process,
246     (req_handler)req_wait_debug_event,
247     (req_handler)req_exception_event,
248     (req_handler)req_output_debug_string,
249     (req_handler)req_continue_debug_event,
250     (req_handler)req_debug_process,
251     (req_handler)req_read_process_memory,
252     (req_handler)req_write_process_memory,
253     (req_handler)req_create_key,
254     (req_handler)req_open_key,
255     (req_handler)req_delete_key,
256     (req_handler)req_close_key,
257     (req_handler)req_enum_key,
258     (req_handler)req_query_key_info,
259     (req_handler)req_set_key_value,
260     (req_handler)req_get_key_value,
261     (req_handler)req_enum_key_value,
262     (req_handler)req_delete_key_value,
263     (req_handler)req_load_registry,
264     (req_handler)req_save_registry,
265     (req_handler)req_set_registry_levels,
266     (req_handler)req_create_timer,
267     (req_handler)req_open_timer,
268     (req_handler)req_set_timer,
269     (req_handler)req_cancel_timer,
270     (req_handler)req_get_thread_context,
271     (req_handler)req_set_thread_context,
272     (req_handler)req_get_selector_entry,
273     (req_handler)req_add_atom,
274     (req_handler)req_delete_atom,
275     (req_handler)req_find_atom,
276     (req_handler)req_get_atom_name,
277 };
278 #endif  /* WANT_REQUEST_HANDLERS */
279
280 /* ### make_requests end ### */
281 /* Everything above this line is generated automatically by tools/make_requests */
282
283 #endif  /* __WINE_SERVER_REQUEST_H */