Back to index

courier  0.68.2
mimegpgfork.h
Go to the documentation of this file.
00001 #ifndef mimegpgfork_h
00002 #define mimegpgfork_h
00003 
00004 /*
00005 ** Copyright 2001 Double Precision, Inc.  See COPYING for
00006 ** distribution information.
00007 */
00008 
00009 
00010 #include "config.h"
00011 #include <stdio.h>
00012 #include <signal.h>
00013 #include <sys/types.h>
00014 
00015 #ifdef  __cplusplus
00016 extern "C" {
00017 #endif
00018 
00019 struct gpgmime_forkinfo {
00020        int togpg_fd;
00021        int fromgpg_fd;
00022        int fromgpg_errfd;
00023 
00024        char gpg_writebuf[BUFSIZ];
00025        char gpg_errbuf[1024];
00026 
00027        unsigned gpg_writecnt;
00028        unsigned gpg_errcnt;
00029 
00030        int gpg_errflag;
00031        pid_t gpg_pid;
00032 
00033        struct sigaction old_pipe_sig;
00034 
00035        int (*gpg_readhandler)(const char *, size_t, void *);
00036        void *gpg_voidarg;
00037 } ;
00038 
00039 int libmail_gpgmime_forksignencrypt(const char *,       /* gpgdir */
00040                                 const char *,    /* passphrase fd */
00041                                 int,      /* Flags: */
00042 
00043 #define GPG_SE_SIGN  1
00044 #define       GPG_SE_ENCRYPT       2
00045 
00046                                 int, char **,    /* argc/argv */
00047 
00048                                 int (*)(const char *, size_t, void *),
00049                                 /* Encrypted output */
00050                                 void *, /* 3rd arg to encrypted output */
00051 
00052                                 struct gpgmime_forkinfo *
00053                                 /* Allocated struct */
00054                                 );
00055 
00056 int libmail_gpgmime_forkchecksign(const char *,  /* gpgdir */
00057                               const char *,      /* passphrase fd */
00058                               const char *,      /* content filename */
00059                               const char *,      /* signature filename */
00060                               int, char **,      /* argc/argv */
00061                               struct gpgmime_forkinfo *);
00062        /* Allocated struct */
00063 
00064 int libmail_gpgmime_forkdecrypt(const char *,    /* gpgdir */
00065                             const char *, /* passphrase fd */
00066                             int, char **, /* argc/argv */
00067                             int (*)(const char *, size_t, void *),
00068                             /* Output callback function */
00069                             void *,       /* 3rd arg to callback function */
00070 
00071                             struct gpgmime_forkinfo *);
00072        /* Allocated struct */
00073 
00074 void libmail_gpgmime_write(struct gpgmime_forkinfo *, const char *, size_t);
00075 int libmail_gpgmime_finish(struct gpgmime_forkinfo *);
00076 
00077 const char *libmail_gpgmime_getoutput(struct gpgmime_forkinfo *);
00078 const char *libmail_gpgmime_getcharset(struct gpgmime_forkinfo *);
00079 
00080 #ifdef  __cplusplus
00081 } ;
00082 #endif
00083 
00084 #endif