1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

dirmngr: Factor some prototypes out to dirmngr-status.h.

* dirmngr/dirmngr-status.h: New.
* dirmngr/dirmngr.h: Include dirmngr-status.h and move some prototypes
to that file.
* dirmngr/t-support.c: New.
* dirmngr/Makefile.am (t_common_src): Add new file.
--

This helps to backport changes from master.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-11-18 18:39:42 +01:00
parent 0f37727fca
commit 466bdf7c07
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
4 changed files with 87 additions and 9 deletions

View File

@ -62,7 +62,7 @@ dirmngr_SOURCES = dirmngr.c dirmngr.h server.c crlcache.c crlfetch.c \
domaininfo.c \ domaininfo.c \
workqueue.c \ workqueue.c \
loadswdb.c \ loadswdb.c \
cdb.h cdblib.c misc.c dirmngr-err.h \ cdb.h cdblib.c misc.c dirmngr-err.h dirmngr-status.h \
ocsp.c ocsp.h validate.c validate.h \ ocsp.c ocsp.h validate.c validate.h \
dns-stuff.c dns-stuff.h \ dns-stuff.c dns-stuff.h \
http.c http.h http-common.c http-common.h http-ntbtls.c \ http.c http.h http-common.c http-common.h http-ntbtls.c \
@ -111,7 +111,7 @@ dirmngr_client_LDADD = $(libcommon) \
dirmngr_client_LDFLAGS = $(extra_bin_ldflags) dirmngr_client_LDFLAGS = $(extra_bin_ldflags)
t_common_src = t-support.h t_common_src = t-support.h t-support.c
if USE_LIBDNS if USE_LIBDNS
t_common_src += dns.c dns.h t_common_src += dns.c dns.h
endif endif

39
dirmngr/dirmngr-status.h Normal file
View File

@ -0,0 +1,39 @@
/* dirmngr-status.h - Status code helper functions for dirmnmgr.
* Copyright (C) 2004, 2014, 2015, 2018 g10 Code GmbH
*
* This file is part of GnuPG.
*
* GnuPG is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* GnuPG 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0+
*/
/* We keep them separate so that we don't always need to include the
* entire dirmngr.h */
#ifndef DIRMNGR_STATUS_H
#define DIRMNGR_STATUS_H
/*-- server.c --*/
gpg_error_t dirmngr_status (ctrl_t ctrl, const char *keyword, ...);
gpg_error_t dirmngr_status_help (ctrl_t ctrl, const char *text);
gpg_error_t dirmngr_status_helpf (ctrl_t ctrl, const char *format,
...) GPGRT_ATTR_PRINTF(2,3);
gpg_error_t dirmngr_status_printf (ctrl_t ctrl, const char *keyword,
const char *format,
...) GPGRT_ATTR_PRINTF(3,4);
#endif /* DIRMNGR_STATUS_H */

View File

@ -36,6 +36,7 @@
#include "../common/sysutils.h" /* (gnupg_fd_t) */ #include "../common/sysutils.h" /* (gnupg_fd_t) */
#include "../common/asshelp.h" /* (assuan_context_t) */ #include "../common/asshelp.h" /* (assuan_context_t) */
#include "../common/i18n.h" #include "../common/i18n.h"
#include "dirmngr-status.h"
#include "http.h" /* (parsed_uri_t) */ #include "http.h" /* (parsed_uri_t) */
/* This objects keeps information about a particular LDAP server and /* This objects keeps information about a particular LDAP server and
@ -229,15 +230,10 @@ gpg_error_t get_istrusted_from_client (ctrl_t ctrl, const char *hexfpr);
int dirmngr_assuan_log_monitor (assuan_context_t ctx, unsigned int cat, int dirmngr_assuan_log_monitor (assuan_context_t ctx, unsigned int cat,
const char *msg); const char *msg);
void start_command_handler (gnupg_fd_t fd, unsigned int session_id); void start_command_handler (gnupg_fd_t fd, unsigned int session_id);
gpg_error_t dirmngr_status (ctrl_t ctrl, const char *keyword, ...);
gpg_error_t dirmngr_status_help (ctrl_t ctrl, const char *text);
gpg_error_t dirmngr_status_helpf (ctrl_t ctrl, const char *format,
...) GPGRT_ATTR_PRINTF(2,3);
gpg_error_t dirmngr_status_printf (ctrl_t ctrl, const char *keyword,
const char *format,
...) GPGRT_ATTR_PRINTF(3,4);
gpg_error_t dirmngr_tick (ctrl_t ctrl); gpg_error_t dirmngr_tick (ctrl_t ctrl);
/* (See also dirmngr-status.h) */
/*-- http-ntbtls.c --*/ /*-- http-ntbtls.c --*/
/* Note that we don't use a callback for gnutls. */ /* Note that we don't use a callback for gnutls. */

43
dirmngr/t-support.c Normal file
View File

@ -0,0 +1,43 @@
/* t-support.c - Module test support (stubs etc).
* Copyright (C) 2018 g10 Code GmbH
*
* This file is part of GnuPG.
*
* GnuPG is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* GnuPG 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
* SPDX-License-Identifier: GPL-3.0+
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "../common/util.h"
#include "dirmngr-status.h"
#include "t-support.h"
/* Stub for testing. See server.c for the real implementation. */
gpg_error_t
dirmngr_status_printf (ctrl_t ctrl, const char *keyword,
const char *format, ...)
{
(void)ctrl;
(void)keyword;
(void)format;
return 0;
}