public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if (srcBuf == null || length <= 0) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType errorType = TdrError.ErrorType.TDR_NO_ERROR; uint tagid = 0u; int num = 0; int usedSize = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < usedSize + length) { errorType = srcBuf.readVarUInt32(ref tagid); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } uint fieldId = TdrTLV.getFieldId(tagid); uint num2 = fieldId; if (num2 != 1u) { if (num2 != 2u) { uint typeId = TdrTLV.getTypeId(tagid); errorType = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)typeId); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } else { if (!this.has_HeaderContent()) { this.set_has_HeaderContent(); } int num3 = 0; errorType = srcBuf.readInt32(ref num3); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } if (num3 >= 260) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } errorType = srcBuf.readCString(ref this.szHeaderContent, num3); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } } else { if (!this.has_HeaderName()) { this.set_has_HeaderName(); } int num4 = 0; errorType = srcBuf.readInt32(ref num4); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } if (num4 >= 80) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } errorType = srcBuf.readCString(ref this.szHeaderName, num4); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } } if (srcBuf.getUsedSize() > usedSize + length) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(errorType); }
public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if (srcBuf == null || length <= 0) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType errorType = TdrError.ErrorType.TDR_NO_ERROR; uint tagid = 0u; int num = 0; int usedSize = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < usedSize + length) { errorType = srcBuf.readVarUInt32(ref tagid); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } uint fieldId = TdrTLV.getFieldId(tagid); uint num2 = fieldId; if (num2 != 1u) { if (num2 != 2u) { uint typeId = TdrTLV.getTypeId(tagid); errorType = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)typeId); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } else { if (!this.has_Data()) { this.set_has_Data(); } int num3 = 0; errorType = srcBuf.readInt32(ref num3); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } if (num3 == 0) { return(TdrError.ErrorType.TDR_ERR_NULL_ARRAY); } int usedSize2 = srcBuf.getUsedSize(); for (int i = 0; i < 1048576; i++) { errorType = srcBuf.readUInt8(ref this.szData[i]); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } if (srcBuf.getUsedSize() > usedSize2 + num3) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (srcBuf.getUsedSize() == usedSize2 + num3) { this.dwDataLen = (uint)(i + 1); break; } } } } else { if (!this.has_DataLen()) { this.set_has_DataLen(); } if (useVarInt) { errorType = srcBuf.readVarUInt32(ref this.dwDataLen); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } else { errorType = srcBuf.readUInt32(ref this.dwDataLen); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } } } if (srcBuf.getUsedSize() > usedSize + length) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(errorType); }
public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if ((srcBuf == null) || (length <= 0)) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; uint dest = 0; int num3 = 0; int num4 = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < (num4 + length)) { type = srcBuf.readVarUInt32(ref dest); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } switch (TdrTLV.getFieldId(dest)) { case 1: if (!this.has_Len()) { this.set_has_Len(); } if (useVarInt) { type = srcBuf.readVarUInt16(ref this.wLen); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } continue; } type = srcBuf.readUInt16(ref this.wLen); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } return(type); case 2: { if (!this.has_Data()) { this.set_has_Data(); } int num5 = 0; type = srcBuf.readInt32(ref num5); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } if (num5 == 0) { return(TdrError.ErrorType.TDR_ERR_NULL_ARRAY); } int num6 = srcBuf.getUsedSize(); for (int i = 0; i < 0xffff; i++) { type = srcBuf.readUInt8(ref this.szData[i]); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } if (srcBuf.getUsedSize() > (num6 + num5)) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (srcBuf.getUsedSize() == (num6 + num5)) { this.wLen = (ushort)(i + 1); break; } } continue; } } uint num8 = TdrTLV.getTypeId(dest); type = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)num8); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } } if (srcBuf.getUsedSize() > (num4 + length)) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num3 < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(type); }
public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if (srcBuf == null || length <= 0) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType errorType = TdrError.ErrorType.TDR_NO_ERROR; uint tagid = 0u; int num = 0; int usedSize = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < usedSize + length) { errorType = srcBuf.readVarUInt32(ref tagid); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } switch (TdrTLV.getFieldId(tagid)) { case 1u: { if (!this.has_RequestMethod()) { this.set_has_RequestMethod(); } int num2 = 0; errorType = srcBuf.readInt32(ref num2); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } if (num2 >= 32) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } errorType = srcBuf.readCString(ref this.szRequestMethod, num2); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } case 2u: { if (!this.has_RequestUri()) { this.set_has_RequestUri(); } int num3 = 0; errorType = srcBuf.readInt32(ref num3); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } if (num3 >= 1024) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } errorType = srcBuf.readCString(ref this.szRequestUri, num3); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } case 3u: { if (!this.has_HttpVersion()) { this.set_has_HttpVersion(); } int num4 = 0; errorType = srcBuf.readInt32(ref num4); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } if (num4 >= 32) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } errorType = srcBuf.readCString(ref this.szHttpVersion, num4); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } default: { uint typeId = TdrTLV.getTypeId(tagid); errorType = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)typeId); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } } } if (srcBuf.getUsedSize() > usedSize + length) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(errorType); }
public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if (srcBuf == null || length <= 0) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType errorType = TdrError.ErrorType.TDR_NO_ERROR; uint tagid = 0u; int num = 0; int usedSize = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < usedSize + length) { errorType = srcBuf.readVarUInt32(ref tagid); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } switch (TdrTLV.getFieldId(tagid)) { case 1u: if (!this.has_Async()) { this.set_has_Async(); } if (useVarInt) { errorType = srcBuf.readVarUInt32(ref this.dwAsync); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } else { errorType = srcBuf.readUInt32(ref this.dwAsync); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } break; case 2u: if (!this.has_Flag()) { this.set_has_Flag(); } errorType = srcBuf.readUInt8(ref this.bFlag); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; case 3u: if (!this.has_Domain()) { this.set_has_Domain(); } errorType = srcBuf.readUInt8(ref this.bDomain); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; case 4u: if (!this.has_CmdFmt()) { this.set_has_CmdFmt(); } errorType = srcBuf.readUInt8(ref this.bCmdFmt); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; case 5u: { int length2 = 0; errorType = srcBuf.readInt32(ref length2); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } long num2 = 0L; errorType = this.stCommand.unpackTLV(ref num2, ref srcBuf, length2, useVarInt); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } this.bCmdFmt = (byte)num2; break; } default: { uint typeId = TdrTLV.getTypeId(tagid); errorType = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)typeId); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } } } if (srcBuf.getUsedSize() > usedSize + length) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(errorType); }
public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if (srcBuf == null || length <= 0) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType errorType = TdrError.ErrorType.TDR_NO_ERROR; uint tagid = 0u; int num = 0; int usedSize = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < usedSize + length) { errorType = srcBuf.readVarUInt32(ref tagid); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } switch (TdrTLV.getFieldId(tagid)) { case 1u: { if (!this.has_ResponseStatus()) { this.set_has_ResponseStatus(); } int length2 = 0; errorType = srcBuf.readInt32(ref length2); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } errorType = this.stResponseStatus.unpackTLV(ref srcBuf, length2, useVarInt); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } case 2u: { if (!this.has_HttpHeaders()) { this.set_has_HttpHeaders(); } int length3 = 0; errorType = srcBuf.readInt32(ref length3); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } errorType = this.stHttpHeaders.unpackTLV(ref srcBuf, length3, useVarInt); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } case 3u: { if (!this.has_ResponseContent()) { this.set_has_ResponseContent(); } int length4 = 0; errorType = srcBuf.readInt32(ref length4); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } errorType = this.stResponseContent.unpackTLV(ref srcBuf, length4, useVarInt); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } default: { uint typeId = TdrTLV.getTypeId(tagid); errorType = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)typeId); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } } } if (srcBuf.getUsedSize() > usedSize + length) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(errorType); }
public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if ((srcBuf == null) || (length <= 0)) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; uint dest = 0; int num3 = 0; int num4 = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < (num4 + length)) { type = srcBuf.readVarUInt32(ref dest); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } switch (TdrTLV.getFieldId(dest)) { case 1: { if (!this.has_RequestLine()) { this.set_has_RequestLine(); } int num5 = 0; type = srcBuf.readInt32(ref num5); if (type == TdrError.ErrorType.TDR_NO_ERROR) { type = this.stRequestLine.unpackTLV(ref srcBuf, num5, useVarInt); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } } return(type); } case 2: { if (!this.has_HttpHeaders()) { this.set_has_HttpHeaders(); } int num6 = 0; type = srcBuf.readInt32(ref num6); if (type == TdrError.ErrorType.TDR_NO_ERROR) { type = this.stHttpHeaders.unpackTLV(ref srcBuf, num6, useVarInt); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } } return(type); } case 3: { if (!this.has_RequestContent()) { this.set_has_RequestContent(); } int num7 = 0; type = srcBuf.readInt32(ref num7); if (type == TdrError.ErrorType.TDR_NO_ERROR) { type = this.stRequestContent.unpackTLV(ref srcBuf, num7, useVarInt); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } } return(type); } } uint num8 = TdrTLV.getTypeId(dest); type = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)num8); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } } if (srcBuf.getUsedSize() > (num4 + length)) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num3 < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(type); }
public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if ((srcBuf == null) || (length <= 0)) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; uint dest = 0; int num3 = 0; int num4 = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < (num4 + length)) { type = srcBuf.readVarUInt32(ref dest); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } switch (TdrTLV.getFieldId(dest)) { case 1: { if (!this.has_RequestMethod()) { this.set_has_RequestMethod(); } int num5 = 0; type = srcBuf.readInt32(ref num5); if (type == TdrError.ErrorType.TDR_NO_ERROR) { if (num5 >= 0x20) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } type = srcBuf.readCString(ref this.szRequestMethod, num5); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } } return(type); } case 2: { if (!this.has_RequestUri()) { this.set_has_RequestUri(); } int num6 = 0; type = srcBuf.readInt32(ref num6); if (type == TdrError.ErrorType.TDR_NO_ERROR) { if (num6 >= 0x400) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } type = srcBuf.readCString(ref this.szRequestUri, num6); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } } return(type); } case 3: { if (!this.has_HttpVersion()) { this.set_has_HttpVersion(); } int num7 = 0; type = srcBuf.readInt32(ref num7); if (type == TdrError.ErrorType.TDR_NO_ERROR) { if (num7 >= 0x20) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } type = srcBuf.readCString(ref this.szHttpVersion, num7); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } } return(type); } } uint num8 = TdrTLV.getTypeId(dest); type = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)num8); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } } if (srcBuf.getUsedSize() > (num4 + length)) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num3 < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(type); }
public TdrError.ErrorType unpackTLV(ref long selector, ref TdrReadBuf srcBuf, int length, bool useVarInt) { if (srcBuf == null || length == 0) { return(TdrError.ErrorType.TDR_ERR_INVALID_BUFFER_PARAMETER); } int usedSize = srcBuf.getUsedSize(); uint tagid = 0u; TdrError.ErrorType errorType = srcBuf.readVarUInt32(ref tagid); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } uint fieldId = TdrTLV.getFieldId(tagid); switch (fieldId) { case 0u: if (useVarInt) { errorType = srcBuf.readVarInt32(ref this.iNilCmd); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } else { errorType = srcBuf.readInt32(ref this.iNilCmd); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } break; case 1u: { if (this.szStrCmd == null) { this.szStrCmd = new byte[64]; } int num = 0; errorType = srcBuf.readInt32(ref num); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } if (num >= 64) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } errorType = srcBuf.readCString(ref this.szStrCmd, num); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } break; } case 2u: if (useVarInt) { errorType = srcBuf.readVarInt32(ref this.iIntCmd); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } else { errorType = srcBuf.readInt32(ref this.iIntCmd); if (errorType != TdrError.ErrorType.TDR_NO_ERROR) { return(errorType); } } break; default: errorType = TdrError.ErrorType.TDR_ERR_SUSPICIOUS_SELECTOR; break; } if (srcBuf.getUsedSize() > usedSize + length) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } selector = (long)((ulong)fieldId); return(errorType); }
public TdrError.ErrorType unpackTLV(ref TdrReadBuf srcBuf, int length, bool useVarInt) { if ((srcBuf == null) || (length <= 0)) { return(TdrError.ErrorType.TDR_ERR_ARG_IS_NULL); } TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; uint dest = 0; int num3 = 0; int num4 = srcBuf.getUsedSize(); while (srcBuf.getUsedSize() < (num4 + length)) { int num5; uint num7; type = srcBuf.readVarUInt32(ref dest); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } switch (TdrTLV.getFieldId(dest)) { case 1: if (!this.has_Async()) { this.set_has_Async(); } if (useVarInt) { type = srcBuf.readVarUInt32(ref this.dwAsync); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } continue; } type = srcBuf.readUInt32(ref this.dwAsync); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } return(type); case 2: if (!this.has_Flag()) { this.set_has_Flag(); } type = srcBuf.readUInt8(ref this.bFlag); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } return(type); case 3: if (!this.has_Domain()) { this.set_has_Domain(); } type = srcBuf.readUInt8(ref this.bDomain); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } return(type); case 4: if (!this.has_CmdFmt()) { this.set_has_CmdFmt(); } type = srcBuf.readUInt8(ref this.bCmdFmt); if (type == TdrError.ErrorType.TDR_NO_ERROR) { continue; } return(type); case 5: num5 = 0; type = srcBuf.readInt32(ref num5); if (type == TdrError.ErrorType.TDR_NO_ERROR) { break; } return(type); default: goto Label_0177; } long selector = 0L; type = this.stCommand.unpackTLV(ref selector, ref srcBuf, num5, useVarInt); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } this.bCmdFmt = (byte)selector; continue; Label_0177: num7 = TdrTLV.getTypeId(dest); type = TdrTLV.skipUnknownFields(ref srcBuf, (TdrTLV.TdrTLVTypeId)num7); if (type != TdrError.ErrorType.TDR_NO_ERROR) { return(type); } } if (srcBuf.getUsedSize() > (num4 + length)) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } if (num3 < this.requiredFieldNum()) { return(TdrError.ErrorType.TDR_ERR_LOST_REQUIRED_FIELD); } return(type); }
public TdrError.ErrorType unpackTLV(ref long selector, ref TdrReadBuf srcBuf, int length, bool useVarInt) { if ((srcBuf == null) || (length == 0)) { return(TdrError.ErrorType.TDR_ERR_INVALID_BUFFER_PARAMETER); } TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; int num = srcBuf.getUsedSize(); uint dest = 0; type = srcBuf.readVarUInt32(ref dest); if (type == TdrError.ErrorType.TDR_NO_ERROR) { uint num3 = TdrTLV.getFieldId(dest); switch (num3) { case 0: if (!useVarInt) { type = srcBuf.readInt32(ref this.iNilCmd); if (type == TdrError.ErrorType.TDR_NO_ERROR) { break; } return(type); } type = srcBuf.readVarInt32(ref this.iNilCmd); if (type == TdrError.ErrorType.TDR_NO_ERROR) { break; } return(type); case 1: { if (this.szStrCmd == null) { this.szStrCmd = new byte[0x40]; } int num4 = 0; type = srcBuf.readInt32(ref num4); if (type == TdrError.ErrorType.TDR_NO_ERROR) { if (num4 >= 0x40) { return(TdrError.ErrorType.TDR_ERR_STR_LEN_TOO_BIG); } type = srcBuf.readCString(ref this.szStrCmd, num4); if (type == TdrError.ErrorType.TDR_NO_ERROR) { break; } } return(type); } case 2: if (!useVarInt) { type = srcBuf.readInt32(ref this.iIntCmd); if (type == TdrError.ErrorType.TDR_NO_ERROR) { break; } return(type); } type = srcBuf.readVarInt32(ref this.iIntCmd); if (type == TdrError.ErrorType.TDR_NO_ERROR) { break; } return(type); default: type = TdrError.ErrorType.TDR_ERR_SUSPICIOUS_SELECTOR; break; } if (srcBuf.getUsedSize() > (num + length)) { return(TdrError.ErrorType.TDR_ERR_UNMATCHED_LENGTH); } selector = num3; } return(type); }