View | Details | Raw Unified | Return to bug 2482
Collapse All | Expand All

(-)a/src/internet/model/icmpv6-l4-protocol.cc (-20 / +68 lines)
 Lines 44-68   NS_OBJECT_ENSURE_REGISTERED (Icmpv6L4Protocol); Link Here 
44
44
45
const uint8_t Icmpv6L4Protocol::PROT_NUMBER = 58;
45
const uint8_t Icmpv6L4Protocol::PROT_NUMBER = 58;
46
46
47
const uint8_t Icmpv6L4Protocol::MAX_INITIAL_RTR_ADVERT_INTERVAL = 16;
48
const uint8_t Icmpv6L4Protocol::MAX_INITIAL_RTR_ADVERTISEMENTS = 3;
49
const uint8_t Icmpv6L4Protocol::MAX_FINAL_RTR_ADVERTISEMENTS = 3;
50
const uint8_t Icmpv6L4Protocol::MIN_DELAY_BETWEEN_RAS = 3;
51
const uint32_t Icmpv6L4Protocol::MAX_RA_DELAY_TIME = 500; /* millisecond */
52
53
const uint8_t Icmpv6L4Protocol::MAX_RTR_SOLICITATION_DELAY = 1;
54
const uint8_t Icmpv6L4Protocol::RTR_SOLICITATION_INTERVAL = 4;
55
const uint8_t Icmpv6L4Protocol::MAX_RTR_SOLICITATIONS = 3;
56
57
const uint8_t Icmpv6L4Protocol::MAX_MULTICAST_SOLICIT = 3;
58
const uint8_t Icmpv6L4Protocol::MAX_UNICAST_SOLICIT = 3;
59
const uint8_t Icmpv6L4Protocol::MAX_ANYCAST_DELAY_TIME = 1;
60
const uint8_t Icmpv6L4Protocol::MAX_NEIGHBOR_ADVERTISEMENT = 3;
61
const uint32_t Icmpv6L4Protocol::REACHABLE_TIME = 30000;
62
const uint32_t Icmpv6L4Protocol::RETRANS_TIMER = 1000;
63
const uint8_t Icmpv6L4Protocol::DELAY_FIRST_PROBE_TIME = 5;
64
const double Icmpv6L4Protocol::MIN_RANDOM_FACTOR = 0.5;
65
const double Icmpv6L4Protocol::MAX_RANDOM_FACTOR = 1.5;
66
47
67
TypeId Icmpv6L4Protocol::GetTypeId ()
48
TypeId Icmpv6L4Protocol::GetTypeId ()
68
{
49
{
 Lines 78-84   TypeId Icmpv6L4Protocol::GetTypeId () Link Here 
78
                   StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=10.0]"),
59
                   StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=10.0]"),
79
                   MakePointerAccessor (&Icmpv6L4Protocol::m_solicitationJitter),
60
                   MakePointerAccessor (&Icmpv6L4Protocol::m_solicitationJitter),
80
                   MakePointerChecker<RandomVariableStream> ())
61
                   MakePointerChecker<RandomVariableStream> ())
81
62
    .AddAttribute ("MAX_INITIAL_RTR_ADVERT_INTERVAL", "Neighbor Discovery router constants : max initial RA initial interval.",
63
                   UintegerValue (16),
64
                   MakeUintegerAccessor (&Icmpv6L4Protocol::MAX_INITIAL_RTR_ADVERT_INTERVAL),
65
                   MakeUintegerChecker<uint8_t> ())
66
    .AddAttribute ("MAX_INITIAL_RTR_ADVERTISEMENTS", "Neighbor Discovery router constants : max initial RA transmission.",
67
                   IntegerValue (3),
68
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_INITIAL_RTR_ADVERTISEMENTS),
69
                   MakeIntegerChecker<uint8_t> ())
70
    .AddAttribute ("MAX_FINAL_RTR_ADVERTISEMENTS", "Neighbor Discovery router constants : max final RA transmission.",
71
                   IntegerValue (3),
72
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_FINAL_RTR_ADVERTISEMENTS),
73
                   MakeIntegerChecker<uint8_t> ())
