3 Written by Egor Duda <deo@logos-m.ru>
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
14 #define CYGWIN_SERVER_VERSION_MAJOR 1
15 #define CYGWIN_SERVER_VERSION_API 4
16 #define CYGWIN_SERVER_VERSION_MINOR 0
17 #define CYGWIN_SERVER_VERSION_PATCH 0
20 CYGSERVER_UNKNOWN
= 0,
25 /*---------------------------------------------------------------------------*
26 * class client_request
27 *---------------------------------------------------------------------------*/
29 class transport_layer_base
;
31 #ifndef __INSIDE_CYGWIN__
39 CYGSERVER_REQUEST_INVALID
,
40 CYGSERVER_REQUEST_GET_VERSION
,
41 CYGSERVER_REQUEST_SHUTDOWN
,
42 CYGSERVER_REQUEST_ATTACH_TTY
,
43 CYGSERVER_REQUEST_MSG
,
44 CYGSERVER_REQUEST_SEM
,
45 CYGSERVER_REQUEST_SHM
,
46 CYGSERVER_REQUEST_SETPWD
,
47 CYGSERVER_REQUEST_PWDGRP
,
48 CYGSERVER_REQUEST_LAST
56 request_code_t request_code
;
61 header_t (request_code_t
, size_t);
65 #ifndef __INSIDE_CYGWIN__
66 static void handle_request (transport_layer_base
*, process_cache
*);
69 client_request (request_code_t request_code
,
72 virtual ~client_request ();
74 request_code_t
request_code () const { return _header
.request_code
; }
76 int error_code () const { return _header
.error_code
; };
77 void error_code (int error_code
) { _header
.error_code
= error_code
; };
79 size_t msglen () const { return _header
.msglen
; };
80 void msglen (size_t len
) { _header
.msglen
= len
; };
85 virtual void send (transport_layer_base
*);
92 #ifndef __INSIDE_CYGWIN__
93 void handle (transport_layer_base
*, process_cache
*);
94 virtual void serve (transport_layer_base
*, process_cache
*) = 0;
98 /*---------------------------------------------------------------------------*
99 * class client_request_get_version
100 *---------------------------------------------------------------------------*/
102 class client_request_get_version
: public client_request
105 struct request_get_version
107 DWORD major
, api
, minor
, patch
;
111 client_request_get_version ();
112 bool check_version () const;
115 struct request_get_version version
;
117 #ifndef __INSIDE_CYGWIN__
118 virtual void serve (transport_layer_base
*, process_cache
*);
122 /*---------------------------------------------------------------------------*
123 * class client_request_shutdown
125 * Nb. This whole class is only !__INSIDE_CYGWIN__ since it is used
126 * solely by cygserver itself.
127 *---------------------------------------------------------------------------*/
129 #ifndef __INSIDE_CYGWIN__
131 class client_request_shutdown
: public client_request
134 client_request_shutdown ();
137 virtual void serve (transport_layer_base
*, process_cache
*);
140 #endif /* !__INSIDE_CYGWIN__ */
142 /*---------------------------------------------------------------------------*
143 * class client_request_attach_tty
144 *---------------------------------------------------------------------------*/
146 class client_request_attach_tty
: public client_request
149 struct request_attach_tty
151 DWORD pid
, master_pid
;
152 HANDLE from_master
, to_master
;
156 #ifdef __INSIDE_CYGWIN__
157 client_request_attach_tty (DWORD nmaster_pid
,
158 HANDLE nfrom_master
, HANDLE nto_master
);
160 client_request_attach_tty ();
163 HANDLE
from_master () const { return req
.from_master
; };
164 HANDLE
to_master () const { return req
.to_master
; };
167 virtual void send (transport_layer_base
*);
170 struct request_attach_tty req
;
172 #ifndef __INSIDE_CYGWIN__
173 virtual void serve (transport_layer_base
*, process_cache
*);
177 #ifndef __INSIDE_CYGWIN__
178 extern PSID admininstrator_group_sid
;
181 extern bool check_cygserver_available ();
182 extern void cygserver_init ();
184 #endif /* _CYGSERVER_H_ */