gpgme-tool socket interface

W. Trevor King wking at
Thu Oct 11 21:07:43 CEST 2012

On Thu, Oct 11, 2012 at 05:18:30PM +0200, Werner Koch wrote:
> > b) gpgme: copy gpg-agent's socket handling code into gpgme-tool (with
> >    copy-paste commits for proper attribution, followed by integration
> Fine.  However, gpg-agent heavily relies on nPth semantics.  This is
> probably not what you want.

The socket setup and teardown shouldn't be too tied up in the
threading, so I'll take a look.

> > c) same as (b), but I'll write up the socket handling from scratch
> >    (man pages, etc.) to keep the code-base distinct from GnuPG.  Since
> >    I can't look at gpg-agent's code, I'll probably someone else to
> >    handle the MS Windows side, if people want that to be supported.
> Actually we have a platform independent socket abstraction in libassuan
> for that purpose.  Check out how it is done in dirmngr or gpg-agent.

Good point.  I'm talking a look at that now.

On Thu, Oct 11, 2012 at 05:20:24PM +0200, Werner Koch wrote:
> On Wed, 10 Oct 2012 17:22, wking at said:
> > A very rough commit along the lines of (c) is in my `socket` branch
> Is there a reason why you do not use assuan_sock_new et al?

I didn't read the libassuan manual thoroughly enough ;).

I'm a bit confused about how to handle listen() and accept(), which
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
`int`s.  Perhaps I should be using assuan_fdopen() instead of
INT2FD()?  I'm not sure what the most idomatic approach is.

I've rebased my socket branch against the new master, and slacked off
on commit messages.  I'll beat them back into shape once the code gets
to a merge-able state.

This email may be signed or encrypted with GnuPG (
For more information, see
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20121011/1629dd14/attachment-0001.pgp>

More information about the Gnupg-devel mailing list