RohcHeader.h Source File

Simu5G: RohcHeader.h Source File
Simu5G
RohcHeader.h
1//
2// Simu5G
3//
4// Authors: Giovanni Nardini, Giovanni Stea, Antonio Virdis (University of Pisa)
5//
6// This file is part of a software released under the license included in file
7// "license.pdf". Please read LICENSE and README files before using it.
8// The above files and the present reference are part of the software itself,
9// and cannot be removed from it.
10//
11
12#ifndef __SIMU5G_ROHCHEADER_H
13#define __SIMU5G_ROHCHEADER_H
14
15#include "inet/common/packet/chunk/Chunk.h"
16
17namespace simu5g {
18
28class RohcHeader : public inet::Chunk
29{
30 friend class RohcHeaderDescriptor;
31
32 protected:
36 inet::Ptr<inet::Chunk> chunk;
40 inet::b length;
41
42 protected:
43 inet::Chunk *_getChunk() const { return chunk.get(); } // only for class descriptor
44
45 virtual const inet::Ptr<inet::Chunk> peekUnchecked(PeekPredicate predicate, PeekConverter converter, const Iterator& iterator, inet::b length, int flags) const override;
46
47 public:
50 RohcHeader();
51 RohcHeader(const RohcHeader& other) = default;
52 RohcHeader(const inet::Ptr<inet::Chunk>& chunk, inet::b length);
53
54 virtual RohcHeader *dup() const override { return new RohcHeader(*this); }
55 virtual const inet::Ptr<inet::Chunk> dupShared() const override { return inet::makeShared<RohcHeader>(*this); }
56
57 virtual void parsimPack(omnetpp::cCommBuffer *buffer) const override;
58 virtual void parsimUnpack(omnetpp::cCommBuffer *buffer) override;
60
61 virtual void forEachChild(omnetpp::cVisitor *v) override;
62
65 const inet::Ptr<inet::Chunk>& getChunk() const { return chunk; }
66 void setChunk(const inet::Ptr<inet::Chunk>& chunk);
67
68 inet::b getLength() const { return length; }
69 void setLength(inet::b length);
71
74 virtual bool isMutable() const override { return inet::Chunk::isMutable() || (chunk && chunk->isMutable()); }
75 virtual bool isImmutable() const override { return inet::Chunk::isImmutable() && (!chunk || chunk->isImmutable()); }
76
77 virtual bool isComplete() const override { return inet::Chunk::isComplete() && (!chunk || chunk->isComplete()); }
78 virtual bool isIncomplete() const override { return inet::Chunk::isIncomplete() || (chunk && chunk->isIncomplete()); }
79
80 virtual bool isCorrect() const override { return inet::Chunk::isCorrect() && (!chunk || chunk->isCorrect()); }
81 virtual bool isIncorrect() const override { return inet::Chunk::isIncorrect() || (chunk && chunk->isIncorrect()); }
82
83 virtual bool isProperlyRepresented() const override { return inet::Chunk::isProperlyRepresented() && (!chunk || chunk->isProperlyRepresented()); }
84 virtual bool isImproperlyRepresented() const override { return inet::Chunk::isImproperlyRepresented() || (chunk && chunk->isImproperlyRepresented()); }
86
89 virtual ChunkType getChunkType() const override { return CT_ENCRYPTED; } // Use CT_SEQUENCE as it's closest to our use case
90 virtual inet::b getChunkLength() const override { CHUNK_CHECK_IMPLEMENTATION(length >= inet::b(0)); return length; }
91
92 virtual bool containsSameData(const inet::Chunk& other) const override;
93
94 virtual std::ostream& printFieldsToStream(std::ostream& stream, int level, int evFlags = 0) const override;
96};
97
98} // namespace simu5g
99
100#endif
Definition RohcHeader.h:29
inet::Ptr< inet::Chunk > chunk
Definition RohcHeader.h:36
inet::b length
Definition RohcHeader.h:40
Definition AlertReceiver.h:24