Пример #1
0
 public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
 {
     TdrError.ErrorType errorType;
     if (useVarInt)
     {
         uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
         errorType = destBuf.writeVarUInt32(src);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
         errorType = destBuf.writeVarUInt32(this.dwDataLen);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
     }
     else
     {
         uint src2 = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_4_BYTE);
         errorType = destBuf.writeVarUInt32(src2);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
         errorType = destBuf.writeUInt32(this.dwDataLen);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
     }
     if (this.dwDataLen > 1048576u)
     {
         return(TdrError.ErrorType.TDR_ERR_REFER_SURPASS_COUNT);
     }
     if (this.dwDataLen > 0u)
     {
         uint src3 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
         errorType = destBuf.writeVarUInt32(src3);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
         int usedSize = destBuf.getUsedSize();
         errorType = destBuf.reserve(4);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
         int num = 0;
         while ((long)num < (long)((ulong)this.dwDataLen))
         {
             errorType = destBuf.writeUInt8(this.szData[num]);
             if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
             {
                 return(errorType);
             }
             num++;
         }
         int src4 = destBuf.getUsedSize() - usedSize - 4;
         errorType = destBuf.writeInt32(src4, usedSize);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
     }
     return(errorType);
 }
Пример #2
0
        public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
        {
            uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            TdrError.ErrorType errorType = destBuf.writeVarUInt32(src);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int num = TdrTypeUtil.cstrlen(this.szRequestMethod);

            if (num >= 32)
            {
                return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
            }
            errorType = destBuf.writeCString(this.szRequestMethod, num);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src2 = destBuf.getUsedSize() - usedSize - 4;

            errorType = destBuf.writeInt32(src2, usedSize);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            uint src3 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            errorType = destBuf.writeVarUInt32(src3);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize2 = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int num2 = TdrTypeUtil.cstrlen(this.szRequestUri);

            if (num2 >= 1024)
            {
                return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
            }
            errorType = destBuf.writeCString(this.szRequestUri, num2);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src4 = destBuf.getUsedSize() - usedSize2 - 4;

            errorType = destBuf.writeInt32(src4, usedSize2);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            uint src5 = TdrTLV.makeTag(3, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            errorType = destBuf.writeVarUInt32(src5);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize3 = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int num3 = TdrTypeUtil.cstrlen(this.szHttpVersion);

            if (num3 >= 32)
            {
                return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
            }
            errorType = destBuf.writeCString(this.szHttpVersion, num3);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src6 = destBuf.getUsedSize() - usedSize3 - 4;

            errorType = destBuf.writeInt32(src6, usedSize3);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            return(errorType);
        }
        public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
        {
            uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            TdrError.ErrorType errorType = destBuf.writeVarUInt32(src);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int num = TdrTypeUtil.cstrlen(this.szHeaderName);

            if (num >= 80)
            {
                return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
            }
            errorType = destBuf.writeCString(this.szHeaderName, num);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src2 = destBuf.getUsedSize() - usedSize - 4;

            errorType = destBuf.writeInt32(src2, usedSize);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            uint src3 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            errorType = destBuf.writeVarUInt32(src3);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize2 = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int num2 = TdrTypeUtil.cstrlen(this.szHeaderContent);

            if (num2 >= 260)
            {
                return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
            }
            errorType = destBuf.writeCString(this.szHeaderContent, num2);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src4 = destBuf.getUsedSize() - usedSize2 - 4;

            errorType = destBuf.writeInt32(src4, usedSize2);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            return(errorType);
        }
Пример #4
0
        public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
        {
            uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            TdrError.ErrorType errorType = destBuf.writeVarUInt32(src);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            errorType = this.stResponseStatus.packTLV(ref destBuf, useVarInt);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src2 = destBuf.getUsedSize() - usedSize - 4;

            errorType = destBuf.writeInt32(src2, usedSize);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            uint src3 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            errorType = destBuf.writeVarUInt32(src3);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize2 = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            errorType = this.stHttpHeaders.packTLV(ref destBuf, useVarInt);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src4 = destBuf.getUsedSize() - usedSize2 - 4;

            errorType = destBuf.writeInt32(src4, usedSize2);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            uint src5 = TdrTLV.makeTag(3, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            errorType = destBuf.writeVarUInt32(src5);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize3 = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            errorType = this.stResponseContent.packTLV(ref destBuf, useVarInt);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src6 = destBuf.getUsedSize() - usedSize3 - 4;

            errorType = destBuf.writeInt32(src6, usedSize3);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            return(errorType);
        }
Пример #5
0
 public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
 {
     TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
     if (useVarInt)
     {
         uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
         type = destBuf.writeVarUInt32(src);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
         type = destBuf.writeVarUInt16(this.wLen);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
     }
     else
     {
         uint num2 = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_2_BYTE);
         type = destBuf.writeVarUInt32(num2);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
         type = destBuf.writeUInt16(this.wLen);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
     }
     if (this.wLen > 0xffff)
     {
         return(TdrError.ErrorType.TDR_ERR_REFER_SURPASS_COUNT);
     }
     if (this.wLen > 0)
     {
         uint num3 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
         type = destBuf.writeVarUInt32(num3);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
         int pos = destBuf.getUsedSize();
         type = destBuf.reserve(4);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
         for (int i = 0; i < this.wLen; i++)
         {
             type = destBuf.writeUInt8(this.szData[i]);
             if (type != TdrError.ErrorType.TDR_NO_ERROR)
             {
                 return(type);
             }
         }
         int num6 = (destBuf.getUsedSize() - pos) - 4;
         type = destBuf.writeInt32(num6, pos);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
     }
     return(type);
 }
Пример #6
0
        public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
        {
            TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
            uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            type = destBuf.writeVarUInt32(src);
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                int pos = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                type = this.stRequestLine.packTLV(ref destBuf, useVarInt);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num3 = (destBuf.getUsedSize() - pos) - 4;
                type = destBuf.writeInt32(num3, pos);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                uint num4 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
                type = destBuf.writeVarUInt32(num4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num5 = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                type = this.stHttpHeaders.packTLV(ref destBuf, useVarInt);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num6 = (destBuf.getUsedSize() - num5) - 4;
                type = destBuf.writeInt32(num6, num5);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                uint num7 = TdrTLV.makeTag(3, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
                type = destBuf.writeVarUInt32(num7);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num8 = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                type = this.stRequestContent.packTLV(ref destBuf, useVarInt);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num9 = (destBuf.getUsedSize() - num8) - 4;
                type = destBuf.writeInt32(num9, num8);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
            }
            return(type);
        }
        public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
        {
            TdrError.ErrorType errorType;
            if (useVarInt)
            {
                uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
                errorType = destBuf.writeVarUInt32(src);
                if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(errorType);
                }
                errorType = destBuf.writeVarUInt32(this.dwAsync);
                if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(errorType);
                }
            }
            else
            {
                uint src2 = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_4_BYTE);
                errorType = destBuf.writeVarUInt32(src2);
                if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(errorType);
                }
                errorType = destBuf.writeUInt32(this.dwAsync);
                if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(errorType);
                }
            }
            uint src3 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_1_BYTE);

            errorType = destBuf.writeVarUInt32(src3);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            errorType = destBuf.writeUInt8(this.bFlag);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            uint src4 = TdrTLV.makeTag(3, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_1_BYTE);

            errorType = destBuf.writeVarUInt32(src4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            errorType = destBuf.writeUInt8(this.bDomain);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            uint src5 = TdrTLV.makeTag(4, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_1_BYTE);

            errorType = destBuf.writeVarUInt32(src5);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            errorType = destBuf.writeUInt8(this.bCmdFmt);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            uint src6 = TdrTLV.makeTag(5, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            errorType = destBuf.writeVarUInt32(src6);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int usedSize = destBuf.getUsedSize();

            errorType = destBuf.reserve(4);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            errorType = this.stCommand.packTLV((long)this.bCmdFmt, ref destBuf, useVarInt);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            int src7 = destBuf.getUsedSize() - usedSize - 4;

            errorType = destBuf.writeInt32(src7, usedSize);
            if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
            {
                return(errorType);
            }
            return(errorType);
        }
Пример #8
0
 public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
 {
     TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
     if (useVarInt)
     {
         uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
         type = destBuf.writeVarUInt32(src);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
         type = destBuf.writeVarUInt32(this.dwHeaderCount);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
     }
     else
     {
         uint num2 = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_4_BYTE);
         type = destBuf.writeVarUInt32(num2);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
         type = destBuf.writeUInt32(this.dwHeaderCount);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
     }
     if (this.dwHeaderCount > 0x20)
     {
         return(TdrError.ErrorType.TDR_ERR_REFER_SURPASS_COUNT);
     }
     if (this.dwHeaderCount > 0)
     {
         uint num3 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
         type = destBuf.writeVarUInt32(num3);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
         int pos = destBuf.getUsedSize();
         type = destBuf.reserve(4);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
         for (int i = 0; i < this.dwHeaderCount; i++)
         {
             int num6 = destBuf.getUsedSize();
             type = destBuf.reserve(4);
             if (type != TdrError.ErrorType.TDR_NO_ERROR)
             {
                 return(type);
             }
             type = this.astHeaderUnit[i].packTLV(ref destBuf, useVarInt);
             if (type != TdrError.ErrorType.TDR_NO_ERROR)
             {
                 return(type);
             }
             int num7 = (destBuf.getUsedSize() - num6) - 4;
             type = destBuf.writeInt32(num7, num6);
             if (type != TdrError.ErrorType.TDR_NO_ERROR)
             {
                 return(type);
             }
         }
         int num8 = (destBuf.getUsedSize() - pos) - 4;
         type = destBuf.writeInt32(num8, pos);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
     }
     return(type);
 }
