[svn] assuan - r365 - trunk/src

svn author wk cvs at cvs.gnupg.org
Tue Apr 6 18:46:31 CEST 2010


Author: wk
Date: 2010-04-06 18:46:31 +0200 (Tue, 06 Apr 2010)
New Revision: 365

Added:
   trunk/src/posix-fd-t.inc.h
   trunk/src/posix-includes.inc.h
   trunk/src/posix-sock-nonce.inc.h
   trunk/src/posix-sys-pth-impl.h
   trunk/src/posix-types.inc.h
   trunk/src/w32-fd-t.inc.h
   trunk/src/w32-includes.inc.h
   trunk/src/w32-sock-nonce.inc.h
   trunk/src/w32-sys-pth-impl.h
   trunk/src/w32-types.inc.h
   trunk/src/w32ce-fd-t.inc.h
Modified:
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/assuan.h.in
   trunk/src/mkheader.c
Log:
Removed sysdep stuff from assuan.h.
fixed a problem for W32CE and Pth.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2010-03-30 18:54:03 UTC (rev 364)
+++ trunk/src/ChangeLog	2010-04-06 16:46:31 UTC (rev 365)
@@ -1,3 +1,20 @@
+2010-04-06  Werner Koch  <wk at 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 at g10code.com>
 
 	* assuan-error.c (_assuan_w32_strerror) [W32CE]: Print only the code.

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2010-03-30 18:54:03 UTC (rev 364)
+++ trunk/src/Makefile.am	2010-04-06 16:46:31 UTC (rev 365)
@@ -41,8 +41,16 @@
 
 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 @@
 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 >$@
 

Modified: trunk/src/assuan.h.in
===================================================================
--- trunk/src/assuan.h.in	2010-03-30 18:54:03 UTC (rev 364)
+++ trunk/src/assuan.h.in	2010-04-06 16:46:31 UTC (rev 365)
@@ -29,18 +29,10 @@
 #include <stdarg.h>
 
 #ifndef _ASSUAN_NO_SOCKET_WRAPPER
-#ifdef _WIN32
-#include <ws2tcpip.h> 
-#else
-#include <sys/socket.h>
-#endif
+ at include:includes@
 #endif /*!_ASSUAN_NO_SOCKET_WRAPPER*/
 
-#ifdef _WIN32
-typedef void *assuan_msghdr_t;
-#else
-typedef struct msghdr *assuan_msghdr_t;
-#endif
+ at include:types@
 
 #include <gpg-error.h>
 
@@ -79,71 +71,12 @@
 
 struct assuan_context_s;
 typedef struct assuan_context_s *assuan_context_t;
+ at include:fd-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
-
 assuan_fd_t assuan_fdopen (int fd);
 
+ at include:sock-nonce@
 
-/* 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
-
 
 /* Global interface.  */
 
@@ -533,89 +466,7 @@
 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) \
   { (void) ctx; pth_usleep (usec); }					\
@@ -625,7 +476,7 @@
   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						\
+ at 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;                                                         \

Modified: trunk/src/mkheader.c
===================================================================
--- trunk/src/mkheader.c	2010-03-30 18:54:03 UTC (rev 364)
+++ trunk/src/mkheader.c	2010-04-06 16:46:31 UTC (rev 365)
@@ -26,7 +26,7 @@
 
 /* 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 @@
   while (fgets (line, LINESIZE, fp))
     {
       if (line[0] == '#' && line[1] == '#')
-        ;
+        {
+          if (!strncmp (line+2, "EOF##", 5))
+            break; /* Forced EOF.  */
+        }
       else
         fputs (line, stdout);
     }
@@ -72,9 +75,46 @@
 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");
     }
   else
@@ -157,16 +197,17 @@
           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 @@
     }
 
   fputs ("/*\n"
-         "Local Variables:\n"
+         "Loc" "al Variables:\n"
          "buffer-read-only: t\n"
          "End:\n"
          "*/\n", stdout);

Added: trunk/src/posix-fd-t.inc.h
===================================================================
--- trunk/src/posix-fd-t.inc.h	                        (rev 0)
+++ trunk/src/posix-fd-t.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##

Added: trunk/src/posix-includes.inc.h
===================================================================
--- trunk/src/posix-includes.inc.h	                        (rev 0)
+++ trunk/src/posix-includes.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##

Added: trunk/src/posix-sock-nonce.inc.h
===================================================================
--- trunk/src/posix-sock-nonce.inc.h	                        (rev 0)
+++ trunk/src/posix-sock-nonce.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##

Added: trunk/src/posix-sys-pth-impl.h
===================================================================
--- trunk/src/posix-sys-pth-impl.h	                        (rev 0)
+++ trunk/src/posix-sys-pth-impl.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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.
+
+

Added: trunk/src/posix-types.inc.h
===================================================================
--- trunk/src/posix-types.inc.h	                        (rev 0)
+++ trunk/src/posix-types.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##

Added: trunk/src/w32-fd-t.inc.h
===================================================================
--- trunk/src/w32-fd-t.inc.h	                        (rev 0)
+++ trunk/src/w32-fd-t.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##

Added: trunk/src/w32-includes.inc.h
===================================================================
--- trunk/src/w32-includes.inc.h	                        (rev 0)
+++ trunk/src/w32-includes.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##

Added: trunk/src/w32-sock-nonce.inc.h
===================================================================
--- trunk/src/w32-sock-nonce.inc.h	                        (rev 0)
+++ trunk/src/w32-sock-nonce.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##

Added: trunk/src/w32-sys-pth-impl.h
===================================================================
--- trunk/src/w32-sys-pth-impl.h	                        (rev 0)
+++ trunk/src/w32-sys-pth-impl.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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.
+

Added: trunk/src/w32-types.inc.h
===================================================================
--- trunk/src/w32-types.inc.h	                        (rev 0)
+++ trunk/src/w32-types.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##

Added: trunk/src/w32ce-fd-t.inc.h
===================================================================
--- trunk/src/w32ce-fd-t.inc.h	                        (rev 0)
+++ trunk/src/w32ce-fd-t.inc.h	2010-04-06 16:46:31 UTC (rev 365)
@@ -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##




More information about the Gnupg-commits mailing list