Changeset 4112


Ignore:
Timestamp:
Dec 12, 2009, 11:19:47 PM (13 years ago)
Author:
Sam Hocevar
Message:

Reorganise source code to better separate zzuf and libzzuf. Note: the Win32
build is now broken.

Location:
zzuf/trunk/src
Files:
2 added
3 edited
1 copied
21 moved

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/Makefile.am

    r4043 r4112  
    11# $Id$
    22
    3 COMMON = random.c random.h ranges.c ranges.h fd.c fd.h fuzz.c fuzz.h
     3bin_PROGRAMS = zzuf
     4pkglib_LTLIBRARIES = libzzuf.la
     5
     6ZZUF = \
     7    zzuf.c opts.c opts.h md5.c md5.h timer.c timer.h
     8
     9LIBZZUF = \
     10    libzzuf/libzzuf.c libzzuf/libzzuf.h \
     11    libzzuf/debug.c libzzuf/debug.h \
     12    libzzuf/sys.c libzzuf/sys.h \
     13    libzzuf/network.c libzzuf/network.h \
     14    libzzuf/lib-fd.c libzzuf/lib-mem.c libzzuf/lib-signal.c \
     15    libzzuf/lib-stream.c libzzuf/lib-load.h
     16
     17COMMON = \
     18    common/random.c common/random.h \
     19    common/ranges.c common/ranges.h \
     20    common/fd.c common/fd.h \
     21    common/fuzz.c common/fuzz.h
     22
    423if NEED_GETOPT_LONG
    524GETOPT = mygetopt.c mygetopt.h
    625endif
    726
    8 bin_PROGRAMS = zzuf
    9 zzuf_SOURCES = zzuf.c $(COMMON) $(GETOPT) \
    10                opts.c opts.h md5.c md5.h timer.c timer.h
    11 zzuf_CFLAGS = -DLIBDIR=\"$(libdir)/zzuf\"
     27zzuf_SOURCES = $(ZZUF) $(COMMON) $(GETOPT)
     28zzuf_CFLAGS = -DLIBDIR=\"$(libdir)/zzuf\" -Icommon/
    1229zzuf_LDFLAGS = $(MATH_LIBS) $(WINSOCK2_LIBS)
    1330zzuf_DEPENDENCIES = libzzuf.la
    1431
    15 pkglib_LTLIBRARIES = libzzuf.la
    16 libzzuf_la_SOURCES = libzzuf.c libzzuf.h $(COMMON) debug.c debug.h \
    17                      sys.c sys.h network.c network.h \
    18                      lib-fd.c lib-mem.c lib-signal.c lib-stream.c lib-load.h
    19 libzzuf_la_CFLAGS = -DLIBZZUF
     32libzzuf_la_SOURCES = $(LIBZZUF) $(COMMON)
     33libzzuf_la_CFLAGS = -DLIBZZUF -Ilibzzuf/ -Icommon/
    2034libzzuf_la_LDFLAGS = -avoid-version -no-undefined $(DLL_LDFLAGS)
    2135libzzuf_la_LIBADD = $(GETOPT_LIBS) $(DL_LIBS) $(MATH_LIBS) $(WINSOCK2_LIBS)
  • zzuf/trunk/src/common/common.h

    r4111 r4112  
    1414
    1515/*
    16  *  libzzuf.h: preloaded wrapper library
     16 *  common.h: default fuzzing settings
    1717 */
    1818
     
    4848};
    4949
    50 /* Internal variables */
    51 extern int _zz_ready;
    52 extern int _zz_disabled;
    53 extern int _zz_debuglevel;
    54 extern int _zz_debugfd;
    55 extern int _zz_signal;
    56 extern int _zz_memory;
    57 extern int _zz_network;
    58 extern int _zz_autoinc;
    59 
    60 /* This function is needed to initialise memory functions */
    61 extern void _zz_mem_init(void);
    62 
  • zzuf/trunk/src/common/fd.c

    r4111 r4112  
    3232#include <math.h>
    3333
    34 #include "debug.h"
    35 #include "libzzuf.h"
     34#include "common.h"
    3635#include "fd.h"
    3736#include "fuzz.h"
    38 #include "network.h"
    3937#include "ranges.h"
     38#if defined LIBZZUF
     39#   include "debug.h"
     40#   include "network.h"
     41#endif
    4042
    4143/* Regex stuff */
     
    224226        return;
    225227
     228#if defined LIBZZUF
    226229    if(autoinc)
    227230        debug2("using seed %li", (long int)seed);
     231#endif
    228232
    229233    /* If filedescriptor is outside our bounds */
     
    376380        return;
    377381
     382#if defined LIBZZUF
    378383    debug2("setfuzzed(%i, %i)", fd, count);
     384#endif
    379385
    380386    files[fds[fd]].already_pos = files[fds[fd]].pos;
  • zzuf/trunk/src/common/fuzz.c

    r4111 r4112  
    2828#include <string.h>
    2929
    30 #include "libzzuf.h"
    31 #include "debug.h"
     30#include "common.h"
    3231#include "random.h"
    3332#include "fuzz.h"
    3433#include "fd.h"
    3534#include "ranges.h"
     35#if defined LIBZZUF
     36#   include "debug.h"
     37#endif
    3638
    3739#define MAGIC1 0x33ea84f7
     
    9294    int todo;
    9395
     96#if defined LIBZZUF
    9497    debug2("fuzz(%i, @%lli, %lli)", fd, (long long int)pos, (long long int)len);
     98#endif
    9599
    96100    aligned_buf = buf - pos;
  • zzuf/trunk/src/common/ranges.c

    r4111 r4112  
    2727#include <string.h>
    2828
    29 #include "libzzuf.h"
     29#include "common.h"
    3030#include "ranges.h"
    3131
  • zzuf/trunk/src/libzzuf/lib-stream.c

    r4111 r4112  
    5555#endif
    5656
     57#include "common.h"
    5758#include "libzzuf.h"
    5859#include "lib-load.h"
  • zzuf/trunk/src/libzzuf/libzzuf.h

    r4111 r4112  
    1414
    1515/*
    16  *  fuzz.h: fuzz functions
     16 *  libzzuf.h: preloaded wrapper library
    1717 */
    1818
    19 extern void _zz_fuzzing(char const *);
    20 extern void _zz_bytes(char const *);
    21 extern void _zz_list(char const *);
    22 extern void _zz_protect(char const *);
    23 extern void _zz_refuse(char const *);
     19/* Internal variables */
     20extern int _zz_ready;
     21extern int _zz_disabled;
     22extern int _zz_debuglevel;
     23extern int _zz_debugfd;
     24extern int _zz_signal;
     25extern int _zz_memory;
     26extern int _zz_network;
     27extern int _zz_autoinc;
    2428
    25 extern void _zz_fuzz(int, volatile uint8_t *, int64_t);
     29/* This function is needed to initialise memory functions */
     30extern void _zz_mem_init(void);
    2631
  • zzuf/trunk/src/opts.c

    r3635 r4112  
    2929#include <stdlib.h>
    3030
    31 #include "libzzuf.h"
     31#include "common.h"
    3232#include "opts.h"
    3333
  • zzuf/trunk/src/zzuf.c

    r4111 r4112  
    6565#endif
    6666
    67 #include "libzzuf.h"
     67#include "common.h"
    6868#include "opts.h"
    6969#include "random.h"
     
    12571257    if(dos->e_magic == IMAGE_DOS_SIGNATURE /* 0x5A4D */
    12581258      && nt->Signature == IMAGE_NT_SIGNATURE /* 0x00004550 */
    1259       && nt->FileHeader.Machine == IMAGE_FILE_MACHINE_I386 
     1259      && nt->FileHeader.Machine == IMAGE_FILE_MACHINE_I386
    12601260      && nt->OptionalHeader.Magic == 0x10b /* IMAGE_NT_OPTIONAL_HDR32_MAGIC */)
    12611261    {
Note: See TracChangeset for help on using the changeset viewer.