00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00025 #ifndef OPS_WRITER_H
00026 #define OPS_WRITER_H
00027
00028 #include "types.h"
00029 #include "packet.h"
00030 #include "crypto.h"
00031 #include "memory.h"
00032 #include "errors.h"
00033 #include "keyring.h"
00034
00044 typedef struct ops_writer_info ops_writer_info_t;
00045 typedef ops_boolean_t ops_writer_t(const unsigned char *src,
00046 unsigned length,
00047 ops_error_t **errors,
00048 ops_writer_info_t *winfo);
00049 typedef ops_boolean_t ops_writer_finaliser_t(ops_error_t **errors,
00050 ops_writer_info_t *winfo);
00051 typedef void ops_writer_destroyer_t(ops_writer_info_t *winfo);
00053 struct ops_writer_info
00054 {
00055 ops_writer_t *writer;
00056 ops_writer_finaliser_t *finaliser;
00057 ops_writer_destroyer_t *destroyer;
00058 void *arg;
00059 ops_writer_info_t *next;
00060 };
00061
00062
00063 void *ops_writer_get_arg(ops_writer_info_t *winfo);
00064 ops_boolean_t ops_stacked_write(const void *src,unsigned length,
00065 ops_error_t **errors,
00066 ops_writer_info_t *winfo);
00067
00068 void ops_writer_set(ops_create_info_t *info,
00069 ops_writer_t *writer,
00070 ops_writer_finaliser_t *finaliser,
00071 ops_writer_destroyer_t *destroyer,
00072 void *arg);
00073 void ops_writer_push(ops_create_info_t *info,
00074 ops_writer_t *writer,
00075 ops_writer_finaliser_t *finaliser,
00076 ops_writer_destroyer_t *destroyer,
00077 void *arg);
00078 void ops_writer_pop(ops_create_info_t *info);
00079 void ops_writer_generic_destroyer(ops_writer_info_t *winfo);
00080 ops_boolean_t ops_writer_passthrough(const unsigned char *src,
00081 unsigned length,
00082 ops_error_t **errors,
00083 ops_writer_info_t *winfo);
00084
00085 void ops_writer_set_fd(ops_create_info_t *info,int fd);
00086 ops_boolean_t ops_writer_close(ops_create_info_t *info);
00087
00088 ops_boolean_t ops_write(const void *src,unsigned length,
00089 ops_create_info_t *opt);
00090 ops_boolean_t ops_write_length(unsigned length,ops_create_info_t *opt);
00091 ops_boolean_t ops_write_ptag(ops_content_tag_t tag,ops_create_info_t *opt);
00092 ops_boolean_t ops_write_scalar(unsigned n,unsigned length,
00093 ops_create_info_t *opt);
00094 ops_boolean_t ops_write_mpi(const BIGNUM *bn,ops_create_info_t *opt);
00095 ops_boolean_t ops_write_encrypted_mpi(const BIGNUM *bn, ops_crypt_t* crypt, ops_create_info_t *info);
00096
00097 void writer_info_delete(ops_writer_info_t *winfo);
00098 ops_boolean_t writer_info_finalise(ops_error_t **errors, ops_writer_info_t *winfo);
00099
00100 #endif