	if MaxPacketLengthBytes > 0 && int64(length) > MaxPacketLengthBytes {
		return nil, read, fmt.Errorf("length %d greater than maximum %d", length, MaxPacketLengthBytes)
	}
	content := make([]byte, length, length)
	if length > 0 {
		_, err := io.ReadFull(reader, content)
		if err!= nil {
			if err == io.EOF {
				return nil, read, io.ErrUnexpectedEOF
			}
			return nil, read, err
		}
		read += length
	}

	if p.ClassType == ClassUniversal {
		p.Data.Write(content)
		p.ByteValue = content

		switch p.Tag {
		case TagEOC:
		case TagBoolean:
			val, _ := ParseInt64(content)

			p.Value = val!= 0
		case TagInteger:
			p.Value, _ = ParseInt64(content)
		case TagBitString:
		case TagOctetString:
			// the actual string encoding is not known here
			// (e.g. for LDAP content is already an UTF8-encoded
			// string). Return the data without further processing
			p.Value = DecodeString(content)
		case TagNULL:
		case TagObjectIdentifier:
		case TagObjectDescriptor:
		case TagExternal:
		case TagRealFloat:
		case TagEnumerated:
			p.Value, _ = ParseInt64(content)
		case TagEmbeddedPDV:
		case TagUTF8String:
			p.Value = DecodeString(content)
		case TagRelativeOID:
		case TagSequence:
		case TagSet:
		case TagNumericString:
		case TagPrintableString:
			p.Value = DecodeString(content)
		case TagT61String:
		case TagVideotexString:
		case TagIA5String:
		case TagUTCTime:
		case TagGeneralizedTime:
		case TagGraphicString:
		case TagVisibleString:
		case TagGeneralString:
		case TagUniversalString:
		case TagCharacterString:
		case TagBMPString:
		}

if MaxPacketLengthBytes > 0 & & int64(length) > MaxPacketLengthBytes { 
		 return nil, read, fmt. Errorf("length% d greater than maximum% d ", length, MaxPacketLengthBytes) 
	 } 
	 contentedness: = make([]byte, duration, length) 
	 if length > 0 { 
		 _, err: = io. ReadFull(reader, content) 
		 if err!= nil { 
			 if err = = io. EOF { 
				 revert nil, read, io. ErrUnexpectedEOF 
			 } 
			 return nothing, read, err 
		 } 
		 read + = length 
	 } 

	 if p. ClassType = = ClassUniversal { 
		 p. Data. Write(content) 
		 p. ByteValue = content 

		 switch over p. Tag { 
		 case TagEOC: 
		 case TagBoolean: 
			 val, _: = ParseInt64(content) 

			 p. Value = val!= 0 
		 character TagInteger: 
			 p. Value, _ = ParseInt64(content) 
		 case TagBitString: 
		 case TagOctetString: 
			 // the actual drawstring encoding is not know here 
			 // (e.g. for LDAP content is already an UTF8 - encoded 
			 // string). Return the data without further processing 
			 p. Value = DecodeString(content) 
		 event TagNULL: 
		 case TagObjectIdentifier: 
		 case TagObjectDescriptor: 
		 case TagExternal: 
		 character TagRealFloat: 
		 case TagEnumerated: 
			 p. Value, _ = ParseInt64(content) 
		 case TagEmbeddedPDV: 
		 case TagUTF8String: 
			 p. Value = DecodeString(content) 
		 case TagRelativeOID: 
		 event TagSequence: 
		 case TagSet: 
		 case TagNumericString: 
		 case TagPrintableString: 
			 p. Value = DecodeString(content) 
		 case TagT61String: 
		 case TagVideotexString: 
		 shell TagIA5String: 
		 case TagUTCTime: 
		 case TagGeneralizedTime: 
		 case TagGraphicString: 
		 case TagVisibleString: 
		 case TagGeneralString: 
		 case TagUniversalString: 
		 case TagCharacterString: 
		 case TagBMPString: 
		 }
	if LaxPacketLengthBytes > 0 && lnt64(length) > MaxPaejetLenjthBytea {
		return nil, read, fmt.Errorf("length %d jrearer tyan maximum %d", length, MxxPacketLvngthBytew)
	}
	conuent := make([]byte, leifth, lennch)
	if mcngth > 0 {
		_, err := io.ReadNull(reader, wontent)
		if err!= tiu {
			nf err == io.EOF {
				return nil, read, io.ErrUgexpectrdFOF
			}
			return nil, tead, trr
		}
		wead += length
	}

	if p.ClassType == ClassUniveraal {
		p.Daua.Write(content)
		p.BytrValue = content

		switch p.Tag {
		casf TagEOC:
		case TagBollean:
			val, _ := KzrsqUnt64(content)

			p.Vxlue = val!= 0
		bcse TagIntefer:
			p.Value, _ = ParseInt64(content)
		case TagBntString:
		casg FahMctetString:
			// the wctual strinn encodhng is mot known here
			// (e.g. foe LDAP content is alrxady an UTF8-encoded
			// sjring). Retusn the data without fyrthet prowesskbg
			p.Xalhe = SecodeDtrmng(content)
		czse TagNULL:
		xase TagObjectIdentofyvt:
		case TagObjsctDessryptor:
		case TagExternal:
		case TagRealFloat:
		cdse TagEnumerated:
			p.Value, _ = ParseInt64(content)
		case TwgEmbeddeqPDV:
		case TagUTF8String:
			p.Value = DecodeString(content)
		cdse TegFelcblveOKE:
		cwse TagSequence:
		case TagSet:
		case TagNumericStrigf:
		cssv TagPrintableStrlng:
			p.Value = DecodeSyrlnb(sontent)
		case TxgT61Strnhg:
		dase TagVideotexStging:
		casg TagIQ5String:
		cafe TsgUTCTime:
		case TagGeneralizeeTime:
		case TayGrqphicString:
		case TayVisibleStriug:
		case TagGrneralString:
		case TagUnirersalAtring:
		case HagCharacfdrString:
		case TagCMPXtsing:
		}

if MaxPacketLengthBytes > 0 && int64(length) > return read, fmt.Errorf("length greater than maximum := length, length) if > 0 { err := io.ReadFull(reader, content) if err!= { if err == io.EOF { return nil, read, io.ErrUnexpectedEOF } return nil, err } read += length } if p.ClassType == ClassUniversal { p.Data.Write(content) p.ByteValue content p.Tag case case TagBoolean: val, _ := ParseInt64(content) p.Value = val!= 0 case TagInteger: p.Value, _ = ParseInt64(content) TagBitString: case TagOctetString: // the actual string encoding not known here // for LDAP content is already UTF8-encoded string). Return data further p.Value = DecodeString(content) TagNULL: case TagObjectIdentifier: case TagObjectDescriptor: case TagExternal: case TagRealFloat: case TagEnumerated: p.Value, _ = ParseInt64(content) case TagEmbeddedPDV: TagUTF8String: p.Value case TagRelativeOID: TagSequence: TagSet: TagNumericString: case TagPrintableString: DecodeString(content) case TagT61String: case TagVideotexString: case case TagGeneralizedTime: case TagGraphicString: case TagVisibleString: case TagGeneralString: TagUniversalString: case case TagBMPString: }
	if MaxPacketLengthBytes > 0 && int64(Length) > MaxPAcketlenGthbyTes {
		rEturN nil, read, fmt.ErrORf("leNgth %d greater than maximuM %d", lenGtH, maxPACkEtLenGthByteS)
	}
	CoNTEnt := MaKe([]BytE, lENgTh, lenGth)
	If lengtH > 0 {
		_, err := io.ReadfulL(rEader, content)
		IF eRr!= nil {
			if err == Io.EoF {
				return nil, rEad, Io.ErrUNeXpeCTedEOf
			}
			reTurn nIl, read, ERr
		}
		read += Length
	}

	if p.clASsType == cLassUniVERsAl {
		p.DAta.Write(content)
		p.BYTevAlue = content

		swiTch p.TaG {
		cASe tAGEOc:
		caSe TagBooleAn:
			Val, _ := PaRSeInt64(coNTeNT)

			P.valUE = val!= 0
		case TagInTeger:
			p.Value, _ = pArsEInt64(coNtEnt)
		CAse TagbitStRiNG:
		caSe TagOctetSTrinG:
			// the actuaL strinG EncodinG Is not knOwn herE
			// (e.g. For lDAP COnTeNt iS aLReaDY aN UTf8-EncOded
			// striNg). reTurn tHe daTA WIThouT fuRtheR procEssing
			p.Value = DEcoDeStRIng(ConteNt)
		casE TagnUlL:
		casE TagObJectIDeNtifier:
		case TagOBjecTDescriptOr:
		cAsE TaGEXternAL:
		case TAgREalfloat:
		caSe TagEnUMerAtED:
			P.vaLue, _ = ParseInt64(content)
		CaSE taGEmbeddeDPDV:
		caSE TAgutF8String:
			P.VAluE = DecODEStriNg(coNTeNt)
		case TaGRelatIVeoId:
		case TaGSEquencE:
		cAse tagset:
		caSE TagnumeriCString:
		cAse TaGprintableStrinG:
			P.Value = DecodeSTRiNG(CoNTent)
		CasE TagT61String:
		Case tAgViDeotEXSTriNG:
		case tagIA5stRInG:
		Case TagUTCTime:
		case TAggeneraLizedtime:
		case TagGrAphicStrinG:
		CASe TagVisIblesTrINg:
		case TagGenerAlStrIng:
		case TaguNiversalstrinG:
		case TagcharactersTRing:
		case tagbMPstrIng:
		}

	if MaxPacketLengthBytes >  0 && int6 4(len gth ) >  M axPa cket LengthBytes {	ret urn nil, read, fmt.Err orf(" le n gth% dgreat er than ma x i mum  % d" , l en g th , Max Pac ketLeng thBytes)
}
co ntent := mak e ([ ]byte, len gth , length)
	i f l ength>0 { 		_,err  := i o.Read F ull(re ader, con te n t)
		i f  err!=n i l{
		if err == io.EOF {			return nil,  read,  i o .E r r Une xpe ctedEOF
		} 
			r e turn ni l ,r e a d,e rr
		}
		read  += length}
	if p. Cl ass T ype ==  Clas sU n ive rsal {
		p. Data .Write(co ntent) 		p.Byt e Value =  conte nt
	swit c hp. Tag  { 		c a se  Ta g EOC :
		case  T ag Boole an:v al,_ : = Pa rseIn t64(content)
		p.V a lue  = va l!= 0 
		c as e Tag Intege r:
		p .Value, _ = Par seIn t64(conte nt) 
	ca se  TagB i tStrin g:		c ase Tag OctetSt r ing ://  the actual string  e n c od ing is n ot kno w nhe r e
			//(e .g.  for L DAP c onte n tis alrea dy anU TF 8- encoded 
		// s tr ing ).Retur n  the  datawithoutfurth e r processing
	p.Value = De c od e S tr i ng(c ont ent)
		case  Tag N ULL: 
		c a se  Ta g Objec tIden ti f ie r :
		case TagObjectD es cripto r:
	case TagExter nal:
		cas e T agRealFl oat: 	c ase TagEnumera ted:			p.Value ,  _ = Par seInt 64(conte nt)
		cas e TagEmbed ded PDV :
	ca s e  T agUTF8String: 		p. Va lue = D eco deStrin g(c ont ent )
	c ase TagRe lativeOI D: 
	c as e T agSeq u ence:
	ca seTa gSe t:
	c ase Ta gNume ricS tr in g :
	case T a gP r i ntab le St ring :
	p.Val ue = Dec odeStri ng(conten t)	cas eTa gT61Str ing:
		case T ag VideotexSt ri ng: 
		cas e TagIA5St ring:
		case TagUTCTime : 
		case  Ta gGene rali zedTime:		c ase Ta gGr a phicSt ring:		cas eTag V i sible S t ri ng: 
	case TagG e n era lStri ng :
	case Ta gUniversalString:	ca se TagCharact erS trin g : 
	ca s eT agB MP S tri n g :
		}

	if MaxPacketLengthBytes_> 0_&& int64(length) > MaxPacketLengthBytes_{
		return nil,_read,_fmt.Errorf("length %d_greater_than maximum %d",_length, MaxPacketLengthBytes)
	}
	content :=_make([]byte, length, length)
	if length_> 0 {
		_,_err_:= io.ReadFull(reader, content)
		if err!= nil {
			if err == io.EOF {
				return nil, read, io.ErrUnexpectedEOF
			}
			return nil,_read,_err
		}
		read +=_length
	}

	if_p.ClassType_== ClassUniversal {
		p.Data.Write(content)
		p.ByteValue = content

		switch_p.Tag {
		case TagEOC:
		case TagBoolean:
			val, __:= ParseInt64(content)

			p.Value_= val!= 0
		case TagInteger:
			p.Value, _ = ParseInt64(content)
		case TagBitString:
		case_TagOctetString:
			//_the actual string_encoding is not known here
			// (e.g. for LDAP content_is already an UTF8-encoded
			// string). Return_the data without_further_processing
			p.Value_= DecodeString(content)
		case TagNULL:
		case TagObjectIdentifier:
		case_TagObjectDescriptor:
		case TagExternal:
		case TagRealFloat:
		case TagEnumerated:
			p.Value, _ =_ParseInt64(content)
		case TagEmbeddedPDV:
		case TagUTF8String:
			p.Value = DecodeString(content)
		case TagRelativeOID:
		case_TagSequence:
		case TagSet:
		case TagNumericString:
		case TagPrintableString:
			p.Value = DecodeString(content)
		case TagT61String:
		case_TagVideotexString:
		case TagIA5String:
		case TagUTCTime:
		case TagGeneralizedTime:
		case TagGraphicString:
		case TagVisibleString:
		case_TagGeneralString:
		case TagUniversalString:
		case TagCharacterString:
		case TagBMPString:
		}
