public OutputStreamBase( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, AccessControlInfo access_control, Channel channel, byte[] header) { this.PeerCast = peercast; this.InputStream = input_stream; this.OutputStream = output_stream; this.RemoteEndPoint = remote_endpoint; this.AccessControl = access_control; this.Channel = channel; var ip = remote_endpoint as IPEndPoint; this.IsLocal = ip!=null ? Utils.IsSiteLocal(ip.Address) : true; this.IsStopped = false; this.mainThread = new Thread(MainProc); this.mainThread.Name = String.Format("{0}:{1}", this.GetType().Name, remote_endpoint); this.SyncContext = new QueuedSynchronizationContext(); this.Logger = new Logger(this.GetType()); if (header!=null) { this.recvStream.Write(header, 0, header.Length); } this.SendTimeout = 10000; }
internal SettingViewModel(PeerCastApplication peca_app) { this.pecaApp = peca_app; this.peerCast = peca_app.PeerCast; this.AddPortCommand = new Command(() => AddPort()); this.RemovePortCommand = new Command(() => RemovePort(), () => SelectedPort!=null); this.AddYellowPageCommand = new Command(() => AddYellowPage()); this.RemoveYellowPageCommand = new Command(() => RemoveYellowPage(), () => SelectedYellowPage!=null); this.CheckBandwidth = new CheckBandwidthCommand(this); channelCleanupMode = ChannelCleaner.Mode; channelCleanupInactiveLimit = ChannelCleaner.InactiveLimit/60000; maxRelays = peerCast.AccessController.MaxRelays; maxRelaysPerChannel = peerCast.AccessController.MaxRelaysPerChannel; maxPlays = peerCast.AccessController.MaxPlays; maxPlaysPerChannel = peerCast.AccessController.MaxPlaysPerChannel; maxUpstreamRate = peerCast.AccessController.MaxUpstreamRate; maxUpstreamRatePerChannel = peerCast.AccessController.MaxUpstreamRatePerChannel; isShowWindowOnStartup = pecaApp.Settings.Get<WPFSettings>().ShowWindowOnStartup; ports = new ObservableCollection<OutputListenerViewModel>( peerCast.OutputListeners .Select(listener => new OutputListenerViewModel(this, listener)) ); yellowPages = new ObservableCollection<YellowPageClientViewModel>( peerCast.YellowPages .Select(yp => new YellowPageClientViewModel(this, yp)) ); }
/// <summary> /// チャンネルIDを指定してチャンネルを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="channel_id">チャンネルID</param> protected Channel(PeerCast peercast, NetworkType network, Guid channel_id) { this.PeerCast = peercast; this.Network = network; this.ChannelID = channel_id; this.contents = new ContentCollection(this); }
/// <summary> /// 指定したエンドポイントで接続待ち受けをするOutputListenerを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="ip">待ち受けをするエンドポイント</param> /// <param name="local_accepts">リンクローカルな接続先に許可する出力ストリームタイプ</param> /// <param name="global_accepts">リンクグローバルな接続先に許可する出力ストリームタイプ</param> internal OutputListener( PeerCast peercast, IConnectionHandler connection_handler, IPEndPoint ip, OutputStreamType local_accepts, OutputStreamType global_accepts) { this.PeerCast = peercast; this.localOutputAccepts = local_accepts; this.globalOutputAccepts = global_accepts; this.LoopbackAccessControlInfo = new AccessControlInfo( OutputStreamType.All, false, null); UpdateLocalAccessControlInfo(); UpdateGlobalAccessControlInfo(); this.ConnectionHandler = connection_handler; server = new TcpListener(ip); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { //Windowsの時だけReuseAddressをつける。 //Windows以外ではReuseAddressがSO_REUSEADDR+SO_REUSEPORT扱いになり //monoの4.6ではLinuxでUDP以外にSO_REUSEPORTを付けようとすると失敗する。 //そのかわりmonoではSO_REUSEADDRが標準で付いてるようなので //Windows以外は明示的には付けないようにした。 server.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); } if (ip.AddressFamily == AddressFamily.InterNetworkV6) { server.Server.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, true); } server.Start(MaxPendingConnections); listenTask = StartListen(server, cancellationSource.Token); }
internal YellowPagesEditViewModel(PeerCast peerCast) { protocols = peerCast.YellowPageFactories .Select(factory => new YellowPageFactoryItem(factory)).ToArray(); add = new Command(() => { if (String.IsNullOrEmpty(Name) || SelectedProtocol == null) return; var factory = SelectedProtocol.Factory; var protocol = factory.Protocol; if (String.IsNullOrEmpty(protocol)) return; Uri uri; var md = Regex.Match(Address, @"\A([^:/]+)(:(\d+))?\Z"); if (md.Success && Uri.CheckHostName(md.Groups[1].Value) != UriHostNameType.Unknown && Uri.TryCreate(protocol + "://" + Address, UriKind.Absolute, out uri) && factory.CheckURI(uri)) { } else if (Uri.TryCreate(Address, UriKind.Absolute, out uri) && factory.CheckURI(uri)) { } else { return; } peerCast.AddYellowPage(protocol, Name, uri); }); }
public OutputStreamBase( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, AccessControlInfo access_control, Channel channel, byte[] header) { this.PeerCast = peercast; this.Connection = new StreamConnection(input_stream, output_stream, header); this.Connection.SendTimeout = 10000; this.RemoteEndPoint = remote_endpoint; this.AccessControl = access_control; this.Channel = channel; var ip = remote_endpoint as IPEndPoint; this.IsLocal = ip != null?ip.Address.IsSiteLocal() : true; this.IsStopped = false; this.mainThread = new Thread(MainProc); this.mainThread.Name = String.Format("{0}:{1}", this.GetType().Name, remote_endpoint); this.SyncContext = new QueuedSynchronizationContext(); this.Logger = new Logger(this.GetType()); }
public OutputStreamBase( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, Channel channel, byte[] header) { this.PeerCast = peercast; this.InputStream = input_stream; this.OutputStream = output_stream; this.RemoteEndPoint = remote_endpoint; this.Channel = channel; var ip = remote_endpoint as IPEndPoint; this.IsLocal = ip != null?Utils.IsSiteLocal(ip.Address) : true; this.IsStopped = false; this.mainThread = new Thread(MainProc); this.mainThread.Name = this.GetType().Name; this.SyncContext = new QueuedSynchronizationContext(); this.Logger = new Logger(this.GetType()); if (header != null) { this.recvStream.Write(header, 0, header.Length); } }
/// <summary> /// チャンネルIDを指定してチャンネルを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="channel_id">チャンネルID</param> protected Channel(PeerCast peercast, Guid channel_id) { this.PeerCast = peercast; this.ChannelID = channel_id; contents.ContentChanged += (sender, e) => { OnContentChanged(); }; }
public PCPYellowPageClient(PeerCast peercast, string name, Uri uri) { this.PeerCast = peercast; this.Name = name; this.Uri = uri; this.Logger = new Logger(this.GetType()); this.AnnouncingStatus = AnnouncingStatus.Idle; }
/// <summary> /// チャンネルIDを指定してチャンネルを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="channel_id">チャンネルID</param> protected Channel(PeerCast peercast, NetworkType network, Guid channel_id) { this.PeerCast = peercast; this.Network = network; this.ChannelID = channel_id; this.contents = new ContentCollection(this); this.contentSinks.Add(new ChannelEventInvoker(this)); }
public RelayTreeViewModel(PeerCast peerCast) { this.peerCast = peerCast; this.RelayTree = new RelayTreeNodeViewModel[0]; refresh = new Command( () => Update(this.channel), () => channel!=null); }
/// <summary> /// チャンネルIDを指定してチャンネルを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="channel_id">チャンネルID</param> protected Channel(PeerCast peercast, NetworkType network, Guid channel_id) { this.PeerCast = peercast; this.Network = network; this.ChannelID = channel_id; this.contents = new ContentCollection(this); this.contentSinks = ImmutableArray <IContentSink> .Empty; }
public HTTPDummyOutputStream( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint) : base(peercast, input_stream, output_stream, remote_endpoint, null, null) { Logger.Debug("Initialized: Remote {0}", remote_endpoint); }
public PCPSourceConnection( PeerCast peercast, Channel channel, Uri source_uri, RemoteHostStatus remote_type) : base(peercast, channel, source_uri) { remoteType = remote_type; }
public BroadcastDialog(PeerCast peercast) { peerCast = peercast; InitializeComponent(); bcContentType.Items.AddRange(peerCast.ContentReaderFactories.Select(reader => new ContentReaderItem(reader)).ToArray()); bcYP.Items.AddRange(peerCast.YellowPages.Select(yp => new YellowPageItem(yp)).ToArray()); if (bcContentType.Items.Count>0) bcContentType.SelectedIndex = 0; if (bcYP.Items.Count>0) bcYP.SelectedIndex = 0; }
public PCPPongOutputStream( PeerCast peercast, Stream input_stream, Stream output_stream, IPEndPoint endpoint, byte[] header) : base(peercast, input_stream, output_stream, endpoint, null, header) { Logger.Debug("Initialized: Remote {0}", endpoint); }
public BroadcastChannel( PeerCast peercast, Guid channel_id, ChannelInfo channel_info, IContentReaderFactory content_reader_factory) : base(peercast, channel_id) { this.ChannelInfo = channel_info; this.ContentReaderFactory = content_reader_factory; }
public ConnectionListViewModel(PeerCast peerCast) { this.peerCast = peerCast; close = new Command( () => connection.Disconnect(), () => connection != null && connection.IsDisconnectable); reconnect = new Command( () => connection.Reconnect(), () => connection != null && connection.IsReconnectable); }
/// <summary> /// チャンネルIDとブロードキャストID、ソースストリームを指定してチャンネルを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="channel_id">チャンネルID</param> /// <param name="broadcast_id">ブロードキャストID</param> /// <param name="source_uri">ソースURI</param> public Channel(PeerCast peercast, Guid channel_id, Guid broadcast_id, Uri source_uri) { this.IsClosed = true; this.PeerCast = peercast; this.SourceUri = source_uri; this.ChannelID = channel_id; this.BroadcastID = broadcast_id; contents.ContentChanged += (sender, e) => { OnContentChanged(); }; }
public SourceStreamBase( PeerCast peercast, Channel channel, Uri source_uri) { this.PeerCast = peercast; this.Channel = channel; this.SourceUri = source_uri; this.StoppedReason = StopReason.None; this.Logger = new Logger(this.GetType(), source_uri.ToString()); }
public SourceConnectionBase( PeerCast peercast, Channel channel, Uri source_uri) { this.PeerCast = peercast; this.Channel = channel; this.SourceUri = source_uri; this.StoppedReason = StopReason.None; this.SyncContext = new QueuedSynchronizationContext(); this.Logger = new Logger(this.GetType()); }
public NotifyIconManager(PeerCast peerCast) { notifyIcon = CreateNotifyIcon(peerCast); notifyIcon.BalloonTipClicked += (sender, e) => { if (newVersionInfo == null) return; new UpdaterWindow() { DataContext = new UpdaterViewModel(newVersionInfo) }.Show(); }; }
public BroadcastChannel( PeerCast peercast, Guid channel_id, ChannelInfo channel_info, ISourceStreamFactory source_stream_factory, IContentReaderFactory content_reader_factory) : base(peercast, channel_id) { this.ChannelInfo = channel_info; this.SourceStreamFactory = source_stream_factory; this.ContentReaderFactory = content_reader_factory; }
public HTTPDummyOutputStream( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, AccessControlInfo access_control, HTTPRequest req) : base(peercast, input_stream, output_stream, remote_endpoint, access_control, null, null) { Logger.Debug("Initialized: Remote {0}", remote_endpoint); this.request = req; }
public SourceConnectionBase( PeerCast peercast, Channel channel, Uri source_uri) { this.PeerCast = peercast; this.Channel = channel; this.SourceUri = source_uri; this.StoppedReason = StopReason.None; this.Logger = new Logger(this.GetType()); this.Status = ConnectionStatus.Idle; }
public SourceConnectionBase( PeerCast peercast, Channel channel, Uri source_uri) { this.PeerCast = peercast; this.Channel = channel; this.SourceUri = source_uri; this.StoppedReason = StopReason.None; this.Logger = new Logger(this.GetType(), source_uri?.ToString()); this.Status = ConnectionStatus.Idle; }
public BroadcastViewModel(PeerCast peerCast) { this.peerCast = peerCast; contentTypes = peerCast.ContentReaderFactories .Select(reader => new ContentReaderItem(reader)).ToArray(); yellowPages = new YellowPageItem[] { new YellowPageItem("掲載なし", null) } .Concat(peerCast.YellowPages.Select(yp => new YellowPageItem(yp))).ToArray(); if (contentTypes.Length > 0) contentType = contentTypes[0]; start = new Command(OnBroadcast, () => CanBroadcast(StreamSource, ContentReaderFactory, channelName)); }
public SourceStreamBase( PeerCast peercast, Channel channel, Uri source_uri) { this.PeerCast = peercast; this.Channel = channel; this.SourceUri = source_uri; this.StoppedReason = StopReason.None; this.EventQueue = new EventQueue <SourceStreamEvent>(); this.Logger = new Logger(this.GetType()); ThreadPool.RegisterWaitForSingleObject(this.EventQueue.WaitHandle, OnEvent, null, Timeout.Infinite, true); }
public SourceStreamBase( PeerCast peercast, Channel channel, Uri source_uri) { this.PeerCast = peercast; this.Channel = channel; this.SourceUri = source_uri; this.StoppedReason = StopReason.None; this.Logger = new Logger(this.GetType(), source_uri.ToString()); actionQueue = new ActionQueue(); actionQueue.UnhandledException += ActionQueue_UnhandledException; }
public BroadcastViewModel(PeerCast peerCast) { this.peerCast = peerCast; this.uiSettings = new UISettingsViewModel(PeerCastApplication.Current.Settings); start = new Command(OnBroadcast, () => CanBroadcast(StreamSource, ContentType, channelName)); contentTypes = peerCast.ContentReaderFactories.ToArray(); yellowPages = Enumerable.Repeat(new KeyValuePair<string,IYellowPageClient>("掲載なし", null),1) .Concat(peerCast.YellowPages.Select(yp => new KeyValuePair<string,IYellowPageClient>(yp.Name, yp))); if (contentTypes.Length > 0) contentType = contentTypes[0]; this.SelectedSourceStream = SourceStreams.FirstOrDefault(); }
public SourceStreamBase( PeerCast peercast, Channel channel, Uri source_uri) { this.PeerCast = peercast; this.Channel = channel; this.SourceUri = source_uri; this.StoppedReason = StopReason.None; this.EventQueue = new EventQueue<SourceStreamEvent>(); this.Logger = new Logger(this.GetType()); ThreadPool.RegisterWaitForSingleObject(this.EventQueue.WaitHandle, OnEvent, null, Timeout.Infinite, true); }
public AdminHostOutputStream( AdminHost owner, PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, AccessControlInfo access_control, HTTPRequest request) : base(peercast, input_stream, output_stream, remote_endpoint, access_control, null, null) { this.owner = owner; this.request = request; Logger.Debug("Initialized: Remote {0}", remote_endpoint); }
/// <summary> /// 指定したエンドポイントで接続待ち受けをするOutputListenerを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="ip">待ち受けをするエンドポイント</param> /// <param name="local_accepts">リンクローカルな接続先に許可する出力ストリームタイプ</param> /// <param name="global_accepts">リンクグローバルな接続先に許可する出力ストリームタイプ</param> internal OutputListener( PeerCast peercast, IPEndPoint ip, OutputStreamType local_accepts, OutputStreamType global_accepts) { this.PeerCast = peercast; this.LocalOutputAccepts = local_accepts; this.GlobalOutputAccepts = global_accepts; server = new TcpListener(ip); server.Start(); listenerThread = new Thread(ListenerThreadFunc); listenerThread.Name = String.Format("OutputListenerThread:{0}", ip); listenerThread.Start(server); }
public LoopbackSourceConnection( PeerCast peercast, Channel channel, Uri source_uri, Channel source_channel) { PeerCast = peercast; Channel = channel; SourceUri = source_uri; SourceChannel = source_channel; if (SourceChannel != null) { channelContentSink = new ChannelContentSink(Channel, true); } }
public APIHostOutputStream( APIHost owner, PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, HTTPRequest request, byte[] header) : base(peercast, input_stream, output_stream, remote_endpoint, null, header) { this.owner = owner; this.request = request; this.rpcHost = new JSONRPCHost(this); Logger.Debug("Initialized: Remote {0}", remote_endpoint); }
/// <summary> /// 元になるストリーム、チャンネル、リクエストからHTTPOutputStreamを初期化します /// </summary> /// <param name="peercast">所属するPeerCast</param> /// <param name="connection">元になるストリーム</param> /// <param name="access_control">接続可否および認証の情報</param> /// <param name="channel">所属するチャンネル。無い場合はnull</param> public OutputStreamBase( PeerCast peercast, ConnectionStream connection, AccessControlInfo access_control, Channel channel) { this.Logger = new Logger(this.GetType(), connection.RemoteEndPoint?.ToString() ?? ""); this.Connection = connection; this.Connection.ReadTimeout = 10000; this.Connection.WriteTimeout = 10000; this.PeerCast = peercast; this.AccessControlInfo = access_control; this.Channel = channel; this.IsLocal = (RemoteEndPoint as IPEndPoint)?.Address?.IsSiteLocal() ?? true; }
public SourceStreamBase( PeerCast peercast, Channel channel, Uri source_uri) { this.PeerCast = peercast; this.Channel = channel; this.SourceUri = source_uri; this.IsStopped = false; this.RecvEvent = new AutoResetEvent(false); this.mainThread = new Thread(MainProc); this.mainThread.Name = this.GetType().Name; this.SyncContext = new QueuedSynchronizationContext(); this.Logger = new Logger(this.GetType()); }
/// <summary> /// 元になるストリーム、チャンネル、リクエストからHTTPOutputStreamを初期化します /// </summary> /// <param name="peercast">所属するPeerCast</param> /// <param name="input_stream">元になる受信ストリーム</param> /// <param name="output_stream">元になる送信ストリーム</param> /// <param name="is_local">接続先がローカルネットワーク内かどうか</param> /// <param name="channel">所属するチャンネル。無い場合はnull</param> /// <param name="request">クライアントからのリクエスト</param> public HTTPOutputStream( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, Channel channel, HTTPRequest request) : base(peercast, input_stream, output_stream, remote_endpoint, channel, null) { Logger.Debug("Initialized: Channel {0}, Remote {1}, Request {2} {3}", channel!=null ? channel.ChannelID.ToString("N") : "(null)", remote_endpoint, request.Method, request.Uri); this.request = request; }
internal ListenerEditViewModel(PeerCast peerCast) { Address = "IPv4 Any"; Port = 7144; LocalRelay = true; LocalPlay = true; LocalInterface = true; GlobalRelay = true; GlobalAuthRequired = true; var key = AuthenticationKey.Generate(); AuthId = key.Id; AuthPassword = key.Password; RegenerateAuthKey = new Command(() => { key = AuthenticationKey.Generate(); AuthId = key.Id; AuthPassword = key.Password; }); add = new Command(() => { IPAddress address; try { address = ToIPAddress(Address); } catch (FormatException) { return; } var localAccepts = ToOutputStreamType( LocalRelay, LocalPlay, LocalInterface); var glocalAccepts = ToOutputStreamType( GlobalRelay, GlobalPlay, GlobalInterface); try { var listener = peerCast.StartListen( new IPEndPoint(address, Port), localAccepts, glocalAccepts); listener.LocalAuthorizationRequired = LocalAuthRequired; listener.GlobalAuthorizationRequired = GlobalAuthRequired; listener.AuthenticationKey = new AuthenticationKey(AuthId, AuthPassword); } catch (SocketException) { } }); }
/// <summary> /// 指定したエンドポイントで接続待ち受けをするOutputListenerを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="ip">待ち受けをするエンドポイント</param> /// <param name="local_accepts">リンクローカルな接続先に許可する出力ストリームタイプ</param> /// <param name="global_accepts">リンクグローバルな接続先に許可する出力ストリームタイプ</param> internal OutputListener( PeerCast peercast, IPEndPoint ip, OutputStreamType local_accepts, OutputStreamType global_accepts) { this.PeerCast = peercast; this.localOutputAccepts = local_accepts; this.globalOutputAccepts = global_accepts; this.LocalAuthorizationRequired = false; this.GlobalAuthorizationRequired = true; this.AuthenticationKey = AuthenticationKey.Generate(); server = new TcpListener(ip); server.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); server.Start(); listenerThread = new Thread(ListenerThreadFunc); listenerThread.Name = String.Format("OutputListenerThread:{0}", ip); listenerThread.Start(server); }
public PCPOutputStream( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, Channel channel, RelayRequest request) : base(peercast, input_stream, output_stream, remote_endpoint, channel, null) { Logger.Debug("Initialized: Channel {0}, Remote {1}, Request {2} {3} ({4} {5})", channel!=null ? channel.ChannelID.ToString("N") : "(null)", remote_endpoint, request.Uri, request.StreamPos, request.PCPVersion, request.UserAgent); this.Downhost = null; this.IsChannelFound = channel!=null && channel.Status==SourceStreamStatus.Receiving; this.IsRelayFull = channel!=null ? !channel.IsRelayable(this) : false; this.relayRequest = request; }
public MainForm(PeerCastApplication app) { InitializeComponent(); application = app; peerCast = app.PeerCast; if (PlatformID.Win32NT==Environment.OSVersion.Platform) { notifyIcon = new NotifyIcon(this.components); notifyIcon.Icon = this.Icon; notifyIcon.ContextMenuStrip = notifyIconMenu; notifyIcon.Visible = true; notifyIcon.DoubleClick += showGUIMenuItem_Click; notifyIcon.BalloonTipClicked += notifyIcon_BalloonTipClicked; versionChecker = new AppCastReader( new Uri(Settings.Default.UpdateURL, UriKind.Absolute), Settings.Default.CurrentVersion); versionChecker.NewVersionFound += versionChecker_Found; versionChecker.CheckVersion(); } var settings = application.Settings.Get<GUISettings>(); this.Visible = settings.ShowWindowOnStartup; }
/// <summary> /// 元になるストリーム、チャンネル、リクエストからHTTPOutputStreamを初期化します /// </summary> /// <param name="peercast">所属するPeerCast</param> /// <param name="input_stream">元になる受信ストリーム</param> /// <param name="output_stream">元になる送信ストリーム</param> /// <param name="remote_endpoint">接続先のアドレス</param> /// <param name="access_control">接続可否および認証の情報</param> /// <param name="channel">所属するチャンネル。無い場合はnull</param> /// <param name="request">クライアントからのリクエスト</param> public OutputStreamBase( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, AccessControlInfo access_control, Channel channel, byte[] header) { this.Logger = new Logger(this.GetType()); this.connection = new ConnectionStream( header!=null && header.Length>0 ? new PrependedStream(header, input_stream) : input_stream, output_stream); this.connection.ReadTimeout = 10000; this.connection.WriteTimeout = 10000; this.PeerCast = peercast; this.RemoteEndPoint = remote_endpoint; this.AccessControlInfo = access_control; this.Channel = channel; var ip = remote_endpoint as IPEndPoint; this.IsLocal = ip!=null ? ip.Address.IsSiteLocal() : true; }
/// <summary> /// 元になるストリーム、チャンネル、リクエストからHTTPOutputStreamを初期化します /// </summary> /// <param name="peercast">所属するPeerCast</param> /// <param name="input_stream">元になる受信ストリーム</param> /// <param name="output_stream">元になる送信ストリーム</param> /// <param name="remote_endpoint">接続先のアドレス</param> /// <param name="access_control">接続可否および認証の情報</param> /// <param name="channel">所属するチャンネル。無い場合はnull</param> /// <param name="request">クライアントからのリクエスト</param> public OutputStreamBase( PeerCast peercast, Stream input_stream, Stream output_stream, EndPoint remote_endpoint, AccessControlInfo access_control, Channel channel, byte[] header) { this.Logger = new Logger(this.GetType(), remote_endpoint != null ? remote_endpoint.ToString() : ""); this.connection = new ConnectionStream( header != null && header.Length > 0 ? new PrependedStream(header, input_stream) : input_stream, output_stream); this.connection.ReadTimeout = 10000; this.connection.WriteTimeout = 10000; this.PeerCast = peercast; this.RemoteEndPoint = remote_endpoint; this.AccessControlInfo = access_control; this.Channel = channel; var ip = remote_endpoint as IPEndPoint; this.IsLocal = ip != null?ip.Address.IsSiteLocal() : true; }
public MainForm(PeerCast peercast) { InitializeComponent(); Settings.Default.PropertyChanged += SettingsPropertyChanged; Logger.Level = LogLevel.Warn; Logger.AddWriter(new DebugWriter()); guiWriter = new TextBoxWriter(logText); if (PlatformID.Win32NT == Environment.OSVersion.Platform) { notifyIcon = new NotifyIcon(this.components); notifyIcon.Icon = this.Icon; notifyIcon.ContextMenuStrip = notifyIconMenu; notifyIcon.Visible = true; notifyIcon.DoubleClick += showGUIMenuItem_Click; notifyIcon.BalloonTipClicked += notifyIcon_BalloonTipClicked; versionChecker = new AppCastReader( new Uri(Settings.Default.UpdateURL, UriKind.Absolute), Settings.Default.CurrentVersion); versionChecker.NewVersionFound += versionChecker_Found; versionChecker.CheckVersion(); } peerCast = peercast; peerCast.ChannelAdded += ChannelAdded; peerCast.ChannelRemoved += ChannelRemoved; logLevelList.SelectedIndex = Settings.Default.LogLevel; logToFileCheck.Checked = Settings.Default.LogToFile; logFileNameText.Text = Settings.Default.LogFileName; logToConsoleCheck.Checked = Settings.Default.LogToConsole; logToGUICheck.Checked = Settings.Default.LogToGUI; OnUpdateSettings(null); timer.Interval = 1000; timer.Enabled = true; timer.Tick += (sender, args) => { UpdateStatus(); }; UpdateStatus(); }
/// <summary> /// 指定したエンドポイントで接続待ち受けをするOutputListenerを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="ip">待ち受けをするエンドポイント</param> /// <param name="local_accepts">リンクローカルな接続先に許可する出力ストリームタイプ</param> /// <param name="global_accepts">リンクグローバルな接続先に許可する出力ストリームタイプ</param> internal OutputListener( PeerCast peercast, IConnectionHandler connection_handler, IPEndPoint ip, OutputStreamType local_accepts, OutputStreamType global_accepts) { this.PeerCast = peercast; this.localOutputAccepts = local_accepts; this.globalOutputAccepts = global_accepts; this.LoopbackAccessControlInfo = new AccessControlInfo( OutputStreamType.All, false, null); UpdateLocalAccessControlInfo(); UpdateGlobalAccessControlInfo(); this.ConnectionHandler = connection_handler; server = new TcpListener(ip); if (ip.AddressFamily == AddressFamily.InterNetworkV6) { server.Server.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, true); } listenTask = StartListen(server, cancellationSource.Token); }
public RelayChannel(PeerCast peercast, NetworkType network, Guid channel_id) : base(peercast, network, channel_id) { }
public OutputStreamFactoryBase(PeerCast peercast) { this.PeerCast = peercast; }
public AdminHostOutputStreamFactory(AdminHost owner, PeerCast peercast) : base(peercast) { this.owner = owner; }
/// <summary> /// AccessControllerオブジェクトを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> public AccessController(PeerCast peercast) { this.PeerCast = peercast; }
public LoopbackSourceStream(PeerCast peercast, Channel channel, Uri source_uri) : base(peercast, channel, source_uri) { }
public ConnectionHandler(PeerCast peercast) { this.PeerCast = peercast; }
public HTTPSourceStream(PeerCast peercast, Channel channel, Uri source_uri, IContentReader reader) : base(peercast, channel, source_uri) { this.ContentReader = reader; }
public HTTPSourceStreamFactory(PeerCast peercast) : base(peercast) { }
public SourceStreamFactoryBase(PeerCast peercast) { this.PeerCast = peercast; }
/// <summary> /// チャンネルIDとソースストリームを指定してチャンネルを初期化します /// </summary> /// <param name="peercast">所属するPeerCastオブジェクト</param> /// <param name="channel_id">チャンネルID</param> /// <param name="source_uri">ソースURI</param> public Channel(PeerCast peercast, Guid channel_id, Uri source_uri) : this(peercast, channel_id, Guid.Empty, source_uri) { }
public LoopbackSourceStreamFactory(PeerCast peercast) : base(peercast) { }