gpgme-tool socket interface

Werner Koch wk at gnupg.org
Thu Oct 11 21:59:06 CEST 2012


On Thu, 11 Oct 2012 21:07, wking at tremily.us said:

> I'm a bit confused about how to handle listen() and accept(), which

There was no immediate need to wrap them.  We can do that of course.

> are not wrapped by libassuan.  libassuan's test/ce-server.c uses
> SOCKET2HANDLE() and HANDLE2SOCKET() defined in assuan-def.h to convert
> between `assuan_fd_t`s and `int`s, while gpg-agent uses INT2FD() and
> FD2INT() defined in sysutils.h to convert between `gnupg_fd_t`s and

That is all a mess.  The casting won't work on 64 bit Windows due to
sizeof(void*) > sizeof(int); i.e. HANDLE vs. int.  There are also a lot
of other maintenance problems with them due to the non-unified usage of
file descriptors in Windows (System handles, several different libc fd,
sockets, etc).  Back then when I ported GnuPG to CE, the plan was to
soon start with a clean way of addressing this.  However a 64 bit GnuPG
port is not on the horizon anymore.  The code in Libassuan is likely
better.

> `int`s.  Perhaps I should be using assuan_fdopen() instead of
> INT2FD()?  I'm not sure what the most idomatic approach is.

Better try to stay away from that mess ;-).


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-devel mailing list