`libnetdude` Manual
Prev |  | Next

# libnd_dumper

## Name

libnd_dumper --

## Synopsis

    #define     LND_DUMPER_500MB
    #define     LND_DUMPER_1GB
    #define     LND_DUMPER_2GB
    void        libnd_dumper_args_init          (LND_DumperArgs *args);
    LND_Dumper* libnd_dumper_new                (pcap_t *pcap,
                                                 const char *dumper_name,
                                                 LND_DumperArgs *args);
    void        libnd_dumper_free               (LND_Dumper *dumper);
    gboolean    libnd_dumper_write              (LND_Dumper *dumper,
                                                 LND_Packet *packet);
    void        libnd_dumper_delete             (LND_Dumper *dumper);
    guint64     libnd_dumper_get_size           (LND_Dumper *dumper);

## Description

## Details

### LND_DUMPER_500MB

    #define LND_DUMPER_500MB  500000000

### LND_DUMPER_1GB

    #define LND_DUMPER_1GB   1000000000

### LND_DUMPER_2GB

    #define LND_DUMPER_2GB   2000000000

### libnd_dumper_args_init ()

    void        libnd_dumper_args_init          (LND_DumperArgs *args);

The function initializes the dumper spec structure to default values. Currently, these are all zeroes.

`args` :

  the argument structure to initialize.

### libnd_dumper_new ()

    LND_Dumper* libnd_dumper_new                (pcap_t *pcap,
                                                 const char *dumper_name,
                                                 LND_DumperArgs *args);

The function returns a new dumper, or NULL on error. `args` can be NULL, in which case a per-file size limit of 1GB is enforced.

`pcap` :

  the pcap handle for the new dumper, as used in `pcap_dump_open()`.

`dumper_name` :

  the file name of the dumper.

`args` :

  the dumper specification.

Returns :

### libnd_dumper_free ()

    void        libnd_dumper_free               (LND_Dumper *dumper);

The function closes the current output file, if any, and releases all memory resources of the dumper.

`dumper` :

  dumper to close.

### libnd_dumper_write ()

    gboolean    libnd_dumper_write              (LND_Dumper *dumper,
                                                 LND_Packet *packet);

`dumper` :

`packet` :

Returns :

### libnd_dumper_delete ()

    void        libnd_dumper_delete             (LND_Dumper *dumper);

The function looks for all files the dumper might have created based on its name and deletes them, until one is found that does not exist. So if the dumper name is "foo", it potentially deletes files foo, foo.00001, foo.00002 etc, until a nonexistant file is hit.

`dumper` :

  the dumper whose files to delete.

### libnd_dumper_get_size ()

    guint64     libnd_dumper_get_size           (LND_Dumper *dumper);

The function returns the total size, in bytes, of all packets ever written to this dumper (counting across multiple created files).

`dumper` :

  dumper to return size of.

Returns :

Prev | Home | Next
libnd_debug | Up | libnd_filter