74
    .AddAttribute ("MIN_DELAY_BETWEEN_RAS", "Neighbor Discovery router constants : min delay between RA.",
75
                   IntegerValue (3),
76
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MIN_DELAY_BETWEEN_RAS),
77
                   MakeIntegerChecker<uint8_t> ())
78
    .AddAttribute ("MAX_RA_DELAY_TIME", "Neighbor Discovery router constants : max delay between RA.",
79
                   IntegerValue (500),
80
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_RA_DELAY_TIME),
81
                   MakeIntegerChecker<uint32_t> ())
82
    .AddAttribute ("MAX_RTR_SOLICITATION_DELAY", "Neighbor Discovery host constants : max RS delay.",
83
                   IntegerValue (1),
84
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_RTR_SOLICITATION_DELAY),
85
                   MakeIntegerChecker<uint8_t> ())
86
    .AddAttribute ("RTR_SOLICITATION_INTERVAL", "Neighbor Discovery host constants : RS interval.",
87
                   IntegerValue (4),
88
                   MakeIntegerAccessor (&Icmpv6L4Protocol::RTR_SOLICITATION_INTERVAL),
89
                   MakeIntegerChecker<uint8_t> ())
90
    .AddAttribute ("MAX_RTR_SOLICITATIONS", "Neighbor Discovery host constants : max RS transmission.",
91
                   IntegerValue (3),
92
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_RTR_SOLICITATIONS),
93
                   MakeIntegerChecker<uint8_t> ())
94
    .AddAttribute ("MAX_MULTICAST_SOLICIT", "Neighbor Discovery node constants : max multicast solicitations.",
95
                   IntegerValue (3),
96
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_MULTICAST_SOLICIT),
97
                   MakeIntegerChecker<uint8_t> ())
98
    .AddAttribute ("MAX_UNICAST_SOLICIT", "Neighbor Discovery node constants : max unicast solicitations.",
99
                   IntegerValue (3),
100
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_UNICAST_SOLICIT),
101
                   MakeIntegerChecker<uint8_t> ())
102
    .AddAttribute ("MAX_ANYCAST_DELAY_TIME", "Neighbor Discovery node constants : max anycast delay.",
103
                   IntegerValue (1),
104
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_ANYCAST_DELAY_TIME),
105
                   MakeIntegerChecker<uint8_t> ())
106
    .AddAttribute ("MAX_NEIGHBOR_ADVERTISEMENT", "Neighbor Discovery node constants : max NA transmission.",
107
                   IntegerValue (3),
108
                   MakeIntegerAccessor (&Icmpv6L4Protocol::MAX_NEIGHBOR_ADVERTISEMENT),
109
                   MakeIntegerChecker<uint8_t> ())
110
    .AddAttribute ("REACHABLE_TIME", "Neighbor Discovery node constants : reachable time.",
111
                   IntegerValue (30000),
112
                   MakeIntegerAccessor (&Icmpv6L4Protocol::REACHABLE_TIME),
113
                   MakeIntegerChecker<uint32_t> ())
114
    .AddAttribute ("RETRANS_TIMER", "Neighbor Discovery node constants : retransmission timer.",
115
                   IntegerValue (1000),
116
                   MakeIntegerAccessor (&Icmpv6L4Protocol::RETRANS_TIMER),
117
                   MakeIntegerChecker<uint32_t> ())
118
    .AddAttribute ("DELAY_FIRST_PROBE_TIME", "Neighbor Discovery node constants : delay for the first probe.",
119
                   IntegerValue (5),
120
                   MakeIntegerAccessor (&Icmpv6L4Protocol::DELAY_FIRST_PROBE_TIME),
121
                   MakeIntegerChecker<uint8_t> ())
122
    .AddAttribute ("MIN_RANDOM_FACTOR", "Neighbor Discovery node constants : min random factor.",
123
                   DoubleValue (0.5),
124
                   MakeDoubleAccessor (&Icmpv6L4Protocol::MIN_RANDOM_FACTOR),
125
                   MakeDoubleChecker<double> ())
126
    .AddAttribute ("MAX_RANDOM_FACTOR", "Neighbor Discovery node constants : max random factor.",
127
                   DoubleValue (1.5),
128
                   MakeDoubleAccessor (&Icmpv6L4Protocol::MAX_RANDOM_FACTOR),
129
                   MakeDoubleChecker<double> ())
