src/devices/wifi/adhoc-wifi-mac.h
changeset 2524 db72c0e7743e
parent 2350 0b54480c4fd1
child 2530 05f9cec44621
equal deleted inserted replaced
2523:58182a1561cc 2524:db72c0e7743e
       
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2005 INRIA
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License version 2 as 
       
     7  * published by the Free Software Foundation;
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    17  *
       
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
       
    19  */
       
    20 #ifndef ADHOC_WIFI_MAC_H
       
    21 #define ADHOC_WIFI_MAC_H
       
    22 
       
    23 #include "ns3/mac48-address.h"
       
    24 #include "ns3/callback.h"
       
    25 #include "ns3/packet.h"
       
    26 #include "wifi-mac.h"
       
    27 
       
    28 namespace ns3 {
       
    29 
       
    30 class DcaTxop;
       
    31 class Packet;
       
    32 class WifiMacHeader;
       
    33 class WifiPhy;
       
    34 class DcfManager;
       
    35 class MacLow;
       
    36 class MacRxMiddle;
       
    37 
       
    38 /**
       
    39  * \brief the Adhoc state machine
       
    40  *
       
    41  * For now, this class is really empty but it should contain
       
    42  * the code for the distributed generation of beacons in an adhoc 
       
    43  * network.
       
    44  */
       
    45 class AdhocWifiMac : public WifiMac 
       
    46 {
       
    47 public:
       
    48   typedef Callback<void, Ptr<Packet>, const Mac48Address &> ForwardCallback;
       
    49 
       
    50   static TypeId GetTypeId (void);
       
    51 
       
    52   AdhocWifiMac ();
       
    53   ~AdhocWifiMac ();
       
    54 
       
    55   virtual void SetSlot (Time slotTime);
       
    56   virtual void SetSifs (Time sifs);
       
    57   virtual void SetEifsNoDifs (Time eifsNoDifs);
       
    58   virtual void SetWifiPhy (Ptr<WifiPhy> phy);
       
    59   virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
       
    60   virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
       
    61   virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, const Mac48Address &> upCallback);
       
    62   virtual void SetLinkUpCallback (Callback<void> linkUp);
       
    63   virtual void SetLinkDownCallback (Callback<void> linkDown);
       
    64   virtual Mac48Address GetAddress (void) const;
       
    65   virtual Ssid GetSsid (void) const;
       
    66   virtual Mac48Address GetBssid (void) const;
       
    67   virtual void SetAddress (Mac48Address address);
       
    68   virtual void SetSsid (Ssid ssid);
       
    69 
       
    70 
       
    71 private:
       
    72   virtual void DoDispose (void);
       
    73   /* invoked by the MacLows. */
       
    74   void ForwardUp (Ptr<Packet> packet, WifiMacHeader const*hdr);
       
    75 
       
    76   Ptr<DcaTxop> m_dca;
       
    77   Callback<void,Ptr<Packet>,const Mac48Address &> m_upCallback;
       
    78   Ptr<WifiRemoteStationManager> m_stationManager;
       
    79   Ptr<WifiPhy> m_phy;
       
    80   DcfManager *m_dcfManager;
       
    81   MacRxMiddle *m_rxMiddle;
       
    82   MacLow *m_low;
       
    83   Mac48Address m_address;
       
    84   Ssid m_ssid;
       
    85 };
       
    86 
       
    87 } // namespace ns3
       
    88 
       
    89 #endif /* ADHOC_WIFI_MAC_H */