This class provides a Rpc to be used during crawls of the network. It provides base informatoin such as geographical coordinates, local end points, the type of node, and neighbors. There is also support for user's to put their own data in the return value.
Inheritance: IRpcHandler
コード例 #1
0
ファイル: IpopNode.cs プロジェクト: pstjuste/brunet
    /// <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);
    }
コード例 #2
0
ファイル: IpopNode.cs プロジェクト: xujyan/ipop
        /// <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;
        }
コード例 #3
0
ファイル: IpopNode.cs プロジェクト: reith2004/ipop
        /// <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);
        }