82
  ;
130
  ;
83
  return tid;
131
  return tid;
84
}
132
}
(-)a/src/internet/model/icmpv6-l4-protocol.h (-18 / +18 lines)
 Lines 65-151   public: Link Here 
65
  /**
65
  /**
66
   * \brief Neighbor Discovery router constants : max initial RA initial interval.
66
   * \brief Neighbor Discovery router constants : max initial RA initial interval.
67
   */
67
   */
68
  static const uint8_t MAX_INITIAL_RTR_ADVERT_INTERVAL;
68
  uint8_t MAX_INITIAL_RTR_ADVERT_INTERVAL;
69
69
70
  /**
70
  /**
71
   * \brief Neighbor Discovery router constants : max initial RA transmission.
71
   * \brief Neighbor Discovery router constants : max initial RA transmission.
72
   */
72
   */
73
  static const uint8_t MAX_INITIAL_RTR_ADVERTISEMENTS;
73
  uint8_t MAX_INITIAL_RTR_ADVERTISEMENTS;
74
74
75
  /**
75
  /**
76
   * \brief Neighbor Discovery router constants : max final RA transmission.
76
   * \brief Neighbor Discovery router constants : max final RA transmission.
77
   */
77
   */
78
  static const uint8_t MAX_FINAL_RTR_ADVERTISEMENTS;
78
  uint8_t MAX_FINAL_RTR_ADVERTISEMENTS;
79
79
80
  /**
80
  /**
81
   * \brief Neighbor Discovery router constants : min delay between RA.
81
   * \brief Neighbor Discovery router constants : min delay between RA.
82
   */
82
   */
83
  static const uint8_t MIN_DELAY_BETWEEN_RAS;
83
  uint8_t MIN_DELAY_BETWEEN_RAS;
84
84
85
  /**
85
  /**
86
   * \brief Neighbor Discovery router constants : max delay between RA.
86
   * \brief Neighbor Discovery router constants : max delay between RA.
87
   */
87
   */
88
  static const uint32_t MAX_RA_DELAY_TIME;
88
  uint32_t MAX_RA_DELAY_TIME;
89
89
90
  /**
90
  /**
91
   * \brief Neighbor Discovery host constants : max RS delay.
91
   * \brief Neighbor Discovery host constants : max RS delay.
92
   */
92
   */
93
  static const uint8_t MAX_RTR_SOLICITATION_DELAY;
93
  uint8_t MAX_RTR_SOLICITATION_DELAY;
94
94
95
  /**
95
  /**
96
   * \brief Neighbor Discovery host constants : RS interval.
96
   * \brief Neighbor Discovery host constants : RS interval.
97
   */
97
   */
98
  static const uint8_t RTR_SOLICITATION_INTERVAL;
98
  uint8_t RTR_SOLICITATION_INTERVAL;
99
99
100
  /**
100
  /**
101
   * \brief Neighbor Discovery host constants : max RS transmission.
101
   * \brief Neighbor Discovery host constants : max RS transmission.
102
   */
102
   */
103
  static const uint8_t MAX_RTR_SOLICITATIONS;
103
  uint8_t MAX_RTR_SOLICITATIONS;
104
104
105
  /**
105
  /**
106
   * \brief Neighbor Discovery node constants : max multicast solicitations.
106
   * \brief Neighbor Discovery node constants : max multicast solicitations.
107
   */
107
   */
108
  static const uint8_t MAX_MULTICAST_SOLICIT;
108
  uint8_t MAX_MULTICAST_SOLICIT;
109
109
110
  /**
110
  /**
111
   * \brief Neighbor Discovery node constants : max unicast solicitations.
111
   * \brief Neighbor Discovery node constants : max unicast solicitations.
112
   */
112
   */
113
  static const uint8_t MAX_UNICAST_SOLICIT;
113
  uint8_t MAX_UNICAST_SOLICIT;
114
114
115
  /**
115
  /**
116
   * \brief Neighbor Discovery node constants : max anycast delay.
116
   * \brief Neighbor Discovery node constants : max anycast delay.
117
   */
117
   */
