#include <stdlib.h>
#include "rdd.h"
#include "writer.h"
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 [] |
int rdd_compare_address | ( | RDD_WRITER * | w, | |
struct addrinfo * | address, | |||
int * | result | |||
) |
Checks if a given address equals the current writer address.
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). |
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.
w | output value: a new writer object. | |
ops | pointers to implementation-specific writer functions. | |
statesize | size in bytes of implementation-specific state. |
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.
int rdd_writer_close | ( | RDD_WRITER * | w | ) |
Closes a writer AND all writers that are below it in the writer stack.
w | a pointer to the writer object. |
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.
w | a pointer to the writer object. | |
buf | a pointer to the data buffer. | |
nbyte | the number of bytes to write |
RDD_OK
on success.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.
char copyright[] [static] |