C# Class Ipop.Ethernet

Provides an interface to the Virtual Network device known as a TAP device. Ethernet is an ISender, meaning to write to the device, one must call the Send method. It is also an ISource, meaning to receive packets one must subscribe via the Subscribe method to the output.
Inheritance: SimpleSource, ISender
Afficher le fichier Open project: pstjuste/brunet Class Usage Examples

Méthodes publiques

Свойство Type Description
Address MemBlock

Protected Properties

Свойство Type Description
_read_thread Thread
_running bool
_send_buffer byte[]
_tap Ipop.Tap.TapDevice

Méthodes publiques

Méthode Description
Ethernet ( string device_name ) : Brunet

Initializes the Ethernet device by opening the TAP device and starting the ISource thread.

Send ( ICopyable data ) : void

Writes the data to the Ethernet device.

The same max MTU byte array is always used to write the data to the device. Since the incoming data is an ICopyable, it needs to be copied to a single byte array before being sent to the unmanaged language.

Stop ( ) : void

Call this method when exiting to stop the _read_thread.

ToUri ( ) : String

Méthodes protégées

Méthode Description
ReadLoop ( ) : void

The thread acting as the ISource for Ethernet, this is where reading of the TAP is performed. Use Subscribe to receive the packets coming from here.

The same max MTU byte array is always read into. This is then copied to a minimum sized MemBlock and send to the subscriber.

Method Details

Ethernet() public méthode

Initializes the Ethernet device by opening the TAP device and starting the ISource thread.
public Ethernet ( string device_name ) : Brunet
device_name string
Résultat Brunet

ReadLoop() protected méthode

The thread acting as the ISource for Ethernet, this is where reading of the TAP is performed. Use Subscribe to receive the packets coming from here.
The same max MTU byte array is always read into. This is then copied to a minimum sized MemBlock and send to the subscriber.
protected ReadLoop ( ) : void
Résultat void

Send() public méthode

Writes the data to the Ethernet device.
The same max MTU byte array is always used to write the data to the device. Since the incoming data is an ICopyable, it needs to be copied to a single byte array before being sent to the unmanaged language.
public Send ( ICopyable data ) : void
data ICopyable ICopyable of the data to be written.
Résultat void

Stop() public méthode

Call this method when exiting to stop the _read_thread.
public Stop ( ) : void
Résultat void

ToUri() public méthode

public ToUri ( ) : String
Résultat String

Property Details

Address public_oe property

The address of our TapDevice
public MemBlock Address
Résultat MemBlock

_read_thread protected_oe property

The thread that provides the ISource for Ethernet
protected Thread _read_thread
Résultat Thread

_running protected_oe property

Set to false when we're exiting
protected bool _running
Résultat bool

_send_buffer protected_oe property

This is a constant buffer used for writing to the tap device
protected byte[] _send_buffer
Résultat byte[]

_tap protected_oe property

protected TapDevice,Ipop.Tap _tap
Résultat Ipop.Tap.TapDevice