1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 IITP RAS
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: Pavel Boyko <boyko@iitp.ru>
19  */
20 
21 #ifndef MESH_WIFI_INTERFACE_MAC_PLUGIN_H
22 #define MESH_WIFI_INTERFACE_MAC_PLUGIN_H
23 
24 #include "ns3/packet.h"
25 #include "ns3/mac48-address.h"
26 #include "ns3/mesh-wifi-beacon.h"
27 #include "ns3/simple-ref-count.h"
28 
29 namespace ns3 {
30 
31 class MeshWifiInterfaceMac;
32 
33 /**
34  * \ingroup mesh
35  *
36  * \brief Common interface for mesh point interface MAC plugins
37  *
38  * \todo plugins description
39  */
40 class MeshWifiInterfaceMacPlugin : public SimpleRefCount<MeshWifiInterfaceMacPlugin>
41 {
42 public:
43   /// This is for subclasses
~MeshWifiInterfaceMacPlugin()44   virtual ~MeshWifiInterfaceMacPlugin (){};
45   /**
46    * Each plugin must be installed on an interface to work
47    *
48    * \param parent the parent object
49    */
50   virtual void SetParent (Ptr<MeshWifiInterfaceMac> parent) = 0;
51   /**
52    * \brief Process received frame
53    * \param packet
54    * \param header
55    *
56    * \return false if (and only if) frame should be dropped
57    * \todo define when MAC call this
58    */
59   virtual bool Receive (Ptr<Packet> packet, const WifiMacHeader & header) = 0;
60   /**
61    * \brief Update frame before it will be forwarded down
62    * \param packet
63    * \param header
64    * \param from
65    * \param to
66    * \return false if (and only if) frame should be dropped
67    * \todo define when MAC call this, preconditions & postconditions
68    */
69   virtual bool UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) = 0;
70   /**
71    * \brief Update beacon before it will be formed and sent
72    * \param beacon
73    *
74    * \todo define when MAC call this
75    */
76   virtual void UpdateBeacon (MeshWifiBeacon & beacon) const = 0;
77   /**
78    * Assign a fixed random variable stream number to the random variables
79    * used by this model.  Return the number of streams (possibly zero) that
80    * have been assigned.
81    *
82    * \param stream first stream index to use
83    * \return the number of stream indices assigned by this model
84    */
85   virtual int64_t AssignStreams (int64_t stream) = 0;
86 
87 };
88 
89 } // namespace ns3
90 
91 #endif /* MESH_WIFI_INTERFACE_MAC_PLUGIN_H */
92