aboutsummaryrefslogtreecommitdiffstats
path: root/src/assuan.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/assuan.h')
-rw-r--r--src/assuan.h265
1 files changed, 55 insertions, 210 deletions
diff --git a/src/assuan.h b/src/assuan.h
index f2d2feb..306dd75 100644
--- a/src/assuan.h
+++ b/src/assuan.h
@@ -1,21 +1,20 @@
/* assuan.h - Definitions for the Assuan IPC library
- * Copyright (C) 2001, 2002, 2003, 2005, 2007,
- * 2008 Free Software Foundation, Inc.
- *
- * This file is part of Assuan.
- *
- * Assuan is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * Assuan 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * Copyright (C) 2001-2003, 2005, 2007-2009 Free Software Foundation, Inc.
+
+ This file is part of Assuan.
+
+ Assuan is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ Assuan 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ASSUAN_H
@@ -30,6 +29,9 @@
#else
#include <sys/socket.h>
#endif
+
+#include <gpg-error.h>
+
#endif /*!_ASSUAN_NO_SOCKET_WRAPPER*/
/* To use this file with libraries the following macros are useful:
@@ -38,11 +40,6 @@
This prefixes all external symbols with "_foo_".
- #define _ASSUAN_ONLY_GPG_ERRORS
-
- If this is defined all old-style Assuan error codes are made
- inactive as well as other deprecated stuff.
-
#define _ASSUAN_NO_SOCKET_WRAPPER
Do not include the definitions for the socket wrapper feature.
@@ -101,8 +98,6 @@
#define assuan_init_pipe_server _ASSUAN_PREFIX(assuan_init_pipe_server)
#define assuan_deinit_server _ASSUAN_PREFIX(assuan_deinit_server)
#define assuan_init_socket_server _ASSUAN_PREFIX(assuan_init_socket_server)
-#define assuan_init_connected_socket_server \
- _ASSUAN_PREFIX(assuan_init_connected_socket_server)
#define assuan_init_socket_server_ext \
_ASSUAN_PREFIX(assuan_init_socket_server_ext)
#define assuan_pipe_connect _ASSUAN_PREFIX(assuan_pipe_connect)
@@ -130,7 +125,6 @@
#define assuan_set_io_monitor _ASSUAN_PREFIX(assuan_set_io_monitor)
#define assuan_begin_confidential _ASSUAN_PREFIX(assuan_begin_confidential)
#define assuan_end_confidential _ASSUAN_PREFIX(assuan_end_confidential)
-#define assuan_strerror _ASSUAN_PREFIX(assuan_strerror)
#define assuan_set_assuan_err_source \
_ASSUAN_PREFIX(assuan_set_assuan_err_source)
#define assuan_set_assuan_log_stream \
@@ -141,7 +135,6 @@
_ASSUAN_PREFIX(assuan_get_assuan_log_prefix)
#define assuan_set_flag _ASSUAN_PREFIX(assuan_set_flag)
#define assuan_get_flag _ASSUAN_PREFIX(assuan_get_flag)
-#define assuan_pipe_connect2 _ASSUAN_PREFIX(assuan_pipe_connect2)
#define assuan_set_assuan_log_prefix \
_ASSUAN_PREFIX(assuan_set_assuan_log_prefix)
#define assuan_sock_close _ASSUAN_PREFIX(assuan_sock_close)
@@ -224,157 +217,24 @@ extern "C"
#endif
-/* Assuan error codes. These are only used by old applications or
- those applications which won't make use of libgpg-error. */
-#ifndef _ASSUAN_ONLY_GPG_ERRORS
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_No_Error 0
-#endif
-#define ASSUAN_General_Error 1
-#define ASSUAN_Out_Of_Core 2
-#define ASSUAN_Invalid_Value 3
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_Timeout 4
-#endif
-#define ASSUAN_Read_Error 5
-#define ASSUAN_Write_Error 6
-#define ASSUAN_Problem_Starting_Server 7
-#define ASSUAN_Not_A_Server 8
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_Not_A_Client 9
-#endif
-#define ASSUAN_Nested_Commands 10
-#define ASSUAN_Invalid_Response 11
-#define ASSUAN_No_Data_Callback 12
-#define ASSUAN_No_Inquire_Callback 13
-#define ASSUAN_Connect_Failed 14
-#define ASSUAN_Accept_Failed 15
-
- /* Error codes above 99 are meant as status codes */
-#define ASSUAN_Not_Implemented 100
-#define ASSUAN_Server_Fault 101
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_Invalid_Command 102
-#endif
-#define ASSUAN_Unknown_Command 103
-#define ASSUAN_Syntax_Error 104
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_Parameter_Error 105
-#endif
-#define ASSUAN_Parameter_Conflict 106
-#define ASSUAN_Line_Too_Long 107
-#define ASSUAN_Line_Not_Terminated 108
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_No_Input 109
-#define ASSUAN_No_Output 110
-#endif
-#define ASSUAN_Canceled 111
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_Unsupported_Algorithm 112
-#define ASSUAN_Server_Resource_Problem 113
-#define ASSUAN_Server_IO_Error 114
-#define ASSUAN_Server_Bug 115
-#define ASSUAN_No_Data_Available 116
-#define ASSUAN_Invalid_Data 117
-#endif
-#define ASSUAN_Unexpected_Command 118
-#define ASSUAN_Too_Much_Data 119
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_Inquire_Unknown 120
-#define ASSUAN_Inquire_Error 121
-#define ASSUAN_Invalid_Option 122
-#define ASSUAN_Invalid_Index 123
-#define ASSUAN_Unexpected_Status 124
-#define ASSUAN_Unexpected_Data 125
-#define ASSUAN_Invalid_Status 126
-#define ASSUAN_Locale_Problem 127
-#endif
-#define ASSUAN_Not_Confirmed 128
-
- /* Warning: Don't use the Error codes, below they are deprecated. */
-#ifndef _ASSUAN_IN_LIBASSUAN
-#define ASSUAN_Bad_Certificate 201
-#define ASSUAN_Bad_Certificate_Chain 202
-#define ASSUAN_Missing_Certificate 203
-#define ASSUAN_Bad_Signature 204
-#define ASSUAN_No_Agent 205
-#define ASSUAN_Agent_Error 206
-#define ASSUAN_No_Public_Key 207
-#define ASSUAN_No_Secret_Key 208
-#define ASSUAN_Invalid_Name 209
-
-#define ASSUAN_Cert_Revoked 301
-#define ASSUAN_No_CRL_For_Cert 302
-#define ASSUAN_CRL_Too_Old 303
-#define ASSUAN_Not_Trusted 304
-
-#define ASSUAN_Card_Error 401
-#define ASSUAN_Invalid_Card 402
-#define ASSUAN_No_PKCS15_App 403
-#define ASSUAN_Card_Not_Present 404
-#define ASSUAN_Invalid_Id 405
-
- /* Error codes in the range 1000 to 9999 may be used by applications
- at their own discretion. */
-#define ASSUAN_USER_ERROR_FIRST 1000
-#define ASSUAN_USER_ERROR_LAST 9999
-#endif
-
-typedef int assuan_error_t;
+/* Definitions of flags for assuan_set_flag(). */
+typedef unsigned int assuan_flag_t;
-typedef assuan_error_t AssuanError _ASSUAN_DEPRECATED;
+/* When using a pipe server, by default Assuan will wait for the
+ forked process to die in assuan_disconnect. In certain cases this
+ is not desirable. By setting this flag, the waitpid will be
+ skipped and the caller is responsible to cleanup a forked
+ process. */
+#define ASSUAN_NO_WAITPID 1
+/* This flag indicates whether Assuan logging is in confidential
+ mode. Use assuan_{begin,end}_condidential to change the mode. */
+#define ASSUAN_CONFIDENTIAL 2
-/* This is a list of pre-registered ASSUAN commands */
-/* Note, these command IDs are now deprectated and solely exists for
- compatibility reasons. */
-typedef enum
-{
- ASSUAN_CMD_NOP = 0,
- ASSUAN_CMD_CANCEL, /* cancel the current request */
- ASSUAN_CMD_BYE,
- ASSUAN_CMD_AUTH,
- ASSUAN_CMD_RESET,
- ASSUAN_CMD_OPTION,
- ASSUAN_CMD_DATA,
- ASSUAN_CMD_END,
- ASSUAN_CMD_INPUT,
- ASSUAN_CMD_OUTPUT,
-
- ASSUAN_CMD_USER = 256 /* Other commands should be used with this offset*/
-} AssuanCommand;
-
-
-#else /*!_ASSUAN_ONLY_GPG_ERRORS*/
-
-/* Choose a type compatible with gpg_error_t. */
-typedef unsigned int assuan_error_t;
-
-#endif /*!_ASSUAN_ONLY_GPG_ERRORS*/
-
-
-/* Definitions of flags for assuan_set_flag(). */
-typedef enum
- {
- /* When using a pipe server, by default Assuan will wait for the
- forked process to die in assuan_disconnect. In certain cases
- this is not desirable. By setting this flag, the waitpid will
- be skipped and the caller is responsible to cleanup a forked
- process. */
- ASSUAN_NO_WAITPID = 1,
- /* This flag indicates whether Assuan logging is in confidential
- mode. Use assuan_{begin,end}_condidential to change the
- mode. */
- ASSUAN_CONFIDENTIAL = 2
- }
-assuan_flag_t;
#define ASSUAN_LINELENGTH 1002 /* 1000 + [CR,]LF */
struct assuan_context_s;
typedef struct assuan_context_s *assuan_context_t;
-#ifndef _ASSUAN_ONLY_GPG_ERRORS
-typedef struct assuan_context_s *ASSUAN_CONTEXT _ASSUAN_DEPRECATED;
-#endif /*_ASSUAN_ONLY_GPG_ERRORS*/
/* Because we use system handles and not libc low level file
descriptors on W32, we need to declare them as HANDLE (which
@@ -457,7 +317,7 @@ int assuan_register_option_handler (assuan_context_t ctx,
int (*fnc)(assuan_context_t,
const char*, const char*));
-int assuan_process (assuan_context_t ctx);
+gpg_error_t assuan_process (assuan_context_t ctx);
int assuan_process_next (assuan_context_t ctx);
int assuan_process_done (assuan_context_t ctx, int rc);
int assuan_get_active_fds (assuan_context_t ctx, int what,
@@ -465,8 +325,8 @@ int assuan_get_active_fds (assuan_context_t ctx, int what,
FILE *assuan_get_data_fp (assuan_context_t ctx);
-assuan_error_t assuan_set_okay_line (assuan_context_t ctx, const char *line);
-assuan_error_t assuan_write_status (assuan_context_t ctx,
+gpg_error_t assuan_set_okay_line (assuan_context_t ctx, const char *line);
+gpg_error_t assuan_write_status (assuan_context_t ctx,
const char *keyword, const char *text);
/* Negotiate a file descriptor. If LINE contains "FD=N", returns N
@@ -474,17 +334,17 @@ assuan_error_t assuan_write_status (assuan_context_t ctx,
file descriptor via CTX and stores it in *RDF (the CTX must be
capable of passing file descriptors). Under W32 the returned FD is
a libc-type one. */
-assuan_error_t assuan_command_parse_fd (assuan_context_t ctx, char *line,
+gpg_error_t assuan_command_parse_fd (assuan_context_t ctx, char *line,
assuan_fd_t *rfd);
/*-- assuan-listen.c --*/
-assuan_error_t assuan_set_hello_line (assuan_context_t ctx, const char *line);
-assuan_error_t assuan_accept (assuan_context_t ctx);
+gpg_error_t assuan_set_hello_line (assuan_context_t ctx, const char *line);
+gpg_error_t assuan_accept (assuan_context_t ctx);
assuan_fd_t assuan_get_input_fd (assuan_context_t ctx);
assuan_fd_t assuan_get_output_fd (assuan_context_t ctx);
-assuan_error_t assuan_close_input_fd (assuan_context_t ctx);
-assuan_error_t assuan_close_output_fd (assuan_context_t ctx);
+gpg_error_t assuan_close_input_fd (assuan_context_t ctx);
+gpg_error_t assuan_close_output_fd (assuan_context_t ctx);
/*-- assuan-pipe-server.c --*/
@@ -493,24 +353,16 @@ void assuan_deinit_server (assuan_context_t ctx);
/*-- assuan-socket-server.c --*/
int assuan_init_socket_server (assuan_context_t *r_ctx, assuan_fd_t listen_fd);
-int assuan_init_connected_socket_server (assuan_context_t *r_ctx,
- assuan_fd_t fd) _ASSUAN_DEPRECATED;
int assuan_init_socket_server_ext (assuan_context_t *r_ctx, assuan_fd_t fd,
unsigned int flags);
void assuan_set_sock_nonce (assuan_context_t ctx, assuan_sock_nonce_t *nonce);
/*-- assuan-pipe-connect.c --*/
-assuan_error_t assuan_pipe_connect (assuan_context_t *ctx,
+gpg_error_t assuan_pipe_connect (assuan_context_t *ctx,
const char *name,
const char *const argv[],
int *fd_child_list);
-assuan_error_t assuan_pipe_connect2 (assuan_context_t *ctx,
- const char *name,
- const char *const argv[],
- int *fd_child_list,
- void (*atfork) (void*, int),
- void *atforkvalue) _ASSUAN_DEPRECATED;
-assuan_error_t assuan_pipe_connect_ext (assuan_context_t *ctx,
+gpg_error_t assuan_pipe_connect_ext (assuan_context_t *ctx,
const char *name,
const char *const argv[],
int *fd_child_list,
@@ -519,10 +371,10 @@ assuan_error_t assuan_pipe_connect_ext (assuan_context_t *ctx,
unsigned int flags);
/*-- assuan-socket-connect.c --*/
-assuan_error_t assuan_socket_connect (assuan_context_t *ctx,
+gpg_error_t assuan_socket_connect (assuan_context_t *ctx,
const char *name,
pid_t server_pid);
-assuan_error_t assuan_socket_connect_ext (assuan_context_t *ctx,
+gpg_error_t assuan_socket_connect_ext (assuan_context_t *ctx,
const char *name,
pid_t server_pid,
unsigned int flags);
@@ -531,45 +383,45 @@ assuan_error_t assuan_socket_connect_ext (assuan_context_t *ctx,
void assuan_disconnect (assuan_context_t ctx);
pid_t assuan_get_pid (assuan_context_t ctx);
#ifndef _WIN32
-assuan_error_t assuan_get_peercred (assuan_context_t ctx,
+gpg_error_t assuan_get_peercred (assuan_context_t ctx,
pid_t *pid, uid_t *uid, gid_t *gid);
#endif
/*-- assuan-client.c --*/
-assuan_error_t
+gpg_error_t
assuan_transact (assuan_context_t ctx,
const char *command,
- assuan_error_t (*data_cb)(void *, const void *, size_t),
+ gpg_error_t (*data_cb)(void *, const void *, size_t),
void *data_cb_arg,
- assuan_error_t (*inquire_cb)(void*, const char *),
+ gpg_error_t (*inquire_cb)(void*, const char *),
void *inquire_cb_arg,
- assuan_error_t (*status_cb)(void*, const char *),
+ gpg_error_t (*status_cb)(void*, const char *),
void *status_cb_arg);
/*-- assuan-inquire.c --*/
-assuan_error_t assuan_inquire (assuan_context_t ctx, const char *keyword,
+gpg_error_t assuan_inquire (assuan_context_t ctx, const char *keyword,
unsigned char **r_buffer, size_t *r_length,
size_t maxlen);
-assuan_error_t assuan_inquire_ext (assuan_context_t ctx, const char *keyword,
+gpg_error_t assuan_inquire_ext (assuan_context_t ctx, const char *keyword,
size_t maxlen,
int (*cb) (void *cb_data, int rc,
unsigned char *buf,
size_t buf_len),
void *cb_data);
/*-- assuan-buffer.c --*/
-assuan_error_t assuan_read_line (assuan_context_t ctx,
+gpg_error_t assuan_read_line (assuan_context_t ctx,
char **line, size_t *linelen);
int assuan_pending_line (assuan_context_t ctx);
-assuan_error_t assuan_write_line (assuan_context_t ctx, const char *line );
-assuan_error_t assuan_send_data (assuan_context_t ctx,
+gpg_error_t assuan_write_line (assuan_context_t ctx, const char *line );
+gpg_error_t assuan_send_data (assuan_context_t ctx,
const void *buffer, size_t length);
/* The file descriptor must be pending before assuan_receivefd is
called. This means that assuan_sendfd should be called *before* the
trigger is sent (normally via assuan_write_line ("INPUT FD")). */
-assuan_error_t assuan_sendfd (assuan_context_t ctx, assuan_fd_t fd);
-assuan_error_t assuan_receivefd (assuan_context_t ctx, assuan_fd_t *fd);
+gpg_error_t assuan_sendfd (assuan_context_t ctx, assuan_fd_t fd);
+gpg_error_t assuan_receivefd (assuan_context_t ctx, assuan_fd_t *fd);
/*-- assuan-util.c --*/
@@ -602,18 +454,11 @@ int assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag);
/*-- assuan-errors.c --*/
-#ifndef _ASSUAN_ONLY_GPG_ERRORS
-/* Return a string describing the assuan error. The use of this
- function is deprecated; it is better to call
- assuan_set_assuan_err_source once and then make use libgpg-error. */
-const char *assuan_strerror (assuan_error_t err);
-#endif /*_ASSUAN_ONLY_GPG_ERRORS*/
-
/* Enable gpg-error style error codes. ERRSOURCE is one of gpg-error
sources. Note, that this function is not thread-safe and should be
used right at startup. Switching back to the old style mode is not
supported. */
-void assuan_set_assuan_err_source (int errsource);
+void assuan_set_assuan_err_source (gpg_err_source_t errsource);
/*-- assuan-logging.c --*/