From 8aad00bbf494aff6eb1f885bb10358dc80a941dc Mon Sep 17 00:00:00 2001 From: free will <2647778488@qq.com> Date: Thu, 11 Mar 2021 22:18:22 +0800 Subject: [PATCH] writing component: IdentifierWrapper --- .../java/component/IdentifierWrapper.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/main/java/component/IdentifierWrapper.java diff --git a/src/main/java/component/IdentifierWrapper.java b/src/main/java/component/IdentifierWrapper.java new file mode 100644 index 0000000..1c26b25 --- /dev/null +++ b/src/main/java/component/IdentifierWrapper.java @@ -0,0 +1,54 @@ +package component; + +import encoding.*; + +/* + * @Author: Wang Feng + * @Description: + * @Version: 1.0.0 + * @Date: 10:48 2021/3/11 + * @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室 + */ +public class IdentifierWrapper implements TlvComponentBase, IEncodingAble { + private Identifier identifier; + private VlInt tlvType; + + /** + * 从一个 IdentifierWrapper 编码成的 TLV Block 中解析出一个 IdentifierWrapper + */ + public IdentifierWrapper(Block block){ + if(!block.parseSubElements()){ + // todo: 错误处理 + } + // 检查是否包含有且仅有一个 Identifier TLV + if((block.getSubElements().length()!=1)&&block.getSubElements().getBlock(0).getType().isEqual(TLV.TlvIdentifier)){ + // todo: 错误处理 + } + + } + + /** + * 自定义标识类型,根据标识的字符串标识创建一个自定义的标识 + * @param tlvType + * @param identifierString + * @return + */ + public IdentifierWrapper createCustomIdentifierByString(VlInt tlvType,String identifierString){ + + } + + public IdentifierWrapper createCustomIdentifierByComponents(){ + + } + + + @Override + public int wireEncode(Encoder encoder) { + return 0; + } + + @Override + public boolean wireDecode(Block block) { + return false; + } +}