[git] Assuan - branch, master, updated. libassuan-2.0.3-9-gca3f8e4

by W. Trevor King cvs at cvs.gnupg.org
Tue Jun 5 18:20:28 CEST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPC library used by GnuPG".

The branch, master has been updated
       via  ca3f8e4b5bbe5549bd7804cf3bff36be21db1b82 (commit)
       via  7cf99d04d864fb308159fb928057f59eb4e5a110 (commit)
       via  f40f8033b21bad8801b43676b486dab80c532397 (commit)
      from  861d19e028af70c7009640efc98eb485fff546d7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ca3f8e4b5bbe5549bd7804cf3bff36be21db1b82
Author: W. Trevor King <wking at tremily.us>
Date:   Fri Apr 20 15:18:03 2012 -0400

    src/assuan-handler.c: add help strings for standard commands.
    
    Signed-off-by: W. Trevor King <wking at tremily.us>

diff --git a/src/assuan-handler.c b/src/assuan-handler.c
index 28fcdfd..dca5968 100644
--- a/src/assuan-handler.c
+++ b/src/assuan-handler.c
@@ -49,12 +49,20 @@ dummy_handler (assuan_context_t ctx, char *line)
 }
 
 
+static const char std_help_nop[] =
+  "NOP\n"
+  "\n"
+  "No operation.  Returns OK without any action.";
 static gpg_error_t
 std_handler_nop (assuan_context_t ctx, char *line)
 {
   return PROCESS_DONE (ctx, 0); /* okay */
 }
 
+static const char std_help_cancel[] =
+  "CANCEL\n"
+  "\n"
+  "Run the server's cancel handler if one has been registered.";
 static gpg_error_t
 std_handler_cancel (assuan_context_t ctx, char *line)
 {
@@ -64,6 +72,14 @@ std_handler_cancel (assuan_context_t ctx, char *line)
   return PROCESS_DONE (ctx, set_error (ctx, GPG_ERR_NOT_IMPLEMENTED, NULL));
 }
 
+static const char std_help_option[] =
+  "OPTION <NAME> [ [=] <VALUE> ]\n"
+  "\n"
+  "Set option <NAME> to configure server operation.  Leading and\n"
+  "trailing spaces around <NAME> and <VALUE> are allowed but should be\n"
+  "ignored.  For compatibility reasons, <NAME> may be prefixed with two\n"
+  "dashes.  The use of the equal sign is optional but suggested if\n"
+  "<VALUE> is given.";
 static gpg_error_t
 std_handler_option (assuan_context_t ctx, char *line)
 {
@@ -117,6 +133,10 @@ std_handler_option (assuan_context_t ctx, char *line)
   return PROCESS_DONE (ctx, 0);
 }
 
+static const char std_help_bye[] =
+  "BYE\n"
+  "\n"
+  "Close the connection.  The server will reply with OK.";
 static gpg_error_t
 std_handler_bye (assuan_context_t ctx, char *line)
 {
@@ -130,12 +150,21 @@ std_handler_bye (assuan_context_t ctx, char *line)
   return PROCESS_DONE (ctx, 0);
 }
 
+static const char std_help_auth[] =
+  "AUTH\n"
+  "\n"
+  "Reserved for future extensions.";
 static gpg_error_t
 std_handler_auth (assuan_context_t ctx, char *line)
 {
   return PROCESS_DONE (ctx, set_error (ctx, GPG_ERR_NOT_IMPLEMENTED, NULL));
 }
 
+static const char std_help_reset[] =
+  "RESET\n"
+  "\n"
+  "Reset the connection but not any existing authentication.  The server\n"
+  "should release all resources associated with the connection.";
 static gpg_error_t
 std_handler_reset (assuan_context_t ctx, char *line)
 {
@@ -152,6 +181,12 @@ std_handler_reset (assuan_context_t ctx, char *line)
   return PROCESS_DONE (ctx, err);
 }
 
+static const char std_help_help[] =
+  "HELP [<COMMAND>]\n"
+  "\n"
+  "Lists all commands that the server understands as comment lines on\n"
+  "the status channel.  If <COMMAND> is given, list detailed help for\n"
+  "that command.";
 static gpg_error_t
 std_handler_help (assuan_context_t ctx, char *line)
 {
@@ -211,7 +246,10 @@ std_handler_help (assuan_context_t ctx, char *line)
   return PROCESS_DONE (ctx, 0);
 }
 
