upload http
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / server / mpm / winnt / mpm_winnt.h
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef APACHE_MPM_WINNT_H
18 #define APACHE_MPM_WINNT_H
19
20 #include "ap_listen.h"
21
22 /* From service.c: */
23
24 #define SERVICE_APACHE_RESTART 128
25
26 #ifndef AP_DEFAULT_SERVICE_NAME
27 #define AP_DEFAULT_SERVICE_NAME "Apache2"
28 #endif
29
30 #define SERVICECONFIG9X "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices"
31 #define SERVICECONFIG "System\\CurrentControlSet\\Services\\%s"
32 #define SERVICEPARAMS "System\\CurrentControlSet\\Services\\%s\\Parameters"
33
34 apr_status_t mpm_service_set_name(apr_pool_t *p, const char **display_name, 
35                                                  const char *set_name);
36 apr_status_t mpm_merge_service_args(apr_pool_t *p, apr_array_header_t *args, 
37                                    int fixed_args);
38
39 apr_status_t mpm_service_to_start(const char **display_name, apr_pool_t *p);
40 apr_status_t mpm_service_started(void);
41 apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc, 
42                                 char const* const* argv, int reconfig);
43 apr_status_t mpm_service_uninstall(void);
44
45 apr_status_t mpm_service_start(apr_pool_t *ptemp, int argc, 
46                               char const* const* argv);
47
48 void mpm_signal_service(apr_pool_t *ptemp, int signal);
49
50 void mpm_service_stopping(void);
51
52 void mpm_start_console_handler(void);
53 void mpm_start_child_console_handler(void);
54
55 /* From nt_eventlog.c: */
56
57 void mpm_nt_eventlog_stderr_open(char *display_name, apr_pool_t *p);
58 void mpm_nt_eventlog_stderr_flush(void);
59
60 /* From winnt.c: */
61 extern int use_acceptex;
62 extern int winnt_mpm_state;
63 extern OSVERSIONINFO osver;
64 extern void clean_child_exit(int);
65
66 void setup_signal_names(char *prefix);
67
68 typedef enum {
69     SIGNAL_PARENT_SHUTDOWN,
70     SIGNAL_PARENT_RESTART,
71     SIGNAL_PARENT_RESTART_GRACEFUL
72 } ap_signal_parent_e;
73 AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type);
74
75 /*
76  * The Windoes MPM uses a queue of completion contexts that it passes
77  * between the accept threads and the worker threads. Declare the
78  * functions to access the queue and the structures passed on the
79  * queue in the header file to enable modules to access them
80  * if necessary. The queue resides in the MPM.
81  */
82 #ifdef CONTAINING_RECORD
83 #undef CONTAINING_RECORD
84 #endif
85 #define CONTAINING_RECORD(address, type, field) ((type *)( \
86                                                   (PCHAR)(address) - \
87                                                   (PCHAR)(&((type *)0)->field)))
88 #define PADDED_ADDR_SIZE sizeof(SOCKADDR_IN)+16
89 typedef struct CompContext {
90     struct CompContext *next;
91     OVERLAPPED Overlapped;
92     apr_socket_t *sock;
93     SOCKET accept_socket;
94     char buff[2*PADDED_ADDR_SIZE];
95     struct sockaddr *sa_server;
96     int sa_server_len;
97     struct sockaddr *sa_client;
98     int sa_client_len;
99     apr_pool_t *ptrans;
100     apr_bucket_alloc_t *ba;
101 } COMP_CONTEXT, *PCOMP_CONTEXT;
102
103 typedef enum {
104     IOCP_CONNECTION_ACCEPTED = 1,
105     IOCP_WAIT_FOR_RECEIVE = 2,
106     IOCP_WAIT_FOR_TRANSMITFILE = 3,
107     IOCP_SHUTDOWN = 4
108 } io_state_e;
109
110 AP_DECLARE(PCOMP_CONTEXT) mpm_get_completion_context(void);
111 AP_DECLARE(void)          mpm_recycle_completion_context(PCOMP_CONTEXT pCompContext);
112 AP_DECLARE(apr_status_t)  mpm_post_completion_context(PCOMP_CONTEXT pCompContext, io_state_e state);
113 void hold_console_open_on_error(void);
114 #endif /* APACHE_MPM_WINNT_H */