refresh test: ttl,etc...

This commit is contained in:
free will committed 2021-03-31 10:44:47 +08:00
1 parent dc060c2fc2
commit fafde2b015
14 files changed
+307 -347

No files matched your search

+23 -27
View File
@@ -44,37 +44,32 @@ public class CanBePrefix implements TlvComponentBase,InitialAble, IEncodingAble
*/
@Override
public int wireEncode(Encoder encoder) throws ComponentException {
// 这是一个存在性组件,所以如果值为false,则无需编码
if(!this.canBePrefix){
return -1;
}
int totalLength=0;
// 编码 TLV-LENGTH
int tmplen= 0;
try {
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
// 这是一个存在性组件,所以如果值为false,则无需编码
if (!this.canBePrefix) {
return -1;
}
int totalLength = 0;
// 编码 TLV-LENGTH
int tmplen = encoder.prependVarNumber(new VlInt(totalLength));
if (tmplen <= 0) {
return -1;
}
totalLength += tmplen;
// 编码 TLV-TYPE
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvCanBePrefix));
if (tmplen <= 0) {
return -1;
}
totalLength += tmplen;
return totalLength;
} catch (EncoderException e) {
throw new ComponentException("CanBePrefix.wireEncode: "+e.getMessage());
}
if(tmplen<=0){
return -1;
}
totalLength+=tmplen;
// 编码 TLV-TYPE
try {
tmplen=encoder.prependVarNumber(new VlInt(TLV.TlvCanBePrefix));
} catch (EncoderException e) {
throw new ComponentException("CanBePrefix.wireEncode: "+e.getMessage());
}
if(tmplen<=0){
return -1;
}
totalLength+=tmplen;
return totalLength;
}
/**
@@ -91,6 +86,7 @@ public class CanBePrefix implements TlvComponentBase,InitialAble, IEncodingAble
// 这是一个存在性组件,所以存在则为 true
this.canBePrefix=true;
this.doInitial();
return true;
}
}