AntHocNet 2.0.0
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
Loading...
Searching...
No Matches
anthocnet-packet.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (C) 2026 Daniel Henrique Joppi
3
4/*
5 * NS-3 on-the-wire header for AntHocNet, carrying a core::AntMessage.
6 *
7 * Unlike NS-2, NS-3 packet headers are real ns3::Header objects with explicit
8 * Serialize/Deserialize, so the variable-length visited path is encoded
9 * directly (no fixed-capacity arrays). The byte layout matches
10 * core/ant_message_codec so an NS-2 and an NS-3 node would agree on the wire.
11 */
12#ifndef ANTHOCNET_PACKET_H
13#define ANTHOCNET_PACKET_H
14
15#include "ns3/header.h"
16
18
19namespace ns3 {
20namespace anthocnet {
21
22class AntHeader : public Header
23{
24public:
25 AntHeader() = default;
26 explicit AntHeader(const ::anthocnet::core::AntMessage& msg) : m_message(msg) {}
27
28 static TypeId GetTypeId();
29 TypeId GetInstanceTypeId() const override;
30
31 uint32_t GetSerializedSize() const override;
32 void Serialize(Buffer::Iterator start) const override;
33 uint32_t Deserialize(Buffer::Iterator start) override;
34 void Print(std::ostream& os) const override;
35
36 const ::anthocnet::core::AntMessage& Message() const { return m_message; }
37 ::anthocnet::core::AntMessage& Message() { return m_message; }
38 void SetMessage(const ::anthocnet::core::AntMessage& m) { m_message = m; }
39
40private:
42};
43
44} // namespace anthocnet
45} // namespace ns3
46
47#endif // ANTHOCNET_PACKET_H
void SetMessage(const ::anthocnet::core::AntMessage &m)
TypeId GetInstanceTypeId() const override
void Serialize(Buffer::Iterator start) const override
AntHeader(const ::anthocnet::core::AntMessage &msg)
void Print(std::ostream &os) const override
::anthocnet::core::AntMessage & Message()
const ::anthocnet::core::AntMessage & Message() const
uint32_t GetSerializedSize() const override
uint32_t Deserialize(Buffer::Iterator start) override
static TypeId GetTypeId()
AntHistoryTracker: (src, seqNum) duplicate detection.
Definition ant_history.h:24
Complete, copyable description of an ant packet.
Definition ant_message.h:48