2003-02-25 Dick Porter <dick@ximian.com>
[mono.git] / mono / io-layer / daemon-messages.h
1 /*
2  * daemon-messages.h:  Communications to and from the handle daemon
3  *
4  * Author:
5  *      Dick Porter (dick@ximian.com)
6  *
7  * (C) 2002 Ximian, Inc.
8  */
9
10 #ifndef _WAPI_DAEMON_MESSAGES_H_
11 #define _WAPI_DAEMON_MESSAGES_H_
12
13 #include <mono/io-layer/wapi-private.h>
14
15 typedef enum {
16         WapiHandleRequestType_Error,
17         WapiHandleRequestType_New,
18         WapiHandleRequestType_Open,
19         WapiHandleRequestType_Close,
20         WapiHandleRequestType_Scratch,
21         WapiHandleRequestType_ScratchFree,
22         WapiHandleRequestType_ProcessFork,
23 } WapiHandleRequestType;
24
25 typedef struct 
26 {
27         WapiHandleType type;
28 } WapiHandleRequest_New;
29
30 typedef struct 
31 {
32         guint32 handle;
33 } WapiHandleRequest_Open;
34
35 typedef struct 
36 {
37         guint32 handle;
38 } WapiHandleRequest_Close;
39
40 typedef struct
41 {
42         guint32 length;
43 } WapiHandleRequest_Scratch;
44
45 typedef struct
46 {
47         guint32 idx;
48 } WapiHandleRequest_ScratchFree;
49
50 typedef struct 
51 {
52         guint32 cmd;
53         guint32 env;
54         guint32 dir;
55         guint32 stdin_handle;
56         guint32 stdout_handle;
57         guint32 stderr_handle;
58         gboolean inherit;
59         guint32 flags;
60 } WapiHandleRequest_ProcessFork;
61
62 typedef struct 
63 {
64         WapiHandleRequestType type;
65         union 
66         {
67                 WapiHandleRequest_New new;
68                 WapiHandleRequest_Open open;
69                 WapiHandleRequest_Close close;
70                 WapiHandleRequest_Scratch scratch;
71                 WapiHandleRequest_ScratchFree scratch_free;
72                 WapiHandleRequest_ProcessFork process_fork;
73         } u;
74 } WapiHandleRequest;
75
76 typedef enum {
77         WapiHandleResponseType_Error,
78         WapiHandleResponseType_New,
79         WapiHandleResponseType_Open,
80         WapiHandleResponseType_Close,
81         WapiHandleResponseType_Scratch,
82         WapiHandleResponseType_ScratchFree,
83         WapiHandleResponseType_ProcessFork,
84 } WapiHandleResponseType;
85
86 typedef struct 
87 {
88         guint32 reason;
89 } WapiHandleResponse_Error;
90
91 typedef struct 
92 {
93         WapiHandleType type;
94         guint32 handle;
95 } WapiHandleResponse_New;
96
97 typedef struct 
98 {
99         WapiHandleType type;
100         guint32 handle;
101 } WapiHandleResponse_Open;
102
103 typedef struct 
104 {
105         gboolean destroy;
106 } WapiHandleResponse_Close;
107
108 typedef struct
109 {
110         guint32 idx;
111 } WapiHandleResponse_Scratch;
112
113 typedef struct
114 {
115         guint32 dummy;
116 } WapiHandleResponse_ScratchFree;
117
118 typedef struct
119 {
120         guint32 process_handle;
121         guint32 thread_handle;
122         guint32 pid;
123         guint32 tid;
124 } WapiHandleResponse_ProcessFork;
125
126 typedef struct
127 {
128         WapiHandleResponseType type;
129         union
130         {
131                 WapiHandleResponse_Error error;
132                 WapiHandleResponse_New new;
133                 WapiHandleResponse_Open open;
134                 WapiHandleResponse_Close close;
135                 WapiHandleResponse_Scratch scratch;
136                 WapiHandleResponse_ScratchFree scratch_free;
137                 WapiHandleResponse_ProcessFork process_fork;
138         } u;
139 } WapiHandleResponse;
140
141 extern void _wapi_daemon_request_response (int fd, WapiHandleRequest *req,
142                                            WapiHandleResponse *resp);
143 extern void _wapi_daemon_request_response_with_fds (int fd,
144                                                     WapiHandleRequest *req,
145                                                     WapiHandleResponse *resp,
146                                                     int in_fd, int out_fd,
147                                                     int err_fd);
148 extern int _wapi_daemon_request (int fd, WapiHandleRequest *req, int *fds,
149                                  gboolean *has_fds);
150 extern int _wapi_daemon_response (int fd, WapiHandleResponse *resp);
151
152 #endif /* _WAPI_DAEMON_MESSAGES_H_ */