2 Copyright (C) 2018-2021 Ben Kibbey <bjk@luxsci.net>
4 This file is part of pwmd.
6 Pwmd is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 Pwmd is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
27 #include "util-string.h"
29 struct command_table_s
31 const char *name
; // The protocol command name.
32 gpg_error_t (*handler
) (assuan_context_t
, char *line
);
33 const char *help
; // Help text for this command.
34 int ignore_startup
; // Do not run file_modified() for this command.
35 int unlock
; // unlock the file mutex after validating the checksum
37 int inquire
; /* For use with BULK: whether this command inquires
38 data. Command data is normally passed directly to
39 the handler , but some commands
40 (OPEN/SAVE/GENKEY/PASSWD) may need to inquire data
41 as well. This flag is to limit the number of BULK
42 status messages in the BULK command to only those
43 that need it. It is an indicator to the client of
44 which command is inquiring the data. See
45 dispatch_bulk_commands(). */
49 char *tag
; // A tag or token name.
50 size_t taglen
; // The length of .tag.
51 char *data
; // Data associated with .tag.
52 size_t datalen
; // The length of .data.
53 void *user
; // User data associated with this tag and data.
54 struct sexp_s
**next
; // Next tag list.
59 struct command_table_s
*cmd
; // Associated command for the sexp tag.
60 char *result
; // The command result (xfer_data()).
61 size_t result_len
; // The length of the command result.
62 int ran
; /* Whether this command should be included in
63 the returned BULK command result. */
64 gpg_error_t rc
; // Result code for this command.
67 gpg_error_t
bulk_parse_commands (struct sexp_s
***, const char *str
,
68 struct command_table_s
**);
69 gpg_error_t
bulk_build_result (struct sexp_s
**, char **);
70 void bulk_free_list (struct sexp_s
**);