First pass at native Win32 support (does not compile).
[srvx.git] / src / ioset-win32.c
1 /* Win32 ioset backend for srvx
2  * Copyright 2006 srvx Development Team
3  *
4  * This file is part of srvx.
5  *
6  * srvx is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with srvx; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
19  */
20
21 #include "ioset-impl.h"
22 #include "common.h"
23 #include "log.h"
24
25 /* This is massively kludgy.  Unfortunately, the only performant I/O
26  * multiplexer with halfway decent semantics under Windows is
27  * WSAAsyncSelect() -- which requires a window that can receive
28  * messages.
29  *
30  * So ioset_win32_init() creates a hidden window and sets it up for
31  * asynchronous socket notifications.
32  */
33
34 static int
35 ioset_win32_init(void)
36 {
37     WSADATA wsadata;
38     int res;
39
40     res = WSAStartup(MAKEWORD(2, 0), &wsadata);
41     // TODO: finish implementing ioset_win32_init()
42     return 0;
43 }
44
45 static void
46 ioset_win32_add(struct io_fd *fd)
47 {
48     // TODO: implement ioset_win32_add()
49 }
50
51 static void
52 ioset_win32_remove(struct io_fd *fd)
53 {
54     // TODO: implement ioset_win32_remove()
55 }
56
57 static void
58 ioset_win32_update(struct io_fd *fd)
59 {
60     // TODO: implement ioset_win32_update()
61 }
62
63 static void
64 ioset_win32_cleanup(void)
65 {
66     // TODO: finish implementing ioset_win32_cleanup()
67     WSACleanup();
68 }
69
70 static int
71 ioset_win32_loop(struct timeval *timeout)
72 {
73     // TODO: implement ioset_win32_loop()
74     return 0;
75 }
76
77 struct io_engine io_engine_win32 = {
78     .name = "win32",
79     .init = ioset_win32_init,
80     .add = ioset_win32_add,
81     .remove = ioset_win32_remove,
82     .update = ioset_win32_update,
83     .loop = ioset_win32_loop,
84     .cleanup = ioset_win32_cleanup,
85 };