src/writer.c File Reference

#include <stdlib.h>
#include "rdd.h"
#include "writer.h"

Include dependency graph for writer.c:

Go to the source code of this file.

Functions

int rdd_compare_address (RDD_WRITER *w, struct addrinfo *address, int *result)
 Checks if a given address equals the current writer address.
int rdd_new_writer (RDD_WRITER **self, RDD_WRITE_OPS *ops, unsigned statesize)
 Allocates and partially initializes a new writer object.
int rdd_writer_close (RDD_WRITER *w)
 Closes a writer AND all writers that are below it in the writer stack.
int rdd_writer_write (RDD_WRITER *w, const unsigned char *buf, unsigned nbyte)
 Writes a data buffer to the output channel associated with a writer.

Variables

static char copyright []


Function Documentation

int rdd_compare_address ( RDD_WRITER w,
struct addrinfo *  address,
int *  result 
)

Checks if a given address equals the current writer address.

Parameters:
w a pointer to the writer object.
address a pointer to the address object.
result output value: the result (1 if equal, 0 if not).
Returns:
Returns RDD_OK on success.

Definition at line 116 of file writer.c.

References _RDD_WRITE_OPS::compare_address, _RDD_WRITER::ops, and RDD_BADARG.

int rdd_new_writer ( RDD_WRITER **  w,
RDD_WRITE_OPS ops,
unsigned  statesize 
)

Allocates and partially initializes a new writer object.

Parameters:
w output value: a new writer object.
ops pointers to implementation-specific writer functions.
statesize size in bytes of implementation-specific state.
Returns:
Returns RDD_OK on success. Returns RDD_NOMEM when there is insufficient memory to allocate the writer object or its state buffer.
rdd_new_writer() allocates a writer object and initializes its ops field to argument . The state field is set to point to a new buffer (allocated with malloc()) with size statesize. The state buffer is zeroed.

Definition at line 50 of file writer.c.

References error(), _RDD_WRITER::ops, RDD_BADARG, RDD_NOMEM, RDD_OK, and _RDD_WRITER::state.

Here is the call graph for this function:

int rdd_writer_close ( RDD_WRITER w  ) 

Closes a writer AND all writers that are below it in the writer stack.

Parameters:
w a pointer to the writer object.
When writer w is closed its resources are released and no further writes can be issued to writer w. At present, all writers stacked below w are closed as well. This behavior may change in the future.

Definition at line 95 of file writer.c.

References _RDD_WRITE_OPS::close, _RDD_WRITER::ops, RDD_BADARG, RDD_OK, and _RDD_WRITER::state.

int rdd_writer_write ( RDD_WRITER w,
const unsigned char *  buf,
unsigned  nbyte 
)

Writes a data buffer to the output channel associated with a writer.

Parameters:
w a pointer to the writer object.
buf a pointer to the data buffer.
nbyte the number of bytes to write
Returns:
Returns RDD_OK on success.
Routine rdd_writer_write() writes the first nbyte bytes in buffer buf to an output channel. The identity and the nature of the output channel is determined by the type of writer object is used and by the arguments that were passed to the writer's constructor.

When rdd_writer_write() returns, data buffer buf can safely be reused.

Definition at line 88 of file writer.c.

References _RDD_WRITER::ops, and _RDD_WRITE_OPS::write.


Variable Documentation

char copyright[] [static]

Initial value:

"@(#) Copyright (c) 2002-2004\n\
    Netherlands Forensic Institute.  All rights reserved.\n"

Definition at line 34 of file writer.c.


Generated on Sun Feb 6 12:36:40 2011 for rdd by  doxygen 1.5.6