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 as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
11 Pwmd is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
28 #include "util-string.h"
30 struct command_table_s
32 const char *name
; // The protocol command name.
33 gpg_error_t (*handler
) (assuan_context_t
, char *line
);
34 const char *help
; // Help text for this command.
35 int ignore_startup
; // Do not run file_modified() for this command.
36 int unlock
; // unlock the file mutex after validating the checksum
38 int inquire
; /* For use with BULK: whether this command inquires
39 data. Command data is normally passed directly to
40 the handler , but some commands
41 (OPEN/SAVE/GENKEY/PASSWD) may need to inquire data
42 as well. This flag is to limit the number of BULK
43 status messages in the BULK command to only those
44 that need it. It is an indicator to the client of
45 which command is inquiring the data. See
46 dispatch_bulk_commands(). */
50 char *tag
; // A tag or token name.
51 size_t taglen
; // The length of .tag.
52 char *data
; // Data associated with .tag.
53 size_t datalen
; // The length of .data.
54 void *user
; // User data associated with this tag and data.
55 struct sexp_s
**next
; // Next tag list.
60 struct command_table_s
*cmd
; // Associated command for the sexp tag.
61 char *result
; // The command result (xfer_data()).
62 size_t result_len
; // The length of the command result.
63 int ran
; /* Whether this command should be included in
64 the returned BULK command result. */
65 gpg_error_t rc
; // Result code for this command.
68 gpg_error_t
bulk_parse_commands (struct sexp_s
***, const char *str
,
69 struct command_table_s
**);
70 gpg_error_t
bulk_build_result (struct sexp_s
**, char **);
71 void bulk_free_list (struct sexp_s
**);