210 unsigned int pos =
b.getPos();
211 unsigned char type =
b.readByte();
212 unsigned char length = 1;
216 return new IPv4OptionEnd();
219 return new IPv4OptionNop();
222 length =
b.readByte();
224 auto *option =
new IPv4OptionStreamId();
225 option->setType(type);
226 option->setLength(length);
227 option->setStreamId(
b.readUint16());
233 length =
b.readByte();
234 uint8_t pointer =
b.readByte();
235 uint8_t flagbyte =
b.readByte();
236 uint8_t overflow = flagbyte >> 4;
239 switch (flagbyte & 0x0f) {
245 if (flag != -1 && length > 4 && bytes && ((length-4) % bytes) == 0 && pointer >= 5 && ((pointer-5) % bytes) == 0) {
246 auto *option =
new IPv4OptionTimestamp();
247 option->setType(type);
248 option->setLength(length);
249 option->setFlag(flag);
250 option->setOverflow(overflow);
251 option->setRecordTimestampArraySize((length - 4) / bytes);
253 option->setRecordAddressArraySize((length - 4) / bytes);
254 option->setNextIdx((pointer-5) / bytes);
255 for (
unsigned int count = 0;
count < option->getRecordAddressArraySize();
count++) {
257 option->setRecordAddress(
count,
b.readIPv4Address());
258 option->setRecordTimestamp(
count, SimTime(
b.readUint32(), SIMTIME_MS));
268 length =
b.readByte();
269 uint8_t pointer =
b.readByte();
270 if (length > 3 && (length % 4) == 3 && pointer >= 4 && (pointer % 4) == 0) {
271 auto *option =
new IPv4OptionRecordRoute();
272 option->setType(type);
273 option->setLength(length);
274 option->setRecordAddressArraySize((length - 3) / 4);
275 option->setNextAddressIdx((pointer-4) / 4);
276 for (
unsigned int count = 0;
count < option->getRecordAddressArraySize();
count++) {
277 option->setRecordAddress(
count,
b.readIPv4Address());
290 auto *option =
new TLVOptionRaw();
293 length =
b.readByte();
294 option->setType(type);
295 option->setLength(length);
297 option->setBytesArraySize(length - 2);
298 for (
unsigned int i = 2; i < length; i++)
299 option->setBytes(i-2,
b.readByte());
Definition: IPv4Datagram_m.h:112
Definition: IPv4Datagram_m.h:107
int count(const std::vector< T > &v, const T &a)
Definition: stlutils.h:58
Definition: IPv4Datagram_m.h:111
Definition: IPv4Datagram_m.h:105
Definition: IPv4Datagram_m.h:109
Definition: IPv4Datagram_m.h:106
Definition: IPv4Datagram_m.h:133
Definition: IPv4Datagram_m.h:108
Definition: IPv4Datagram_m.h:113
Definition: IPv4Datagram_m.h:135
Definition: IPv4Datagram_m.h:110
Definition: IPv4Datagram_m.h:134
value< double, units::m > b
Definition: Units.h:1054