ReactOS
0.4.16-dev-106-g10b08aa
roshttpd.cpp
Go to the documentation of this file.
1
/*
2
* COPYRIGHT: See COPYING in the top level directory
3
* PROJECT: ReactOS HTTP Daemon
4
* FILE: roshttpd.cpp
5
* PURPOSE: Main program
6
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7
* REVISIONS:
8
* CSH 01/09/2000 Created
9
*/
10
#include <debug.h>
11
#include <new>
12
#include <
winsock2.h
>
13
#include <stdio.h>
14
#include <config.h>
15
#include <error.h>
16
#include <
httpd.h
>
17
18
using namespace
std
;
19
20
21
VOID
Run
()
22
{
23
InitWinsock
();
24
25
pDaemonThread
=
NULL
;
26
pConfiguration
=
NULL
;
27
28
try
{
29
// Create configuration object
30
pConfiguration
=
new
CConfig
;
31
pConfiguration
->
Default
();
32
33
// Create daemon object
34
pDaemonThread
=
new
CHttpDaemonThread
;
35
36
MSG
Msg
;
37
BOOL
bQuit =
FALSE
;
38
while
((!bQuit) && (!
pDaemonThread
->
Terminated
())) {
39
bQuit =
PeekMessage
(&
Msg
,
NULL
, 0, 0,
PM_REMOVE
);
40
if
(!bQuit)
41
DispatchMessage
(&
Msg
);
42
}
43
44
delete
pDaemonThread
;
45
46
if
(
pConfiguration
!=
NULL
)
47
delete
pConfiguration
;
48
}
catch
(bad_alloc&) {
49
if
(
pConfiguration
!=
NULL
)
50
delete
pConfiguration
;
51
ReportErrorStr
(
TS
(
"Insufficient resources."
));
52
}
53
54
DeinitWinsock
();
55
}
56
57
/* Program entry point */
58
int
main
(
int
argc
,
char
*
argv
[])
59
{
60
printf
(
"ReactOS HTTP Daemon\n"
);
61
printf
(
"Type Control-C to stop.\n"
);
62
63
Run
();
64
65
printf
(
"Daemon stopped.\n"
);
66
}
argc
static int argc
Definition:
ServiceArgs.c:12
CConfig
Definition:
config.h:22
CConfig::Default
VOID Default()
Definition:
config.cpp:42
CHttpDaemonThread
Definition:
httpd.h:76
CThread::Terminated
BOOL Terminated()
Definition:
thread.cpp:77
Msg
struct @1636 Msg[]
pConfiguration
LPCConfig pConfiguration
Definition:
config.cpp:18
pDaemonThread
LPCHttpDaemonThread pDaemonThread
Definition:
config.cpp:19
NULL
#define NULL
Definition:
types.h:112
FALSE
#define FALSE
Definition:
types.h:117
main
int main()
Definition:
test.c:6
ReportErrorStr
void ReportErrorStr(LPTSTR lpsText)
Definition:
error.cpp:13
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
printf
#define printf
Definition:
freeldr.h:97
httpd.h
void
Definition:
nsiface.idl:2307
TS
#define TS(x)
Definition:
error.h:11
argv
#define argv
Definition:
mplay32.c:18
std
Definition:
features.h:417
Run
VOID Run()
Definition:
roshttpd.cpp:21
DeinitWinsock
VOID DeinitWinsock()
Definition:
socket.cpp:340
InitWinsock
VOID InitWinsock()
Definition:
socket.cpp:319
MSG
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition:
twain.h:1829
winsock2.h
PM_REMOVE
#define PM_REMOVE
Definition:
winuser.h:1199
PeekMessage
#define PeekMessage
Definition:
winuser.h:5842
DispatchMessage
#define DispatchMessage
Definition:
winuser.h:5777
modules
rosapps
applications
net
roshttpd
roshttpd.cpp
Generated on Tue Oct 8 2024 06:09:47 for ReactOS by
1.9.6