| 95 | } |
| 96 | |
| 97 | func (tlv *TLVDecoder) decode(data []byte) *TLVDecoder { |
| 98 | tlvData := TLVDecoder{} |
| 99 | //Get T |
| 100 | tlvData.Tag = binary.BigEndian.Uint32(data[0:4]) |
| 101 | //Get L |
| 102 | tlvData.Length = binary.BigEndian.Uint32(data[4:8]) |
| 103 | //Determine the length of V. (确定V的长度) |
| 104 | tlvData.Value = make([]byte, tlvData.Length) |
| 105 | |
| 106 | //Get V |
| 107 | binary.Read(bytes.NewBuffer(data[8:8+tlvData.Length]), binary.BigEndian, tlvData.Value) |
| 108 | |
| 109 | //zlog.Ins().DebugF("TLV-DecodeData size:%d data:%+v\n", unsafe.Sizeof(data), tlvData) |
| 110 | return &tlvData |
| 111 | } |
| 112 | |
| 113 | func (tlv *TLVDecoder) Intercept(chain ziface.IChain) ziface.IcResp { |
| 114 | |