Add OLSR attribute documentation; make Willingness an enum attribute instead of uint. Closes #211
1.1 --- a/src/routing/olsr/olsr-agent-impl.cc Thu Jun 05 11:21:50 2008 +0100
1.2 +++ b/src/routing/olsr/olsr-agent-impl.cc Thu Jun 05 11:46:15 2008 +0100
1.3 @@ -38,6 +38,7 @@
1.4 #include "ns3/inet-socket-address.h"
1.5 #include "ns3/boolean.h"
1.6 #include "ns3/uinteger.h"
1.7 +#include "ns3/enum.h"
1.8 #include "ns3/trace-source-accessor.h"
1.9
1.10 /********** Useful macros **********/
1.11 @@ -53,17 +54,6 @@
1.12
1.13
1.14
1.15 -/********** Intervals **********/
1.16 -
1.17 -/// HELLO messages emission interval.
1.18 -#define OLSR_HELLO_INTERVAL Seconds (2)
1.19 -
1.20 -/// TC messages emission interval.
1.21 -#define OLSR_TC_INTERVAL Seconds (5)
1.22 -
1.23 -/// MID messages emission interval.
1.24 -#define OLSR_MID_INTERVAL OLSR_TC_INTERVAL
1.25 -
1.26 ///
1.27 /// \brief Period at which a node must cite every link and every neighbor.
1.28 ///
1.29 @@ -77,11 +67,11 @@
1.30 /// Neighbor holding time.
1.31 #define OLSR_NEIGHB_HOLD_TIME (Scalar (3) * OLSR_REFRESH_INTERVAL)
1.32 /// Top holding time.
1.33 -#define OLSR_TOP_HOLD_TIME (Scalar (3) * OLSR_TC_INTERVAL)
1.34 +#define OLSR_TOP_HOLD_TIME (Scalar (3) * m_tcInterval)
1.35 /// Dup holding time.
1.36 #define OLSR_DUP_HOLD_TIME Seconds (30)
1.37 /// MID holding time.
1.38 -#define OLSR_MID_HOLD_TIME (Scalar (3) * OLSR_MID_INTERVAL)
1.39 +#define OLSR_MID_HOLD_TIME (Scalar (3) * m_midInterval)
1.40
1.41
1.42 /********** Link types **********/
1.43 @@ -122,7 +112,7 @@
1.44 /********** Miscellaneous constants **********/
1.45
1.46 /// Maximum allowed jitter.
1.47 -#define OLSR_MAXJITTER (OLSR_HELLO_INTERVAL.GetSeconds () / 4)
1.48 +#define OLSR_MAXJITTER (m_helloInterval.GetSeconds () / 4)
1.49 /// Maximum allowed sequence number.
1.50 #define OLSR_MAX_SEQ_NUM 65535
1.51 /// Random number between [0-OLSR_MAXJITTER] used to jitter OLSR packet transmission.
1.52 @@ -156,22 +146,26 @@
1.53 static TypeId tid = TypeId ("ns3::olsr::AgentImpl")
1.54 .SetParent<Agent> ()
1.55 .AddConstructor<AgentImpl> ()
1.56 - .AddAttribute ("HelloInterval", "XXX",
1.57 - TimeValue (OLSR_HELLO_INTERVAL),
1.58 + .AddAttribute ("HelloInterval", "HELLO messages emission interval.",
1.59 + TimeValue (Seconds (2)),
1.60 MakeTimeAccessor (&AgentImpl::m_helloInterval),
1.61 MakeTimeChecker ())
1.62 - .AddAttribute ("TcInterval", "XXX",
1.63 - TimeValue (OLSR_TC_INTERVAL),
1.64 + .AddAttribute ("TcInterval", "TC messages emission interval.",
1.65 + TimeValue (Seconds (5)),
1.66 MakeTimeAccessor (&AgentImpl::m_tcInterval),
1.67 MakeTimeChecker ())
1.68 - .AddAttribute ("MidInterval", "XXX",
1.69 - TimeValue (OLSR_MID_INTERVAL),
1.70 + .AddAttribute ("MidInterval", "MID messages emission interval. Normally it is equal to TcInterval.",
1.71 + TimeValue (Seconds (5)),
1.72 MakeTimeAccessor (&AgentImpl::m_midInterval),
1.73 MakeTimeChecker ())
1.74 - .AddAttribute ("Willingness", "XXX",
1.75 - UintegerValue (OLSR_WILL_DEFAULT),
1.76 - MakeUintegerAccessor (&AgentImpl::m_willingness),
1.77 - MakeUintegerChecker<uint8_t> ())
1.78 + .AddAttribute ("Willingness", "Willingness of a node to carry and forward traffic for other nodes.",
1.79 + EnumValue (OLSR_WILL_DEFAULT),
1.80 + MakeEnumAccessor (&AgentImpl::m_willingness),
1.81 + MakeEnumChecker (OLSR_WILL_NEVER, "never",
1.82 + OLSR_WILL_LOW, "low",
1.83 + OLSR_WILL_DEFAULT, "default",
1.84 + OLSR_WILL_HIGH, "high",
1.85 + OLSR_WILL_ALWAYS, "always"))
1.86 .AddTraceSource ("Rx", "Receive OLSR packet.",
1.87 MakeTraceSourceAccessor (&AgentImpl::m_rxPacketTrace))
1.88 .AddTraceSource ("Tx", "Send OLSR packet.",