src/devices/mesh/dot11s/ie-dot11s-preq.cc
author Pavel Boyko <boyko@iitp.ru>
Mon, 04 May 2009 18:08:49 +0400
changeset 5004 29928e8d1a1c
parent 4965 e6e44c9415e7
child 5018 aecd3eedd65f
permissions -rw-r--r--
IE tests cleanup
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     2
/*
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     3
 * Copyright (c) 2008,2009 IITP RAS
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     4
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     8
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    13
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    17
 *
4811
080b8f23fa4a Added license information to some files.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    18
 * Author: Kirill Andreev <andreev@iitp.ru>
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    19
 */
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    20
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    21
4877
f08902c42733 Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents: 4876
diff changeset
    22
#include "ie-dot11s-preq.h"
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    23
#include "ns3/address-utils.h"
4841
702fa974e205 Fixed bugs with includes
Kirill Andreev <andreev@iitp.ru>
parents: 4838
diff changeset
    24
#include "ns3/node.h"
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    25
#include "ns3/assert.h"
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
    26
#include "ns3/test.h"
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
    27
#include "ns3/packet.h"
4813
e4e2c44d27cd All mesh related filed moved to devices/mesh. Let the refactoring begins!
Pavel Boyko <boyko@iitp.ru>
parents: 4812
diff changeset
    28
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    29
namespace ns3 {
4872
ea1bce018a44 Added namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4871
diff changeset
    30
namespace dot11s {
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    31
/*************************
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    32
 * DestinationAddressUnit
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    33
 ************************/
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    34
DestinationAddressUnit::DestinationAddressUnit ():
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    35
  m_do (false),
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    36
  m_rf (false),
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    37
  m_usn (false),
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    38
  m_destinationAddress (Mac48Address ()),
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    39
  m_destSeqNumber (0)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    40
{
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    41
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    42
void
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    43
DestinationAddressUnit::SetFlags (bool doFlag, bool rfFlag, bool usnFlag)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    44
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    45
  m_do = doFlag;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    46
  m_rf = rfFlag;
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    47
  m_usn = usnFlag;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    48
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    49
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    50
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    51
DestinationAddressUnit::SetDestSeqNumber (uint32_t dest_seq_number)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    52
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    53
  m_destSeqNumber = dest_seq_number;
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    54
  if(m_destSeqNumber != 0)
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    55
    m_usn = true;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    56
}
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    57
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    58
DestinationAddressUnit::SetDestinationAddress (Mac48Address dest_address)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    59
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    60
  m_destinationAddress = dest_address;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    61
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    62
bool
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    63
DestinationAddressUnit::IsDo ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    64
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    65
  return m_do;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    66
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    67
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    68
bool
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    69
DestinationAddressUnit::IsRf ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    70
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    71
  return m_rf;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    72
}
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    73
bool
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    74
DestinationAddressUnit::IsUsn ()
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    75
{
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    76
  return m_usn;
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
    77
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    78
uint32_t
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    79
DestinationAddressUnit::GetDestSeqNumber () const
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    80
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    81
  return m_destSeqNumber;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    82
}
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    83
Mac48Address
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    84
DestinationAddressUnit::GetDestinationAddress () const
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    85
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    86
  return m_destinationAddress;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    87
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    88
/********************************
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
    89
 * IePreq
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    90
 *******************************/
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
    91
IePreq::~IePreq ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    92
{
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    93
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    94
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    95
TypeId
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
    96
IePreq::GetTypeId ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    97
{
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
    98
  static TypeId tid = TypeId ("ns3::dot11s::IePreq")
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
    99
                      .SetParent<Object> ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   100
  return tid;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   101
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   102
TypeId
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   103
IePreq::GetInstanceTypeId () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   104
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   105
  return GetTypeId ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   106
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   107
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   108
IePreq::IePreq ():
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   109
    m_maxSize (32),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   110
    m_flags (0),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   111
    m_hopCount (0),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   112
    m_ttl (0),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   113
    m_preqId (0),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   114
    m_originatorAddress (Mac48Address::GetBroadcast()),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   115
    m_originatorSeqNumber (0),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   116
    m_lifetime (0),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   117
    m_metric (0),
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   118
    m_destCount (0)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   119
{
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   120
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   121
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   122
IePreq::SetUnicastPreq ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   123
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   124
  m_flags |= 1<<1;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   125
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   126
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   127
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   128
IePreq::SetNeedNotPrep ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   129
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   130
  m_flags |= 1<<2;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   131
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   132
//void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   133
//IePreq::SetFlags (uint8_t flags)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   134
//{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   135
// m_flags = flags;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   136
//}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   137
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   138
IePreq::SetHopcount (uint8_t hopcount)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   139
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   140
  m_hopCount = hopcount;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   141
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   142
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   143
IePreq::SetTTL (uint8_t ttl)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   144
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   145
  m_ttl = ttl;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   146
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   147
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   148
IePreq::SetPreqID (uint32_t preq_id)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   149
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   150
  m_preqId = preq_id;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   151
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   152
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   153
IePreq::SetMetric (uint32_t metric)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   154
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   155
  m_metric = metric;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   156
}
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   157
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   158
IePreq::SetOriginatorAddress (Mac48Address originator_address)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   159
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   160
  m_originatorAddress = originator_address;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   161
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   162
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   163
IePreq::SetOriginatorSeqNumber (uint32_t originator_seq_number)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   164
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   165
  m_originatorSeqNumber = originator_seq_number;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   166
}
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   167
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   168
IePreq::SetLifetime (uint32_t lifetime)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   169
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   170
  m_lifetime = lifetime;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   171
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   172
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   173
IePreq::SetDestCount (uint8_t dest_count)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   174
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   175
  m_destCount = dest_count;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   176
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   177
bool
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   178
IePreq::IsUnicastPreq () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   179
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   180
  return (m_flags & (1<<1));
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   181
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   182
bool
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   183
IePreq::IsNeedNotPrep () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   184
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   185
  return (m_flags & (1<<2));
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   186
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   187
uint8_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   188
IePreq::GetHopCount () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   189
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   190
  return m_hopCount;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   191
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   192
uint8_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   193
IePreq::GetTtl () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   194
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   195
  return m_ttl;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   196
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   197
uint32_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   198
IePreq::GetPreqID () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   199
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   200
  return m_preqId;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   201
}
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   202
uint32_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   203
IePreq::GetMetric () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   204
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   205
  return m_metric;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   206
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   207
Mac48Address
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   208
IePreq::GetOriginatorAddress () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   209
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   210
  return m_originatorAddress;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   211
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   212
uint32_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   213
IePreq::GetOriginatorSeqNumber () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   214
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   215
  return m_originatorSeqNumber;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   216
}
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   217
uint32_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   218
IePreq::GetLifetime () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   219
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   220
  return m_lifetime;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   221
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   222
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   223
uint8_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   224
IePreq::GetDestCount () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   225
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   226
  return m_destCount;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   227
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   228
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   229
IePreq::DecrementTtl ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   230
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   231
  m_ttl --;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   232
  m_hopCount ++;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   233
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   234
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   235
IePreq::IncrementMetric (uint32_t metric)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   236
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   237
  m_metric +=metric;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   238
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   239
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   240
IePreq::SerializeInformation (Buffer::Iterator i) const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   241
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   242
  i.WriteU8 (m_flags);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   243
  i.WriteU8 (m_hopCount);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   244
  i.WriteU8 (m_ttl);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   245
  i.WriteHtonU32 (m_preqId);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   246
  WriteTo (i, m_originatorAddress);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   247
  i.WriteHtonU32 (m_originatorSeqNumber);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   248
  i.WriteHtonU32 (m_lifetime);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   249
  i.WriteHtonU32 (m_metric);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   250
  i.WriteU8 (m_destCount);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   251
  int written = 0;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   252
  for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator j = m_destinations.begin (); j != m_destinations.end(); j++)
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   253
    {
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   254
      uint8_t flags = 0;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   255
      if ((*j)->IsDo ())
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   256
        flags += 128;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   257
      if ((*j)->IsRf ())
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   258
        flags += 64;
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   259
      if((*j)->IsUsn ())
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   260
        flags += 32;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   261
      i.WriteU8 (flags);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   262
      WriteTo (i, (*j)->GetDestinationAddress());
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   263
      i.WriteHtonU32 ((*j)->GetDestSeqNumber ());
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   264
      written++;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   265
      if (written > m_maxSize)
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   266
        break;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   267
    }
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   268
}
4838
ce31277d72ad Finished restructuring information elements
Kirill Andreev <andreev@iitp.ru>
parents: 4835
diff changeset
   269
