AntHocNet 2.0.0
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
Loading...
Searching...
No Matches
visited_path.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 * The visited-node stack an ant carries.
6 *
7 * In the original NS-2 code this was a header-resident `AntTimeEntry**`
8 * malloc'd array of heap pointers, which leaked, double-freed on broadcast
9 * (the same header memory was reused by NS-2's packet pool), and serialized
10 * as `sizeof(pointer)` bytes regardless of the real path length. Modelling it
11 * as a value-type vector of PODs removes that entire class of bug.
12 */
13#ifndef ANTHOCNET_CORE_VISITED_PATH_H
14#define ANTHOCNET_CORE_VISITED_PATH_H
15
16#include <vector>
17
19
20namespace anthocnet {
21namespace core {
22
23/// One entry on an ant's visited-node stack: a node and the trip time the ant
24/// took to reach it from the previous hop.
29
30using VisitedPath = std::vector<AntHop>;
31
32} // namespace core
33} // namespace anthocnet
34
35#endif // ANTHOCNET_CORE_VISITED_PATH_H
double Time
Simulation time, in seconds.
Definition types.h:24
constexpr NodeAddress kInvalidAddress
"No such node / no route" sentinel, mirroring the legacy use of -1.
Definition types.h:27
std::int32_t NodeAddress
Network-layer node address.
Definition types.h:21
std::vector< AntHop > VisitedPath
AntHistoryTracker: (src, seqNum) duplicate detection.
Definition ant_history.h:24
One entry on an ant's visited-node stack: a node and the trip time the ant took to reach it from the ...