author | Nicola Baldo <nbaldo@cttc.es> |
Wed, 26 Oct 2011 13:45:00 +0200 | |
changeset 8255 | bd60df311c7b |
parent 8253 | 6faee3d1d1d0 |
child 8390 | fb2bef5bb0e2 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Mileti? <rivanvx@gmail.com>
parents:
7238
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6705 | 2 |
/* |
3 |
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
|
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 |
* |
|
7886 | 18 |
* Author: Giuseppe Piro <g.piro@poliba.it> |
19 |
* Nicola Baldo <nbaldo@cttc.es> |
|
6705 | 20 |
*/ |
21 |
||
22 |
#ifndef LTE_NET_DEVICE_H |
|
23 |
#define LTE_NET_DEVICE_H |
|
24 |
||
7886 | 25 |
#include <ns3/net-device.h> |
26 |
#include <ns3/event-id.h> |
|
27 |
#include <ns3/mac48-address.h> |
|
28 |
#include <ns3/traced-callback.h> |
|
29 |
#include <ns3/nstime.h> |
|
30 |
#include <ns3/lte-phy.h> |
|
31 |
#include <ns3/ideal-control-messages.h> |
|
6705 | 32 |
|
33 |
namespace ns3 { |
|
34 |
||
35 |
class Node; |
|
36 |
class Packet; |
|
37 |
class PacketBurst; |
|
7886 | 38 |
|
6705 | 39 |
|
40 |
/** |
|
7238
85a7e87bb4cc
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
6969
diff
changeset
|
41 |
* \defgroup lte LTE Models |
85a7e87bb4cc
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
6969
diff
changeset
|
42 |
* |
85a7e87bb4cc
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
6969
diff
changeset
|
43 |
*/ |
85a7e87bb4cc
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
6969
diff
changeset
|
44 |
|
85a7e87bb4cc
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
6969
diff
changeset
|
45 |
/** |
85a7e87bb4cc
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
6969
diff
changeset
|
46 |
* \ingroup lte |
85a7e87bb4cc
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
6969
diff
changeset
|
47 |
* |
6705 | 48 |
* LteNetDevice provides basic implementation for all LTE network devices |
49 |
*/ |
|
50 |
class LteNetDevice : public NetDevice |
|
51 |
{ |
|
52 |
public: |
|
53 |
static TypeId GetTypeId (void); |
|
54 |
||
55 |
LteNetDevice (void); |
|
56 |
virtual ~LteNetDevice (void); |
|
57 |
||
58 |
virtual void DoDispose (void); |
|
59 |
||
60 |
// inherited from NetDevice |
|
61 |
virtual void SetIfIndex (const uint32_t index); |
|
62 |
virtual uint32_t GetIfIndex (void) const; |
|
63 |
virtual Ptr<Channel> GetChannel (void) const; |
|
64 |
virtual bool SetMtu (const uint16_t mtu); |
|
65 |
virtual uint16_t GetMtu (void) const; |
|
66 |
virtual void SetAddress (Address address); |
|
67 |
virtual Address GetAddress (void) const; |
|
68 |
virtual bool IsLinkUp (void) const; |
|
69 |
virtual void AddLinkChangeCallback (Callback<void> callback); |
|
70 |
virtual bool IsBroadcast (void) const; |
|
71 |
virtual Address GetBroadcast (void) const; |
|
72 |
virtual bool IsMulticast (void) const; |
|
73 |
virtual bool IsPointToPoint (void) const; |
|
74 |
virtual bool IsBridge (void) const; |
|
75 |
virtual Ptr<Node> GetNode (void) const; |
|
76 |
virtual void SetNode (Ptr<Node> node); |
|
77 |
virtual bool NeedsArp (void) const; |
|
78 |
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); |
|
79 |
virtual Address GetMulticast (Ipv4Address addr) const; |
|
80 |
virtual Address GetMulticast (Ipv6Address addr) const; |
|
7886 | 81 |
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb); |
6705 | 82 |
|
83 |
virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber); |
|
84 |
virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber); |
|
85 |
virtual bool SupportsSendFrom (void) const; |
|
86 |
||
87 |
/** |
|
88 |
* \brief Receive the packet from the phy layer |
|
89 |
* \param p the received packet |
|
90 |
*/ |
|
91 |
void Receive (Ptr<Packet> p); |
|
92 |
/** |
|
93 |
* \brief Forward packet to the uppar layer. |
|
94 |
* If is called by DoReceive method |
|
95 |
* \param packet packet sent from Network Device to the upper layer |
|
96 |
* \param source source mac address |
|
97 |
* \param dest mac address of the destination |
|
98 |
*/ |
|
99 |
void ForwardUp (Ptr<Packet> packet, const Mac48Address &source, const Mac48Address &dest); |
|
100 |
/** |
|
101 |
* \brief Forward packet to the uppar layer. |
|
102 |
* If is called by DoReceive method |
|
103 |
* \param packet packet sent from Network Device to the upper layer |
|
104 |
*/ |
|
105 |
void ForwardUp (Ptr<Packet> packet); |
|
106 |
||
107 |
/** |
|
7886 | 108 |
* \brief Set packets to send |
109 |
* \param p the burst of packets to send |
|
110 |
*/ |
|
6705 | 111 |
void SetPacketToSend (Ptr<PacketBurst> p); |
112 |
/** |
|
7886 | 113 |
* \brief Get packets to send |
114 |
* \return the pointer to the burst of packets to send |
|
6705 | 115 |
*/ |
116 |
Ptr<PacketBurst> GetPacketToSend (void); |
|
117 |
||
118 |
||
119 |
private: |
|
120 |
LteNetDevice (const LteNetDevice &); |
|
121 |
LteNetDevice & operator= (const LteNetDevice &); |
|
122 |
||
123 |
static const uint16_t MAX_MSDU_SIZE = 1500; |
|
124 |
||
125 |
virtual bool DoSend (Ptr<Packet> packet, |
|
126 |
const Mac48Address& source, |
|
127 |
const Mac48Address& dest, |
|
128 |
uint16_t protocolNumber) = 0; |
|
129 |
virtual void DoReceive (Ptr<Packet> p) = 0; |
|
130 |
||
131 |
||
132 |
Ptr<Node> m_node; |
|
133 |
||
134 |
TracedCallback<Ptr<const Packet> > m_macTxTrace; |
|
135 |
TracedCallback<Ptr<const Packet> > m_macTxDropTrace; |
|
136 |
TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace; |
|
137 |
TracedCallback<Ptr<const Packet> > m_macRxTrace; |
|
138 |
||
139 |
NetDevice::ReceiveCallback m_rxCallback; |
|
140 |
NetDevice::PromiscReceiveCallback m_promiscRxCallback; |
|
8012
1e2d34cb9f28
removed useless LteNetDevice:m_phyMacTxStartCallback
Nicola Baldo <nbaldo@cttc.es>
parents:
8010
diff
changeset
|
141 |
|
6705 | 142 |
TracedCallback<> m_linkChangeCallbacks; |
143 |
||
144 |
uint32_t m_ifIndex; |
|
145 |
bool m_linkUp; |
|
146 |
mutable uint16_t m_mtu; |
|
147 |
||
148 |
Mac48Address m_address; |
|
149 |
||
150 |
Ptr<PacketBurst> m_packetToSend; |
|
151 |
}; |
|
152 |
||
153 |
||
154 |
} // namespace ns3 |
|
155 |
||
156 |
#endif /* LTE_NET_DEVICE_H */ |