Beispiel #1
0
        /// <summary>
        /// Send a Tunnel Data PDU with RDP_NETCHAR_RESULT in its subheader
        /// </summary>
        /// <param name="requestedProtocol"></param>
        /// <param name="sequenceNumber"></param>
        private void SendTunnelDataPdu_NetcharResult(Multitransport_Protocol_value requestedProtocol, ushort sequenceNumber)
        {
            autoDetectedBaseRTT    = (uint)(rttDataStore.responseTime - rttDataStore.requestTime).Milliseconds;
            autoDetectedAverageRTT = (uint)(rttDataStore.responseTime - rttDataStore.requestTime).Milliseconds;
            if (bwDataStore.timeDelta != 0)
            {
                autoDetectedBandwidth = (bwDataStore.byteCount * 8) / bwDataStore.timeDelta;
            }

            RdpemtServer rdpemtServer = rdpemtServerR;

            if (requestedProtocol == Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL)
            {
                rdpemtServer = rdpemtServerL;
            }
            RDP_NETCHAR_RESULT netResult = RdpbcgrUtility.GenerateNetworkCharacteristicsResult(AUTO_DETECT_REQUEST_TYPE.RDP_NETCHAR_RESULT_BASERTT_BANDWIDTH_AVERAGERTT, sequenceNumber, autoDetectedBaseRTT, autoDetectedBandwidth, autoDetectedAverageRTT);

            byte[]        reqData       = rdpbcgrServer.EncodeNetworkDetectionRequest(netResult, true);
            List <byte[]> subHdDataList = new List <byte[]>();

            subHdDataList.Add(reqData);
            RDP_TUNNEL_DATA tunnelData = rdpemtServer.CreateTunnelDataPdu(null, subHdDataList);

            rdpemtServer.SendRdpemtPacket(tunnelData);
        }
        /// <summary>
        /// Send an invalid UDP source Packet.
        /// </summary>
        /// <param name="udpTransportMode"></param>
        /// <param name="invalidType"></param>
        private void SendInvalidUdpSourcePacket(TransportMode udpTransportMode, SourcePacket_InvalidType invalidType)
        {
            RdpeudpSocket rdpeudpSocket = rdpeudpSocketR;
            RdpemtServer  rdpemtServer  = rdpemtServerR;

            if (udpTransportMode == TransportMode.Lossy)
            {
                rdpeudpSocket = rdpeudpSocketL;
                rdpemtServer  = rdpemtServerL;
            }

            if (invalidType == SourcePacket_InvalidType.LargerSourcePayload)
            {
                // Change UpStreamMtu of RDPEUDP Socket, so that large data can be sent
                ushort upstreamMtu = rdpeudpSocket.UUpStreamMtu;
                rdpeudpSocket.UUpStreamMtu = 2000;

                byte[]          data       = new byte[1600];
                RDP_TUNNEL_DATA tunnelData = rdpemtServer.CreateTunnelDataPdu(data, null);
                rdpemtServer.SendRdpemtPacket(tunnelData);

                // Change UpStreamMtu to correct value
                rdpeudpSocket.UUpStreamMtu = upstreamMtu;
            }
        }
        /// <summary>
        /// Get a valid RDPEUDP packet and send it.
        /// </summary>
        /// <param name="udpTransportMode">Transport mode: reliable or lossy.</param>
        private void SendNextValidUdpPacket(TransportMode udpTransportMode, byte[] data = null)
        {
            RdpemtServer rdpemtServer = rdpemtServerR;
            if (udpTransportMode == TransportMode.Lossy)
            {
                rdpemtServer = rdpemtServerL;
            }

            if (data == null)
                data = new byte[1000];
            RDP_TUNNEL_DATA tunnelData = rdpemtServer.CreateTunnelDataPdu(data, null);
            rdpemtServer.SendRdpemtPacket(tunnelData);
        }
Beispiel #4
0
        /// <summary>
        /// Send a Tunnel Data PDU with RDP_BW_STOP in its subheader
        /// </summary>
        /// <param name="requestedProtocol"></param>
        /// <param name="sequenceNumber"></param>
        private void SendTunnelDataPdu_BWStop(Multitransport_Protocol_value requestedProtocol, ushort sequenceNumber)
        {
            AUTO_DETECT_REQUEST_TYPE requestType  = AUTO_DETECT_REQUEST_TYPE.RDP_BW_STOP_AFTER_CONNECTTIME_OR_RELIABLEUDP;
            RdpemtServer             rdpemtServer = rdpemtServerR;

            if (requestedProtocol == Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL)
            {
                requestType  = AUTO_DETECT_REQUEST_TYPE.RDP_BW_STOP_AFTER_CONNECTTIME_OR_LOSSYUDP;
                rdpemtServer = rdpemtServerL;
            }
            RDP_BW_STOP bwStop = RdpbcgrUtility.GenerateBandwidthMeasureStop(requestType, sequenceNumber);

            byte[]        reqData       = rdpbcgrServer.EncodeNetworkDetectionRequest(bwStop, true);
            List <byte[]> subHdDataList = new List <byte[]>();

            subHdDataList.Add(reqData);
            RDP_TUNNEL_DATA tunnelData = rdpemtServer.CreateTunnelDataPdu(null, subHdDataList);

            rdpemtServer.SendRdpemtPacket(tunnelData);
        }
Beispiel #5
0
        /// <summary>
        /// Send a Tunnel Data PDU with RTT Measure Request in its subheader
        /// </summary>
        /// <param name="udpTransportMode">Transport Mode: Reliable or Lossy</param>
        private void SendTunnelDataPdu_RTTMeasureRequest(Multitransport_Protocol_value requestedProtocol, ushort sequenceNumber)
        {
            AUTO_DETECT_REQUEST_TYPE requestType  = AUTO_DETECT_REQUEST_TYPE.RDP_RTT_REQUEST_AFTER_CONNECTTIME;
            RdpemtServer             rdpemtServer = rdpemtServerR;

            if (requestedProtocol == Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL)
            {
                rdpemtServer = rdpemtServerL;
            }
            RDP_RTT_REQUEST RTTRequest = RdpbcgrUtility.GenerateRTTMeasureRequest(requestType, sequenceNumber);

            byte[]        reqData       = rdpbcgrServer.EncodeNetworkDetectionRequest(RTTRequest, true);
            List <byte[]> subHdDataList = new List <byte[]>();

            subHdDataList.Add(reqData);
            RDP_TUNNEL_DATA tunnelData = rdpemtServer.CreateTunnelDataPdu(null, subHdDataList);

            rttDataStore.requestTime = DateTime.Now;
            rdpemtServer.SendRdpemtPacket(tunnelData);
        }