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
파일 보기 프로젝트 열기: pstjuste/brunet 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
AppNode Brunet.Applications.ApplicationNode
Ethernet Ethernet
Info Brunet.Applications.Information
PublicInfo Brunet.Applications.Information
PublicNode Brunet.Applications.ApplicationNode

보호된 프로퍼티들

프로퍼티 타입 설명
_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