Adds support for encoding a frame.

This adds support for encoding a frame in the injector command.
Adds an option to write resulting frame in a file.

This patch adds a new option to the injector command to write the frame
resulting from the command line modifiers into a specified file.
Avoids displaying an invalid frame.

When a frame is invalid most of it is probably uninitialized garbage
from the frame decoder. Therefor we do not display a frame in the
sniffer when it was not decoded properly.
Displays the payload with the injector command.

Until now the injector command only displayed the MAC frame. When a
payload was present there was no way to check if it was succesfully
loaded. This patch displays the payload when the display option is
requested with the injector command.
Fixes a typo.

This patch fixes a typo with the mac encoding error message in the
injector command.
Fixes a bug with frame encoding.

When the reserved or full adress mode was used when encoding a frame the
function in charge of encoding the address returned an incorrect value
which resulted in an encoding error.
Fixes writing to a pcap file.

The flags used for the new buffered IO was incorrect. This patch use a
correct for writing, creating and truncing the pcap file.
Uses a valid mode when writing to a file.

The mode used when writing to a file through the syscall was incorrect.
Fixes frame loading in the injector command.

When the injector command tried to load and decode a frame from a file,
it tried to extract the FCS too which was not present hence resulting in
an off by two error and a segmentation fault.
Avoids displaying the payload when it is empty.

When decoding a frame the payload was copied even if it was empty hence
resulting in a non-null payload pointer which was displayed to the user.
Cleans mac decoding code.

This patch removes some parts of the mac frame
decoding functions which were obsolete.
Adds an option to write the payload to a file.

This patch adds a new option to the injector command to write the
payload into a specified file. This can be used to extract the payload
from a frame file.
Adds an option to write the header to a file.

This patch adds a new option to the injector command to write the
header into a specified file. This can be used to extract the header
from a frame file.
Fixes a bug with frame encoding.

The MAC frame encoding function checks that the size of the frame is
still below the 127 Bytes limit before appending the payload to the
header. The check was invalid which resulted in frames with large payload
to be rejected from encoding.
Adds support to fill a frame with a random payload.

This patch adds a new option to the injector command to fill the frame
with random padding. The seed is generated from a clock with microseconds
precision hashed with seconds for better randomness.
Fixes writing PCAP to a pipe.

A bug in the buffered IO flush function could cause the output buffer
to not being properly flushed when the program exit resulting in a
corrupted PCAP file. In particular the flush function did not handle
incomplete writes which resulted in a write buffer being only partially
flushed.
Adds suport to flush the PCAP file.

This adds a signal handler to SIGUSR1 to flush the PCAP buffer.