func SplitTLVs(raw []byte) ([]TLV, error) {
	var tlvs []TLV
	for i := 0; i < len(raw); {
		tlv := TLV{
			Type: PP2Type(raw[i]),
		}
		if len(raw)-i <= 2 {
			return nil, ErrTruncatedTLV
		}
		tlvLen := int(binary.BigEndian.Uint16(raw[i+1 : i+3])) // Max length = 65K
		i += 3
		if i+tlvLen > len(raw) {
			return nil, ErrTruncatedTLV
		}
		// Ignore no-op padding
		if tlv.Type != PP2TypeNoop {
			tlv.Value = make([]byte, tlvLen)
			copy(tlv.Value, raw[i:i+tlvLen])
		}
		i += tlvLen
		tlvs = append(tlvs, tlv)
	}
	return tlvs, nil
}
// SplitTLVs splits the Type-Length-Value vector, returns the vector or an error.
SplitTLVs splits the Type-Length-Value vector, returns the vector or an error.
// SplitTLVs splits the Type - Length - Value vector returns the vector or an error .
func SplitTLVs(raw []byte) ([]TLV, error) {
	var tlvs []TLV
	for i := 0; i < len(raw); {
		tlv := TLV{
			Type: PP2Type(raw[i]),
		}
		if len(raw)-i <= 2 {
			return nil, ErrTruncatedTLV
		}
		tlvLen := int(binary.BigEndian.Uint16(raw[i+1 : i+3])) 
		i += 3
		if i+tlvLen > len(raw) {
			return nil, ErrTruncatedTLV
		}
		if tlv.Type != PP2TypeNoop {
			tlv.Value = make([]byte, tlvLen)
			copy(tlv.Value, raw[i:i+tlvLen])
		}
		i += tlvLen
		tlvs = append(tlvs, tlv)
	}
	return tlvs, nil
}
func SplitTLVs ( raw [ ] byte ) ( [ ] TLV , error ) { var tlvs [ ] TLV for i := 0 ; i < len ( raw ) ; { tlv := TLV { Type : PP2Type ( raw [ i ] ) , } if len ( raw ) - i <= 2 { return nil , ErrTruncatedTLV } tlvLen := int ( binary . BigEndian . Uint16 ( raw [ i + 1 : i + 3 ] ) ) i += 3 if i + tlvLen > len ( raw ) { return nil , ErrTruncatedTLV } if tlv . Type != PP2TypeNoop { tlv . Value = make ( [ ] byte , tlvLen ) copy ( tlv . Value , raw [ i : i + tlvLen ] ) } i += tlvLen tlvs = append ( tlvs , tlv ) } return tlvs , nil }
SplitTLVs splits the Type-Length-Value vector, returns the vector or an error.
SplitTLVs splits the Type - Length - Value vector returns the vector or an error .
// Max length = 65K // Ignore no-op padding