-
+static const char std_help_end[] =
+  "END\n"
+  "\n"
+  "Used by a client to mark the end of raw data.";
 static gpg_error_t
 std_handler_end (assuan_context_t ctx, char *line)
 {
@@ -255,7 +293,13 @@ assuan_command_parse_fd (assuan_context_t ctx, char *line, assuan_fd_t *rfd)
 }
 
 
-/* Format is INPUT FD=<n> */
+static const char std_help_input[] =
+  "INPUT FD[=<N>]\n"
+  "\n"
+  "Used by a client to pass an input file descriptor to the server.\n"
+  "The server opens <N> as a local file descriptor.  Without <N>, the\n"
+  "server opens the file descriptor just sent by the client using\n"
+  "assuan_sendfd.";
 static gpg_error_t
 std_handler_input (assuan_context_t ctx, char *line)
 {
@@ -290,7 +334,13 @@ std_handler_input (assuan_context_t ctx, char *line)
 }
 
 
-/* Format is OUTPUT FD=<n> */
+static const char std_help_output[] =
+  "OUTPUT FD[=<N>]\n"
+  "\n"
+  "Used by a client to pass an output file descriptor to the server.\n"
+  "The server opens <N> as a local file descriptor.  Without <N>, the\n"
+  "server opens the file descriptor just sent by the client using\n"
+  "assuan_sendfd.";
 static gpg_error_t
 std_handler_output (assuan_context_t ctx, char *line)
 {
@@ -331,21 +381,21 @@ std_handler_output (assuan_context_t ctx, char *line)
 static struct {
   const char *name;
   gpg_error_t (*handler)(assuan_context_t, char *line);
+  const char *help;
   int always; /* always initialize this command */
 } std_cmd_table[] = {
-  { "NOP",    std_handler_nop, 1 },
-  { "CANCEL", std_handler_cancel, 1 },
-  { "OPTION", std_handler_option, 1 },
-  { "BYE",    std_handler_bye, 1 },
-  { "AUTH",   std_handler_auth, 1 },
-  { "RESET",  std_handler_reset, 1 },
-  { "END",    std_handler_end, 1 },
-  { "HELP",   std_handler_help, 1 },
-
-  { "INPUT",  std_handler_input, 0 },
-  { "OUTPUT", std_handler_output, 0 },
-  { NULL, NULL, 0 }
-};
+  { "NOP",    std_handler_nop, std_help_nop, 1 },
+  { "CANCEL", std_handler_cancel, std_help_cancel, 1 },
+  { "OPTION", std_handler_option, std_help_option, 1 },
+  { "BYE",    std_handler_bye, std_help_bye, 1 },
+  { "AUTH",   std_handler_auth, std_help_auth, 1 },
+  { "RESET",  std_handler_reset, std_help_reset, 1 },
+  { "END",    std_handler_end, std_help_end, 1 },
+  { "HELP",   std_handler_help, std_help_help, 1 },
+
+  { "INPUT",  std_handler_input, std_help_input, 0 },
+  { "OUTPUT", std_handler_output, std_help_output, 0 },
+  { } };
 
 
 /**

commit 7cf99d04d864fb308159fb928057f59eb4e5a110
Author: W. Trevor King <wking at tremily.us>
Date:   Thu Apr 19 20:19:46 2012 -0400

    Update example code for pipe server.
    
    * doc/assuan.texi: Fix server example code to use assuan_new.

diff --git a/doc/assuan.texi b/doc/assuan.texi
index 9ea7804..ddac37a 100644
--- a/doc/assuan.texi
+++ b/doc/assuan.texi
@@ -741,6 +741,7 @@ GPGME and an application using GPGME, the context is very extensive
 and covers utilitary information like memory allocation callbacks as
 well as specific information associated with client/server operations.
 
+ at anchor{function assuan_new}
 @deftypefun gpg_error_t assuan_new (@w{assuan_context_t *@var{ctx_p}})
 The function @code{assuan_new} creates a new context, using the global
 default memory allocation, log handler and @code{libgpg-error} source.
@@ -1230,16 +1231,24 @@ command_handler (int fd)
   int i;
   assuan_context_t ctx;
 
+  rc = assuan_new (&ctx);
+  if (rc)
+    @{
+      fprintf (stderr, "server context creation failed: %s\n",
+               gpg_strerror(rc));
+      return;
+    @}
+
   if (fd == -1)
     @{
       assuan_fd_t filedes[2];
 
-      filedes[0] = assuan_fd_from_posix (0);
-      filedes[1] = assuan_fd_from_posix (1);
-      rc = assuan_init_pipe_server (&ctx, filedes);
+      filedes[0] = assuan_fd_from_posix_fd (0);
+      filedes[1] = assuan_fd_from_posix_fd (1);
+      rc = assuan_init_pipe_server (ctx, filedes);
     @}
   else
-    rc = assuan_init_socket_server (&ctx, fd, ASSUAN_SOCKET_SERVER_ACCEPTED);
+    rc = assuan_init_socket_server (ctx, fd, ASSUAN_SOCKET_SERVER_ACCEPTED);
   if (rc)
     @{
       fprintf (stderr, "server init failed: %s\n", gpg_strerror (rc));
@@ -1248,13 +1257,16 @@ command_handler (int fd)
 @end example
 
 @noindent
-This is the first part of the command handler.  In case this is called
-as a pipe based server, @var{fd} will be based as @var{fd} and the
-code assumes that the server's @code{stdin} and @code{stdout} file
-handles are connected to a pipe.  The initialization is thus done
-using the function:
+This is the first part of the command handler.  We start of by
+allocating a new Assuan context with @code{assuan_new}.
+ at xref{function assuan_new}.
+
+In case this is called as a pipe based server, @var{fd} will be based
+as @var{fd} and the code assumes that the server's @code{stdin} and
+ at code{stdout} file handles are connected to a pipe.  The
+initialization is thus done using the function:
 
- at deftypefun gpg_error_t assuan_init_pipe_server (@w{assuan_context_t *@var{r_ctx}}, @w{assuan_fd_t @var{filedes}[2]})
+ at deftypefun gpg_error_t assuan_init_pipe_server (@w{assuan_context_t @var{ctx}}, @w{assuan_fd_t @var{filedes}[2]})
 
 The function takes the two file descriptors from @var{filedes} and
 returns a new Assuan context at @var{r_ctx}.  As usual, a return value
@@ -1270,15 +1282,11 @@ by the client to connect to such a server, automagically sets this
 variable.
 @end deftypefun
 
- at noindent
-If a file descriptor has been passed, the assuan context gets
-initialized by the function:
-
- at deftypefun gpg_error_t assuan_init_socket_server (@w{assuan_context_t *@var{r_ctx}}, @w{assuan_fd_t @var{fd}}, @w{unsigned int @var{flags}})
+ at deftypefun gpg_error_t assuan_init_socket_server (@w{assuan_context_t @var{ctx}}, @w{assuan_fd_t @var{fd}}, @w{unsigned int @var{flags}})
 
-The function takes the file descriptor @var{fd} which is expected to be
-associated with a socket and returns a new Assuan context at
- at var{r_ctx}. The following bits are currently defined for @var{flags}:
+The function takes the file descriptor @var{fd} which is expected to
+be associated with a socket and an Assuan context @var{ctx}. The
+following bits are currently defined for @var{flags}:
 
 @table @code
 @item ASSUAN_SOCKET_SERVER_FDPASSING
@@ -1291,8 +1299,7 @@ bit as it allows better control of the connection state.
 @end table
 
 As usual, a return value of @code{0} indicates success and a failure
-is indicated by a returning an error value.  In case of error,
- at code{NULL} will be stored at @var{r_ctx}.
+is indicated by a returning an error value.
 @end deftypefun
 
 @noindent

commit f40f8033b21bad8801b43676b486dab80c532397
Author: W. Trevor King <wking at tremily.us>
Date:   Thu Apr 19 20:19:43 2012 -0400

    Wrap reference to END with @code.
    
    * doc/assuan.texi: Wrap reference to END with @code{}.

diff --git a/doc/assuan.texi b/doc/assuan.texi
index 1d48391..9ea7804 100644
--- a/doc/assuan.texi
+++ b/doc/assuan.texi
@@ -336,8 +336,8 @@ Reset the connection but not any existing authentication.  The server
 should release all resources associated with the connection.
 
 @item END
-Used by a client to mark the end of raw data.  The server may send END
-to indicate a partial end of data.
+Used by a client to mark the end of raw data.  The server may send
+ at code{END} to indicate a partial end of data.
 
 @item HELP
 Lists all commands that the server understands as comment lines on the

-----------------------------------------------------------------------

Summary of changes:
 doc/assuan.texi      |   51 +++++++++++++++++-------------
 src/assuan-handler.c |   82 ++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 95 insertions(+), 38 deletions(-)


hooks/post-receive
-- 
IPC library used by GnuPG
http://git.gnupg.org




More information about the Gnupg-commits mailing list