LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari | 3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ns3/node.h" | 25 #include "ns3/node.h" |
26 #include "ns3/packet.h" | 26 #include "ns3/packet.h" |
27 #include "lte-net-device.h" | 27 #include "lte-net-device.h" |
28 #include "ns3/packet-burst.h" | 28 #include "ns3/packet-burst.h" |
29 #include "ns3/uinteger.h" | 29 #include "ns3/uinteger.h" |
30 #include "ns3/trace-source-accessor.h" | 30 #include "ns3/trace-source-accessor.h" |
31 #include "ns3/pointer.h" | 31 #include "ns3/pointer.h" |
32 #include "ns3/enum.h" | 32 #include "ns3/enum.h" |
33 #include "lte-amc.h" | 33 #include "lte-amc.h" |
34 #include "ns3/ipv4-header.h" | 34 #include "ns3/ipv4-header.h" |
| 35 #include "ns3/ipv6-header.h" |
35 #include <ns3/lte-radio-bearer-tag.h> | 36 #include <ns3/lte-radio-bearer-tag.h> |
36 #include <ns3/ipv4-l3-protocol.h> | 37 #include <ns3/ipv4-l3-protocol.h> |
| 38 #include <ns3/ipv6-l3-protocol.h> |
37 #include <ns3/log.h> | 39 #include <ns3/log.h> |
38 | 40 |
39 namespace ns3 { | 41 namespace ns3 { |
40 | 42 |
41 NS_LOG_COMPONENT_DEFINE ("LteNetDevice"); | 43 NS_LOG_COMPONENT_DEFINE ("LteNetDevice"); |
42 | 44 |
43 NS_OBJECT_ENSURE_REGISTERED ( LteNetDevice); | 45 NS_OBJECT_ENSURE_REGISTERED ( LteNetDevice); |
44 | 46 |
45 //////////////////////////////// | 47 //////////////////////////////// |
46 // LteNetDevice | 48 // LteNetDevice |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 NS_LOG_FUNCTION (this); | 93 NS_LOG_FUNCTION (this); |
92 // we can't return a meaningful channel here, because LTE devices using FDD ha
ve actually two channels. | 94 // we can't return a meaningful channel here, because LTE devices using FDD ha
ve actually two channels. |
93 return 0; | 95 return 0; |
94 } | 96 } |
95 | 97 |
96 | 98 |
97 void | 99 void |
98 LteNetDevice::SetAddress (Address address) | 100 LteNetDevice::SetAddress (Address address) |
99 { | 101 { |
100 NS_LOG_FUNCTION (this << address); | 102 NS_LOG_FUNCTION (this << address); |
101 m_address = Mac48Address::ConvertFrom (address); | 103 m_address = Mac64Address::ConvertFrom (address); |
102 } | 104 } |
103 | 105 |
104 | 106 |
105 Address | 107 Address |
106 LteNetDevice::GetAddress (void) const | 108 LteNetDevice::GetAddress (void) const |
107 { | 109 { |
108 NS_LOG_FUNCTION (this); | 110 NS_LOG_FUNCTION (this); |
109 return m_address; | 111 return m_address; |
110 } | 112 } |
111 | 113 |
(...skipping 19 matching lines...) Expand all Loading... |
131 { | 133 { |
132 NS_LOG_FUNCTION (this); | 134 NS_LOG_FUNCTION (this); |
133 m_rxCallback = cb; | 135 m_rxCallback = cb; |
134 } | 136 } |
135 | 137 |
136 | 138 |
137 bool | 139 bool |
138 LteNetDevice::SendFrom (Ptr<Packet> packet, const Address& source, const Address
& dest, uint16_t protocolNumber) | 140 LteNetDevice::SendFrom (Ptr<Packet> packet, const Address& source, const Address
& dest, uint16_t protocolNumber) |
139 { | 141 { |
140 NS_FATAL_ERROR ("SendFrom () not supported"); | 142 NS_FATAL_ERROR ("SendFrom () not supported"); |
141 NS_UNUSED(source); | 143 NS_UNUSED (source); |
142 NS_UNUSED(dest); | 144 NS_UNUSED (dest); |
143 NS_UNUSED(protocolNumber); | 145 NS_UNUSED (protocolNumber); |
144 return false; | 146 return false; |
145 } | 147 } |
146 | 148 |
147 | 149 |
148 bool | 150 bool |
149 LteNetDevice::SupportsSendFrom (void) const | 151 LteNetDevice::SupportsSendFrom (void) const |
150 { | 152 { |
151 NS_LOG_FUNCTION (this); | 153 NS_LOG_FUNCTION (this); |
152 return false; | 154 return false; |
153 } | 155 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 NS_LOG_FUNCTION (this); | 281 NS_LOG_FUNCTION (this); |
280 NS_LOG_WARN ("Promisc mode not supported"); | 282 NS_LOG_WARN ("Promisc mode not supported"); |
281 } | 283 } |
282 | 284 |
283 | 285 |
284 | 286 |
285 void | 287 void |
286 LteNetDevice::Receive (Ptr<Packet> p) | 288 LteNetDevice::Receive (Ptr<Packet> p) |
287 { | 289 { |
288 NS_LOG_FUNCTION (this << p); | 290 NS_LOG_FUNCTION (this << p); |
289 m_rxCallback (this, p, Ipv4L3Protocol::PROT_NUMBER, Address ()); | 291 uint8_t ipType; |
290 } | 292 |
291 | 293 p->CopyData (&ipType, 1); |
292 | 294 ipType = (ipType>>4) & 0x0f; |
293 } | 295 |
| 296 if (ipType == 0x04) |
| 297 m_rxCallback (this, p, Ipv4L3Protocol::PROT_NUMBER, Address ()); |
| 298 else if (ipType == 0x06) |
| 299 m_rxCallback (this, p, Ipv6L3Protocol::PROT_NUMBER, Address ()); |
| 300 else |
| 301 NS_ABORT_MSG ("LteNetDevice::Receive - Unknown IP type..."); |
| 302 } |
| 303 |
| 304 |
| 305 } |
LEFT | RIGHT |