C# Class Ipop.Dht.DhtDhcpServer

The DhtDhcpLeaseController provides mechanisms to acquire IP Addresses in the Dht. This is responsible for IP Address allocation, hostname reservation, and multicast subscribing, which is done in GetLease.
Inheritance: Ipop.DhcpServer
ファイルを表示 Open project: pstjuste/brunet Class Usage Examples

Protected Properties

Property Type Description
_current_ip MemBlock
_current_quarter_lifetime System.DateTime
_dht IDht
_multicast bool

Public Methods

Method Description
DhtDhcpServer ( IDht dht, DHCPConfig config, bool EnableMulticast ) : Brunet

Creates a DhtDhcpLeaseController for a specific namespace

GetDhcpConfig ( IDht dht, string ipop_namespace ) : DHCPConfig
GetDhtDhcpServer ( IDht dht, string ipop_namespace, bool enable_multicast ) : DhtDhcpServer
RequestLease ( byte RequestedAddr, bool Renew, string node_address ) : byte[]

This provides a mechanism for a node to get a lease by using the Dht. This uses Dht.Create which provides an atomic operation on the Dht, where this node is the first to store a value at a specific key. The idea being that, this node being the first to store the IP, all nodes doing a lookup for that IP Address would be directed to this node.

Working with the Dht is a little tricky as transient errors could be misrepresented as a failed Create. It is that reason why there is a Renew parameter. If that is set, the algorithm for obtaining an address is slightly changed with more weight on reobtaining the RequestedAddr.

Method Details

DhtDhcpServer() public method

Creates a DhtDhcpLeaseController for a specific namespace
public DhtDhcpServer ( IDht dht, DHCPConfig config, bool EnableMulticast ) : Brunet
dht IDht The dht object use to store lease information.
config Ipop.DHCPConfig The DHCPConfig used to define the Lease parameters.
EnableMulticast bool Defines if Multicast is to be enabled during the lease.
return Brunet

GetDhcpConfig() public static method

public static GetDhcpConfig ( IDht dht, string ipop_namespace ) : DHCPConfig
dht IDht
ipop_namespace string
return Ipop.DHCPConfig

GetDhtDhcpServer() public static method

public static GetDhtDhcpServer ( IDht dht, string ipop_namespace, bool enable_multicast ) : DhtDhcpServer
dht IDht
ipop_namespace string
enable_multicast bool
return DhtDhcpServer

RequestLease() public method

This provides a mechanism for a node to get a lease by using the Dht. This uses Dht.Create which provides an atomic operation on the Dht, where this node is the first to store a value at a specific key. The idea being that, this node being the first to store the IP, all nodes doing a lookup for that IP Address would be directed to this node.
Working with the Dht is a little tricky as transient errors could be misrepresented as a failed Create. It is that reason why there is a Renew parameter. If that is set, the algorithm for obtaining an address is slightly changed with more weight on reobtaining the RequestedAddr.
public RequestLease ( byte RequestedAddr, bool Renew, string node_address ) : byte[]
RequestedAddr byte Optional parameter if the node would like to request a specific address.
Renew bool Is the RequestedAddr a renewal?
node_address string The Brunet.Address where the DhtIpopNode resides
return byte[]

Property Details

_current_ip protected_oe property

Speed optimization for slow dht, current ip
protected MemBlock _current_ip
return MemBlock

_current_quarter_lifetime protected_oe property

Speed optimization for slow dht, lease quarter time.
protected DateTime,System _current_quarter_lifetime
return System.DateTime

_dht protected_oe property

The dht object used to stored lease information.
protected IDht _dht
return IDht

_multicast protected_oe property

Multicast enabled.
protected bool _multicast
return bool