C# Class Ipop.Managed.ManagedAddressResolverAndDns

This class implements Dns, IAddressResolver, IManagedHandler, and ITranslator. It provides most functionality needed by ManagedIpopNode.
Inheritance: System.Net.Dns, IAddressResolver, ITranslator
Show file Open project: pstjuste/brunet Class Usage Examples

Public Properties

Property Type Description
mcast_addr List

Protected Properties

Property Type Description
_addr_ip MemBlock>.Dictionary
_blocked_addrs MemBlock>.Dictionary
_dhcp DhcpServer
_dns_a string>.Dictionary
_dns_ptr string>.Dictionary
_ip_addr Address>.Dictionary
_local_ip MemBlock
_node StructuredNode
_resolver WriteOnce
_rx_counters int>.Dictionary
_sync object
_tx_counters int>.Dictionary
_udp_translators IProtocolTranslator[]

Public Methods

Method Description
AddDnsMapping ( string alias, string ip, bool reverse ) : void

Maps DNS alias to IP address.

AddIPMapping ( string ip, Brunet.Address addr ) : string

Maps IP address to Brunet address.

AddressLookUp ( String name ) : String

This method does an address lookup on the Dns

Check ( MemBlock ip, Brunet.Address addr ) : bool
GetStats ( string address ) : string
ManagedAddressResolverAndDns ( StructuredNode node, DhcpServer dhcp, MemBlock local_ip, string name_server, bool forward_queries ) : Brunet

Constructor for the class, it initializes various objects

MapLocalDns ( string name ) : bool

Sets up DNS for localhost

NameLookUp ( String ip ) : String

This method does an inverse lookup for the DNS

RemoveDnsMapping ( string alias, bool reverse ) : void

Remove Dns alias mapping.

RemoveIPMapping ( string ip ) : void

Remove IP to Brunet address mapping.

Resolve ( MemBlock IP ) : Brunet.Address

Returns the Brunet address given an IP

Translate ( MemBlock packet, Brunet.Address from ) : MemBlock

Implements the ITranslator portion for ManagedAddress..., takes an IP Packet, based upon who the originating Brunet Sender was, changes who the packet was sent from and then switches the destination address to the local nodes address. Takes incomming packets only.

Protected Methods

Method Description
UpdateCounter ( int>.Dictionary counters, Brunet.Address addr ) : void

Method Details

AddDnsMapping() public method

Maps DNS alias to IP address.
public AddDnsMapping ( string alias, string ip, bool reverse ) : void
alias string Dns alias to map
ip string IP address to map
reverse bool If true, add reverve mapping
return void

AddIPMapping() public method

Maps IP address to Brunet address.
public AddIPMapping ( string ip, Brunet.Address addr ) : string
ip string IP address to map
addr Brunet.Address Brunet address to map
return string

AddressLookUp() public method

This method does an address lookup on the Dns
public AddressLookUp ( String name ) : String
name String Takes in name as string to lookup
return String

Check() public method

public Check ( MemBlock ip, Brunet.Address addr ) : bool
ip MemBlock
addr Brunet.Address
return bool

GetStats() public method

public GetStats ( string address ) : string
address string
return string

ManagedAddressResolverAndDns() public method

Constructor for the class, it initializes various objects
public ManagedAddressResolverAndDns ( StructuredNode node, DhcpServer dhcp, MemBlock local_ip, string name_server, bool forward_queries ) : Brunet
node StructuredNode Takes in a structured node
dhcp DhcpServer
local_ip MemBlock
name_server string
forward_queries bool
return Brunet

MapLocalDns() public method

Sets up DNS for localhost
public MapLocalDns ( string name ) : bool
name string The DNS alias for the localhost
return bool

NameLookUp() public method

This method does an inverse lookup for the DNS
public NameLookUp ( String ip ) : String
ip String IP address of the name that's being looked up
return String

RemoveDnsMapping() public method

Remove Dns alias mapping.
public RemoveDnsMapping ( string alias, bool reverse ) : void
alias string Dns alias to remove
reverse bool If true, remove reverse mapping
return void

RemoveIPMapping() public method

Remove IP to Brunet address mapping.
public RemoveIPMapping ( string ip ) : void
ip string IP address to remove
return void

Resolve() public method

Returns the Brunet address given an IP
public Resolve ( MemBlock IP ) : Brunet.Address
IP MemBlock A MemBlock of the IP
return Brunet.Address

Translate() public method

Implements the ITranslator portion for ManagedAddress..., takes an IP Packet, based upon who the originating Brunet Sender was, changes who the packet was sent from and then switches the destination address to the local nodes address. Takes incomming packets only.
public Translate ( MemBlock packet, Brunet.Address from ) : MemBlock
packet MemBlock The IP Packet to translate.
from Brunet.Address The Brunet address the packet was sent from.
return MemBlock

UpdateCounter() protected method

protected UpdateCounter ( int>.Dictionary counters, Brunet.Address addr ) : void
counters int>.Dictionary
addr Brunet.Address
return void

Property Details

_addr_ip protected property

Maps Brunet Address as Address to MemBlock IP Addresses
protected Dictionary _addr_ip
return MemBlock>.Dictionary

_blocked_addrs protected property

Keeps track of blocked addresses
protected Dictionary _blocked_addrs
return MemBlock>.Dictionary

_dhcp protected property

Helps assign remote end points
protected DhcpServer _dhcp
return DhcpServer

_dns_a protected property

Contains ip:hostname mapping
protected Dictionary _dns_a
return string>.Dictionary

_dns_ptr protected property

Contains hostname:ip mapping
protected Dictionary _dns_ptr
return string>.Dictionary

_ip_addr protected property

Maps MemBlock IP Addresses to Brunet Address as Address
protected Dictionary _ip_addr
return Address>.Dictionary

_local_ip protected property

MemBlock of the IP mapped to local node
protected MemBlock _local_ip
return MemBlock

_node protected property

The node to do ping checks on
protected StructuredNode _node
return StructuredNode

_resolver protected property

Create a new address resolver
protected WriteOnce _resolver
return WriteOnce

_rx_counters protected property

Keeps track of number or received packets
protected Dictionary _rx_counters
return int>.Dictionary

_sync protected property

Synchronization object
protected object _sync
return object

_tx_counters protected property

Keeps track of number of sent packets
protected Dictionary _tx_counters
return int>.Dictionary

_udp_translators protected property

protected IProtocolTranslator[] _udp_translators
return IProtocolTranslator[]

mcast_addr public property

Array list of multicast addresses
public List
mcast_addr
return List