uint8_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   270
IePreq::DeserializeInformation (Buffer::Iterator start, uint8_t length)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   271
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   272
  Buffer::Iterator i = start;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   273
  m_flags = i.ReadU8 ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   274
  m_hopCount = i.ReadU8 ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   275
  m_ttl = i.ReadU8 ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   276
  m_preqId = i.ReadNtohU32 ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   277
  ReadFrom (i, m_originatorAddress);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   278
  m_originatorSeqNumber = i.ReadNtohU32 ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   279
  m_lifetime = i.ReadNtohU32 ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   280
  m_metric = i.ReadNtohU32 ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   281
  m_destCount = i.ReadU8 ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   282
  for (int j = 0; j < m_destCount; j++ )
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   283
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   284
      Ptr<DestinationAddressUnit> new_element = Create<DestinationAddressUnit> ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   285
      bool doFlag = false;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   286
      bool rfFlag = false;
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   287
      bool usnFlag = false;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   288
      uint8_t flags = i.ReadU8 ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   289
      if (flags >= 128)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   290
        {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   291
          doFlag = true;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   292
          flags -=128;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   293
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   294
      if (flags >=64)
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   295
      {
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   296
        rfFlag = true;
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   297
        flags -= 64;
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   298
      }
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   299
      if (flags >= 32)
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   300
        usnFlag = true;
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   301
      new_element->SetFlags (doFlag, rfFlag, usnFlag);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   302
      Mac48Address addr;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   303
      ReadFrom (i,addr);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   304
      new_element->SetDestinationAddress (addr);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   305
      new_element->SetDestSeqNumber (i.ReadNtohU32());
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   306
      m_destinations.push_back (new_element);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   307
      NS_ASSERT (28+j*11 < length);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   308
    }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   309
  return i.GetDistanceFrom (start);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   310
}
4838
ce31277d72ad Finished restructuring information elements
Kirill Andreev <andreev@iitp.ru>
parents: 4835
diff changeset
   311
