src/devices/mesh/mesh-wifi-beacon.h
author Kirill Andreev <andreev@iitp.ru>
Tue, 25 Aug 2009 14:37:10 +0400
changeset 5161 1c685e8be8d1
parent 5140 64084ae6cff1
child 5423 79ff6ad1adbb
permissions -rw-r--r--
Restructured files, removed unneeded includes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
     2
/*
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     3
 * Copyright (c) 2009 IITP RAS
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
     4
 *
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     8
 *
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    13
 *
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    17
 *
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    18
 * Author: Pavel Boyko <boyko@iitp.ru>
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    19
 */
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    20
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    21
#ifndef MESHWIFIBEACON_H_
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    22
#define MESHWIFIBEACON_H_
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    23
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    24
#include "ns3/object.h"
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    25
#include "ns3/packet.h"
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    26
#include "ns3/mgt-headers.h"        // from wifi module
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4842
diff changeset
    27
#include "ns3/wifi-mac-header.h"
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    28
#include "ns3/wifi-information-element-vector.h"
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    29
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    30
#include <vector>
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    31
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    32
namespace ns3 {
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    33
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    34
/**
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    35
 * \brief Beacon is beacon header + list of arbitrary information elements
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    36
 *
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    37
 * It is supposed that distinct mesh protocols can use beacons to transport
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    38
 * their own information elements.
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    39
 */
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    40
class MeshWifiBeacon
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    41
{
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    42
public:
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    43
  /**
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    44
   * C-tor
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    45
   *
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    46
   * \param ssid is SSID for beacon header
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    47
   * \param rates is a set of supported rates
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    48
   * \param us beacon interval in microseconds
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    49
   */
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4843
diff changeset
    50
  MeshWifiBeacon (Ssid ssid, SupportedRates rates, uint64_t us);
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    51
  /// Read standard Wifi beacon header
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4842
diff changeset
    52
  MgtBeaconHeader BeaconHeader () const { return m_header; }
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    53
  /// Add information element
4842
605a2680b56b Use reference counting for WifiInformationElement
Pavel Boyko <boyko@iitp.ru>
parents: 4822
diff changeset
    54
  void AddInformationElement (Ptr<WifiInformationElement> ie);
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    55
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    56
  /**
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    57
   * Create wifi header for beacon frame.
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    58
   *
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    59
   * \param address is sender address
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 4985
diff changeset
    60
   * \param mpAddress is mesh point address
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 4985
diff changeset
    61
   */
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4852
diff changeset
    62
  WifiMacHeader CreateHeader (Mac48Address address, Mac48Address mpAddress);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4843
diff changeset
    63
  /// Create frame = { beacon header + all information elements sorted by ElementId () }
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4842
diff changeset
    64
  Ptr<Packet> CreatePacket ();
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    65
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    66
private:
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    67
  /// Beacon header
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    68
  MgtBeaconHeader m_header;
5140
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    69
  /// List of information elements added
64084ae6cff1 Removed FindFirst from WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5063
diff changeset
    70
  WifiInformationElementVector m_elements;
4822
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    71
};
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    72
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    73
}
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    74
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    75
55868bb52909 MeshWifiBeacon class created
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    76
#endif /* MESHWIFIBEACON_H_ */