#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "rdd.h"
#include "reader.h"
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 MAX_FAULT 8 |
Definition at line 49 of file faultyreader.c.
#define MAX_LINE 128 |
Definition at line 48 of file faultyreader.c.
typedef struct _FAULTY_READER_STATE FAULTY_READER_STATE |
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.
static int fault_compare | ( | const void * | p1, | |
const void * | p2 | |||
) | [static] |
static void fault_init | ( | RDDFAULT * | f, | |
rdd_count_t | meanpos | |||
) | [static] |
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().
int rdd_faulty_read | ( | RDD_READER * | r, | |
unsigned char * | buf, | |||
unsigned | nbyte, | |||
unsigned * | nread | |||
) | [static] |
Definition at line 215 of file faultyreader.c.
References _FAULTY_READER_STATE::faults, _RDDFAULT::meanpos, _FAULTY_READER_STATE::nfault, _FAULTY_READER_STATE::parent, RDD_EREAD, RDD_OK, rdd_reader_read(), and rdd_reader_tell().
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().
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().
int rdd_open_faulty_reader | ( | RDD_READER ** | r, | |
RDD_READER * | p, | |||
char * | specfile | |||
) |
Instantiates a reader that simulates read errors.
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.
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.
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.
RDD_READ_OPS faulty_read_ops [static] |
Initial value:
Definition at line 77 of file faultyreader.c.