C# Класс Ipop.IpopNode

IpopRouter allows Ipop to provide L3 connectivity between multiple domains with only a single instance per site.
Specifically, a user can have 2 remote clusters set up and using only a single instance of Ipop per-site connect the two clusters. Unlike previous versions of Ipop, the advantage are that this does not require any configuration changes to the individual cluster machines, still provides dynamic IP addresses for all nodes in the combined cluster, and allows machines in the same cluster to talk directly with each other.
Наследование: Brunet.Applications.BasicNode, IDataHandler, IRpcHandler
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
AppNode Brunet.Applications.ApplicationNode
Ethernet Ethernet
Info Brunet.Applications.Information
PublicInfo Brunet.Applications.Information
PublicNode Brunet.Applications.ApplicationNode

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

Свойство Тип Описание
_address_resolver IAddressResolver
_broadcast bool
_checked_out System.Collections.Hashtable
_conn_handler ConnectionHandler
_dhcp_client_port int
_dhcp_config DHCPConfig
_dhcp_server Ipop.DhcpServer
_dhcp_server_port int
_dns Dns
_ether_to_dhcp_server DhcpServer>.Dictionary
_ether_to_ip MemBlock>.Dictionary
_ip_to_ether MemBlock>.Dictionary
_ipop_config IpopConfig
_last_check_node System.DateTime
_lock int
_multicast bool
_static_dhcp_server Ipop.DhcpServer
_static_mapping SimpleTimer>.Dictionary
_sync object
_translator ITranslator

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

Метод Описание
CalculateNetmaskCidr ( string netmask ) : int

Converts from a.b.c.d to the number of 1s in a.b.c.d (CIDR notation).

HandleData ( MemBlock b, ISender ret, object state ) : void

This method handles all incoming packets into the IpopNode, both abroad and local. This is done to reduce unnecessary extra classes and circular dependencies. This method probably shouldn't be called directly.

HandleIPIn ( MemBlock packet, ISender ret ) : void

This method handles IPPackets that come from Brunet, i.e., abroad.

HandleRpc ( ISender caller, string method, IList args, object rs ) : void
IpopNode ( NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config ) : Brunet

Creates an IpopNode given a NodeConfig and an IpopConfig. Also sets up the Information, Ethernet device, and subscribes to Brunet for IP Packets

Run ( ) : void

Starts the execution of the IpopNode, this passes the caller to execute the Brunet.Connect to eventually become Brunet.AnnounceThread.

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

Метод Описание
CheckInDhcpServer ( Ipop.DhcpServer dhcp_server ) : void

The request on the IP allocation space (DHT) has returned. So we're done with the server.

CheckNode ( object o, EventArgs ea ) : void
CheckOutDhcpServer ( MemBlock ether_addr ) : Ipop.DhcpServer

Static addresses are handled nearly identically to dynamic, so we use one shared method to pull a dhcp server from the list of dhcp servers. We only want one request per Ethernet / IP at a time.

GetDhcpConfig ( ) : void

We need to get the DHCPConfig as soon as possible so that we can allocate static addresses, this method helps us do that.

GetDhcpServer ( ) : Ipop.DhcpServer

Used to retrieve an instance of the DhcpServer associated with this type of node.

HandleArp ( MemBlock packet ) : void

Parses Arp Packets and writes to the Ethernet the translation.

IpopRouter makes nodes think they are in the same Layer 2 network so that two nodes in the same network can communicate directly with each other. IpopRouter masquerades for those that are not local.

HandleBroadcast ( IPPacket ipp ) : bool

This method is called by HandleIPOut if the destination address is the broadcast address. If you want Broadcast, implement this method, output will most likely be sent via the SendIP() method in the IpopNode base class.

HandleDhcp ( IPPacket ipp ) : bool

This is used to process a dhcp packet on the node side, that includes placing data such as the local Brunet Address, Ipop Namespace, and other optional parameters in our request to the dhcp server. When receiving the results, if it is successful, the results are written to the TAP device.

HandleDns ( IPPacket ipp ) : bool

If a request is sent to address a.b.c.255 with the dns port (53), this method will be called by HandleIPOut. If you want Dns, implement this method, responses should be written directly to the tap interface using Ethernet.Send()

HandleIPOut ( EthernetPacket packet, ISender ret ) : void

This method handles IPPackets that come from the TAP Device, i.e., local system.