118
  static const uint8_t MAX_ANYCAST_DELAY_TIME;
118
  uint8_t MAX_ANYCAST_DELAY_TIME;
119
119
120
  /**
120
  /**
121
   * \brief Neighbor Discovery node constants : max NA transmission.
121
   * \brief Neighbor Discovery node constants : max NA transmission.
122
   */
122
   */
123
  static const uint8_t MAX_NEIGHBOR_ADVERTISEMENT;
123
  uint8_t MAX_NEIGHBOR_ADVERTISEMENT;
124
124
125
  /**
125
  /**
126
   * \brief Neighbor Discovery node constants : reachable time.
126
   * \brief Neighbor Discovery node constants : reachable time.
127
   */
127
   */
128
  static const uint32_t REACHABLE_TIME;
128
  uint32_t REACHABLE_TIME;
129
129
130
  /**
130
  /**
131
   * \brief Neighbor Discovery node constants : retransmission timer.
131
   * \brief Neighbor Discovery node constants : retransmission timer.
132
   */
132
   */
133
  static const uint32_t RETRANS_TIMER;
133
  uint32_t RETRANS_TIMER;
134
134
135
  /**
135
  /**
136
   * \brief Neighbor Discovery node constants : delay for the first probe.
136
   * \brief Neighbor Discovery node constants : delay for the first probe.
137
   */
137
   */
138
  static const uint8_t DELAY_FIRST_PROBE_TIME;
138
  uint8_t DELAY_FIRST_PROBE_TIME;
139
139
  
140
  /**
140
  /**
141
   * \brief Neighbor Discovery node constants : min random factor.
141
   * \brief Neighbor Discovery node constants : min random factor.
142
   */
142
   */
143
  static const double MIN_RANDOM_FACTOR;
143
  double MIN_RANDOM_FACTOR;
144
144
145
  /**
145
  /**
146
   * \brief Neighbor Discovery node constants : max random factor.
146
   * \brief Neighbor Discovery node constants : max random factor.
147
   */
147
   */
148
  static const double MAX_RANDOM_FACTOR;
148
  double MAX_RANDOM_FACTOR;
