Skip to content

Commit

Permalink
Tcp: fixed TcpHeader parsim/unparsim (issue #961)
Browse files Browse the repository at this point in the history
Verified with next code in Tcp::handleLowerPacket():

{
    cCommBuffer *b = check_and_cast<cCommBuffer *>(createOne("omnetpp::cMemCommBuffer"));
    tcpHeader.get()->parsimPack(b);
    auto h = makeShared<TcpHeader>();
    h->parsimUnpack(b);
    ASSERT(h->getChunkLength() == tcpHeader->getChunkLength());
    ASSERT(h->getHeaderOptionArrayLength() == tcpHeader->getHeaderOptionArrayLength());
    MemoryOutputStream s1, s2;
    Chunk::serialize(s1, tcpHeader);
    Chunk::serialize(s2, h);
    ASSERT(s1.getData() == s2.getData());
}
  • Loading branch information
ZoltanBojthe committed Dec 17, 2024
1 parent 1501c10 commit 5236543
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/inet/transportlayer/tcp_common/TcpHeader.msg
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,19 @@ class TcpHeader extends TransportHeaderBase
TcpOption *headerOption[] @owned;
}

cplusplus(cc) {{
void doParsimPacking(omnetpp::cCommBuffer *b, TcpOption *t)
{
b->packObject(t);
}

void doParsimUnpacking(omnetpp::cCommBuffer *b, TcpOption * &t)
{
t = check_and_cast<TcpOption*>(b->unpackObject());
}

}}

cplusplus(TcpHeader) {{
public:
/**
Expand Down

0 comments on commit 5236543

Please sign in to comment.