11.5. Saving capture files
Prev | Chapter 11. Lua Support in Wireshark | Next

## 11.5. Saving capture files

### 11.5.1. Dumper

#### 11.5.1.1. Dumper.new(filename, [filetype], [encap])

Creates a file to write packets. Dumper:new_for_current() will probably be a better choice.

##### 11.5.1.1.1. Arguments

filename

  The name of the capture file to be created

filetype (optional)

  The type of the file to be created

encap (optional)

  The encapsulation to be used in the file to be created

##### 11.5.1.1.2. Returns

The newly created Dumper object

##### 11.5.1.1.3. Errors

- Not every filetype handles every encap

#### 11.5.1.2. dumper:close()

Closes a dumper

##### 11.5.1.2.1. Errors

- Cannot operate on a closed dumper

#### 11.5.1.3. dumper:flush()

Writes all unsaved data of a dumper to the disk.

#### 11.5.1.4. dumper:dump(timestamp, pseudoheader, bytearray)

Dumps an arbitrary packet. Note: Dumper:dump_current() will fit best in most cases.

##### 11.5.1.4.1. Arguments

timestamp

  The absolute timestamp the packet will have

pseudoheader

  The Pseudoheader to use.

bytearray

  the data to be saved

#### 11.5.1.5. dumper:new_for_current([filetype])

Creates a capture file using the same encapsulation as the one of the cuurrent packet

##### 11.5.1.5.1. Arguments

filetype (optional)

  The file type. Defaults to pcap.

##### 11.5.1.5.2. Returns

The newly created Dumper Object

##### 11.5.1.5.3. Errors

- Cannot be used outside a tap or a dissector

#### 11.5.1.6. dumper:dump_current()

Dumps the current packet as it is.

##### 11.5.1.6.1. Errors

- Cannot be used outside a tap or a dissector

### 11.5.2. PseudoHeader

A pseudoheader to be used to save captured frames.

#### 11.5.2.1. PseudoHeader.none()

Creates a "no" pseudoheader.

##### 11.5.2.1.1. Returns

A null pseudoheader

#### 11.5.2.2. PseudoHeader.eth([fcslen])

Creates an ethernet pseudoheader

##### 11.5.2.2.1. Arguments

fcslen (optional)

  The fcs length

##### 11.5.2.2.2. Returns

The ethernet pseudoheader

#### 11.5.2.3. PseudoHeader.atm([aal], [vpi], [vci], [channel], [cells], [aal5u2u], [aal5len])

Creates an ATM pseudoheader

##### 11.5.2.3.1. Arguments

aal (optional)

  AAL number

vpi (optional)

  VPI

vci (optional)

  VCI

channel (optional)

  Channel

cells (optional)

  Number of cells in the PDU

aal5u2u (optional)

  AAL5 User to User indicator

aal5len (optional)

  AAL5 Len

##### 11.5.2.3.2. Returns

The ATM pseudoheader

#### 11.5.2.4. PseudoHeader.mtp2()

Creates an MTP2 PseudoHeader

##### 11.5.2.4.1. Returns

The MTP2 pseudoheader

Prev | Up | Next
11.4. Wireshark's Lua API Reference Manual | Home | 11.6. Obtaining dissection data