ExPcap.MagicNumber

This module represents a ‘magic number’ from a pcap header. The magic number not only contains a known value, but the value indicates the order in which bytes should be read AND whether or not datetimes use milliseconds or nanoseconds.

Source

Summary

bytes_in_magic()

Returns the number of bytes contained in the magic number

from_file(f)

Reads the magic number from the file passed in

magic_number(int1, int2, int3, int4)

Returns a magic number that indicates that the bytes need to be reversed when read and that datetimes are in nanoseconds

read_magic(data)

This reads the bytes of the magic number and matches them with the appropriate interpretation of the magic number

Types

t :: %ExPcap.MagicNumber{reverse_bytes: boolean, nanos: boolean, magic: non_neg_integer}

Functions

bytes_in_magic()

Specs:

  • bytes_in_magic :: non_neg_integer

Returns the number of bytes contained in the magic number.

Source
from_file(f)

Specs:

Reads the magic number from the file passed in.

Source
magic_number(int1, int2, int3, int4)

Specs:

Returns a magic number that indicates that the bytes need to be reversed when read and that datetimes are in nanoseconds.

Source
read_magic(data)

Specs:

This reads the bytes of the magic number and matches them with the appropriate interpretation of the magic number.

Source