Ejemplo n.º 1
0
 /// <summary>The request on the IP allocation space (DHT) has returned.  So
 /// we're done with the server.</summary>
 protected void CheckInDHCPServer(DHCPServer dhcp_server)
 {
     lock(_checked_out.SyncRoot) {
     _checked_out.Remove(dhcp_server);
       }
 }
Ejemplo n.º 2
0
        /// <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;
        }