org.jnetstream.capture
Interface NetTransmitter


public interface NetTransmitter

Transmitter which transmits or send low level packets using the link layer of the open network interface.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 void send(java.nio.ByteBuffer buffer)
          Transmits the specified buffer using the currently open network interface.
 void send(java.nio.ByteBuffer buffer, int count)
          Transmits the specified buffer using the currently open network interface.
 void send(java.util.Queue<java.nio.ByteBuffer> queue)
          Transmits the specified queue with buffers in it using the currently open network interface.
 

Method Detail

send

void send(java.nio.ByteBuffer buffer)
          throws java.io.IOException

Transmits the specified buffer using the currently open network interface. The transmition is done using link layer. the supplied buffer must contain valid data-link header otherwise an error will occur.

The buffer position and limit properties mark the area of the buffer that will be transmitted.

Parameters:
buffer - the buffer to transmit
Throws:
java.io.IOException - any IO errors during the transmittion of the buffer

send

void send(java.nio.ByteBuffer buffer,
          int count)
          throws java.io.IOException

Transmits the specified buffer using the currently open network interface. The transmition is done using link layer. the supplied buffer must contain valid data-link header otherwise an error will occur.

The buffer position and limit properties mark the area of the buffer that will be transmitted.

Parameters:
buffer - the buffer to transmit
count - Number of times the packet is to be repeatadily resent. The packet will be sent count number of times, as quickly as the kernel and the hardware are capable of. This is a very efficient way to generate large number of packets on a network for testing purposes.
Throws:
java.io.IOException - any IO errors during the transmittion of the buffer

send

void send(java.util.Queue<java.nio.ByteBuffer> queue)
          throws java.io.IOException

Transmits the specified queue with buffers in it using the currently open network interface. The transmition is done using link layer and raw packets. The supplied buffers on the queue must contain valid data-link headers.

Each buffer's property position and limit on the queue, mark the area of the buffer that will be transmitted, one buffer after the other. The order of the buffers is retrieved using Queue.poll() method.

Note that it is much more efficient to transmit a set of packets

Parameters:
queue - queue of buffers to be transmitted
Throws:
java.io.IOException - any IO errors