149
149
150
  /**
150
  /**
151
   * \brief Get ICMPv6 protocol number.
151
   * \brief Get ICMPv6 protocol number.
(-)a/src/internet/model/ndisc-cache.cc (-4 / +12 lines)
 Lines 417-422   Time NdiscCache::Entry::GetLastReachabilityConfirmation () const Link Here 
417
void NdiscCache::Entry::StartReachableTimer ()
417
void NdiscCache::Entry::StartReachableTimer ()
418
{
418
{
419
  NS_LOG_FUNCTION_NOARGS ();
419
  NS_LOG_FUNCTION_NOARGS ();
420
  Ptr<Ipv6L3Protocol> ipv6 = m_ndCache->GetDevice ()->GetNode ()->GetObject<Ipv6L3Protocol> ();
421
  Ptr<Icmpv6L4Protocol> icmpv6 = ipv6->GetIcmpv6 ();
420
  if (m_nudTimer.IsRunning ())
422
  if (m_nudTimer.IsRunning ())
421
    {
423
    {
422
      m_nudTimer.Cancel ();
424
      m_nudTimer.Cancel ();
 Lines 424-430   void NdiscCache::Entry::StartReachableTimer () Link Here 
424
426
425
  m_lastReachabilityConfirmation = Simulator::Now ();
427
  m_lastReachabilityConfirmation = Simulator::Now ();
426
  m_nudTimer.SetFunction (&NdiscCache::Entry::FunctionReachableTimeout, this);
428
  m_nudTimer.SetFunction (&NdiscCache::Entry::FunctionReachableTimeout, this);
427
  m_nudTimer.SetDelay (MilliSeconds (Icmpv6L4Protocol::REACHABLE_TIME));
429
  m_nudTimer.SetDelay (MilliSeconds (icmpv6->REACHABLE_TIME));
428
  m_nudTimer.Schedule ();
430
  m_nudTimer.Schedule ();
429
}
431
}
430
432
 Lines 446-481   void NdiscCache::Entry::UpdateReachableTimer () Link Here 
446
void NdiscCache::Entry::StartProbeTimer ()
448
void NdiscCache::Entry::StartProbeTimer ()
447
{
449
{
448
  NS_LOG_FUNCTION_NOARGS ();
450
  NS_LOG_FUNCTION_NOARGS ();
451
  Ptr<Ipv6L3Protocol> ipv6 = m_ndCache->GetDevice ()->GetNode ()->GetObject<Ipv6L3Protocol> ();
452
  Ptr<Icmpv6L4Protocol> icmpv6 = ipv6->GetIcmpv6 ();
449
  if (m_nudTimer.IsRunning ())
453
  if (m_nudTimer.IsRunning ())
450
    {
454
    {
451
      m_nudTimer.Cancel ();
455
      m_nudTimer.Cancel ();
452
    }
456
    }
453
  m_nudTimer.SetFunction (&NdiscCache::Entry::FunctionProbeTimeout, this);
457
  m_nudTimer.SetFunction (&NdiscCache::Entry::FunctionProbeTimeout, this);
454
  m_nudTimer.SetDelay (MilliSeconds (Icmpv6L4Protocol::RETRANS_TIMER));
458
  m_nudTimer.SetDelay (MilliSeconds (icmpv6->RETRANS_TIMER));
455
  m_nudTimer.Schedule ();
459
  m_nudTimer.Schedule ();
456
}
460
}
457
461
458
void NdiscCache::Entry::StartDelayTimer ()
462
void NdiscCache::Entry::StartDelayTimer ()
459
{
463
{
460
  NS_LOG_FUNCTION_NOARGS ();
464
  NS_LOG_FUNCTION_NOARGS ();
465
  Ptr<Ipv6L3Protocol> ipv6 = m_ndCache->GetDevice ()->GetNode ()->GetObject<Ipv6L3Protocol> ();
466
  Ptr<Icmpv6L4Protocol> icmpv6 = ipv6->GetIcmpv6 ();
461
  if (m_nudTimer.IsRunning ())
467
  if (m_nudTimer.IsRunning ())
462
    {
468
    {
463
      m_nudTimer.Cancel ();
469
      m_nudTimer.Cancel ();
464
    }
470
    }
465
  m_nudTimer.SetFunction (&NdiscCache::Entry::FunctionDelayTimeout, this);
471
  m_nudTimer.SetFunction (&NdiscCache::Entry::FunctionDelayTimeout, this);
466
  m_nudTimer.SetDelay (Seconds (Icmpv6L4Protocol::DELAY_FIRST_PROBE_TIME));
472
  m_nudTimer.SetDelay (Seconds (icmpv6->DELAY_FIRST_PROBE_TIME));
467
  m_nudTimer.Schedule ();
473
  m_nudTimer.Schedule ();
468
}
474
}
469
475
470
void NdiscCache::Entry::StartRetransmitTimer ()
476
void NdiscCache::Entry::StartRetransmitTimer ()
471
{
477
{
472
  NS_LOG_FUNCTION_NOARGS ();
478
  NS_LOG_FUNCTION_NOARGS ();
479
  Ptr<Ipv6L3Protocol> ipv6 = m_ndCache->GetDevice ()->GetNode ()->GetObject<Ipv6L3Protocol> ();
480
  Ptr<Icmpv6L4Protocol> icmpv6 = ipv6->GetIcmpv6 ();
473
  if (m_nudTimer.IsRunning ())
481
  if (m_nudTimer.IsRunning ())
474
    {
482
    {
475
      m_nudTimer.Cancel ();
483
      m_nudTimer.Cancel ();
476
    }
484
    }
477
  m_nudTimer.SetFunction (&NdiscCache::Entry::FunctionRetransmitTimeout, this);
485
  m_nudTimer.SetFunction (&NdiscCache::Entry::FunctionRetransmitTimeout, this);
478
  m_nudTimer.SetDelay (MilliSeconds (Icmpv6L4Protocol::RETRANS_TIMER));
486
  m_nudTimer.SetDelay (MilliSeconds (icmpv6->RETRANS_TIMER));
479
  m_nudTimer.Schedule ();
487
  m_nudTimer.Schedule ();
480
}
488
}
481
489

Return to bug 2482