示例#1
0
 public NetworkPeerService(NetworkPeerStorage p, WinDHCP.Library.DhcpServer dhcpManager)
 {
     this.storage = p;
     init();
     if (isSetIP) {
         dhcpManager.addReservation(storage.MACAddress, storage.IPAddress);
         if (isSetHostName)
             updateHostName(storage.HostName);
     }
 }
示例#2
0
 public NetworkPeerService(NetworkPeerStorage p, WinDHCP.Library.DhcpServer dhcpManager)
 {
     this.storage = p;
     init();
     if (isSetIP)
     {
         dhcpManager.addReservation(storage.MACAddress, storage.IPAddress);
         if (isSetHostName)
         {
             updateHostName(storage.HostName);
         }
     }
 }
示例#3
0
        public void SaveConfig()
        {
            Trace.TraceInformation("Getaway saving config");

            var serviceState = new softGetawayServiceState();

            serviceState.active = shouldStart_;

            var connGuid = GetSharedConnection();

            if (connGuid != null)
            {
                serviceState.publicConnectionGuid = connGuid;
            }

            var connSettings = GetPrivateConnectionSettings();

            serviceState.wifiSSID          = connSettings.SSID;
            serviceState.limitClientsCount = connSettings.MaxPeerCount;

            serviceState.wifiPassword = connSettings.Password;

            serviceState.privateIP = GetIP();
            objectToFile(strStateFileName + "config", serviceState);
            var peersState = new softGetawayPeersStorage();

            foreach (var peerService in GetPeers())
            {
                NetworkPeerStorage storage = (NetworkPeerStorage)peerService.storage.Clone();
                if (!peerService.isSetHostName)
                {
                    storage.HostName = null;
                }
                if (!peerService.isSetIP)
                {
                    storage.IPAddress = null;
                }
                peersState.peers.Add(storage);
            }
            objectToFile(strStateFileName + "peers", peersState);

            Trace.TraceInformation("Getaway config saved");
        }
示例#4
0
 public NetworkPeerService()
 {
     storage = new NetworkPeerStorage();
 }
示例#5
0
 internal void AddPeerFromStorage(NetworkPeerStorage p)
 {
     Peers[p.MACAddress] = new NetworkPeerService(p, dhcpManager);
 }
示例#6
0
 internal void AddPeerFromStorage(NetworkPeerStorage p)
 {
     Peers[p.MACAddress] = new NetworkPeerService(p, dhcpManager);
 }
示例#7
0
 public NetworkPeerService()
 {
     storage = new NetworkPeerStorage();
 }