Пример #9
0
        public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
        {
            TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
            uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            type = destBuf.writeVarUInt32(src);
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                int pos = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int count = TdrTypeUtil.cstrlen(this.szRequestMethod);
                if (count >= 0x20)
                {
                    return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
                }
                type = destBuf.writeCString(this.szRequestMethod, count);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num4 = (destBuf.getUsedSize() - pos) - 4;
                type = destBuf.writeInt32(num4, pos);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                uint num5 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
                type = destBuf.writeVarUInt32(num5);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num6 = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num7 = TdrTypeUtil.cstrlen(this.szRequestUri);
                if (num7 >= 0x400)
                {
                    return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
                }
                type = destBuf.writeCString(this.szRequestUri, num7);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num8 = (destBuf.getUsedSize() - num6) - 4;
                type = destBuf.writeInt32(num8, num6);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                uint num9 = TdrTLV.makeTag(3, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
                type = destBuf.writeVarUInt32(num9);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num10 = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num11 = TdrTypeUtil.cstrlen(this.szHttpVersion);
                if (num11 >= 0x20)
                {
                    return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
                }
                type = destBuf.writeCString(this.szHttpVersion, num11);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num12 = (destBuf.getUsedSize() - num10) - 4;
                type = destBuf.writeInt32(num12, num10);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
            }
            return(type);
        }
