AntHocNet 2.0.0
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
Loading...
Searching...
No Matches
anthocnet-routing-protocol.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 * AntHocNet routing protocol for NS-3.
6 *
7 * An additive Ipv4RoutingProtocol (mirroring src/aodv) that delegates all
8 * routing decisions to the shared core::AntRouterLogic. Ant control packets
9 * travel over a dedicated UDP port; data packets are routed/queued via
10 * RouteOutput / RouteInput.
11 */
12#ifndef ANTHOCNET_ROUTING_PROTOCOL_H
13#define ANTHOCNET_ROUTING_PROTOCOL_H
14
15#include "ns3/ipv4-routing-protocol.h"
16#include "ns3/ipv4-interface-address.h"
17#include "ns3/ipv4-l3-protocol.h"
18#include "ns3/socket.h"
19#include "ns3/timer.h"
20#include "ns3/random-variable-stream.h"
21#include "ns3/traced-callback.h"
22#include "ns3/mac48-address.h"
23#include "ns3/queue.h"
24#include "ns3/wifi-mac.h"
25
26// ns-3 renamed WifiMacQueueItem -> WifiMpdu (and wifi-mac-queue-item.h ->
27// wifi-mpdu.h) in ns-3.37; the WifiMac "DroppedMpdu" trace carries this type.
28// ANTHOCNET_NS3_WIFI_QUEUE_ITEM is defined by the module's CMakeLists for
29// ns-3 <= 3.36; default to the modern name.
30#ifdef ANTHOCNET_NS3_WIFI_QUEUE_ITEM
31#include "ns3/wifi-mac-queue-item.h"
32#define AHN_WIFI_MPDU ns3::WifiMacQueueItem
33#else
34#include "ns3/wifi-mpdu.h"
35#define AHN_WIFI_MPDU ns3::WifiMpdu
36#endif
37
38#include <map>
39#include <memory>
40#include <set>
41
44#include "anthocnet-adapters.h"
45#include "anthocnet-rqueue.h"
46
47// ns-3 changed Ipv4RoutingProtocol::RouteInput's forwarding-callback parameters
48// from by-value (<= ns-3.36) to const-reference (ns-3.37+). The override must
49// match exactly or the class stays abstract. ANTHOCNET_NS3_ROUTEINPUT_BYVALUE is
50// defined by the module's CMakeLists for ns-3 <= 3.36; default to const-ref.
51#ifdef ANTHOCNET_NS3_ROUTEINPUT_BYVALUE
52#define AHN_RI_CB(T) T
53#else
54#define AHN_RI_CB(T) const T&
55#endif
56
57namespace ns3 {
58namespace anthocnet {
59
60// The protocol is also a core IRouterObserver (item 15): it forwards the core's
61// ant/route events to ns-3 trace sources so users can Config::Connect and so the
62// comparison harness can read ant-level diagnostics. The interface is all
63// no-op-default virtuals, so this adds no state to the core.
67{
68public:
69 static TypeId GetTypeId();
70 static const uint16_t ANT_PORT; ///< UDP port for ant control traffic.
71
73 ~RoutingProtocol() override;
74
75 // Trace-source callback signatures (introspection names used in GetTypeId).
76 typedef void (*AntTxCallback)(uint8_t type, uint8_t direction, bool broadcast);
77 typedef void (*AntRxCallback)(uint8_t type, uint8_t direction);
78 typedef void (*RouteChangedCallback)(uint32_t dest, uint32_t neighbor, bool added);
79 // #386: a MAC retry-limit-dropped data packet was re-injected into the
80 // pending queue (#46). `header` is the packet's Ipv4 header as captured off
81 // the failed MPDU; `packet` is the queued form (UDP header + payload, no IP
82 // header — RouteInput's convention). Fired once per re-injection, at the
83 // same site that increments MacReinjectedPackets(), so a listener's event
84 // count and that counter agree by construction.
85 typedef void (*MacReinjectCallback)(const Ipv4Header& header, Ptr<const Packet> packet);
86
87 // core::IRouterObserver
89 ::anthocnet::core::AntDirection dir, bool broadcast) override;
93 ::anthocnet::core::NodeAddress nb, bool added) override;
94
95 // #216 diagnostic: read the current regular and virtual pheromone for
96 // (dest, neighbour), both given as canonical Ipv4 addresses. Zeroes when
97 // the routing logic is not yet constructed. Read-only — used by the
98 // isl-grid corridor cell's "# pher" sampler to watch whether a gradient
99 // toward the clean corridor ever forms at the probe source.
100 void GetPheromoneDiag(Ipv4Address dest, Ipv4Address neighbor,
101 double& regular, double& virt) const;
102
103 // core::ILinkState (item 10/A2): supply MAC congestion signals for the
104 // congestion-aware per-hop metric. Only meaningful when EnableMacMetric is
105 // set; the core queries these while stamping a forward ant, naming the
106 // next hop the cost is for (#206). This wifi implementation is the
107 // degenerate single-interface case — one radio, one MAC, one queue — so
108 // the parameter is ignored and per-next-hop collapses to per-node.
111
112 // Ipv4RoutingProtocol
113 Ptr<Ipv4Route> RouteOutput(Ptr<Packet> p, const Ipv4Header& header,
114 Ptr<NetDevice> oif, Socket::SocketErrno& sockerr) override;
115 bool RouteInput(Ptr<const Packet> p, const Ipv4Header& header, Ptr<const NetDevice> idev,
116 AHN_RI_CB(UnicastForwardCallback) ucb, AHN_RI_CB(MulticastForwardCallback) mcb,
117 AHN_RI_CB(LocalDeliverCallback) lcb, AHN_RI_CB(ErrorCallback) ecb) override;
118 void NotifyInterfaceUp(uint32_t interface) override;
119 void NotifyInterfaceDown(uint32_t interface) override;
120 void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address) override;
121 void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address) override;
122 void SetIpv4(Ptr<Ipv4> ipv4) override;
123 void PrintRoutingTable(Ptr<OutputStreamWrapper> stream,
124 Time::Unit unit = Time::S) const override;
125
126 /// Seed the protocol's RNG; returns the number of streams used.
127 int64_t AssignStreams(int64_t stream);
128 /// #496: seed the hello/proactive timer-jitter stream (separate from the
129 /// core's decision stream, so jitter draws never shift the core's
130 /// sequence); returns the number of streams used. AntHocNetHelper assigns
131 /// these after every node's core stream, so the core streams keep their
132 /// pre-#496 indices.
133 int64_t AssignTimerStreams(int64_t stream);
134
135 /// Issue #20 diagnostics: LinkFail origin/propagation split from the core
136 /// (origins = antTx[linkfail] − propagations; budget drops = suppressed).
137 uint64_t LinkfailPropagations() const {
138 return m_logic ? m_logic->linkfailPropagations() : 0;
139 }
140 uint64_t LinkfailBudgetDrops() const {
141 return m_logic ? m_logic->linkfailBudgetDrops() : 0;
142 }
143 uint64_t LinkfailOriginsSuppressed() const {
144 return m_logic ? m_logic->linkfailOriginsSuppressed() : 0;
145 }
146
147 /// Directed reactive discovery diagnostics: reactive forward ants unicast
148 /// along the diffusion gradient instead of broadcast (EnableDirectedReactive).
149 /// Zero on an enabled run means the gradient never covered a destination the
150 /// regular table was missing, i.e. the switch was inert for this scenario.
151 uint64_t DirectedSteers() const {
152 return m_logic ? m_logic->directedSteers() : 0;
153 }
154
155 /// Issue #133 observability: per-node pheromone-table size gauge from the
156 /// core — current (neighbor, dest) entry counts, split regular vs virtual.
157 /// Read by the comparison harness under --diag to watch table growth.
158 uint64_t PtableEntriesRegular() const {
159 return m_logic ? m_logic->table().numEntriesRegular() : 0;
160 }
161 uint64_t PtableEntriesVirtual() const {
162 return m_logic ? m_logic->table().numEntriesVirtual() : 0;
163 }
164
165 /// Issue #21 hold-time attribution: per-reason (setup / reconvergence /
166 /// repair) pending-queue hold-time stats accumulated over the run, read by
167 /// the comparison harness under --diag to locate the delay tail's dominant
168 /// hold path.
169 const HoldStats& HoldTimeStats() const { return m_queue.Stats(); }
170
171 /// Issue #215 drop-cause breakdown, the AntHocNet-specific causes. The
172 /// generic ones (channel, MAC, TTL, interface queue) are measured
173 /// simulator-side by the comparison harness for every protocol; these three
174 /// exist only here because only this protocol has a pending queue and a
175 /// local-repair discard.
176 ///
177 /// Data packets released by a failed local repair ([1] §3.5, D6) — the
178 /// *packet* count behind the core's DiscardPending events. This is expected
179 /// protocol behaviour, not a fault: the paper trades these packets for a
180 /// bounded delay tail.
181 uint64_t RepairDiscardedPackets() const { return m_repairDiscardedPackets; }
182 /// Expired local repairs (the core's event count; several packets may be
183 /// released per event).
184 uint64_t RepairDiscards() const { return m_logic ? m_logic->repairDiscards() : 0; }
185 /// Data packets a MAC retry-limit drop put *back* into the pending queue
186 /// (#46 re-injection). Such a packet is not lost yet — its terminal fate is
187 /// counted wherever it finally ends up — so the harness subtracts these from
188 /// the raw MAC-failure tally to avoid double-counting them (#215).
189 uint64_t MacReinjectedPackets() const { return m_macReinjectedPackets; }
190
191protected:
192 void DoInitialize() override;
193 void DoDispose() override;
194
195public:
196 // Address mapping between core (int32 NodeAddress == the IP, opaque) and
197 // ns-3 (ADR-0011). Broadcast is a RouteAction, never an identity, so the
198 // all-ones address must never reach the core as a peer; guard it so it
199 // cannot alias kInvalidAddress (-1 == 0xFFFFFFFF). MSB-set unicast IPs map
200 // to negative ints and round-trip fine — only the all-ones value collides.
201 // Public so the test suite can assert the round-trip / sentinel guard.
202 static ::anthocnet::core::NodeAddress ToCore(Ipv4Address a) {
203 const uint32_t raw = a.Get();
204 if (raw == 0xFFFFFFFFu) return 0; // limited broadcast: not an identity
205 return static_cast<::anthocnet::core::NodeAddress>(raw);
206 }
208 return Ipv4Address(static_cast<uint32_t>(a));
209 }
210
211private:
212 void Start();
213 Ptr<Ipv4Route> LoopbackRoute(const Ipv4Header& header, Ptr<NetDevice> oif) const;
214 bool IsMyOwnAddress(Ipv4Address src) const;
215 Ptr<Socket> FindSocketWithInterfaceAddress(Ipv4InterfaceAddress addr) const;
216
217 // ant I/O
218 void RecvAnt(Ptr<Socket> socket);
219 void SendAnt(const ::anthocnet::core::AntMessage& msg, Ipv4Address dest);
220 void ExecuteDecisions(const std::vector<::anthocnet::core::RouteDecision>& decisions,
222
223 // data path
224 void DeferredRouteOutput(Ptr<const Packet> p, const Ipv4Header& header,
225 UnicastForwardCallback ucb, ErrorCallback ecb);
226 void FlushQueue(::anthocnet::core::NodeAddress coreDest);
227 /// Repair wait expired ([1] §3.5, D6): drop the packets queued for
228 /// `coreDest`, firing their error callbacks.
229 void DiscardQueue(::anthocnet::core::NodeAddress coreDest);
230
231 // timers
232 void HelloTimerExpire();
233 void ProactiveTimerExpire();
234 /// Issue #21: re-flood a reactive forward ant for every destination with
235 /// data still waiting in the pending queue but no route. onDataPacket only
236 /// retries when a data packet arrives (~1 pkt/s at paper CBR), so a lost
237 /// first re-discovery attempt otherwise waits a full second; this timer
238 /// retries at a sub-second cadence, shortening the reconvergence hold that
239 /// dominates the delay/jitter tail.
240 void ReactiveRetryTimerExpire();
241
242 // ADR-0008 detector D: MAC transmit-failure hook. The WifiMac "DroppedMpdu"
243 // trace fires when a unicast frame is dropped after exhausting retries; we
244 // treat a retry-limit drop as a broken link to that next hop and drive the
245 // shared core reportTxFailure path (prune + bounded repair ant).
246 void NotifyTxError(WifiMacDropReason reason, Ptr<const AHN_WIFI_MPDU> mpdu);
247 /// Issue #68: successful-transmission hook — samples the measured
248 /// per-packet MAC service time for the A2 congestion metric.
249 void NotifyAckedMpdu(Ptr<const AHN_WIFI_MPDU> mpdu);
250 // Resolve a failed next-hop MAC to a core address via the ARP caches.
251 bool MapMacToCore(const Mac48Address& mac,
253
254 /// Issue #203: resolve a core next-hop name to the concrete way of reaching
255 /// it — the gateway address to send to, the device to send it out of, and
256 /// that device's interface index.
257 ///
258 /// Necessary because the core names a node by ONE address (the first
259 /// interface's, fixed when the logic is constructed in NotifyInterfaceUp)
260 /// while a multi-interface node is reachable on a different subnet per
261 /// link. On single-interface topologies the two coincide and this resolves
262 /// to exactly the pre-#203 values.
263 ///
264 /// Never fails: an unresolvable hop falls back to the first interface, the
265 /// old behaviour, rather than dropping the packet.
266 void ResolveNextHop(::anthocnet::core::NodeAddress next, Ipv4Address& gateway,
267 Ptr<NetDevice>& dev, uint32_t& iface) const;
268
269 // state
270 Ptr<Ipv4> m_ipv4;
271 // Per-interface sockets: one bound to the unicast address (receives
272 // unicast ants), one bound to the subnet-broadcast address (receives
273 // broadcast hello/forward ants). A socket bound only to the unicast
274 // address does NOT receive broadcasts, so both are required.
275 //
276 // Issue #362: ordered by the index of the device each socket is bound to,
277 // NOT by Ptr<Socket> (whose operator< compares heap addresses). With more
278 // than one interface (the ISL mesh) the broadcast fan-out order and the
279 // `.begin()` "first interface" fallbacks otherwise depended on what the
280 // process had allocated earlier — i.e. on --protocols order.
281 struct SocketByBoundDevice {
282 bool operator()(const Ptr<Socket>& a, const Ptr<Socket>& b) const;
283 };
284 std::map<Ptr<Socket>, Ipv4InterfaceAddress, SocketByBoundDevice> m_socketAddresses;
285 std::map<Ptr<Socket>, Ipv4InterfaceAddress, SocketByBoundDevice> m_socketSubnetBroadcast;
286
287 /// Issue #203: where a peer the core named actually is. `iface` is the ns-3
288 /// interface index whose device shares a link with it; `linkLocal` is the
289 /// address to send to on that link.
290 struct PeerRoute {
291 uint32_t iface = 0;
292 Ipv4Address linkLocal;
293 };
294 /// Peer canonical address (how the core names it, i.e. how it appears in
295 /// pheromone tables and ant paths) -> how to reach it. Learned from hello
296 /// ants, the one message carrying both of a peer's names: `msg.src` is the
297 /// canonical one, the IP source is the link-local one. Only populated when
298 /// the two differ, so it stays empty on every single-interface topology.
299 std::map<Ipv4Address, PeerRoute> m_peerRoutes;
300
301 /// Issue #260: every core name a neighbour was heard under, per interface —
302 /// both the link-local sender (what learnNeighbor records as prevHop) and
303 /// the canonical `msg.src` a hello carries. Consulted only by the non-wifi
304 /// interface-down fast path in NotifyInterfaceDown so an ISL break can
305 /// attribute which next hop(s) it severed; an interface that never heard a
306 /// hello has no entry, and that path is then a no-op.
307 std::map<uint32_t, std::set<::anthocnet::core::NodeAddress>> m_ifaceNeighbors;
308
310 Ns3Clock m_clock;
311 Ns3Rng m_rng;
312 std::unique_ptr<::anthocnet::core::AntRouterLogic> m_logic;
313 bool m_started;
314
315 RequestQueue m_queue;
316
317 Timer m_helloTimer;
318 Timer m_proactiveTimer;
319 /// #496: relative per-period jitter on the hello and proactive timers
320 /// (0 = the pre-#496 fixed, phase-locked timers).
321 double m_timerJitter = 0.05;
322 Ptr<UniformRandomVariable> m_timerRng = CreateObject<UniformRandomVariable>();
323 /// Delay to the next firing of a periodic timer with period `base`: the
324 /// first firing is a uniform phase in [0, base), later ones base scaled by
325 /// U[1 - TimerJitter, 1 + TimerJitter]. Returns `base` unchanged (and draws
326 /// nothing) when TimerJitter is 0.
327 Time TimerDelay(Time base, bool first);
328 Timer m_reactiveRetryTimer; ///< issue #21: re-flood discovery for held data
329
330 // attribute-backed parameters
331 Time m_helloInterval;
332 Time m_proactiveInterval;
333 double m_alpha;
334 double m_betaAnts;
335 double m_betaData;
336 double m_gamma;
337 double m_hopCountAlpha; ///< #185: thesis alpha, eq. 4.2 (default 0 = off)
338 bool m_enableProactive;
339 bool m_enableDiffusion;
340 bool m_enableReactive; ///< reactive forward-ant gate (ablation)
341 bool m_enableRepair; ///< local-repair ant gate (ablation)
342 bool m_enableLinkFail; ///< link-failure notification gate (ablation)
343 bool m_enableDirectedReactive; ///< steer reactive ants by the virtual table
344 double m_proactiveBroadcastProb;
345 double m_proactiveVirtualMargin;
346 uint32_t m_maxHelloAdverts; ///< #186: diffusion advert cap k (thesis: 10)
347 double m_sessionTtl;
348 uint32_t m_txFailureThreshold;
349 bool m_enableMacFailureDetector;
350 uint32_t m_maxReinjectPerPacket; ///< #386 remedy: path-global re-injection cap (0 = unlimited)
351 double m_repairWaitFactor;
352 double m_repairTimeout;
353 double m_hopTime; ///< T_hop unloaded-hop reference (s), #88
354 bool m_enableMultipath; ///< multipath reactive setup gate, #96
355 double m_antAcceptanceFactor; ///< multipath acceptance factor a1, #96/#177
356 double m_antAcceptanceFactorNewHop; ///< disjoint-first-hop factor a2, #177
357 double m_linkfailNotifyInterval; ///< issue #20 origin cooldown (s), 0 = off
358 Time m_queueTimeout; ///< issue #21 pending-queue hold before drop
359 Time m_reconvHoldCap; ///< issue #21 L2: cap on reconv holds (0 = off)
360 Time m_repairHoldCap; ///< issue #21 L2: cap on repair holds (0 = off)
361 Time m_reactiveRetryInterval; ///< issue #21 timer-driven re-discovery cadence (0 = off)
362 // Issue #68: measured per-packet MAC service time (EWMA of inter-ack
363 // spacing while the MAC queue stays backlogged — pure service time, no
364 // queue wait, so (Q+1)*T̂_mac does not double-count congestion).
365 double m_macServiceAlpha; ///< EWMA smoothing (old-value weight)
366 double m_macServiceEwmaSec = 0.0; ///< 0 = no sample yet (core falls back)
367 Time m_lastAckTime; ///< previous AckedMpdu timestamp
368 bool m_backlogAtLastAck = false; ///< queue was non-empty at previous ack
369 bool m_enableMacMetric; ///< item 10/A2 congestion-aware per-hop metric
370
371 // WifiMac handle for the item-10/A2 queue-occupancy signal (null on non-wifi
372 // devices, where the p2p/ISL transmit-queue reader below takes over, #206).
373 Ptr<WifiMac> m_wifiMac;
374
375 // #206 step 2: per-interface transmit-queue congestion for non-wifi
376 // devices — the p2p/ISL regime, where each interface is one ISL with its
377 // own queue and the useful signal is per-next-hop. `queue` is the device's
378 // "TxQueue" (PointToPointNetDevice, CsmaNetDevice and SimpleNetDevice all
379 // expose the attribute); the EWMA samples inter-dequeue spacing while the
380 // queue stays backlogged — the transmitter-side analogue of the wifi
381 // inter-ack EWMA (#68), which excludes propagation by construction (the
382 // sender never waits for it). Smoothing shares MacServiceAlpha.
383 struct TxQueueState {
384 Ptr<Queue<Packet>> queue;
385 double ewmaSec = 0.0; ///< 0 = no sample yet (core falls back)
386 Time lastDequeue; ///< previous Dequeue timestamp
387 bool backlogAtLastDequeue = false;
388 };
389 std::map<uint32_t, TxQueueState> m_txQueues; ///< iface index -> queue state
390 void NotifyTxDequeue(uint32_t interface, Ptr<const Packet> p);
391 static void TxDequeueTrace(RoutingProtocol* self, uint32_t interface,
392 Ptr<const Packet> p);
393
394 // L3 forwarding callbacks cached from RouteInput (Ipv4L3Protocol passes the
395 // same bound callbacks on every call). NotifyTxError needs them to re-inject
396 // a MAC-dropped data packet it only sees as a raw MPDU (issue #46).
397 UnicastForwardCallback m_cachedUcb;
398 ErrorCallback m_cachedEcb;
399
400 // Destinations this node has ever had a usable next hop for (issue #21):
401 // separates a first-time reactive setup (never routed) from a
402 // reconvergence wait (route was known and lost) when a data packet is
403 // deferred, so the hold-time attribution can tell the two apart.
404 std::set<::anthocnet::core::NodeAddress> m_everRouted;
405
406 // Issue #215 drop-cause counters (see the accessors above).
407 uint64_t m_repairDiscardedPackets = 0;
408 uint64_t m_macReinjectedPackets = 0;
409
410 // trace sources (item 15): ant sent/received and route add/remove.
411 TracedCallback<uint8_t, uint8_t, bool> m_txAntTrace;
412 TracedCallback<uint8_t, uint8_t> m_rxAntTrace;
413 TracedCallback<uint32_t, uint32_t, bool> m_routeChangedTrace;
414 // #386: MAC-failure re-injection (see MacReinjectCallback above).
415 TracedCallback<const Ipv4Header&, Ptr<const Packet>> m_macReinjectTrace;
416 // #402: the cap counterpart — a MAC retry-limit-dropped data packet hit
417 // MaxReinjectPerPacket and was NOT re-injected, so its MAC drop stays
418 // terminal. Same signature and packet form as MacReinject (it reuses
419 // MacReinjectCallback); fired only inside the m_maxReinjectPerPacket != 0
420 // branch of NotifyTxError, so it can never fire at the default cap 0.
421 TracedCallback<const Ipv4Header&, Ptr<const Packet>> m_macReinjectSkipTrace;
422};
423
424} // namespace anthocnet
425} // namespace ns3
426
427#endif // ANTHOCNET_ROUTING_PROTOCOL_H
#define AHN_RI_CB(T)
Node-local MAC-layer signals for the congestion-aware per-hop metric (item 10/A2, [1] §3....
Definition ports.h:69
Optional observer the core notifies of routing events (item 15).
Definition ports.h:90
uint64_t LinkfailPropagations() const
Issue #20 diagnostics: LinkFail origin/propagation split from the core (origins = antTx[linkfail] − p...
void(* MacReinjectCallback)(const Ipv4Header &header, Ptr< const Packet > packet)
void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address) override
::anthocnet::core::NodeAddress ToCore(Ipv4Address a)
void onAntSent(::anthocnet::core::AntType type, ::anthocnet::core::AntDirection dir, bool broadcast) override
void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address) override
uint64_t RepairDiscards() const
Expired local repairs (the core's event count; several packets may be released per event).
::anthocnet::core::Time macServiceTime(::anthocnet::core::NodeAddress nextHop) const override
void onRouteChanged(::anthocnet::core::NodeAddress dest, ::anthocnet::core::NodeAddress nb, bool added) override
void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override
uint64_t MacReinjectedPackets() const
Data packets a MAC retry-limit drop put back into the pending queue (#46 re-injection).
void GetPheromoneDiag(Ipv4Address dest, Ipv4Address neighbor, double &regular, double &virt) const
void(* AntRxCallback)(uint8_t type, uint8_t direction)
uint64_t RepairDiscardedPackets() const
Issue #215 drop-cause breakdown, the AntHocNet-specific causes.
void onAntReceived(::anthocnet::core::AntType type, ::anthocnet::core::AntDirection dir) override
const HoldStats & HoldTimeStats() const
Issue #21 hold-time attribution: per-reason (setup / reconvergence / repair) pending-queue hold-time ...
void SetIpv4(Ptr< Ipv4 > ipv4) override
void(* RouteChangedCallback)(uint32_t dest, uint32_t neighbor, bool added)
uint64_t PtableEntriesRegular() const
Issue #133 observability: per-node pheromone-table size gauge from the core — current (neighbor,...
uint64_t DirectedSteers() const
Directed reactive discovery diagnostics: reactive forward ants unicast along the diffusion gradient i...
bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, AHN_RI_CB(UnicastForwardCallback) ucb, AHN_RI_CB(MulticastForwardCallback) mcb, AHN_RI_CB(LocalDeliverCallback) lcb, AHN_RI_CB(ErrorCallback) ecb) override
void(* AntTxCallback)(uint8_t type, uint8_t direction, bool broadcast)
int macQueueLength(::anthocnet::core::NodeAddress nextHop) const override
Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) override
void NotifyInterfaceUp(uint32_t interface) override
static const uint16_t ANT_PORT
UDP port for ant control traffic.
static Ipv4Address ToIpv4(::anthocnet::core::NodeAddress a)
int64_t AssignStreams(int64_t stream)
Seed the protocol's RNG; returns the number of streams used.
void NotifyInterfaceDown(uint32_t interface) override
int64_t AssignTimerStreams(int64_t stream)
#496: seed the hello/proactive timer-jitter stream (separate from the core's decision stream,...
double Time
Simulation time, in seconds.
Definition types.h:24
std::int32_t NodeAddress
Network-layer node address.
Definition types.h:21
AntDirection
Travel direction.
Definition ant_message.h:35
AntType
Ant role.
Definition ant_message.h:25
AntHistoryTracker: (src, seqNum) duplicate detection.
Definition ant_history.h:24