assuan-defs.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ASSUAN_DEFS_H
00022 #define ASSUAN_DEFS_H
00023
00024 #include <sys/types.h>
00025 #include <sys/socket.h>
00026 #include <sys/un.h>
00027 #include <unistd.h>
00028
00029 #include "assuan.h"
00030
00031 #define LINELENGTH ASSUAN_LINELENGTH
00032
00033 struct cmdtbl_s
00034 {
00035 const char *name;
00036 int (*handler)(ASSUAN_CONTEXT, char *line);
00037 };
00038
00039 struct assuan_io
00040 {
00041
00042 ssize_t (*read) (ASSUAN_CONTEXT, void *, size_t);
00043
00044 ssize_t (*write) (ASSUAN_CONTEXT, const void *, size_t);
00045
00046 AssuanError (*sendfd) (ASSUAN_CONTEXT, int);
00047
00048 AssuanError (*receivefd) (ASSUAN_CONTEXT, int *);
00049 };
00050
00051 struct assuan_context_s
00052 {
00053 AssuanError err_no;
00054 const char *err_str;
00055 int os_errno;
00056
00057 int confidential;
00058 int is_server;
00059 int in_inquire;
00060 char *hello_line;
00061 char *okay_line;
00062
00063 void *user_pointer;
00064
00065 FILE *log_fp;
00066
00067 struct {
00068 int fd;
00069 int eof;
00070 char line[LINELENGTH];
00071 int linelen;
00072
00073
00074 struct {
00075 char line[LINELENGTH];
00076 int linelen ;
00077 int pending;
00078 } attic;
00079 } inbound;
00080
00081 struct {
00082 int fd;
00083 struct {
00084 FILE *fp;
00085 char line[LINELENGTH];
00086 int linelen;
00087 int error;
00088 } data;
00089 } outbound;
00090
00091 int pipe_mode;
00092
00093 pid_t pid;
00094
00095 int listen_fd;
00096 int connected_fd;
00097
00098 pid_t client_pid;
00099
00100
00101
00102 struct sockaddr_un myaddr;
00103 struct sockaddr_un serveraddr;
00104
00105
00106
00107 void *domainbuffer;
00108
00109 int domainbufferoffset;
00110
00111 int domainbuffersize;
00112
00113 int domainbufferallocated;
00114
00115 int *pendingfds;
00116 int pendingfdscount;
00117
00118 void (*deinit_handler)(ASSUAN_CONTEXT);
00119 int (*accept_handler)(ASSUAN_CONTEXT);
00120 int (*finish_handler)(ASSUAN_CONTEXT);
00121
00122 struct cmdtbl_s *cmdtbl;
00123 size_t cmdtbl_used;
00124 size_t cmdtbl_size;
00125
00126 void (*bye_notify_fnc)(ASSUAN_CONTEXT);
00127 void (*reset_notify_fnc)(ASSUAN_CONTEXT);
00128 void (*cancel_notify_fnc)(ASSUAN_CONTEXT);
00129 int (*option_handler_fnc)(ASSUAN_CONTEXT,const char*, const char*);
00130 void (*input_notify_fnc)(ASSUAN_CONTEXT, const char *);
00131 void (*output_notify_fnc)(ASSUAN_CONTEXT, const char *);
00132
00133 int input_fd;
00134 int output_fd;
00135
00136
00137 struct assuan_io *io;
00138 };
00139
00140
00141 int _assuan_new_context (ASSUAN_CONTEXT *r_ctx);
00142 void _assuan_release_context (ASSUAN_CONTEXT ctx);
00143
00144
00145
00146
00147
00148 AssuanError _assuan_domain_init (ASSUAN_CONTEXT *r_ctx,
00149 int rendezvousfd,
00150 pid_t peer);
00151
00152
00153 int _assuan_register_std_commands (ASSUAN_CONTEXT ctx);
00154
00155
00156 int _assuan_read_line (ASSUAN_CONTEXT ctx);
00157 int _assuan_cookie_write_data (void *cookie, const char *buffer, size_t size);
00158 int _assuan_cookie_write_flush (void *cookie);
00159
00160
00161 AssuanError _assuan_read_from_server (ASSUAN_CONTEXT ctx, int *okay, int *off);
00162
00163
00164
00165 void *_assuan_malloc (size_t n);
00166 void *_assuan_calloc (size_t n, size_t m);
00167 void *_assuan_realloc (void *p, size_t n);
00168 void _assuan_free (void *p);
00169
00170 #define xtrymalloc(a) _assuan_malloc ((a))
00171 #define xtrycalloc(a,b) _assuan_calloc ((a),(b))
00172 #define xtryrealloc(a,b) _assuan_realloc((a),(b))
00173 #define xfree(a) _assuan_free ((a))
00174
00175 #define set_error(c,e,t) assuan_set_error ((c), ASSUAN_ ## e, (t))
00176
00177 void _assuan_log_print_buffer (FILE *fp, const void *buffer, size_t length);
00178 void _assuan_log_sanitized_string (const char *string);
00179
00180
00181 ssize_t _assuan_simple_read (ASSUAN_CONTEXT ctx, void *buffer, size_t size);
00182 ssize_t _assuan_simple_write (ASSUAN_CONTEXT ctx, const void *buffer,
00183 size_t size);
00184
00185 #ifdef HAVE_FOPENCOOKIE
00186
00187 FILE *funopen(const void *cookie, cookie_read_function_t *readfn,
00188 cookie_write_function_t *writefn,
00189 cookie_seek_function_t *seekfn,
00190 cookie_close_function_t *closefn);
00191 #endif
00192
00193 #endif
00194
This file is part of the documentation for libkdenetwork Library Version 3.3.0.