summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog17
-rw-r--r--src/Makefile.am12
-rw-r--r--src/assuan.h.in159
-rw-r--r--src/mkheader.c55
-rw-r--r--src/posix-fd-t.inc.h32
-rw-r--r--src/posix-includes.inc.h23
-rw-r--r--src/posix-sock-nonce.inc.h32
-rw-r--r--src/posix-sys-pth-impl.h88
-rw-r--r--src/posix-types.inc.h23
-rw-r--r--src/w32-fd-t.inc.h39
-rw-r--r--src/w32-includes.inc.h23
-rw-r--r--src/w32-sock-nonce.inc.h50
-rw-r--r--src/w32-sys-pth-impl.h39
-rw-r--r--src/w32-types.inc.h23
-rw-r--r--src/w32ce-fd-t.inc.h32
15 files changed, 484 insertions, 163 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 534ba65..9ee246f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,20 @@
+2010-04-06 Werner Koch <wk@g10code.com>
+
+ * posix-includes.inc.h, w32-includes.inc.h: New.
+ * posix-types.inc.h, w32-types.inc.h: New.
+ * posix-fd-t.inc.h, w32-fd-t.inc.h, w32ce-fd-t.inc.h: New.
+ * posix-sock-nonce.inc.h, w32-sock-nonce.inc.h: New.
+ * mkheader.c (write_special): Support them.
+ * Makefile.am (common_sources, assuan.h): Ditto
+ (parts_of_assuan_h): New.
+
+ * w32-sys-pth-impl.h: Use gpg_err_set_errno.
+
+ * assuan.h.in (_ASSUAN_SYSTEM_PTH_IMPL): Factor code out to ..
+ * posix-sys-pth-impl.h, w32-sys-pth-impl.h: New
+ * mkheader.c (write_special): Support them.
+ * Makefile.am (common_sources, assuan.h): Ditto
+
2010-03-23 Werner Koch <wk@g10code.com>
* assuan-error.c (_assuan_w32_strerror) [W32CE]: Print only the code.
diff --git a/src/Makefile.am b/src/Makefile.am
index d28d2a2..b97490c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,8 +41,16 @@ CLEANFILES = mkheader assuan.h
BUILT_SOURCES = assuan.h
+parts_of_assuan_h = \
+ posix-includes.inc.h w32-includes.inc.h \
+ posix-types.inc.h w32-types.inc.h \
+ posix-fd-t.inc.h w32-fd-t.inc.h w32ce-fd-t.inc.h \
+ posix-sock-nonce.inc.h w32-sock-nonce.inc.h \
+ posix-sys-pth-impl.h w32-sys-pth-impl.h \
+ w32ce-add.h
+
common_sources = \
- assuan.h.in w32ce-add.h \
+ assuan.h.in $(parts_of_assuan_h) \
assuan-defs.h \
assuan.c context.c system.c \
debug.c debug.h conversion.c sysutils.c \
@@ -130,6 +138,6 @@ endif
mkheader: mkheader.c Makefile
$(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
-assuan.h: assuan.h.in mkheader w32ce-add.h
+assuan.h: assuan.h.in mkheader $(parts_of_assuan_h)
./mkheader $(host_os) $(srcdir)/assuan.h.in >$@
diff --git a/src/assuan.h.in b/src/assuan.h.in
index 91b75ab..410b4b7 100644
--- a/src/assuan.h.in
+++ b/src/assuan.h.in
@@ -29,18 +29,10 @@
#include <stdarg.h>
#ifndef _ASSUAN_NO_SOCKET_WRAPPER
-#ifdef _WIN32
-#include <ws2tcpip.h>
-#else
-#include <sys/socket.h>
-#endif
+@include:includes@
#endif /*!_ASSUAN_NO_SOCKET_WRAPPER*/
-#ifdef _WIN32
-typedef void *assuan_msghdr_t;
-#else
-typedef struct msghdr *assuan_msghdr_t;
-#endif
+@include:types@
#include <gpg-error.h>
@@ -79,70 +71,11 @@ extern "C"
struct assuan_context_s;
typedef struct assuan_context_s *assuan_context_t;
-
-/* Because we use system handles and not libc low level file
- descriptors on W32, we need to declare them as HANDLE (which
- actually is a plain pointer). This is required to eventually
- support 64 bit Windows systems. */
-#ifdef _WIN32
-typedef void *assuan_fd_t;
-#define ASSUAN_INVALID_FD ((void*)(-1))
-#define ASSUAN_INVALID_PID ((pid_t) -1)
-static inline assuan_fd_t
-assuan_fd_from_posix_fd (int fd)
-{
-#ifdef __MINGW32CE__
- return (assuan_fd_t)(fd);
-#else
- if (fd < 0)
- return ASSUAN_INVALID_FD;
- else
- return (assuan_fd_t) _get_osfhandle (fd);
-#endif
-}
-#else
-typedef int assuan_fd_t;
-#define ASSUAN_INVALID_FD (-1)
-#define ASSUAN_INVALID_PID ((pid_t) -1)
-static inline assuan_fd_t
-assuan_fd_from_posix_fd (int fd)
-{
- return fd;
-}
-#endif
+@include:fd-t@
assuan_fd_t assuan_fdopen (int fd);
-
-/* Assuan features an emulation of Unix domain sockets based on a
- local TCP connections. To implement access permissions based on
- file permissions a nonce is used which is expected by the server as
- the first bytes received. This structure is used by the server to
- save the nonce created initially by bind. On POSIX systems this is
- a dummy operation. */
-struct assuan_sock_nonce_s
-{
- size_t length;
-#ifdef _WIN32
- char nonce[16];
-#endif
-};
-typedef struct assuan_sock_nonce_s assuan_sock_nonce_t;
-
-/* Define the Unix domain socket structure for Windows. */
-#if defined(_WIN32) && !defined(_ASSUAN_NO_SOCKET_WRAPPER)
-#ifndef AF_LOCAL
-#define AF_LOCAL AF_UNIX
-#endif
-#define EADDRINUSE WSAEADDRINUSE
-struct sockaddr_un
-{
- short sun_family;
- unsigned short sun_port;
- struct in_addr sun_addr;
- char sun_path[108-2-4];
-};
-#endif
+@include:sock-nonce@
/* Global interface. */
@@ -533,88 +466,6 @@ int __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name,
int __assuan_socketpair (assuan_context_t ctx, int _namespace, int style,
int protocol, assuan_fd_t filedes[2]);
-#ifdef _WIN32
-#define _ASSUAN_SYSTEM_PTH_IMPL \
- static int _assuan_pth_recvmsg (assuan_context_t ctx, assuan_fd_t fd, \
- assuan_msghdr_t msg, int flags) \
- { \
- (void) ctx; \
- errno = ENOSYS; \
- return -1; \
- } \
- static int _assuan_pth_sendmsg (assuan_context_t ctx, assuan_fd_t fd, \
- const assuan_msghdr_t msg, int flags) \
- { \
- (void) ctx; \
- errno = ENOSYS; \
- return -1; \
- }
-#else
-#define _ASSUAN_SYSTEM_PTH_IMPL \
- static int _assuan_pth_recvmsg (assuan_context_t ctx, assuan_fd_t fd, \
- assuan_msghdr_t msg, int flags) \
- { \
- /* Pth does not provide a recvmsg function. We implement it. */ \
- int ret; \
- int fdmode; \
- \
- (void) ctx; \
- fdmode = pth_fdmode (fd, PTH_FDMODE_POLL); \
- if (fdmode == PTH_FDMODE_ERROR) \
- { \
- errno = EBADF; \
- return -1; \
- } \
- if (fdmode == PTH_FDMODE_BLOCK) \
- { \
- fd_set fds; \
- \
- FD_ZERO (&fds); \
- FD_SET (fd, &fds); \
- while ((ret = pth_select (fd + 1, &fds, NULL, NULL, NULL)) < 0 \
- && errno == EINTR) \
- ; \
- if (ret < 0) \
- return -1; \
- } \
- \
- while ((ret = recvmsg (fd, msg, flags)) == -1 && errno == EINTR) \
- ; \
- return ret; \
- } \
- static int _assuan_pth_sendmsg (assuan_context_t ctx, assuan_fd_t fd, \
- const assuan_msghdr_t msg, int flags) \
- { \
- /* Pth does not provide a sendmsg function. We implement it. */ \
- int ret; \
- int fdmode; \
- \
- (void) ctx; \
- fdmode = pth_fdmode (fd, PTH_FDMODE_POLL); \
- if (fdmode == PTH_FDMODE_ERROR) \
- { \
- errno = EBADF; \
- return -1; \
- } \
- if (fdmode == PTH_FDMODE_BLOCK) \
- { \
- fd_set fds; \
- \
- FD_ZERO (&fds); \
- FD_SET (fd, &fds); \
- while ((ret = pth_select (fd + 1, NULL, &fds, NULL, NULL)) < 0 \
- && errno == EINTR) \
- ; \
- if (ret < 0) \
- return -1; \
- } \
- \
- while ((ret = sendmsg (fd, msg, flags)) == -1 && errno == EINTR) \
- ; \
- return ret; \
- }
-#endif
-
#define ASSUAN_SYSTEM_PTH_IMPL \
static void _assuan_pth_usleep (assuan_context_t ctx, unsigned int usec) \
@@ -625,7 +476,7 @@ int __assuan_socketpair (assuan_context_t ctx, int _namespace, int style,
static ssize_t _assuan_pth_write (assuan_context_t ctx, assuan_fd_t fd, \
const void *buffer, size_t size) \
{ (void) ctx; return pth_write (fd, buffer, size); } \
- _ASSUAN_SYSTEM_PTH_IMPL \
+@include:sys-pth-impl@
static pid_t _assuan_pth_waitpid (assuan_context_t ctx, pid_t pid, \
int nowait, int *status, int options) \
{ (void) ctx; \
diff --git a/src/mkheader.c b/src/mkheader.c
index 3a99408..1b2e165 100644
--- a/src/mkheader.c
+++ b/src/mkheader.c
@@ -26,7 +26,7 @@ static char *srcdir;
/* Include the file NAME form the source directory. The included file
is not further expanded. It may have comments indicated by a
- double hash masrk at the begin of a line. */
+ double hash mark at the begin of a line. */
static void
include_file (const char *fname, int lnr, const char *name)
{
@@ -54,7 +54,10 @@ include_file (const char *fname, int lnr, const char *name)
while (fgets (line, LINESIZE, fp))
{
if (line[0] == '#' && line[1] == '#')
- ;
+ {
+ if (!strncmp (line+2, "EOF##", 5))
+ break; /* Forced EOF. */
+ }
else
fputs (line, stdout);
}
@@ -72,7 +75,44 @@ include_file (const char *fname, int lnr, const char *name)
static int
write_special (const char *fname, int lnr, const char *tag)
{
- if (!strcmp (tag, "include:w32ce-add"))
+ if (!strcmp (tag, "include:includes"))
+ {
+ if (strstr (host_os, "mingw32"))
+ include_file (fname, lnr, "w32-includes.inc.h");
+ else
+ include_file (fname, lnr, "posix-includes.inc.h");
+ }
+ else if (!strcmp (tag, "include:types"))
+ {
+ if (strstr (host_os, "mingw32"))
+ include_file (fname, lnr, "w32-types.inc.h");
+ else
+ include_file (fname, lnr, "posix-types.inc.h");
+ }
+ else if (!strcmp (tag, "include:fd-t"))
+ {
+ if (!strcmp (host_os, "mingw32ce"))
+ include_file (fname, lnr, "w32ce-fd-t.inc.h");
+ else if (strstr (host_os, "mingw32"))
+ include_file (fname, lnr, "w32-fd-t.inc.h");
+ else
+ include_file (fname, lnr, "posix-fd-t.inc.h");
+ }
+ else if (!strcmp (tag, "include:sock-nonce"))
+ {
+ if (strstr (host_os, "mingw32"))
+ include_file (fname, lnr, "w32-sock-nonce.inc.h");
+ else
+ include_file (fname, lnr, "posix-sock-nonce.inc.h");
+ }
+ else if (!strcmp (tag, "include:sys-pth-impl"))
+ {
+ if (strstr (host_os, "mingw32"))
+ include_file (fname, lnr, "w32-sys-pth-impl.h");
+ else
+ include_file (fname, lnr, "posix-sys-pth-impl.h");
+ }
+ else if (!strcmp (tag, "include:w32ce-add"))
{
if (!strcmp (host_os, "mingw32ce"))
include_file (fname, lnr, "w32ce-add.h");
@@ -157,16 +197,17 @@ main (int argc, char **argv)
s = strrchr (fname, '/');
printf ("Do not edit. Generated from %s by %s for %s.",
s? s+1 : fname, PGM, host_os);
+ fputs (p2, stdout);
+ putchar ('\n');
}
else if (!write_special (fname, lnr, p1))
{
putchar ('@');
fputs (p1, stdout);
putchar ('@');
+ fputs (p2, stdout);
+ putchar ('\n');
}
-
- fputs (p2, stdout);
- putchar ('\n');
}
if (ferror (fp))
@@ -177,7 +218,7 @@ main (int argc, char **argv)
}
fputs ("/*\n"
- "Local Variables:\n"
+ "Loc" "al Variables:\n"
"buffer-read-only: t\n"
"End:\n"
"*/\n", stdout);
diff --git a/src/posix-fd-t.inc.h b/src/posix-fd-t.inc.h
new file mode 100644
index 0000000..35bf5ae
--- /dev/null
+++ b/src/posix-fd-t.inc.h
@@ -0,0 +1,32 @@
+## posix-fd-t.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+
+typedef int assuan_fd_t;
+#define ASSUAN_INVALID_FD (-1)
+#define ASSUAN_INVALID_PID ((pid_t) -1)
+static inline assuan_fd_t
+assuan_fd_from_posix_fd (int fd)
+{
+ return fd;
+}
+
+##EOF##
diff --git a/src/posix-includes.inc.h b/src/posix-includes.inc.h
new file mode 100644
index 0000000..c641f86
--- /dev/null
+++ b/src/posix-includes.inc.h
@@ -0,0 +1,23 @@
+## posix-includes.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+#include <sys/socket.h>
+##EOF##
diff --git a/src/posix-sock-nonce.inc.h b/src/posix-sock-nonce.inc.h
new file mode 100644
index 0000000..a62216d
--- /dev/null
+++ b/src/posix-sock-nonce.inc.h
@@ -0,0 +1,32 @@
+## posix-sock-nonce.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+/* Under Windows Assuan features an emulation of Unix domain sockets
+ based on a local TCP connections. To implement access permissions
+ based on file permissions a nonce is used which is expected by the
+ server as the first bytes received. On POSIX systems this is a
+ dummy structure. */
+struct assuan_sock_nonce_s
+{
+ size_t length;
+};
+typedef struct assuan_sock_nonce_s assuan_sock_nonce_t;
+##EOF##
diff --git a/src/posix-sys-pth-impl.h b/src/posix-sys-pth-impl.h
new file mode 100644
index 0000000..77d38f0
--- /dev/null
+++ b/src/posix-sys-pth-impl.h
@@ -0,0 +1,88 @@
+## posix-sys-pth-impl.h - Include fragment to build assuan.h.
+## Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+##
+## Warning: This is a fragment of a macro - no empty lines please.
+ static int _assuan_pth_recvmsg (assuan_context_t ctx, assuan_fd_t fd, \
+ assuan_msghdr_t msg, int flags) \
+ { \
+ /* Pth does not provide a recvmsg function. We implement it. */ \
+ int ret; \
+ int fdmode; \
+ \
+ (void) ctx; \
+ fdmode = pth_fdmode (fd, PTH_FDMODE_POLL); \
+ if (fdmode == PTH_FDMODE_ERROR) \
+ { \
+ errno = EBADF; \
+ return -1; \
+ } \
+ if (fdmode == PTH_FDMODE_BLOCK) \
+ { \
+ fd_set fds; \
+ \
+ FD_ZERO (&fds); \
+ FD_SET (fd, &fds); \
+ while ((ret = pth_select (fd + 1, &fds, NULL, NULL, NULL)) < 0 \
+ && errno == EINTR) \
+ ; \
+ if (ret < 0) \
+ return -1; \
+ } \
+ \
+ while ((ret = recvmsg (fd, msg, flags)) == -1 && errno == EINTR) \
+ ; \
+ return ret; \
+ } \
+ static int _assuan_pth_sendmsg (assuan_context_t ctx, assuan_fd_t fd, \
+ const assuan_msghdr_t msg, int flags) \
+ { \
+ /* Pth does not provide a sendmsg function. We implement it. */ \
+ int ret; \
+ int fdmode; \
+ \
+ (void) ctx; \
+ fdmode = pth_fdmode (fd, PTH_FDMODE_POLL); \
+ if (fdmode == PTH_FDMODE_ERROR) \
+ { \
+ errno = EBADF; \
+ return -1; \
+ } \
+ if (fdmode == PTH_FDMODE_BLOCK) \
+ { \
+ fd_set fds; \
+ \
+ FD_ZERO (&fds); \
+ FD_SET (fd, &fds); \
+ while ((ret = pth_select (fd + 1, NULL, &fds, NULL, NULL)) < 0 \
+ && errno == EINTR) \
+ ; \
+ if (ret < 0) \
+ return -1; \
+ } \
+ \
+ while ((ret = sendmsg (fd, msg, flags)) == -1 && errno == EINTR) \
+ ; \
+ return ret; \
+ } \
+##EOF## Force end-of file.
+
+
diff --git a/src/posix-types.inc.h b/src/posix-types.inc.h
new file mode 100644
index 0000000..c242b48
--- /dev/null
+++ b/src/posix-types.inc.h
@@ -0,0 +1,23 @@
+## posix-types.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+typedef struct msghdr *assuan_msghdr_t;
+##EOF##
diff --git a/src/w32-fd-t.inc.h b/src/w32-fd-t.inc.h
new file mode 100644
index 0000000..11cd511
--- /dev/null
+++ b/src/w32-fd-t.inc.h
@@ -0,0 +1,39 @@
+## w32-fd-t.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+
+/* Because we use system handles and not libc low level file
+ descriptors on W32, we need to declare them as HANDLE (which
+ actually is a plain pointer). This is required to eventually
+ support 64 bit Windows systems. */
+typedef void *assuan_fd_t;
+#define ASSUAN_INVALID_FD ((void*)(-1))
+#define ASSUAN_INVALID_PID ((pid_t) -1)
+static inline assuan_fd_t
+assuan_fd_from_posix_fd (int fd)
+{
+ if (fd < 0)
+ return ASSUAN_INVALID_FD;
+ else
+ return (assuan_fd_t) _get_osfhandle (fd);
+}
+
+##EOF##
diff --git a/src/w32-includes.inc.h b/src/w32-includes.inc.h
new file mode 100644
index 0000000..7e9216b
--- /dev/null
+++ b/src/w32-includes.inc.h
@@ -0,0 +1,23 @@
+## w32-includes.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+#include <ws2tcpip.h>
+##EOF##
diff --git a/src/w32-sock-nonce.inc.h b/src/w32-sock-nonce.inc.h
new file mode 100644
index 0000000..260c872
--- /dev/null
+++ b/src/w32-sock-nonce.inc.h
@@ -0,0 +1,50 @@
+## w32-sock-nonce.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+
+/* Assuan features an emulation of Unix domain sockets based on local
+ TCP connections. To implement access permissions based on file
+ permissions a nonce is used which is expected by the server as the
+ first bytes received. This structure is used by the server to save
+ the nonce created initially by bind. */
+struct assuan_sock_nonce_s
+{
+ size_t length;
+ char nonce[16];
+};
+typedef struct assuan_sock_nonce_s assuan_sock_nonce_t;
+
+/* Define the Unix domain socket structure for Windows. */
+#ifndef _ASSUAN_NO_SOCKET_WRAPPER
+# ifndef AF_LOCAL
+# define AF_LOCAL AF_UNIX
+# endif
+# define EADDRINUSE WSAEADDRINUSE
+struct sockaddr_un
+{
+ short sun_family;
+ unsigned short sun_port;
+ struct in_addr sun_addr;
+ char sun_path[108-2-4];
+};
+#endif
+
+##EOF##
diff --git a/src/w32-sys-pth-impl.h b/src/w32-sys-pth-impl.h
new file mode 100644
index 0000000..ebd6ec6
--- /dev/null
+++ b/src/w32-sys-pth-impl.h
@@ -0,0 +1,39 @@
+## w32-sys-pth-impl.h - Include fragment to build assuan.h.
+## Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+##
+## Warning: This is a fragment of a macro - no empty lines please.
+ static int _assuan_pth_recvmsg (assuan_context_t ctx, assuan_fd_t fd, \
+ assuan_msghdr_t msg, int flags) \
+ { \
+ (void) ctx; \
+ gpg_err_set_errno (ENOSYS); \
+ return -1; \
+ } \
+ static int _assuan_pth_sendmsg (assuan_context_t ctx, assuan_fd_t fd, \
+ const assuan_msghdr_t msg, int flags) \
+ { \
+ (void) ctx; \
+ gpg_err_set_errno (ENOSYS); \
+ return -1; \
+ } \
+##EOF## Force end-of file.
+
diff --git a/src/w32-types.inc.h b/src/w32-types.inc.h
new file mode 100644
index 0000000..56bc7b2
--- /dev/null
+++ b/src/w32-types.inc.h
@@ -0,0 +1,23 @@
+## w32-types.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+typedef void *assuan_msghdr_t;
+##EOF##
diff --git a/src/w32ce-fd-t.inc.h b/src/w32ce-fd-t.inc.h
new file mode 100644
index 0000000..df55f23
--- /dev/null
+++ b/src/w32ce-fd-t.inc.h
@@ -0,0 +1,32 @@
+## w32ce-fd-t.inc.h - Include fragment to build assuan.h.
+## Copyright (C) 2010 Free Software Foundation, Inc.
+##
+## This file is part of Assuan.
+##
+## Assuan is free software; you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as
+## published by the Free Software Foundation; either version 2.1 of
+## the License, or (at your option) any later version.
+##
+## Assuan is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+##
+## This file is included by the mkheader tool. Lines starting with
+## a double hash mark are not copied to the destination file.
+
+typedef void *assuan_fd_t;
+#define ASSUAN_INVALID_FD ((void*)(-1))
+#define ASSUAN_INVALID_PID ((pid_t) -1)
+static inline assuan_fd_t
+assuan_fd_from_posix_fd (int fd)
+{
+ return (assuan_fd_t)(fd);
+}
+
+##EOF##