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
17
#include "
anthocnet/core/ant_message.h
"
18
19
namespace
ns3
{
20
namespace
anthocnet
{
21
22
class
AntHeader
:
public
Header
23
{
24
public
:
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
40
private
:
41
::anthocnet::core::AntMessage
m_message;
42
};
43
44
}
// namespace anthocnet
45
}
// namespace ns3
46
47
#endif
// ANTHOCNET_PACKET_H
ant_message.h
Header
ns3::anthocnet::AntHeader
Definition
anthocnet-packet.h:23
ns3::anthocnet::AntHeader::SetMessage
void SetMessage(const ::anthocnet::core::AntMessage &m)
Definition
anthocnet-packet.h:38
ns3::anthocnet::AntHeader::AntHeader
AntHeader()=default
ns3::anthocnet::AntHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
ns3::anthocnet::AntHeader::Serialize
void Serialize(Buffer::Iterator start) const override
ns3::anthocnet::AntHeader::AntHeader
AntHeader(const ::anthocnet::core::AntMessage &msg)
Definition
anthocnet-packet.h:26
ns3::anthocnet::AntHeader::Print
void Print(std::ostream &os) const override
ns3::anthocnet::AntHeader::Message
::anthocnet::core::AntMessage & Message()
Definition
anthocnet-packet.h:37
ns3::anthocnet::AntHeader::Message
const ::anthocnet::core::AntMessage & Message() const
Definition
anthocnet-packet.h:36
ns3::anthocnet::AntHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
ns3::anthocnet::AntHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
ns3::anthocnet::AntHeader::GetTypeId
static TypeId GetTypeId()
anthocnet
AntHistoryTracker: (src, seqNum) duplicate detection.
Definition
ant_history.h:24
ns3
Definition
anthocnet-routing-protocol.h:57
anthocnet::core::AntMessage
Complete, copyable description of an ant packet.
Definition
ant_message.h:48
ns3
model
anthocnet-packet.h
Generated by
1.9.8