クライアントからのリレーリクエスト内容を保持するクラスです
Ejemplo n.º 1
0
 public PCPOutputStream(
     PeerCast peercast,
     Stream input_stream,
     Stream output_stream,
     EndPoint remote_endpoint,
     AccessControlInfo access_control,
     Channel channel,
     RelayRequest request)
     : base(peercast, input_stream, output_stream, remote_endpoint, access_control, 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.Connection.ReadTimeout = 180000;
     this.Downhost          = null;
     this.UserAgent         = request.UserAgent;
     this.IsChannelFound    = channel != null && channel.Status == SourceStreamStatus.Receiving;
     this.IsRelayFull       = channel != null ? !channel.MakeRelayable(this) : false;
     this.IsProtocolMatched = channel != null ?
                              (channel.Network == NetworkType.IPv6 && request.PCPVersion == PCPVersion.ProtocolVersionIPv6 && remote_endpoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6) ||
                              (channel.Network == NetworkType.IPv4 && request.PCPVersion == PCPVersion.ProtocolVersionIPv4 && remote_endpoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) : false;
     this.relayRequest = request;
     this.UserAgent    = request.UserAgent;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// リレーリクエストを解析します
        /// </summary>
        /// <param name="header">リクエスト</param>
        /// <returns>
        /// 解析できた場合はRelayRequest、それ以外はnull
        /// </returns>
        private RelayRequest ParseRequest(byte[] header)
        {
            RelayRequest res    = null;
            var          stream = new MemoryStream(header);

            try {
                res = RelayRequestReader.Read(stream);
            }
            catch (EndOfStreamException) {
            }
            stream.Close();
            return(res);
        }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 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;
 }