/// <summary> /// Encode a RDP_BW_START structure for subheader, don't encode the first two field /// </summary> /// <param name="bwStart"></param> /// <returns></returns> public static byte[] EncodeRdpBWStart(RDP_BW_START bwStart) { List <byte> bufferList = new List <byte>(); bufferList.AddRange(ToBytes(bwStart.sequenceNumber)); bufferList.AddRange(ToBytes((ushort)bwStart.requestType)); return(bufferList.ToArray()); }
/// <summary> /// Parse RDP_BW_START structure from RDPEMT subheader /// </summary> /// <param name="data">Data of subheader, not include first two bytes of Parse RDP_BW_START</param> /// <returns></returns> public static RDP_BW_START ParseRdpBWStart(byte[] data) { RDP_BW_START bwStart = new RDP_BW_START(); bwStart.sequenceNumber = ParseUInt16(data, 0); bwStart.requestType = (AUTO_DETECT_REQUEST_TYPE)ParseUInt16(data, 2); return(bwStart); }
/// <summary> /// Send a Tunnel Data PDU with RDP_BW_START in its subheader /// </summary> /// <param name="requestedProtocol"></param> /// <param name="sequenceNumber"></param> private void SendTunnelDataPdu_BWStart(Multitransport_Protocol_value requestedProtocol, ushort sequenceNumber) { AUTO_DETECT_REQUEST_TYPE requestType = AUTO_DETECT_REQUEST_TYPE.RDP_BW_START_AFTER_CONNECTTIME_OR_RELIABLEUDP; RdpemtServer rdpemtServer = rdpemtServerR; if (requestedProtocol == Multitransport_Protocol_value.INITITATE_REQUEST_PROTOCOL_UDPFECL) { requestType = AUTO_DETECT_REQUEST_TYPE.RDP_BW_START_AFTER_CONNECTTIME_OR_LOSSYUDP; rdpemtServer = rdpemtServerL; } RDP_BW_START bwStart = RdpbcgrUtility.GenerateBandwidthMeasureStart(requestType, sequenceNumber); byte[] reqData = rdpbcgrServer.EncodeNetworkDetectionRequest(bwStart, true); List <byte[]> subHdDataList = new List <byte[]>(); subHdDataList.Add(reqData); RDP_TUNNEL_DATA tunnelData = rdpemtServer.CreateTunnelDataPdu(null, subHdDataList); rdpemtServer.SendRdpemtPacket(tunnelData); }