-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
In an emulation setup, sending UDP packets, with 2 GNBs, errors occur at the GtpUserMsgSerializer due to not setting the GtpUserMsg length here since it reads the default length of 1B and remainder become <0 here.
I have fixed it by setting gtpMsg->setChunkLenght(B(8)) before inserting and now it seems to work.
In addition, in this setting, errors also occur because there is no X2HandoverDataMsg serializer. I have added a X2HandoverDataMsgSerializer class as below and it fixes it.
using namespace inet;
Register_Serializer(X2HandoverDataMsg, X2HandoverDataMsgSerializer);
void X2HandoverDataMsgSerializer::serialize(inet::MemoryOutputStream &stream,
const inet::Ptr<const inet::Chunk> &chunk) const {
auto startPosition = stream.getLength();
const auto& x2DataMsg = staticPtrCast<const X2HandoverDataMsg>(chunk);
//We need to write to the stream exactly getChunkLength(), which is 11 for ltex2messages. If we write only 8, then fill with remainders
//We cannot write the length because we write 12 bytes and cannot change the ltex2message length
stream.writeUint24Be(B(x2DataMsg->getChunkLength()).get());
stream.writeUint32Be(x2DataMsg->getDestinationId());
stream.writeUint32Be(x2DataMsg->getSourceId());
int64_t remainders = B(x2DataMsg->getChunkLength() - (stream.getLength() - startPosition)).get();
if (remainders < 0) {
throw cRuntimeError("X2HandoverDataMsgSerializer length = %d smaller than required %d bytes", (int)B(x2DataMsg->getChunkLength()).get(), (int)B(stream.getLength() - startPosition).get());
} else {
stream.writeByteRepeatedly('?', remainders);
}
}
const inet::Ptr<inet::Chunk> X2HandoverDataMsgSerializer::deserialize(
inet::MemoryInputStream &stream) const {
auto startPosition = stream.getPosition();
auto x2DataMsg = makeShared<X2HandoverDataMsg>();
B dataLength = B(stream.readUint24Be());
x2DataMsg->setDestinationId(stream.readUint32Be());
x2DataMsg->setSourceId(stream.readUint32Be());
B remainders = dataLength - (stream.getPosition() - startPosition);
ASSERT(remainders >= B(0));
if (remainders.get()>=0) {
stream.readByteRepeatedly('?', B(remainders).get());
}
return x2DataMsg;
}
Metadata
Metadata
Assignees
Labels
No labels