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.
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
Specs:
- bytes_in_magic :: non_neg_integer
Returns the number of bytes contained in the magic number.
Specs:
- from_file(IO.device) :: ExPcap.MagicNumber.t
Reads the magic number from the file passed in.
Specs:
- magic_number(77, 60, 178, 161) :: ExPcap.MagicNumber.t
- magic_number(161, 178, 60, 77) :: ExPcap.MagicNumber.t
- magic_number(161, 178, 195, 212) :: ExPcap.MagicNumber.t
- magic_number(212, 195, 178, 161) :: ExPcap.MagicNumber.t
Returns a magic number that indicates that the bytes need to be reversed when read and that datetimes are in nanoseconds.
Specs:
- read_magic(binary) :: ExPcap.MagicNumber.t
This reads the bytes of the magic number and matches them with the appropriate interpretation of the magic number.