Currently this supports HandleMulticast (ip[0] >= 244 && ip[0]<=239), HandleDns (dport = 53 and ip[3] == 1), dhcp (sport 68 and dport 67.

HandleMulticast ( IPPacket ipp ) : bool

This method is called by HandleIPOut if the destination address is within the multicast address range. If you want Multicast, implement this method, output will most likely be sent via the SendIP() method in the IpopNode base class.

HandleNewStaticIP ( MemBlock ether_addr, MemBlock ip ) : void

Let's see if we can route for an IP. Default is do nothing!

IsLocalIP ( MemBlock ip ) : bool

Is this our IP? Are we routing for it?

MappingMissing ( MemBlock ip ) : bool
MissedMapping ( string ip, Brunet.Address addr ) : void
SendIP ( Brunet.Address target, MemBlock packet ) : void

Sends the IP Packet to the specified target address.

SendIcmpRequest ( MemBlock dest_ip ) : void

This sends an Icmp Request to the specified address, we want him to respond to us, so we can guarantee that by pretending to be the Server (i.e. x.y.z.1). We'll get a response in our main thread.

SetDns ( ) : void
SetTAAuth ( ) : void
SupportedDns ( string dns ) : bool
UpdateMapping ( MemBlock ether_addr, MemBlock ip_addr ) : void

Called when an ethernet address has had its IP address changed or set for the first time.

WriteIP ( ICopyable packet ) : void

Writes an IPPacket as is to the TAP device.

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

CalculateNetmaskCidr() публичный статический Метод

Converts from a.b.c.d to the number of 1s in a.b.c.d (CIDR notation).
public static CalculateNetmaskCidr ( string netmask ) : int
netmask string
Результат int

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

The request on the IP allocation space (DHT) has returned. So we're done with the server.
protected CheckInDhcpServer ( Ipop.DhcpServer dhcp_server ) : void
dhcp_server Ipop.DhcpServer
Результат void

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

protected CheckNode ( object o, EventArgs ea ) : void
o object
ea System.EventArgs
Результат void

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

Static addresses are handled nearly identically to dynamic, so we use one shared method to pull a dhcp server from the list of dhcp servers. We only want one request per Ethernet / IP at a time.
protected CheckOutDhcpServer ( MemBlock ether_addr ) : Ipop.DhcpServer
ether_addr MemBlock
Результат Ipop.DhcpServer

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

We need to get the DHCPConfig as soon as possible so that we can allocate static addresses, this method helps us do that.
protected GetDhcpConfig ( ) : void
Результат void

GetDhcpServer() защищенный абстрактный Метод

Used to retrieve an instance of the DhcpServer associated with this type of node.
protected abstract GetDhcpServer ( ) : Ipop.DhcpServer
Результат Ipop.DhcpServer

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

Parses Arp Packets and writes to the Ethernet the translation.
IpopRouter makes nodes think they are in the same Layer 2 network so that two nodes in the same network can communicate directly with each other. IpopRouter masquerades for those that are not local.
protected HandleArp ( MemBlock packet ) : void
packet MemBlock
Результат void

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

This method is called by HandleIPOut if the destination address is the broadcast address. If you want Broadcast, implement this method, output will most likely be sent via the SendIP() method in the IpopNode base class.
protected HandleBroadcast ( IPPacket ipp ) : bool
ipp NetworkPackets.IPPacket The IPPacket the contains the broadcast message
Результат bool

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

This method handles all incoming packets into the IpopNode, both abroad and local. This is done to reduce unnecessary extra classes and circular dependencies. This method probably shouldn't be called directly.
public HandleData ( MemBlock b, ISender ret, object state ) : void
b MemBlock The incoming packet
ret ISender An ISender to return data from the original sender.
state object always will be null
Результат void

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

This is used to process a dhcp packet on the node side, that includes placing data such as the local Brunet Address, Ipop Namespace, and other optional parameters in our request to the dhcp server. When receiving the results, if it is successful, the results are written to the TAP device.
protected HandleDhcp ( IPPacket ipp ) : bool
ipp NetworkPackets.IPPacket The IPPacket that contains the Dhcp Request
Результат bool

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

If a request is sent to address a.b.c.255 with the dns port (53), this method will be called by HandleIPOut. If you want Dns, implement this method, responses should be written directly to the tap interface using Ethernet.Send()
protected HandleDns ( IPPacket ipp ) : bool
ipp NetworkPackets.IPPacket The IPPacket contain the Dns packet
Результат bool

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

This method handles IPPackets that come from Brunet, i.e., abroad.
public HandleIPIn ( MemBlock packet, ISender ret ) : void
packet MemBlock The packet from Brunet.
ret ISender An ISender to send data to the Brunet node that sent /// the packet.
Результат void

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

This method handles IPPackets that come from the TAP Device, i.e., local system.
Currently this supports HandleMulticast (ip[0] >= 244 && ip[0]<=239), HandleDns (dport = 53 and ip[3] == 1), dhcp (sport 68 and dport 67.
protected HandleIPOut ( EthernetPacket packet, ISender ret ) : void
packet NetworkPackets.EthernetPacket The packet from the TAP device
ret ISender
Результат void

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

This method is called by HandleIPOut if the destination address is within the multicast address range. If you want Multicast, implement this method, output will most likely be sent via the SendIP() method in the IpopNode base class.
protected HandleMulticast ( IPPacket ipp ) : bool
ipp NetworkPackets.IPPacket The IPPacket the contains the multicast message
Результат bool

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

Let's see if we can route for an IP. Default is do nothing!
protected HandleNewStaticIP ( MemBlock ether_addr, MemBlock ip ) : void
ether_addr MemBlock
ip MemBlock The IP in question.
Результат void

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

public HandleRpc ( ISender caller, string method, IList args, object rs ) : void
caller ISender
method string
args IList
rs object
Результат void

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

Creates an IpopNode given a NodeConfig and an IpopConfig. Also sets up the Information, Ethernet device, and subscribes to Brunet for IP Packets
public IpopNode ( NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config ) : Brunet
node_config Brunet.Applications.NodeConfig The path to a NodeConfig xml file
ipop_config IpopConfig The path to a IpopConfig xml file
dhcp_config DHCPConfig
Результат Brunet

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

Is this our IP? Are we routing for it?
protected IsLocalIP ( MemBlock ip ) : bool
ip MemBlock The IP in question.
Результат bool

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

protected MappingMissing ( MemBlock ip ) : bool
ip MemBlock
Результат bool

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

protected MissedMapping ( string ip, Brunet.Address addr ) : void
ip string
addr Brunet.Address
Результат void

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

Starts the execution of the IpopNode, this passes the caller to execute the Brunet.Connect to eventually become Brunet.AnnounceThread.
public Run ( ) : void
Результат void

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

Sends the IP Packet to the specified target address.
protected SendIP ( Brunet.Address target, MemBlock packet ) : void
target Brunet.Address the Brunet Address of the target
packet MemBlock the data to send to the recepient
Результат void

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

This sends an Icmp Request to the specified address, we want him to respond to us, so we can guarantee that by pretending to be the Server (i.e. x.y.z.1). We'll get a response in our main thread.
protected SendIcmpRequest ( MemBlock dest_ip ) : void
dest_ip MemBlock
Результат void

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

protected SetDns ( ) : void
Результат void

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

protected SetTAAuth ( ) : void
Результат void

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

protected SupportedDns ( string dns ) : bool
dns string
Результат bool

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

Called when an ethernet address has had its IP address changed or set for the first time.
protected UpdateMapping ( MemBlock ether_addr, MemBlock ip_addr ) : void
ether_addr MemBlock
ip_addr MemBlock
Результат void

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

Writes an IPPacket as is to the TAP device.
protected WriteIP ( ICopyable packet ) : void
packet ICopyable The IPPacket!
Результат void

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

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

Stores the underlying ApplicationNode
public ApplicationNode,Brunet.Applications AppNode
Результат Brunet.Applications.ApplicationNode

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

The Virtual Network handler
public Ethernet,Ipop Ethernet
Результат Ethernet

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

The Rpc handler for Information
public Information,Brunet.Applications Info
Результат Brunet.Applications.Information

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

The Rpc handler for the Public overlays Information. It will be the same as AppNode's, if there is no private overlay.
public Information,Brunet.Applications PublicInfo
Результат Brunet.Applications.Information

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

Stores the public overlays ApplicationNode. It will be the same as AppNode, if there is no private overlay.
public ApplicationNode,Brunet.Applications PublicNode
Результат Brunet.Applications.ApplicationNode

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

Resolves IP Addresses to Brunet.Addresses
protected IAddressResolver _address_resolver
Результат IAddressResolver

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

Enables broadcast.
protected bool _broadcast
Результат bool

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

A hashtable used to lock Dhcp Servers.
protected Hashtable,System.Collections _checked_out
Результат System.Collections.Hashtable

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

Address to ISender (connection or secure connection).
protected ConnectionHandler _conn_handler
Результат ConnectionHandler

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

Port number to use for the Dhcp Client, typically 68.
protected int _dhcp_client_port
Результат int

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

We use this to set our L3 network
protected DHCPConfig,Ipop _dhcp_config
Результат DHCPConfig

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

protected DhcpServer,Ipop _dhcp_server
Результат Ipop.DhcpServer

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

Port number to use for the Dhcp Server, typically 67.
protected int _dhcp_server_port
Результат int

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

Resolves hostnames and IP Addresses
protected Dns _dns
Результат Dns

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

Mapping of Ethernet to the its Dhcp server.
protected Dictionary _ether_to_dhcp_server
Результат DhcpServer>.Dictionary

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

Mapping of Ethernet address to IP Address.
protected Dictionary _ether_to_ip
Результат MemBlock>.Dictionary

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

Mapping of IP Address to Ethernet Address
protected Dictionary _ip_to_ether
Результат MemBlock>.Dictionary

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

The IpopConfig for this IpopNode
protected IpopConfig,Ipop _ipop_config
Результат IpopConfig

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

We must check the node every so often to see if there are any static addresses that have gone away or new ones that have shown up.
protected DateTime,System _last_check_node
Результат System.DateTime

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

Because locks are reentrant, this is a non-reentrant lock.
protected int _lock
Результат int

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

Enables multicast.
protected bool _multicast
Результат bool

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

Used to hold configuration information.
protected DhcpServer,Ipop _static_dhcp_server
Результат Ipop.DhcpServer

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

protected Dictionary _static_mapping
Результат SimpleTimer>.Dictionary

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

Global lock
protected object _sync
Результат object

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

If necessary, acts as a DNAT / SNAT
protected ITranslator _translator
Результат ITranslator