writer.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005-2008 Nominet UK (www.nic.uk)
00003  * All rights reserved.
00004  * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
00005  * their moral rights under the UK Copyright Design and Patents Act 1988 to
00006  * be recorded as the authors of this copyright work.
00007  *
00008  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
00009  * use this file except in compliance with the License. 
00010  * 
00011  * You may obtain a copy of the License at 
00012  *     http://www.apache.org/licenses/LICENSE-2.0 
00013  * 
00014  * Unless required by applicable law or agreed to in writing, software 
00015  * distributed under the License is distributed on an "AS IS" BASIS, 
00016  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
00017  * 
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
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; /* writer-specific argument */
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

Generated on Tue May 21 00:00:02 2013 for OpenPGP:SDK by  doxygen 1.4.6