src/faultyreader.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "rdd.h"
#include "reader.h"

Include dependency graph for faultyreader.c:

Go to the source code of this file.

Data Structures

struct  _FAULTY_READER_STATE
struct  _RDDFAULT

Defines

#define MAX_FAULT   8
#define MAX_LINE   128

Typedefs

typedef struct _FAULTY_READER_STATE FAULTY_READER_STATE
typedef struct _RDDFAULT RDDFAULT
typedef unsigned short rngstate_t [3]
typedef unsigned long seed_t

Functions

static int fault_compare (const void *p1, const void *p2)
static void fault_init (RDDFAULT *f, rdd_count_t meanpos)
static int rdd_faulty_close (RDD_READER *r, int recurse)
static int rdd_faulty_read (RDD_READER *r, unsigned char *buf, unsigned nbyte, unsigned *nread)
static int rdd_faulty_seek (RDD_READER *r, rdd_count_t pos)
static int rdd_faulty_tell (RDD_READER *r, rdd_count_t *pos)
int rdd_open_faulty_reader (RDD_READER **self, RDD_READER *parent, char *path)
 Instantiates a reader that simulates read errors.
static int read_faults (FILE *fp, FAULTY_READER_STATE *state)

Variables

static char copyright []
static RDD_READ_OPS faulty_read_ops


Define Documentation

#define MAX_FAULT   8

Definition at line 49 of file faultyreader.c.

#define MAX_LINE   128

Definition at line 48 of file faultyreader.c.


Typedef Documentation

typedef struct _RDDFAULT RDDFAULT

typedef unsigned short rngstate_t[3]

Definition at line 51 of file faultyreader.c.

typedef unsigned long seed_t

Definition at line 52 of file faultyreader.c.


Function Documentation

static int fault_compare ( const void *  p1,
const void *  p2 
) [static]

Definition at line 81 of file faultyreader.c.

References _RDDFAULT::meanpos.

static void fault_init ( RDDFAULT f,
rdd_count_t  meanpos 
) [static]

Definition at line 101 of file faultyreader.c.

References _RDDFAULT::meanpos.

int rdd_faulty_close ( RDD_READER r,
int  recurse 
) [static]

Definition at line 274 of file faultyreader.c.

References _FAULTY_READER_STATE::parent, RDD_OK, and rdd_reader_close().

Here is the call graph for this function:

int rdd_faulty_read ( RDD_READER r,
unsigned char *  buf,
unsigned  nbyte,
unsigned *  nread 
) [static]

int rdd_faulty_seek ( RDD_READER r,
rdd_count_t  pos 
) [static]

Definition at line 266 of file faultyreader.c.

References _FAULTY_READER_STATE::parent, and rdd_reader_seek().

Here is the call graph for this function:

int rdd_faulty_tell ( RDD_READER r,
rdd_count_t pos 
) [static]

Definition at line 258 of file faultyreader.c.

References _FAULTY_READER_STATE::parent, and rdd_reader_tell().

Here is the call graph for this function:

int rdd_open_faulty_reader ( RDD_READER **  r,
RDD_READER p,
char *  specfile 
)

Instantiates a reader that simulates read errors.

Parameters:
r output value: a new reader object.
p an existing parent reader.
specfile a file that specifies the file positions at which read errors should be simulated by this reader.

Definition at line 146 of file faultyreader.c.

References fault_compare(), _FAULTY_READER_STATE::faults, _FAULTY_READER_STATE::nfault, _FAULTY_READER_STATE::parent, RDD_BADARG, RDD_ECLOSE, RDD_EOPEN, rdd_new_reader(), RDD_OK, read_faults(), and _RDD_READER::state.

Here is the call graph for this function:

static int read_faults ( FILE *  fp,
FAULTY_READER_STATE state 
) [static]

Definition at line 110 of file faultyreader.c.

References fault_init(), _FAULTY_READER_STATE::faults, MAX_FAULT, MAX_LINE, _FAULTY_READER_STATE::nfault, RDD_ESPACE, RDD_ESYNTAX, and RDD_OK.

Here is the call graph for this function:


Variable Documentation

char copyright[] [static]

Initial value:

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

Definition at line 32 of file faultyreader.c.

Initial value:

Definition at line 77 of file faultyreader.c.


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