Missing test.
[mono.git] / mono / io-layer / wapi-private.h
1 #ifndef _WAPI_PRIVATE_H_
2 #define _WAPI_PRIVATE_H_
3
4 #include <config.h>
5 #include <glib.h>
6
7 #include "mono/io-layer/handles.h"
8
9 typedef enum {
10         WAPI_HANDLE_FILE,
11         WAPI_HANDLE_CONSOLE,
12         WAPI_HANDLE_THREAD,
13         WAPI_HANDLE_SEM,
14         WAPI_HANDLE_MUTEX,
15         WAPI_HANDLE_EVENT,
16         WAPI_HANDLE_SOCKET,
17         WAPI_HANDLE_COUNT,
18 } WapiHandleType;
19
20 struct _WapiHandleOps 
21 {
22         /* All handle types */
23         void (*close)(WapiHandle *handle);
24
25         /* File, console and pipe handles */
26         WapiFileType (*getfiletype)(void);
27         
28         /* File and console handles */
29         gboolean (*readfile)(WapiHandle *handle, gpointer buffer,
30                              guint32 numbytes, guint32 *bytesread,
31                              WapiOverlapped *overlapped);
32         gboolean (*writefile)(WapiHandle *handle, gconstpointer buffer,
33                               guint32 numbytes, guint32 *byteswritten,
34                               WapiOverlapped *overlapped);
35         
36         /* File handles */
37         guint32 (*seek)(WapiHandle *handle, gint32 movedistance,
38                         gint32 *highmovedistance, WapiSeekMethod method);
39         gboolean (*setendoffile)(WapiHandle *handle);
40         guint32 (*getfilesize)(WapiHandle *handle, guint32 *highsize);
41         gboolean (*getfiletime)(WapiHandle *handle, WapiFileTime *create_time,
42                                 WapiFileTime *last_access,
43                                 WapiFileTime *last_write);
44         gboolean (*setfiletime)(WapiHandle *handle,
45                                 const WapiFileTime *create_time,
46                                 const WapiFileTime *last_access,
47                                 const WapiFileTime *last_write);
48         
49         /* WaitForSingleObject */
50         gboolean (*wait)(WapiHandle *handle, WapiHandle *signal, guint32 ms);
51
52         /* WaitForMultipleObjects */
53         guint32 (*wait_multiple)(gpointer data);
54
55         /* SignalObjectAndWait */
56         void (*signal)(WapiHandle *signal);
57 };
58
59 struct _WapiHandle
60 {
61         WapiHandleType type;
62         guint ref;
63         gboolean signalled;
64         struct _WapiHandleOps *ops;
65 };
66
67 #define _WAPI_HANDLE_INIT(_handle, _type, _ops) G_STMT_START {\
68                 _handle->type=_type;\
69                 _handle->ref=1;\
70                 _handle->signalled=FALSE;\
71                 _handle->ops=&_ops;\
72         } G_STMT_END;
73
74 #endif /* _WAPI_PRIVATE_H_ */