C# Класс 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.
Наследование: SimpleSource, ISender
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Address MemBlock

Защищенные свойства (Protected)

Свойство Тип Описание
_read_thread Thread
_running bool
_send_buffer byte[]
_tap Ipop.Tap.TapDevice

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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.

Описание методов

Ethernet() публичный Метод

Initializes the Ethernet device by opening the TAP device and starting the ISource thread.
public Ethernet ( string device_name ) : Brunet
device_name string
Результат Brunet

ReadLoop() защищенный Метод

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
Результат void

Send() публичный Метод

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.
Результат void

Stop() публичный Метод

Call this method when exiting to stop the _read_thread.
public Stop ( ) : void
Результат void

ToUri() публичный Метод

public ToUri ( ) : String
Результат String

Описание свойств

Address публичное свойство

The address of our TapDevice
public MemBlock Address
Результат MemBlock

_read_thread защищенное свойство

The thread that provides the ISource for Ethernet
protected Thread _read_thread
Результат Thread

_running защищенное свойство

Set to false when we're exiting
protected bool _running
Результат bool

_send_buffer защищенное свойство

This is a constant buffer used for writing to the tap device
protected byte[] _send_buffer
Результат byte[]

_tap защищенное свойство

protected TapDevice,Ipop.Tap _tap
Результат Ipop.Tap.TapDevice