///<summary>Creates a DhtIpopNode.</summary> /// <param name="NodeConfig">NodeConfig object</param> /// <param name="IpopConfig">IpopConfig object</param> public DhtIpopNode(NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config) : base(node_config, ipop_config, dhcp_config) { _address_resolver = new DhtAddressResolver(Dht, _ipop_config.IpopNamespace); _connected = false; Brunet.StateChangeEvent += StateChangeHandler; StateChangeHandler(Brunet, Brunet.ConState); }
public SocialNode(NodeConfig brunetConfig, IpopConfig ipopConfig, RSACryptoServiceProvider rsa) : base(brunetConfig, ipopConfig) { _friends = ImmutableDictionary<string, SocialUser>.Empty; _rsa = rsa; _address = AppNode.Node.Address.ToString(); _user = new WriteOnce<SocialUser>(); _mco = new ManagedConnectionOverlord(AppNode.Node); AppNode.Node.AddConnectionOverlord(_mco); }
///<summary>Creates a DhtIpopNode.</summary> /// <param name="NodeConfig">NodeConfig object</param> /// <param name="IpopConfig">IpopConfig object</param> public DhtIpopNode(NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config) : base(node_config, ipop_config, dhcp_config) { DhtAddressResolver dar = new DhtAddressResolver(AppNode.Dht, _ipop_config.IpopNamespace); Shutdown.OnExit += dar.Stop; _address_resolver = dar; _connected = false; AppNode.Node.StateChangeEvent += StateChangeHandler; StateChangeHandler(AppNode.Node, AppNode.Node.ConState); }
public SocialNode(NodeConfig brunetConfig, IpopConfig ipopConfig, string certificate) : base(brunetConfig, ipopConfig) { _friends = new Dictionary<string, SocialUser>(); _bfriends = new List<string>(); _sync = new object(); _status = StatusTypes.Offline.ToString(); _global_block = new WriteOnce<bool>(); _local_user = new SocialUser(); _local_user.Certificate = certificate; _local_user.IP = _marad.LocalIP; _marad.AddDnsMapping(_local_user.Alias, _local_user.IP, true); _bso = AppNode.SecurityOverlord; _bso.CertificateHandler.AddCACertificate(_local_user.GetCert().X509); _bso.CertificateHandler.AddSignedCertificate(_local_user.GetCert().X509); }
/** * Constructor. * @param brunetConfig configuration file for Brunet P2P library. * @param ipopConfig configuration file for IP over P2P app. */ public SocialNode(NodeConfig brunetConfig, IpopConfig ipopConfig, string certDir, string http_port, string jabber_port, string global_access) : base(brunetConfig, ipopConfig) { _friends = new Dictionary<string, SocialUser>(); _aliases = new Dictionary<string, string>(); _addr_to_key = new Dictionary<string, string>(); _cert_dir = certDir; _http_port = http_port; string cert_path = Path.Combine(certDir, CERTFILENAME); _local_cert = new Certificate(SocialUtils.ReadFileBytes(cert_path)); _local_user = new SocialUser(_local_cert); _local_cert_b64 = Convert.ToBase64String(_local_cert.X509.RawData); _bso.CertificateHandler.AddCACertificate(_local_cert.X509); _bso.CertificateHandler.AddSignedCertificate(_local_cert.X509); _queue = new BlockingQueue(); _snp = new SocialNetworkProvider(this.Dht, _local_user, _local_cert.X509.RawData, _queue, jabber_port); _sdm = new SocialDnsManager(this, _local_user); _srh = new SocialRpcHandler(_node, _local_user, _friends, _queue, _sdm); _scm = new SocialConnectionManager(this, _snp, _srh, http_port, _queue, _sdm); _cert_published = false; _node.ConnectionTable.ConnectionEvent += ConnectHandler; _node.HeartBeatEvent += _scm.HeartBeatHandler; Shutdown.OnExit += _scm.Stop; _local_user.IP = _marad.LocalIP; CreateAlias(_local_user); _marad.MapLocalDNS(_local_user.Alias); _scm.GlobalAccess = (global_access == "on"); LoadCertificates(); }
/// <summary>Creates an IpopNode given a NodeConfig and an IpopConfig. /// Also sets up the Information, Ethernet device, and subscribes /// to Brunet for IP Packets</summary> /// <param name="node_config">The path to a NodeConfig xml file</param> /// <param name="ipop_config">The path to a IpopConfig xml file</param> public IpopNode(NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config) : base(node_config) { CreateNode(); this.Brunet = _node; _ipop_config = ipop_config; Ethernet = new Ethernet(_ipop_config.VirtualNetworkDevice); Ethernet.Subscribe(this, null); _info = new Information(Brunet, "IpopNode"); _info.UserData["IpopNamespace"] = _ipop_config.IpopNamespace; if(_ipop_config.EndToEndSecurity && _bso != null) { _secure_senders = true; } else { _secure_senders = false; } Brunet.GetTypeSource(PType.Protocol.IP).Subscribe(this, null); _sync = new object(); _lock = 0; _ether_to_ip = new Dictionary<MemBlock, MemBlock>(); _ip_to_ether = new Dictionary<MemBlock, MemBlock>(); _dhcp_server_port = _ipop_config.DHCPPort != 0 ? _ipop_config.DHCPPort : 67; _dhcp_client_port = _dhcp_server_port + 1; ProtocolLog.WriteIf(IpopLog.DHCPLog, String.Format( "Setting DHCP Ports to: {0},{1}", _dhcp_server_port, _dhcp_client_port)); _ether_to_dhcp_server = new Dictionary<MemBlock, DHCPServer>(); _static_mapping = new Dictionary<MemBlock, SimpleTimer>(); _dhcp_config = dhcp_config; if(_dhcp_config != null) { SetDNS(); _dhcp_server = GetDHCPServer(); } _checked_out = new Hashtable(); Brunet.HeartBeatEvent += CheckNode; _last_check_node = DateTime.UtcNow; }
/// <summary>Creates an IpopNode given a NodeConfig and an IpopConfig. /// Also sets up the Information, Ethernet device, and subscribes /// to Brunet for IP Packets</summary> /// <param name="node_config">The path to a NodeConfig xml file</param> /// <param name="ipop_config">The path to a IpopConfig xml file</param> public IpopNode(NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config) : base(node_config) { PublicNode = CreateNode(node_config); PublicNode.Node.DisconnectOnOverload = false; if(PublicNode.PrivateNode == null) { AppNode = PublicNode; } else { AppNode = PublicNode.PrivateNode; AppNode.Node.DisconnectOnOverload = false; } _ipop_config = ipop_config; Ethernet = new Ethernet(_ipop_config.VirtualNetworkDevice); Ethernet.Subscribe(this, null); Info = new Information(AppNode.Node, "IpopNode", AppNode.SecurityOverlord); Info.UserData["IpopNamespace"] = _ipop_config.IpopNamespace; if(PublicNode == AppNode) { PublicInfo = Info; } else { PublicInfo = new Information(PublicNode.Node, "PrivateIpopNode", PublicNode.SecurityOverlord); PublicInfo.UserData["IpopNamespace"] = _ipop_config.IpopNamespace; } if(_ipop_config.EndToEndSecurity && !AppNode.Config.Security.SecureEdges && AppNode.Config.Security.Enabled) { _conn_handler = new Brunet.Security.PeerSec.Symphony.SecureConnectionHandler( PType.Protocol.IP, AppNode.Node, AppNode.SymphonySecurityOverlord); } else { _conn_handler = new ConnectionHandler(PType.Protocol.IP, AppNode.Node); } _conn_handler.Subscribe(this, null); _sync = new object(); _lock = 0; _ether_to_ip = new Dictionary<MemBlock, MemBlock>(); _ip_to_ether = new Dictionary<MemBlock, MemBlock>(); _dhcp_server_port = _ipop_config.DHCPPort != 0 ? _ipop_config.DHCPPort : 67; _dhcp_client_port = _dhcp_server_port + 1; ProtocolLog.WriteIf(IpopLog.DhcpLog, String.Format( "Setting Dhcp Ports to: {0},{1}", _dhcp_server_port, _dhcp_client_port)); _ether_to_dhcp_server = new Dictionary<MemBlock, DhcpServer>(); _static_mapping = new Dictionary<MemBlock, SimpleTimer>(); _dhcp_config = dhcp_config; if(_dhcp_config != null) { SetDns(); SetTAAuth(); _dhcp_server = GetDhcpServer(); } _checked_out = new Hashtable(); AppNode.Node.HeartBeatEvent += CheckNode; _last_check_node = DateTime.UtcNow; AppNode.Node.Rpc.AddHandler("Ipop", this); }
/// <summary>Creates an IpopNode given a NodeConfig and an IpopConfig. /// Also sets up the Information, Ethernet device, and subscribes /// to Brunet for IP Packets</summary> /// <param name="node_config">The path to a NodeConfig xml file</param> /// <param name="ipop_config">The path to a IpopConfig xml file</param> public IpopNode(NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config) : base(node_config) { PublicNode = CreateNode(node_config); PublicNode.Node.DisconnectOnOverload = false; if (PublicNode.PrivateNode == null) { AppNode = PublicNode; } else { AppNode = PublicNode.PrivateNode; AppNode.Node.DisconnectOnOverload = false; } _ipop_config = ipop_config; Ethernet = new Ethernet(_ipop_config.VirtualNetworkDevice); Ethernet.Subscribe(this, null); Info = new Information(AppNode.Node, "IpopNode", AppNode.SecurityOverlord); Info.UserData["IpopNamespace"] = _ipop_config.IpopNamespace; if (PublicNode == AppNode) { PublicInfo = Info; } else { PublicInfo = new Information(PublicNode.Node, "PrivateIpopNode", PublicNode.SecurityOverlord); PublicInfo.UserData["IpopNamespace"] = _ipop_config.IpopNamespace; } if (_ipop_config.EndToEndSecurity && !AppNode.Config.Security.SecureEdges && AppNode.Config.Security.Enabled) { _conn_handler = new Brunet.Security.PeerSec.Symphony.SecureConnectionHandler( PType.Protocol.IP, AppNode.Node, AppNode.SymphonySecurityOverlord); } else { _conn_handler = new ConnectionHandler(PType.Protocol.IP, AppNode.Node); } _conn_handler.Subscribe(this, null); _sync = new object(); _lock = 0; _ether_to_ip = new Dictionary <MemBlock, MemBlock>(); _ip_to_ether = new Dictionary <MemBlock, MemBlock>(); _dhcp_server_port = _ipop_config.DHCPPort != 0 ? _ipop_config.DHCPPort : 67; _dhcp_client_port = _dhcp_server_port + 1; ProtocolLog.WriteIf(IpopLog.DhcpLog, String.Format( "Setting Dhcp Ports to: {0},{1}", _dhcp_server_port, _dhcp_client_port)); _ether_to_dhcp_server = new Dictionary <MemBlock, DhcpServer>(); _static_mapping = new Dictionary <MemBlock, SimpleTimer>(); _dhcp_config = dhcp_config; if (_dhcp_config != null) { SetDns(); SetTAAuth(); _dhcp_server = GetDhcpServer(); } _checked_out = new Hashtable(); AppNode.Node.HeartBeatEvent += CheckNode; _last_check_node = DateTime.UtcNow; AppNode.Node.Rpc.AddHandler("Ipop", this); }
public DhtIpopNode(NodeConfig node_config, IpopConfig ipop_config) : this(node_config, ipop_config, null) { }
/// <summary>Creates an IpopNode given a NodeConfig and an IpopConfig. /// Also sets up the Information, Ethernet device, and subscribes /// to Brunet for IP Packets</summary> /// <param name="node_config">The path to a NodeConfig xml file</param> /// <param name="ipop_config">The path to a IpopConfig xml file</param> public IpopNode(NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config) : base(node_config) { AppNode = CreateNode(node_config); AppNode.Node.DisconnectOnOverload = false; _chota = AppNode.Node.Cco; _ipop_config = ipop_config; Ethernet = new Ethernet(_ipop_config.VirtualNetworkDevice); Ethernet.Subscribe(this, null); Info = new Information(AppNode.Node, "IpopNode"); Info.UserData["IpopNamespace"] = _ipop_config.IpopNamespace; if(_ipop_config.EndToEndSecurity && AppNode.SecurityOverlord != null) { _secure_senders = true; } else { _secure_senders = false; } AppNode.Node.GetTypeSource(PType.Protocol.IP).Subscribe(this, null); _sync = new object(); _lock = 0; _ether_to_ip = new Dictionary<MemBlock, MemBlock>(); _ip_to_ether = new Dictionary<MemBlock, MemBlock>(); _dhcp_server_port = _ipop_config.DHCPPort != 0 ? _ipop_config.DHCPPort : 67; _dhcp_client_port = _dhcp_server_port + 1; ProtocolLog.WriteIf(IpopLog.DhcpLog, String.Format( "Setting Dhcp Ports to: {0},{1}", _dhcp_server_port, _dhcp_client_port)); _ether_to_dhcp_server = new Dictionary<MemBlock, DhcpServer>(); _static_mapping = new Dictionary<MemBlock, SimpleTimer>(); _dhcp_config = dhcp_config; if(_dhcp_config != null) { SetDns(); _dhcp_server = GetDhcpServer(); } _checked_out = new Hashtable(); AppNode.Node.HeartBeatEvent += CheckNode; _last_check_node = DateTime.UtcNow; AppNode.Node.Rpc.AddHandler("Ipop", this); }
///<summary>Creates a DhtIpopNode.</summary> /// <param name="NodeConfig">NodeConfig object</param> /// <param name="IpopConfig">IpopConfig object</param> public DhtIpopNode(NodeConfig node_config, IpopConfig ipop_config, DHCPConfig dhcp_config) : base(node_config, ipop_config, dhcp_config) { _address_resolver = new DhtAddressResolver(Dht, _ipop_config.IpopNamespace); }