Debian Codegraph @

src/microhttpd/mhd_itc_types.h

raw
1 /*
2 This file is part of libmicrohttpd
3 Copyright (C) 2016-2020 Karlson2k (Evgeny Grin), Christian Grothoff
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19 */
20
21 /**
22 * @file microhttpd/mhd_itc_types.h
23 * @brief Types for platform-independent inter-thread communication
24 * @author Karlson2k (Evgeny Grin)
25 * @author Christian Grothoff
26 *
27 * Provides basic types for inter-thread communication.
28 * Designed to be included by other headers.
29 */
30 #ifndef MHD_ITC_TYPES_H
31 #define MHD_ITC_TYPES_H 1
32 #include "mhd_options.h"
33
34 /* Force socketpair on native W32 */
35 #if defined(_WIN32) && ! defined(__CYGWIN__) && ! defined(_MHD_ITC_SOCKETPAIR)
36 #error _MHD_ITC_SOCKETPAIR is not defined on naitive W32 platform
37 #endif /* _WIN32 && !__CYGWIN__ && !_MHD_ITC_SOCKETPAIR */
38
39 #if defined(_MHD_ITC_EVENTFD)
40 /* **************** Optimized GNU/Linux ITC implementation by eventfd ********** */
41
42 /**
43 * Data type for a MHD ITC.
44 */
45 struct MHD_itc_
46 {
47 int fd;
48 };
49
50 /**
51 * Static initialiser for struct MHD_itc_
52 */
53 #define MHD_ITC_STATIC_INIT_INVALID { -1 }
54
55
56 #elif defined(_MHD_ITC_PIPE)
57 /* **************** Standard UNIX ITC implementation by pipe ********** */
58
59 /**
60 * Data type for a MHD ITC.
61 */
62 struct MHD_itc_
63 {
64 int fd[2];
65 };
66
67 /**
68 * Static initialiser for struct MHD_itc_
69 */
70 #define MHD_ITC_STATIC_INIT_INVALID { { -1, -1 } }
71
72
73 #elif defined(_MHD_ITC_SOCKETPAIR)
74 /* **************** ITC implementation by socket pair ********** */
75
76 #include "mhd_sockets.h"
77
78 /**
79 * Data type for a MHD ITC.
80 */
81 struct MHD_itc_
82 {
83 MHD_socket sk[2];
84 };
85
86 /**
87 * Static initialiser for struct MHD_itc_
88 */
89 #define MHD_ITC_STATIC_INIT_INVALID \
90 { { MHD_INVALID_SOCKET, MHD_INVALID_SOCKET } }
91
92 #endif /* _MHD_ITC_SOCKETPAIR */
93
94 #endif /* ! MHD_ITC_TYPES_H */