uint8_t
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   312
IePreq::GetInformationSize () const
4829
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   313
{
4838
ce31277d72ad Finished restructuring information elements
Kirill Andreev <andreev@iitp.ru>
parents: 4835
diff changeset
   314
  uint8_t retval =
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   315
     1 //Flags
4829
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   316
    +1 //Hopcount
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   317
    +1 //TTL
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   318
    +4 //PREQ ID
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   319
    +6 //Source address (originator)
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   320
    +4 //Originator seqno
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   321
    +4 //Lifetime
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   322
    +4 //metric
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   323
    +1; //destination count
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   324
  if (m_destCount > m_maxSize)
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   325
     retval += (m_maxSize*11);
4829
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   326
  else
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   327
     retval += (m_destCount*11);
4829
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   328
  return retval;
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   329
}
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   330
void
4896
e579c19f0dee Preq propagation ported:)
Kirill Andreev <andreev@iitp.ru>
parents: 4877
diff changeset
   331
IePreq::PrintInformation (std::ostream &os) const
4829
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   332
{
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   333
  os << " originator address  = " << m_originatorAddress << "\n";
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   334
  os << " TTL                 = "  <<  (uint16_t)m_ttl << "\n";
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   335
  os << " hop count           = "  <<  (uint16_t)m_hopCount << "\n";
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   336
  os << " metric              = " << m_metric << "\n";
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   337
  os << " seqno               = " << m_originatorSeqNumber << "\n";
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   338
  os << " lifetime            = " << m_lifetime << "\n";
4944
779b641cff5a Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents: 4904
diff changeset
   339
  os << " preq ID             = " <<m_preqId << "\n";
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   340
  os << " Destinations are:\n";
4896
e579c19f0dee Preq propagation ported:)
Kirill Andreev <andreev@iitp.ru>
parents: 4877
diff changeset
   341
  for (int j = 0; j < m_destCount; j++ )
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   342
    os << "    " << m_destinations[j]->GetDestinationAddress () << "\n";
4829
51b7bcb3fab3 Restructured PREQ and PREP
Kirill Andreev <andreev@iitp.ru>
parents: 4824
diff changeset
   343
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   344
std::vector<Ptr<DestinationAddressUnit> >
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   345
IePreq::GetDestinationList ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   346
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   347
  return m_destinations;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   348
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   349
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   350
IePreq::AddDestinationAddressElement (
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   351
  bool doFlag, bool rfFlag,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   352
  Mac48Address dest_address,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   353
  uint32_t dest_seq_number
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   354
)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   355
{
4945
e64c6bfd8536 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   356
  for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator i = m_destinations.begin (); i != m_destinations.end(); i++ )
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   357
    if ((*i)->GetDestinationAddress () == dest_address)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   358
      return;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   359
  Ptr<DestinationAddressUnit>new_element = Create<DestinationAddressUnit> ();
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   360
  new_element->SetFlags (doFlag, rfFlag, false);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   361
  new_element->SetDestinationAddress (dest_address);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   362
  new_element->SetDestSeqNumber (dest_seq_number);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   363
  m_destinations.push_back (new_element);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   364
  m_destCount++;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   365
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   366
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   367
IePreq::DelDestinationAddressElement (Mac48Address dest_address)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   368
{
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   369
  for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = m_destinations.begin (); i != m_destinations.end(); i++)
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   370
    if ((*i)->GetDestinationAddress () == dest_address)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   371
      {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   372
        m_destinations.erase (i);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   373
        m_destCount--;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   374
        break;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   375
      }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   376
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   377
void
4876
d78f1b978dac Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4872
diff changeset
   378
