public OutputListenerViewModel(SettingViewModel owner, OutputListener model) { this.owner = owner; if (model.LocalEndPoint.Address.Equals(System.Net.IPAddress.Any)) { address = "IPv4 Any"; } else if (model.LocalEndPoint.Address.Equals(System.Net.IPAddress.IPv6Any)) { address = "IPv6 Any"; } else { address = model.LocalEndPoint.Address.ToString(); } port = model.LocalEndPoint.Port; globalRelay = (model.GlobalOutputAccepts & OutputStreamType.Relay)!=0; globalPlay = (model.GlobalOutputAccepts & OutputStreamType.Play)!=0; globalInterface = (model.GlobalOutputAccepts & OutputStreamType.Interface)!=0; globalAuthRequired = model.GlobalAuthorizationRequired; localRelay = (model.LocalOutputAccepts & OutputStreamType.Relay)!=0; localPlay = (model.LocalOutputAccepts & OutputStreamType.Play)!=0; localInterface = (model.LocalOutputAccepts & OutputStreamType.Interface)!=0; localAuthRequired = model.LocalAuthorizationRequired; authId = model.AuthenticationKey!=null ? model.AuthenticationKey.Id : null; authPassword = model.AuthenticationKey!=null ? model.AuthenticationKey.Password : null; isOpen = null; RegenerateAuthKey = new Command(DoRegenerateAuthKey); }
/// <summary> /// 指定した接続待ち受けを終了します。 /// 既に接続されているクライアント接続には影響ありません /// </summary> /// <param name="listener">待ち受けを終了するリスナ</param> public void StopListen(OutputListener listener) { listener.Stop(); Utils.ReplaceCollection(ref outputListeners, orig => { var new_collection = new List <OutputListener>(orig); new_collection.Remove(listener); return(new_collection); }); }
/// <summary> /// 指定した接続待ち受けを終了します。 /// 既に接続されているクライアント接続には影響ありません /// </summary> /// <param name="listener">待ち受けを終了するリスナ</param> /// <remarks>指定したリスナのWANへのリレーが許可されておりIsFirewalledがfalseだった場合にはnullにリセットします</remarks> public void StopListen(OutputListener listener) { listener.Stop(); ReplaceCollection(ref outputListeners, orig => { var new_collection = new List <OutputListener>(orig); new_collection.Remove(listener); return(new_collection); }); if ((listener.GlobalOutputAccepts & OutputStreamType.Relay) != 0) { OnListenPortClosed(); } }
/// <summary> /// 指定したエンドポイントで接続待ち受けを開始します /// </summary> /// <param name="ip">待ち受けを開始するエンドポイント</param> /// <param name="local_accepts">リンクローカルな接続相手に許可する出力ストリームタイプ</param> /// <param name="global_accepts">リンクグローバルな接続相手に許可する出力ストリームタイプ</param> /// <returns>接続待ち受け</returns> /// <exception cref="System.Net.Sockets.SocketException">待ち受けが開始できませんでした</exception> /// <remarks>WANへのリレーが許可されておりIsFirewalledがtrueだった場合にはnullにリセットします</remarks> public OutputListener StartListen(IPEndPoint ip, OutputStreamType local_accepts, OutputStreamType global_accepts) { OutputListener res = null; logger.Info("starting listen at {0}", ip); try { res = new OutputListener(this, new ConnectionHandler(this), ip, local_accepts, global_accepts); ReplaceCollection(ref outputListeners, orig => orig.Add(res)); } catch (System.Net.Sockets.SocketException e) { logger.Error("Listen failed: {0}", ip); logger.Error(e); throw; } return(res); }
/// <summary> /// 指定したエンドポイントで接続待ち受けを開始します /// </summary> /// <param name="ip">待ち受けを開始するエンドポイント</param> /// <param name="local_accepts">リンクローカルな接続相手に許可する出力ストリームタイプ</param> /// <param name="global_accepts">リンクグローバルな接続相手に許可する出力ストリームタイプ</param> /// <returns>接続待ち受け</returns> /// <exception cref="System.Net.Sockets.SocketException">待ち受けが開始できませんでした</exception> public OutputListener StartListen(IPEndPoint ip, OutputStreamType local_accepts, OutputStreamType global_accepts) { OutputListener res = null; logger.Info("starting listen at {0}", ip); try { res = new OutputListener(this, ip, local_accepts, global_accepts); Utils.ReplaceCollection(ref outputListeners, orig => { var new_collection = new List <OutputListener>(orig); new_collection.Add(res); return(new_collection); }); } catch (System.Net.Sockets.SocketException e) { logger.Error("Listen failed: {0}", ip); logger.Error(e); throw; } return(res); }
/// <summary> /// 指定した接続待ち受けを終了します。 /// 既に接続されているクライアント接続には影響ありません /// </summary> /// <param name="listener">待ち受けを終了するリスナ</param> /// <remarks>指定したリスナのWANへのリレーが許可されておりIsFirewalledがfalseだった場合にはnullにリセットします</remarks> public void StopListen(OutputListener listener) { listener.Stop(); ReplaceCollection(ref outputListeners, orig => orig.Remove(listener)); }
/// <summary> /// 指定した接続待ち受けを終了します。 /// 既に接続されているクライアント接続には影響ありません /// </summary> /// <param name="listener">待ち受けを終了するリスナ</param> /// <remarks>指定したリスナのWANへのリレーが許可されておりIsFirewalledがfalseだった場合にはnullにリセットします</remarks> public void StopListen(OutputListener listener) { listener.Stop(); Utils.ReplaceCollection(ref outputListeners, orig => { var new_collection = new List<OutputListener>(orig); new_collection.Remove(listener); return new_collection; }); if ((listener.GlobalOutputAccepts & OutputStreamType.Relay)!=0) { OnListenPortClosed(); } }
/// <summary> /// 指定したエンドポイントで接続待ち受けを開始します /// </summary> /// <param name="ip">待ち受けを開始するエンドポイント</param> /// <param name="local_accepts">リンクローカルな接続相手に許可する出力ストリームタイプ</param> /// <param name="global_accepts">リンクグローバルな接続相手に許可する出力ストリームタイプ</param> /// <returns>接続待ち受け</returns> /// <exception cref="System.Net.Sockets.SocketException">待ち受けが開始できませんでした</exception> /// <remarks>WANへのリレーが許可されておりIsFirewalledがtrueだった場合にはnullにリセットします</remarks> public OutputListener StartListen(IPEndPoint ip, OutputStreamType local_accepts, OutputStreamType global_accepts) { OutputListener res = null; logger.Info("starting listen at {0}", ip); try { res = new OutputListener(this, ip, local_accepts, global_accepts); Utils.ReplaceCollection(ref outputListeners, orig => { var new_collection = new List<OutputListener>(orig); new_collection.Add(res); return new_collection; }); if ((global_accepts & OutputStreamType.Relay)!=0) { OnListenPortOpened(); } } catch (System.Net.Sockets.SocketException e) { logger.Error("Listen failed: {0}", ip); logger.Error(e); throw; } return res; }
private JObject GetListener(OutputListener listener) { var res = new JObject(); res["listenerId"] = GetObjectId(listener); res["address"] = listener.LocalEndPoint.Address.ToString(); res["port"] = listener.LocalEndPoint.Port; res["localAccepts"] = (int)listener.LocalOutputAccepts; res["globalAccepts"] = (int)listener.GlobalOutputAccepts; res["localAuthorizationRequired"] = listener.LocalAuthorizationRequired; res["globalAuthorizationRequired"] = listener.GlobalAuthorizationRequired; res["authenticationId"] = listener.AuthenticationKey!=null ? listener.AuthenticationKey.Id : null; res["authenticationPassword"] = listener.AuthenticationKey!=null ? listener.AuthenticationKey.Password : null; res["authToken"] = listener.AuthenticationKey!=null ? HTTPUtils.CreateAuthorizationToken(listener.AuthenticationKey) : null; if ((listener.GlobalOutputAccepts & OutputStreamType.Relay)!=0 && owner.OpenedPorts!=null) { res["isOpened"] = (listener.GlobalOutputAccepts & OutputStreamType.Relay)!=0 && owner.OpenedPorts.Contains(listener.LocalEndPoint.Port); } else { res["isOpened"] = null; } return res; }
private JObject GetListener(OutputListener listener) { var res = new JObject(); res["listenerId"] = GetObjectId(listener); res["address"] = listener.LocalEndPoint.Address.ToString(); res["port"] = listener.LocalEndPoint.Port; res["localAccepts"] = (int)listener.LocalOutputAccepts; res["globalAccepts"] = (int)listener.GlobalOutputAccepts; res["localAuthorizationRequired"] = listener.LocalAuthorizationRequired; res["globalAuthorizationRequired"] = listener.GlobalAuthorizationRequired; res["authenticationId"] = listener.AuthenticationKey!=null ? listener.AuthenticationKey.Id : null; res["authenticationPassword"] = listener.AuthenticationKey!=null ? listener.AuthenticationKey.Password : null; return res; }
public OutputListenerViewModel(OutputListener model) { this.model = model; RegenerateAuthKey = new Command(DoRegenerateAuthKey); }
public PortListItem(OutputListener listener) { Listener = listener; }