Writers
[Core API]


Modules

 First (stacks start with one of these)
 Next (stacks may use these)

Functions

void ops_setup_memory_write (ops_create_info_t **cinfo, ops_memory_t **mem, size_t bufsz)
 Create and initialise cinfo and mem; Set for writing to mem.
void ops_teardown_memory_write (ops_create_info_t *cinfo, ops_memory_t *mem)
 Closes writer and frees cinfo and mem.
int ops_setup_file_write (ops_create_info_t **cinfo, const char *filename, ops_boolean_t allow_overwrite)
 Create and initialise cinfo and mem; Set for writing to file.
void ops_teardown_file_write (ops_create_info_t *cinfo, int fd)
 Closes writer, frees info, closes fd.
int ops_setup_file_append (ops_create_info_t **cinfo, const char *filename)
 As ops_setup_file_write, but appends to file.
void ops_teardown_file_append (ops_create_info_t *cinfo, int fd)
 As ops_teardown_file_write().
void ops_writer_set (ops_create_info_t *info, ops_writer_t *writer, ops_writer_finaliser_t *finaliser, ops_writer_destroyer_t *destroyer, void *arg)
 Set a writer in info.
void ops_writer_push (ops_create_info_t *info, ops_writer_t *writer, ops_writer_finaliser_t *finaliser, ops_writer_destroyer_t *destroyer, void *arg)
 Push a writer in info.
ops_boolean_t ops_writer_close (ops_create_info_t *info)
 Close the writer currently set in info.
void * ops_writer_get_arg (ops_writer_info_t *winfo)
 Get the arg supplied to ops_create_info_set_writer().
ops_boolean_t ops_stacked_write (const void *src, unsigned length, ops_error_t **errors, ops_writer_info_t *winfo)
 Write to the next writer down in the stack.
void ops_writer_generic_destroyer (ops_writer_info_t *winfo)
 Free the arg.
ops_boolean_t ops_writer_passthrough (const unsigned char *src, unsigned length, ops_error_t **errors, ops_writer_info_t *winfo)
 A writer that just writes to the next one down.

Function Documentation

int ops_setup_file_write ops_create_info_t **  cinfo,
const char *  filename,
ops_boolean_t  allow_overwrite
 

Create and initialise cinfo and mem; Set for writing to file.

Parameters:
cinfo Address where new cinfo pointer will be set
filename File to write to
allow_overwrite Allows file to be overwritten, if set.
Returns:
Newly-opened file descriptor
Note:
It is the caller's responsiblity to free cinfo and to close fd.
See also:
ops_teardown_file_write()

void ops_setup_memory_write ops_create_info_t **  cinfo,
ops_memory_t **  mem,
size_t  bufsz
 

Create and initialise cinfo and mem; Set for writing to mem.

Parameters:
cinfo Address where new cinfo pointer will be set
mem Address when new mem pointer will be set
bufsz Initial buffer size (will automatically be increased when necessary)
Note:
It is the caller's responsiblity to free cinfo and mem.
See also:
ops_teardown_memory_write()

ops_boolean_t ops_stacked_write const void *  src,
unsigned  length,
ops_error_t **  errors,
ops_writer_info_t winfo
 

Write to the next writer down in the stack.

Parameters:
src The data to write.
length The length of src.
errors A place to store errors.
winfo The writer_info structure.
Returns:
Success - if ops_false, then errors should contain the error.

void ops_teardown_file_write ops_create_info_t cinfo,
int  fd
 

Closes writer, frees info, closes fd.

Parameters:
cinfo 
fd 

void ops_teardown_memory_write ops_create_info_t cinfo,
ops_memory_t mem
 

Closes writer and frees cinfo and mem.

Parameters:
cinfo 
mem 
See also:
ops_setup_memory_write()

ops_boolean_t ops_writer_close ops_create_info_t info  ) 
 

Close the writer currently set in info.

Parameters:
info The info structure

void ops_writer_generic_destroyer ops_writer_info_t winfo  ) 
 

Free the arg.

Many writers just have a malloc()ed lump of storage, this function releases it.

Parameters:
winfo the info structure.

void* ops_writer_get_arg ops_writer_info_t winfo  ) 
 

Get the arg supplied to ops_create_info_set_writer().

Parameters:
winfo The writer_info structure
Returns:
The arg

ops_boolean_t ops_writer_passthrough const unsigned char *  src,
unsigned  length,
ops_error_t **  errors,
ops_writer_info_t winfo
 

A writer that just writes to the next one down.

Useful for when you want to insert just a finaliser into the stack.

void ops_writer_push ops_create_info_t info,
ops_writer_t *  writer,
ops_writer_finaliser_t *  finaliser,
ops_writer_destroyer_t *  destroyer,
void *  arg
 

Push a writer in info.

There must already be another writer set.

Parameters:
info The info structure
writer 
finaliser 
destroyer 
arg The argument for the writer and destroyer

void ops_writer_set ops_create_info_t info,
ops_writer_t *  writer,
ops_writer_finaliser_t *  finaliser,
ops_writer_destroyer_t *  destroyer,
void *  arg
 

Set a writer in info.

There should not be another writer set.

Parameters:
info The info structure
writer 
finaliser 
destroyer 
arg The argument for the writer and destroyer


Generated on Wed Jun 19 00:00:02 2013 for OpenPGP:SDK by  doxygen 1.4.6