Example #1
0
        private static bool CheckPacket(ArraySegment <byte> buffer, int unitLength, RpcHttpRtsFlags flags, int numberOfCommands, out int unitLengthFound)
        {
            RpcHttpRtsFlags rpcHttpRtsFlags;
            int             num;

            return(RpcHttpPackets.TryParseRtsHeader(buffer, out unitLengthFound, out rpcHttpRtsFlags, out num) && (unitLengthFound == unitLength && rpcHttpRtsFlags == flags) && num == numberOfCommands);
        }
Example #2
0
 private static bool TryParseRtsHeader(IList <byte> buffer, out int unitLength, out RpcHttpRtsFlags flags, out int numberOfCommands)
 {
     unitLength       = 0;
     flags            = RpcHttpRtsFlags.None;
     numberOfCommands = 0;
     if (buffer.Count < 20)
     {
         return(false);
     }
     if (buffer[2] != 20)
     {
         return(false);
     }
     unitLength       = (int)RpcHttpPackets.ReadInt16(buffer, 8);
     flags            = (RpcHttpRtsFlags)RpcHttpPackets.ReadInt16(buffer, 16);
     numberOfCommands = (int)RpcHttpPackets.ReadInt16(buffer, 18);
     return(true);
 }
Example #3
0
 // Token: 0x0600037C RID: 892 RVA: 0x00013D68 File Offset: 0x00011F68
 protected override byte[] GetUpdatedBufferToSend(ArraySegment <byte> buffer)
 {
     if (!this.isConnecting)
     {
         return(null);
     }
     if (RpcHttpPackets.IsConnA3PacketInBuffer(buffer))
     {
         this.endTime = new ExDateTime?(ExDateTime.Now + this.connectTimeout);
     }
     if (RpcHttpPackets.IsConnC2PacketInBuffer(buffer))
     {
         this.isConnecting = false;
         this.endTime      = null;
     }
     if (RpcHttpPackets.IsPingPacket(buffer) && this.endTime != null && ExDateTime.Now >= this.endTime.Value)
     {
         throw new HttpProxyException(HttpStatusCode.InternalServerError, 2013, "Outbound proxy connection timed out");
     }
     return(null);
 }
Example #4
0
 private static bool CheckPacketInStream(ArraySegment <byte> buffer, int unitLength, RpcHttpRtsFlags flags, int numberOfCommands)
 {
     while (buffer.Count > 0)
     {
         int num;
         if (RpcHttpPackets.CheckPacket(buffer, unitLength, flags, numberOfCommands, out num))
         {
             return(true);
         }
         if (num == 0)
         {
             break;
         }
         int num2 = buffer.Offset + num;
         int num3 = buffer.Count - num;
         if (num2 > buffer.Array.Length || num3 < 0)
         {
             break;
         }
         buffer = new ArraySegment <byte>(buffer.Array, num2, num3);
     }
     return(false);
 }
Example #5
0
 public static bool IsConnA3PacketInBuffer(ArraySegment <byte> buffer)
 {
     return(RpcHttpPackets.CheckPacketInStream(buffer, 28, RpcHttpRtsFlags.None, 1));
 }
Example #6
0
        public static bool IsPingPacket(ArraySegment <byte> buffer)
        {
            int num;

            return(RpcHttpPackets.CheckPacket(buffer, 20, RpcHttpRtsFlags.Ping, 0, out num));
        }