IePreq::ClearDestinationAddressElement ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   379
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   380
  int i;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   381
  for (std::vector<Ptr<DestinationAddressUnit> >::iterator j = m_destinations.begin (); j != m_destinations.end(); j++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   382
    (*j) = 0;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4811
diff changeset
   383
  for (i = 0; i < m_destCount; i ++)
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   384
    m_destinations.pop_back ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   385
  m_destinations.clear ();
4965
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   386
}
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   387
bool operator== (const DestinationAddressUnit & a, const DestinationAddressUnit & b)
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   388
{
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   389
  return (a.m_do == b.m_do 
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   390
      &&  a.m_rf == b.m_rf
4955
b83a62acbcf2 Added proper flags to HWMP PREQ, routing information is updated in accordance
Kirill Andreev <andreev@iitp.ru>
parents: 4945
diff changeset
   391
      &&  a.m_usn == b.m_usn
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   392
      &&  a.m_destinationAddress == b.m_destinationAddress
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   393
      &&  a.m_destSeqNumber == b.m_destSeqNumber
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   394
    );
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   395
}
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   396
bool operator== (const IePreq & a, const IePreq & b)
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   397
{
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   398
  bool ok = ( a.m_flags == b.m_flags 
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   399
    && a.m_hopCount == b.m_hopCount
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   400
    && a.m_ttl == b.m_ttl
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   401
    && a.m_preqId == b.m_preqId 
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   402
    && a.m_originatorAddress == b.m_originatorAddress
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   403
    && a.m_originatorSeqNumber == b.m_originatorSeqNumber
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   404
    && a.m_lifetime == b.m_lifetime
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   405
    && a.m_metric == b.m_metric
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   406
    && a.m_destCount == b.m_destCount
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   407
  );
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   408
  
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   409
  if (! ok) 
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   410
    return false;
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   411
  
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   412
  if (a.m_destinations.size() != b.m_destinations.size())
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   413
    return false;
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   414
  
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   415
  for (size_t i = 0; i < a.m_destinations.size(); ++i)
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   416
    if (!( *(PeekPointer (a.m_destinations[i])) == 
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   417
           *(PeekPointer (b.m_destinations[i]))
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   418
         )
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   419
       )
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   420
      return false;
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   421
  
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   422
  return true;
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   423
}
4965
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   424
bool
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   425
IePreq::MayAddAddress (Mac48Address originator)
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   426
{
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   427
  if (m_originatorAddress != originator)
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   428
    return false;
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   429
  if(m_destinations[0]->GetDestinationAddress () == Mac48Address::GetBroadcast ())
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   430
    return false;
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   431
  return true;
e6e44c9415e7 Preq queue bugfix. deleted m_myPreq
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
   432
}
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   433
#ifdef RUN_SELF_TESTS
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   434
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   435
/// Built-in self test for IePreq
5004
29928e8d1a1c IE tests cleanup
Pavel Boyko <boyko@iitp.ru>
parents: 4965
diff changeset
   436
struct IePreqBist : public IeTest 
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   437
{
5004
29928e8d1a1c IE tests cleanup
Pavel Boyko <boyko@iitp.ru>
parents: 4965
diff changeset
   438
  IePreqBist () : IeTest ("Mesh/802.11s/IE/PREQ") {}
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   439
  virtual bool RunTests(); 
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   440
};
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   441
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   442
/// Test instance
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   443
static IePreqBist g_IePreqBist;
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   444
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   445
bool IePreqBist::RunTests ()
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   446
{
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   447
  bool result(true);
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   448
  
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   449
  // create test information element
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   450
  IePreq a;
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   451
  a.SetHopcount (0);
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   452
  a.SetTTL (1);
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   453
  a.SetPreqID (2);
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   454
  a.SetOriginatorAddress ( Mac48Address("11:22:33:44:55:66") );
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   455
  a.SetOriginatorSeqNumber (3);
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   456
  a.SetLifetime (4);
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   457
  a.AddDestinationAddressElement (false, false, Mac48Address("11:11:11:11:11:11"), 5);
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   458
  a.AddDestinationAddressElement (false, false, Mac48Address("22:22:22:22:22:22"), 6);
5004
29928e8d1a1c IE tests cleanup
Pavel Boyko <boyko@iitp.ru>
parents: 4965
diff changeset
   459
29928e8d1a1c IE tests cleanup
Pavel Boyko <boyko@iitp.ru>
parents: 4965
diff changeset
   460
  result = result && TestRoundtripSerialization (a);
4904
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   461
  return result;
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   462
}
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   463
4e2ac4a8b5c6 PREQ unit test created
Pavel Boyko <boyko@iitp.ru>
parents: 4896
diff changeset
   464
#endif // RUN_SELF_TESTS
4872
ea1bce018a44 Added namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4871
diff changeset
   465
  
ea1bce018a44 Added namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4871
diff changeset
   466
} // namespace dot11s
ea1bce018a44 Added namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents: 4871
diff changeset
   467
} //namespace ns3
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   468