Пример #10
0
 public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
 {
     TdrError.ErrorType errorType;
     if (useVarInt)
     {
         uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
         errorType = destBuf.writeVarUInt32(src);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
         errorType = destBuf.writeVarUInt16(this.wLen);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
     }
     else
     {
         uint src2 = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_2_BYTE);
         errorType = destBuf.writeVarUInt32(src2);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
         errorType = destBuf.writeUInt16(this.wLen);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
     }
     if (this.wLen > 65535)
     {
         return(TdrError.ErrorType.TDR_ERR_REFER_SURPASS_COUNT);
     }
     if (this.wLen > 0)
     {
         uint src3 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
         errorType = destBuf.writeVarUInt32(src3);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
         int usedSize = destBuf.getUsedSize();
         errorType = destBuf.reserve(4);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
         for (int i = 0; i < (int)this.wLen; i++)
         {
             errorType = destBuf.writeUInt8(this.szData[i]);
             if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
             {
                 return(errorType);
             }
         }
         int src4 = destBuf.getUsedSize() - usedSize - 4;
         errorType = destBuf.writeInt32(src4, usedSize);
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(errorType);
         }
     }
     return(errorType);
 }
Пример #11
0
        public TdrError.ErrorType packTLV(long selector, ref TdrWriteBuf destBuf, bool useVarInt)
        {
            if (destBuf == null)
            {
                return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL);
            }
            if (selector >= 0L && selector <= 2L)
            {
                switch ((int)selector)
                {
                case 0:
                {
                    TdrError.ErrorType errorType;
                    if (useVarInt)
                    {
                        uint src = TdrTLV.makeTag(0, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
                        errorType = destBuf.writeVarUInt32(src);
                        if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            return(errorType);
                        }
                        errorType = destBuf.writeVarInt32(this.iNilCmd);
                        if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            return(errorType);
                        }
                    }
                    else
                    {
                        uint src2 = TdrTLV.makeTag(0, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_4_BYTE);
                        errorType = destBuf.writeVarUInt32(src2);
                        if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            return(errorType);
                        }
                        errorType = destBuf.writeInt32(this.iNilCmd);
                        if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            return(errorType);
                        }
                    }
                    return(errorType);
                }

                case 1:
                {
                    if (this.szStrCmd == null)
                    {
                        return(TdrError.ErrorType.TDR_ERR_UNION_SELECTE_FIELD_IS_NULL);
                    }
                    uint src3 = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
                    TdrError.ErrorType errorType = destBuf.writeVarUInt32(src3);
                    if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                    {
                        return(errorType);
                    }
                    int usedSize = destBuf.getUsedSize();
                    errorType = destBuf.reserve(4);
                    if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                    {
                        return(errorType);
                    }
                    int num = TdrTypeUtil.cstrlen(this.szStrCmd);
                    if (num >= 64)
                    {
                        return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
                    }
                    errorType = destBuf.writeCString(this.szStrCmd, num);
                    if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                    {
                        return(errorType);
                    }
                    int src4 = destBuf.getUsedSize() - usedSize - 4;
                    errorType = destBuf.writeInt32(src4, usedSize);
                    if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                    {
                        return(errorType);
                    }
                    return(errorType);
                }

                case 2:
                {
                    TdrError.ErrorType errorType;
                    if (useVarInt)
                    {
                        uint src5 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
                        errorType = destBuf.writeVarUInt32(src5);
                        if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            return(errorType);
                        }
                        errorType = destBuf.writeVarInt32(this.iIntCmd);
                        if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            return(errorType);
                        }
                    }
                    else
                    {
                        uint src6 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_4_BYTE);
                        errorType = destBuf.writeVarUInt32(src6);
                        if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            return(errorType);
                        }
                        errorType = destBuf.writeInt32(this.iIntCmd);
                        if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            return(errorType);
                        }
                    }
                    return(errorType);
                }
                }
            }
            return(TdrError.ErrorType.TDR_ERR_SUSPICIOUS_SELECTOR);
        }
