C# Класс Ipop.Dht.DhtAddressResolver

This class provides a method to do address resolution over the Brunet Dht, where entries are listed in the dht by means of the DhtDHCPServer.
Наследование: IAddressResolver
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
_attempts int>.Dictionary
_dht IDht
_incoming_cache Address>.TimeBasedCache
_ipop_namespace string
_mapping MemBlock>.Dictionary
_queued bool>.Dictionary
_sync Object
_verified_cache Address>.TimeBasedCache

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

Метод Описание
Check ( MemBlock ip, Brunet.Address addr ) : bool

Is the right person sending me this packet?

DhtAddressResolver ( IDht dht, string ipop_namespace ) : Brunet

Creates a DhtAddressResolver Object.

Resolve ( MemBlock ip ) : Brunet.Address

Translates an IP Address to a Brunet Address. If it is in the cache it returns a result, otherwise it returns null and begins a Miss lookup.

Stop ( ) : void

Stops the timer at which point a new DhtAddressResolver will need to be constructed, if used in the same process.

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

Метод Описание
Miss ( MemBlock ip ) : bool

This is called if the cache's don't have an Address mapping. It prepares an asynchronous Dht query if one doesn't already exist, that is only one query at a time per IP regardless of how many misses occur. The ansychonorous call back is call MissCallback.

MissCallback ( Object o, EventArgs args ) : void

This is the asynchronous callback for Miss. This contains the lookup results from the Dht. If there is a valid mapping it is added to the cache. Either way, new queries can now be run for the IP address after the completion of this method.

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

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

Is the right person sending me this packet?
public Check ( MemBlock ip, Brunet.Address addr ) : bool
ip MemBlock The IP source.
addr Brunet.Address
Результат bool

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

Creates a DhtAddressResolver Object.
public DhtAddressResolver ( IDht dht, string ipop_namespace ) : Brunet
dht IDht The dht object to use for dht interactions.
ipop_namespace string The ipop namespace where the dhcp server /// is storing names.
Результат Brunet

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

This is called if the cache's don't have an Address mapping. It prepares an asynchronous Dht query if one doesn't already exist, that is only one query at a time per IP regardless of how many misses occur. The ansychonorous call back is call MissCallback.
protected Miss ( MemBlock ip ) : bool
ip MemBlock The IP Address to look up in the Dht.
Результат bool

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

This is the asynchronous callback for Miss. This contains the lookup results from the Dht. If there is a valid mapping it is added to the cache. Either way, new queries can now be run for the IP address after the completion of this method.
protected MissCallback ( Object o, EventArgs args ) : void
o Object Contains the Channel where the results are stored.
args System.EventArgs Null.
Результат void

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

Translates an IP Address to a Brunet Address. If it is in the cache it returns a result, otherwise it returns null and begins a Miss lookup.
public Resolve ( MemBlock ip ) : Brunet.Address
ip MemBlock The IP Address to translate.
Результат Brunet.Address

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

Stops the timer at which point a new DhtAddressResolver will need to be constructed, if used in the same process.
public Stop ( ) : void
Результат void

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

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

Failed query attempts.
protected Dictionary _attempts
Результат int>.Dictionary

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

The dht object to use for dht interactions.
protected IDht _dht
Результат IDht

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

Cache based upon check calls
protected TimeBasedCache _incoming_cache
Результат Address>.TimeBasedCache

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

The ipop namespace where the dhcp server is storing names
protected string _ipop_namespace
Результат string

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

Maps the Channel in MissCallback to an IP.
protected Dictionary _mapping
Результат MemBlock>.Dictionary

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

Contains which IP Address Misses are pending.
protected Dictionary _queued
Результат bool>.Dictionary

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

A lock synchronizer for the hashtables and cache.
protected Object _sync
Результат Object

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

Cache based upon Dht and thus verified
protected TimeBasedCache _verified_cache
Результат Address>.TimeBasedCache