|
mathieu@1899
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
|
mathieu@1899
|
2 |
/*
|
|
mathieu@1899
|
3 |
* Copyright (c) 2005,2006 INRIA
|
|
mathieu@1899
|
4 |
*
|
|
mathieu@1899
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
mathieu@1899
|
6 |
* it under the terms of the GNU General Public License version 2 as
|
|
mathieu@1899
|
7 |
* published by the Free Software Foundation;
|
|
mathieu@1899
|
8 |
*
|
|
mathieu@1899
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
mathieu@1899
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
mathieu@1899
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
mathieu@1899
|
12 |
* GNU General Public License for more details.
|
|
mathieu@1899
|
13 |
*
|
|
mathieu@1899
|
14 |
* You should have received a copy of the GNU General Public License
|
|
mathieu@1899
|
15 |
* along with this program; if not, write to the Free Software
|
|
mathieu@1899
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
mathieu@1899
|
17 |
*
|
|
mathieu@1899
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
|
mathieu@1899
|
19 |
*/
|
|
mathieu@1899
|
20 |
|
|
mathieu@1899
|
21 |
#ifndef WIFI_NET_DEVICE_H
|
|
mathieu@1899
|
22 |
#define WIFI_NET_DEVICE_H
|
|
mathieu@1899
|
23 |
|
|
mathieu@1899
|
24 |
#include "ns3/net-device.h"
|
|
mathieu@1899
|
25 |
#include "ns3/packet.h"
|
|
mathieu@2524
|
26 |
#include "ns3/traced-callback.h"
|
|
mathieu@1899
|
27 |
#include "ns3/mac48-address.h"
|
|
mathieu@2524
|
28 |
#include "wifi-remote-station-manager.h"
|
|
mathieu@1899
|
29 |
#include <string>
|
|
mathieu@1899
|
30 |
|
|
mathieu@1899
|
31 |
namespace ns3 {
|
|
mathieu@1899
|
32 |
|
|
mathieu@1899
|
33 |
class WifiChannel;
|
|
mathieu@1954
|
34 |
class WifiPhy;
|
|
mathieu@2524
|
35 |
class WifiMac;
|
|
mathieu@2053
|
36 |
|
|
mathieu@2053
|
37 |
/**
|
|
mathieu@2687
|
38 |
* \brief Hold together all Wifi-related objects.
|
|
mathieu@2029
|
39 |
*
|
|
mathieu@2687
|
40 |
* This class holds together ns3::WifiChannel, ns3::WifiPhy,
|
|
mathieu@2687
|
41 |
* ns3::WifiMac, and, ns3::WifiRemoteStationManager.
|
|
mathieu@2029
|
42 |
*/
|
|
mathieu@2524
|
43 |
class WifiNetDevice : public NetDevice
|
|
mathieu@2524
|
44 |
{
|
|
mathieu@1899
|
45 |
public:
|
|
mathieu@2524
|
46 |
static TypeId GetTypeId (void);
|
|
mathieu@2524
|
47 |
|
|
mathieu@2524
|
48 |
WifiNetDevice ();
|
|
mathieu@1899
|
49 |
virtual ~WifiNetDevice ();
|
|
mathieu@1899
|
50 |
|
|
mathieu@2687
|
51 |
/**
|
|
mathieu@2687
|
52 |
* \param mac the mac layer to use.
|
|
mathieu@2687
|
53 |
*/
|
|
mathieu@2601
|
54 |
void SetMac (Ptr<WifiMac> mac);
|
|
mathieu@2687
|
55 |
/**
|
|
mathieu@2687
|
56 |
* \param phy the phy layer to use.
|
|
mathieu@2687
|
57 |
*/
|
|
mathieu@2601
|
58 |
void SetPhy (Ptr<WifiPhy> phy);
|
|
mathieu@2687
|
59 |
/**
|
|
mathieu@2687
|
60 |
* \param manager the manager to use.
|
|
mathieu@2687
|
61 |
*/
|
|
mathieu@2601
|
62 |
void SetRemoteStationManager (Ptr<WifiRemoteStationManager> manager);
|
|
mathieu@2687
|
63 |
/**
|
|
mathieu@2687
|
64 |
* \param channel the channel to connect to.
|
|
mathieu@2687
|
65 |
*/
|
|
mathieu@2601
|
66 |
void SetChannel (Ptr<WifiChannel> channel);
|
|
mathieu@2687
|
67 |
/**
|
|
mathieu@2687
|
68 |
* \returns the mac we are currently using.
|
|
mathieu@2687
|
69 |
*/
|
|
mathieu@2524
|
70 |
Ptr<WifiMac> GetMac (void) const;
|
|
mathieu@2687
|
71 |
/**
|
|
mathieu@2687
|
72 |
* \returns the phy we are currently using.
|
|
mathieu@2687
|
73 |
*/
|
|
mathieu@2524
|
74 |
Ptr<WifiPhy> GetPhy (void) const;
|
|
mathieu@2687
|
75 |
/**
|
|
mathieu@2687
|
76 |
* \returns the remote station manager we are currently using.
|
|
mathieu@2687
|
77 |
*/
|
|
mathieu@2524
|
78 |
Ptr<WifiRemoteStationManager> GetRemoteStationManager (void) const;
|
|
mathieu@1899
|
79 |
|
|
mathieu@1899
|
80 |
|
|
mathieu@2470
|
81 |
// inherited from NetDevice base class.
|
|
mathieu@2470
|
82 |
virtual void SetName(const std::string name);
|
|
mathieu@2470
|
83 |
virtual std::string GetName(void) const;
|
|
mathieu@2470
|
84 |
virtual void SetIfIndex(const uint32_t index);
|
|
mathieu@2470
|
85 |
virtual uint32_t GetIfIndex(void) const;
|
|
mathieu@2470
|
86 |
virtual Ptr<Channel> GetChannel (void) const;
|
|
mathieu@2470
|
87 |
virtual Address GetAddress (void) const;
|
|
mathieu@2470
|
88 |
virtual bool SetMtu (const uint16_t mtu);
|
|
mathieu@2470
|
89 |
virtual uint16_t GetMtu (void) const;
|
|
mathieu@2470
|
90 |
virtual bool IsLinkUp (void) const;
|
|
mathieu@2470
|
91 |
virtual void SetLinkChangeCallback (Callback<void> callback);
|
|
mathieu@2470
|
92 |
virtual bool IsBroadcast (void) const;
|
|
mathieu@2470
|
93 |
virtual Address GetBroadcast (void) const;
|
|
mathieu@2470
|
94 |
virtual bool IsMulticast (void) const;
|
|
craigdo@3841
|
95 |
virtual Address GetMulticast (Ipv4Address multicastGroup) const;
|
|
mathieu@2470
|
96 |
virtual bool IsPointToPoint (void) const;
|
|
mathieu@2470
|
97 |
virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
|
|
mathieu@2470
|
98 |
virtual Ptr<Node> GetNode (void) const;
|
|
mathieu@2600
|
99 |
virtual void SetNode (Ptr<Node> node);
|
|
mathieu@2470
|
100 |
virtual bool NeedsArp (void) const;
|
|
mathieu@2470
|
101 |
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
|
|
mathieu@2470
|
102 |
|
|
vincent@3852
|
103 |
virtual Address GetMulticast (Ipv6Address addr) const;
|
|
vincent@3852
|
104 |
|
|
gjc@3480
|
105 |
virtual bool SendFrom(Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
|
|
gjc@3480
|
106 |
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
|
|
mathieu@3584
|
107 |
virtual bool SupportsSendFrom (void) const;
|
|
gjc@3480
|
108 |
|
|
mathieu@1964
|
109 |
private:
|
|
mathieu@2530
|
110 |
virtual void DoDispose (void);
|
|
mathieu@3604
|
111 |
void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
|
|
mathieu@2524
|
112 |
void LinkUp (void);
|
|
mathieu@2524
|
113 |
void LinkDown (void);
|
|
mathieu@2601
|
114 |
void Setup (void);
|
|
mathieu@2620
|
115 |
Ptr<WifiChannel> DoGetChannel (void) const;
|
|
mathieu@2524
|
116 |
Ptr<Node> m_node;
|
|
mathieu@2054
|
117 |
Ptr<WifiPhy> m_phy;
|
|
mathieu@2601
|
118 |
Ptr<WifiChannel> m_channel;
|
|
mathieu@2524
|
119 |
Ptr<WifiMac> m_mac;
|
|
mathieu@2524
|
120 |
Ptr<WifiRemoteStationManager> m_stationManager;
|
|
mathieu@3604
|
121 |
NetDevice::ReceiveCallback m_forwardUp;
|
|
mathieu@3604
|
122 |
NetDevice::PromiscReceiveCallback m_promiscRx;
|
|
mathieu@2524
|
123 |
TracedCallback<Ptr<const Packet>, Mac48Address> m_rxLogger;
|
|
mathieu@2524
|
124 |
TracedCallback<Ptr<const Packet>, Mac48Address> m_txLogger;
|
|
mathieu@2470
|
125 |
uint32_t m_ifIndex;
|
|
mathieu@2470
|
126 |
std::string m_name;
|
|
mathieu@2470
|
127 |
bool m_linkUp;
|
|
mathieu@2524
|
128 |
Callback<void> m_linkChange;
|
|
mathieu@2524
|
129 |
mutable uint16_t m_mtu;
|
|
mathieu@1899
|
130 |
};
|
|
mathieu@1899
|
131 |
|
|
mathieu@1899
|
132 |
} // namespace ns3
|
|
mathieu@1899
|
133 |
|
|
mathieu@1899
|
134 |
#endif /* WIFI_NET_DEVICE_H */
|