Пример #12
0
        public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
        {
            TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
            uint src = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);

            type = destBuf.writeVarUInt32(src);
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                int pos = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int count = TdrTypeUtil.cstrlen(this.szHeaderName);
                if (count >= 80)
                {
                    return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
                }
                type = destBuf.writeCString(this.szHeaderName, count);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num4 = (destBuf.getUsedSize() - pos) - 4;
                type = destBuf.writeInt32(num4, pos);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                uint num5 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
                type = destBuf.writeVarUInt32(num5);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num6 = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num7 = TdrTypeUtil.cstrlen(this.szHeaderContent);
                if (num7 >= 260)
                {
                    return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
                }
                type = destBuf.writeCString(this.szHeaderContent, num7);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num8 = (destBuf.getUsedSize() - num6) - 4;
                type = destBuf.writeInt32(num8, num6);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
            }
            return(type);
        }
Пример #13
0
        public TdrError.ErrorType packTLV(ref TdrWriteBuf destBuf, bool useVarInt)
        {
            TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
            if (useVarInt)
            {
                uint num = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
                type = destBuf.writeVarUInt32(num);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                type = destBuf.writeVarUInt32(this.dwAsync);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
            }
            else
            {
                uint num2 = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_4_BYTE);
                type = destBuf.writeVarUInt32(num2);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                type = destBuf.writeUInt32(this.dwAsync);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
            }
            uint src = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_1_BYTE);

            type = destBuf.writeVarUInt32(src);
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                type = destBuf.writeUInt8(this.bFlag);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                uint num4 = TdrTLV.makeTag(3, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_1_BYTE);
                type = destBuf.writeVarUInt32(num4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                type = destBuf.writeUInt8(this.bDomain);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                uint num5 = TdrTLV.makeTag(4, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_1_BYTE);
                type = destBuf.writeVarUInt32(num5);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                type = destBuf.writeUInt8(this.bCmdFmt);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                uint num6 = TdrTLV.makeTag(5, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
                type = destBuf.writeVarUInt32(num6);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int pos = destBuf.getUsedSize();
                type = destBuf.reserve(4);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                type = this.stCommand.packTLV((long)this.bCmdFmt, ref destBuf, useVarInt);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
                int num8 = (destBuf.getUsedSize() - pos) - 4;
                type = destBuf.writeInt32(num8, pos);
                if (type != TdrError.ErrorType.TDR_NO_ERROR)
                {
                    return(type);
                }
            }
            return(type);
        }
