C# Class 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.
Inheritance: Brunet.Applications.BasicNode, IDataHandler, IRpcHandler
Afficher le fichier Open project: pstjuste/brunet Class Usage Examples

Méthodes publiques

Свойство Type Description
AppNode Brunet.Applications.ApplicationNode
Ethernet Ethernet
Info Brunet.Applications.Information
PublicInfo Brunet.Applications.Information
PublicNode Brunet.Applications.ApplicationNode

Protected Properties

Свойство Type Description
_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

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Method Details

CalculateNetmaskCidr() public static méthode

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
Résultat int

CheckInDhcpServer() protected méthode

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
Résultat void

CheckNode() protected méthode

protected CheckNode ( object o, EventArgs ea ) : void
o object
ea System.EventArgs
Résultat void

CheckOutDhcpServer() protected méthode

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
Résultat Ipop.DhcpServer

GetDhcpConfig() protected méthode

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
Résultat void

GetDhcpServer() protected abstract méthode

Used to retrieve an instance of the DhcpServer associated with this type of node.
protected abstract GetDhcpServer ( ) : Ipop.DhcpServer
Résultat Ipop.DhcpServer

HandleArp() protected méthode

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
Résultat void

HandleBroadcast() protected méthode

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
Résultat bool

HandleData() public méthode

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
Résultat void

HandleDhcp() protected méthode

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
Résultat bool

HandleDns() protected méthode

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
Résultat bool

HandleIPIn() public méthode

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.
Résultat void

HandleIPOut() protected méthode

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
Résultat void

HandleMulticast() protected méthode

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
Résultat bool

HandleNewStaticIP() protected méthode

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.
Résultat void

HandleRpc() public méthode

public HandleRpc ( ISender caller, string method, IList args, object rs ) : void
caller ISender
method string
args IList
rs object
Résultat void

IpopNode() public méthode

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
Résultat Brunet

IsLocalIP() protected méthode

Is this our IP? Are we routing for it?
protected IsLocalIP ( MemBlock ip ) : bool
ip MemBlock The IP in question.
Résultat bool

MappingMissing() protected méthode

protected MappingMissing ( MemBlock ip ) : bool
ip MemBlock
Résultat bool

MissedMapping() protected méthode

protected MissedMapping ( string ip, Brunet.Address addr ) : void
ip string
addr Brunet.Address
Résultat void

Run() public méthode

Starts the execution of the IpopNode, this passes the caller to execute the Brunet.Connect to eventually become Brunet.AnnounceThread.
public Run ( ) : void
Résultat void

SendIP() protected méthode

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
Résultat void

SendIcmpRequest() protected méthode

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
Résultat void

SetDns() protected méthode

protected SetDns ( ) : void
Résultat void

SetTAAuth() protected méthode

protected SetTAAuth ( ) : void
Résultat void

SupportedDns() protected méthode

protected SupportedDns ( string dns ) : bool
dns string
Résultat bool

UpdateMapping() protected méthode

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
Résultat void

WriteIP() protected méthode

Writes an IPPacket as is to the TAP device.
protected WriteIP ( ICopyable packet ) : void
packet ICopyable The IPPacket!
Résultat void

Property Details

AppNode public_oe property

Stores the underlying ApplicationNode
public ApplicationNode,Brunet.Applications AppNode
Résultat Brunet.Applications.ApplicationNode

Ethernet public_oe property

The Virtual Network handler
public Ethernet,Ipop Ethernet
Résultat Ethernet

Info public_oe property

The Rpc handler for Information
public Information,Brunet.Applications Info
Résultat Brunet.Applications.Information

PublicInfo public_oe property

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
Résultat Brunet.Applications.Information

PublicNode public_oe property

Stores the public overlays ApplicationNode. It will be the same as AppNode, if there is no private overlay.
public ApplicationNode,Brunet.Applications PublicNode
Résultat Brunet.Applications.ApplicationNode

_address_resolver protected_oe property

Resolves IP Addresses to Brunet.Addresses
protected IAddressResolver _address_resolver
Résultat IAddressResolver

_broadcast protected_oe property

Enables broadcast.
protected bool _broadcast
Résultat bool

_checked_out protected_oe property

A hashtable used to lock Dhcp Servers.
protected Hashtable,System.Collections _checked_out
Résultat System.Collections.Hashtable

_conn_handler protected_oe property

Address to ISender (connection or secure connection).
protected ConnectionHandler _conn_handler
Résultat ConnectionHandler

_dhcp_client_port protected_oe property

Port number to use for the Dhcp Client, typically 68.
protected int _dhcp_client_port
Résultat int

_dhcp_config protected_oe property

We use this to set our L3 network
protected DHCPConfig,Ipop _dhcp_config
Résultat DHCPConfig

_dhcp_server protected_oe property

protected DhcpServer,Ipop _dhcp_server
Résultat Ipop.DhcpServer

_dhcp_server_port protected_oe property

Port number to use for the Dhcp Server, typically 67.
protected int _dhcp_server_port
Résultat int

_dns protected_oe property

Resolves hostnames and IP Addresses
protected Dns _dns
Résultat Dns

_ether_to_dhcp_server protected_oe property

Mapping of Ethernet to the its Dhcp server.
protected Dictionary _ether_to_dhcp_server
Résultat DhcpServer>.Dictionary

_ether_to_ip protected_oe property

Mapping of Ethernet address to IP Address.
protected Dictionary _ether_to_ip
Résultat MemBlock>.Dictionary

_ip_to_ether protected_oe property

Mapping of IP Address to Ethernet Address
protected Dictionary _ip_to_ether
Résultat MemBlock>.Dictionary

_ipop_config protected_oe property

The IpopConfig for this IpopNode
protected IpopConfig,Ipop _ipop_config
Résultat IpopConfig

_last_check_node protected_oe property

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
Résultat System.DateTime

_lock protected_oe property

Because locks are reentrant, this is a non-reentrant lock.
protected int _lock
Résultat int

_multicast protected_oe property

Enables multicast.
protected bool _multicast
Résultat bool

_static_dhcp_server protected_oe property

Used to hold configuration information.
protected DhcpServer,Ipop _static_dhcp_server
Résultat Ipop.DhcpServer

_static_mapping protected_oe property

protected Dictionary _static_mapping
Résultat SimpleTimer>.Dictionary

_sync protected_oe property

Global lock
protected object _sync
Résultat object

_translator protected_oe property

If necessary, acts as a DNAT / SNAT
protected ITranslator _translator
Résultat ITranslator