summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2017-12-07 13:41:46 +0100
committerWerner Koch <wk@gnupg.org>2017-12-07 13:41:46 +0100
commit90dc81682b13a7cf716a8a26b891051cbd4b0caf (patch)
tree3232088899d6e9919e7bb4b2303d121b9f7493da
parenta627350eed5dc32bac41195462f27dee1987b0f5 (diff)
downloadlibassuan-90dc81682b13a7cf716a8a26b891051cbd4b0caf.tar.gz
Allow change of system hooks for assuan_sock_...
* src/assuan-socket.c (assuan_sock_set_system_hooks): New. * src/assuan.h.in (assuan_sock_set_system_hooks): New prototype. * src/libassuan.def: Add new function. * src/libassuan.vers: Add new function. -- Co-authored-by: wk@gnupg.org Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r--NEWS11
-rw-r--r--configure.ac10
-rw-r--r--doc/assuan.texi8
-rw-r--r--src/assuan-socket.c7
-rw-r--r--src/assuan.h.in9
-rw-r--r--src/libassuan.def1
-rw-r--r--src/libassuan.vers1
7 files changed, 39 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 022af96..e2937d7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,15 @@
-Noteworthy changes in version 2.4.6 (unreleased) [C7/A7/R_]
+Noteworthy changes in version 2.5.0 (unreleased) [C8/A8/R0]
------------------------------------------------
+ * New function to change the system hooks for the socket
+ interface. [#3378]
+
+ * Fix the use of the internal usleep in the nPth implementation.
+
+ * Interface changes relative to the 2.4.0 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ assuan_sock_set_system_hooks NEW.
+
Noteworthy changes in version 2.4.5 (2017-12-01) [C7/A7/R5]
------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 40c378c..4128f18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,8 +32,8 @@ min_automake_version="1.14"
# for the LT versions.
m4_define([mym4_package],[libassuan])
m4_define([mym4_major], [2])
-m4_define([mym4_minor], [4])
-m4_define([mym4_micro], [6])
+m4_define([mym4_minor], [5])
+m4_define([mym4_micro], [0])
# To start a new development series, i.e a new major or minor number
# you need to mark an arbitrary commit before the first beta release
@@ -61,9 +61,9 @@ AC_INIT([mym4_package],[mym4_version], [https://bugs.gnupg.org])
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBASSUAN_LT_CURRENT=7
-LIBASSUAN_LT_AGE=7
-LIBASSUAN_LT_REVISION=5
+LIBASSUAN_LT_CURRENT=8
+LIBASSUAN_LT_AGE=8
+LIBASSUAN_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
LIBASSUAN_CONFIG_API_VERSION=2
diff --git a/doc/assuan.texi b/doc/assuan.texi
index aae3de7..5c423d0 100644
--- a/doc/assuan.texi
+++ b/doc/assuan.texi
@@ -994,11 +994,19 @@ Set the default system hooks to use. There is currently no way to
reset to the default system hooks.
@end deftypefun
+@deftypefun void assuan_sock_set_system_hooks (@w{assuan_system_hooks_t @var{system_hooks}})
+The socket subsystem uses an internal context which uses the default
+system hooks. This function allows to change these system hooks. The
+function is not thread-safe and only useful if a certain order of
+assuan and assuan socket initializations are required.
+@end deftypefun
+
@deftypefun void assuan_ctx_set_system_hooks (@w{assuan_context_t @var{ctx}}, @w{assuan_system_hooks_t @var{system_hooks}})
Set the system hooks for context @var{ctx}. There is currently no way
to reset to the default system hooks, create a new context for that.
@end deftypefun
+
The following system hook collections are defined by the library for
your convenience:
diff --git a/src/assuan-socket.c b/src/assuan-socket.c
index adcd40a..7fb2201 100644
--- a/src/assuan-socket.c
+++ b/src/assuan-socket.c
@@ -1495,3 +1495,10 @@ assuan_sock_check_nonce (assuan_fd_t fd, assuan_sock_nonce_t *nonce)
{
return _assuan_sock_check_nonce (sock_ctx, fd, nonce);
}
+
+void
+assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks)
+{
+ if (sock_ctx)
+ _assuan_system_hooks_copy (&sock_ctx->system, system_hooks);
+}
diff --git a/src/assuan.h.in b/src/assuan.h.in
index 9594e73..cfa4409 100644
--- a/src/assuan.h.in
+++ b/src/assuan.h.in
@@ -490,15 +490,20 @@ int assuan_sock_set_sockaddr_un (const char *fname, struct sockaddr *addr,
int assuan_sock_get_nonce (struct sockaddr *addr, int addrlen,
assuan_sock_nonce_t *nonce);
int assuan_sock_check_nonce (assuan_fd_t fd, assuan_sock_nonce_t *nonce);
+void assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks);
-/* Set the default or per context system callbacks. This is
- irreversible. */
+/* Set the default system callbacks. This is irreversible. */
void assuan_set_system_hooks (assuan_system_hooks_t system_hooks);
+/* Set the per context system callbacks. This is irreversible. */
void assuan_ctx_set_system_hooks (assuan_context_t ctx,
assuan_system_hooks_t system_hooks);
+/* Change the system hooks for the socket interface.
+ * This is not thread-safe. */
+void assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks);
+
void __assuan_usleep (assuan_context_t ctx, unsigned int usec);
int __assuan_pipe (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx);
int __assuan_close (assuan_context_t ctx, assuan_fd_t fd);
diff --git a/src/libassuan.def b/src/libassuan.def
index 7e32a3d..ed9ceaf 100644
--- a/src/libassuan.def
+++ b/src/libassuan.def
@@ -115,6 +115,7 @@ EXPORTS
assuan_sock_set_flag @94
assuan_sock_get_flag @95
assuan_sock_connect_byname @96
+ assuan_sock_set_system_hooks @97
; END
diff --git a/src/libassuan.vers b/src/libassuan.vers
index a178127..c9cd5d7 100644
--- a/src/libassuan.vers
+++ b/src/libassuan.vers
@@ -106,6 +106,7 @@ LIBASSUAN_1.0 {
assuan_sock_set_flag;
assuan_sock_get_flag;
assuan_sock_connect_byname;
+ assuan_sock_set_system_hooks;
__assuan_close;
__assuan_pipe;