Пример #14
0
        public TdrError.ErrorType packTLV(long selector, ref TdrWriteBuf destBuf, bool useVarInt)
        {
            if (destBuf == null)
            {
                return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL);
            }
            TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
            long num9 = selector;

            if ((num9 >= 0L) && (num9 <= 2L))
            {
                switch (((int)num9))
                {
                case 0:
                {
                    if (!useVarInt)
                    {
                        uint num2 = TdrTLV.makeTag(0, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_4_BYTE);
                        type = destBuf.writeVarUInt32(num2);
                        if (type == TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            type = destBuf.writeInt32(this.iNilCmd);
                            if (type == TdrError.ErrorType.TDR_NO_ERROR)
                            {
                                return(type);
                            }
                        }
                        return(type);
                    }
                    uint src = TdrTLV.makeTag(0, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
                    type = destBuf.writeVarUInt32(src);
                    if (type == TdrError.ErrorType.TDR_NO_ERROR)
                    {
                        type = destBuf.writeVarInt32(this.iNilCmd);
                        if (type == TdrError.ErrorType.TDR_NO_ERROR)
                        {
                        }
                        return(type);
                    }
                    return(type);
                }

                case 1:
                    if (this.szStrCmd != null)
                    {
                        uint num3 = TdrTLV.makeTag(1, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_LENGTH_DELIMITED);
                        type = destBuf.writeVarUInt32(num3);
                        if (type == TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            int pos = destBuf.getUsedSize();
                            type = destBuf.reserve(4);
                            if (type != TdrError.ErrorType.TDR_NO_ERROR)
                            {
                                return(type);
                            }
                            int count = TdrTypeUtil.cstrlen(this.szStrCmd);
                            if (count >= 0x40)
                            {
                                return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG);
                            }
                            type = destBuf.writeCString(this.szStrCmd, count);
                            if (type != TdrError.ErrorType.TDR_NO_ERROR)
                            {
                                return(type);
                            }
                            int num6 = (destBuf.getUsedSize() - pos) - 4;
                            type = destBuf.writeInt32(num6, pos);
                            if (type == TdrError.ErrorType.TDR_NO_ERROR)
                            {
                                return(type);
                            }
                        }
                        return(type);
                    }
                    return(TdrError.ErrorType.TDR_ERR_UNION_SELECTE_FIELD_IS_NULL);

                case 2:
                {
                    if (!useVarInt)
                    {
                        uint num8 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_4_BYTE);
                        type = destBuf.writeVarUInt32(num8);
                        if (type == TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            type = destBuf.writeInt32(this.iIntCmd);
                            if (type == TdrError.ErrorType.TDR_NO_ERROR)
                            {
                                return(type);
                            }
                        }
                        return(type);
                    }
                    uint num7 = TdrTLV.makeTag(2, TdrTLV.TdrTLVTypeId.TDR_TYPE_ID_VARINT);
                    type = destBuf.writeVarUInt32(num7);
                    if (type == TdrError.ErrorType.TDR_NO_ERROR)
                    {
                        type = destBuf.writeVarInt32(this.iIntCmd);
                        if (type == TdrError.ErrorType.TDR_NO_ERROR)
                        {
                        }
                        return(type);
                    }
                    return(type);
                }
                }
            }
            return(TdrError.ErrorType.TDR_ERR_SUSPICIOUS_SELECTOR);
        }