equal
deleted
inserted
replaced
74 return tid; |
74 return tid; |
75 } |
75 } |
76 |
76 |
77 |
77 |
78 |
78 |
79 EpcSgwPgwApplication::EpcSgwPgwApplication (const Ptr<VirtualNetDevice> giTunDevice, const Ptr<Socket> s1uSocket) |
79 EpcSgwPgwApplication::EpcSgwPgwApplication (const Ptr<VirtualNetDevice> tunDevice, const Ptr<Socket> s1uSocket) |
80 : m_s1uSocket (s1uSocket), |
80 : m_s1uSocket (s1uSocket), |
81 m_giTunDevice (giTunDevice), |
81 m_tunDevice (tunDevice), |
82 m_gtpuUdpPort (2152) // fixed by the standard |
82 m_gtpuUdpPort (2152) // fixed by the standard |
83 { |
83 { |
84 NS_LOG_FUNCTION (this << giTunDevice << s1uSocket); |
84 NS_LOG_FUNCTION (this << tunDevice << s1uSocket); |
85 m_s1uSocket->SetRecvCallback (MakeCallback (&EpcSgwPgwApplication::RecvFromS1uSocket, this)); |
85 m_s1uSocket->SetRecvCallback (MakeCallback (&EpcSgwPgwApplication::RecvFromS1uSocket, this)); |
86 } |
86 } |
87 |
87 |
88 |
88 |
89 EpcSgwPgwApplication::~EpcSgwPgwApplication () |
89 EpcSgwPgwApplication::~EpcSgwPgwApplication () |
103 uint32_t teid = m_enbInfoMap[enbAddr].AddBearer (tft); |
103 uint32_t teid = m_enbInfoMap[enbAddr].AddBearer (tft); |
104 return teid; |
104 return teid; |
105 } |
105 } |
106 |
106 |
107 bool |
107 bool |
108 EpcSgwPgwApplication::RecvFromGiTunDevice (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) |
108 EpcSgwPgwApplication::RecvFromTunDevice (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) |
109 { |
109 { |
110 NS_LOG_FUNCTION (this << source << dest << packet << packet->GetSize ()); |
110 NS_LOG_FUNCTION (this << source << dest << packet << packet->GetSize ()); |
111 |
111 |
112 // get IP address of UE |
112 // get IP address of UE |
113 Ptr<Packet> pCopy = packet->Copy (); |
113 Ptr<Packet> pCopy = packet->Copy (); |
156 |
156 |
157 // workaround for bug 231 https://www.nsnam.org/bugzilla/show_bug.cgi?id=231 |
157 // workaround for bug 231 https://www.nsnam.org/bugzilla/show_bug.cgi?id=231 |
158 SocketAddressTag tag; |
158 SocketAddressTag tag; |
159 packet->RemovePacketTag (tag); |
159 packet->RemovePacketTag (tag); |
160 |
160 |
161 SendToGiTunDevice (packet, teid); |
161 SendToTunDevice (packet, teid); |
162 } |
162 } |
163 |
163 |
164 void |
164 void |
165 EpcSgwPgwApplication::SendToGiTunDevice (Ptr<Packet> packet, uint32_t teid) |
165 EpcSgwPgwApplication::SendToTunDevice (Ptr<Packet> packet, uint32_t teid) |
166 { |
166 { |
167 NS_LOG_FUNCTION (this << packet << teid); |
167 NS_LOG_FUNCTION (this << packet << teid); |
168 m_giTunDevice->Receive (packet, 0x0800, m_giTunDevice->GetAddress (), m_giTunDevice->GetAddress (), NetDevice::PACKET_HOST); |
168 m_tunDevice->Receive (packet, 0x0800, m_tunDevice->GetAddress (), m_tunDevice->GetAddress (), NetDevice::PACKET_HOST); |
169 } |
169 } |
170 |
170 |
171 void |
171 void |
172 EpcSgwPgwApplication::SendToS1uSocket (Ptr<Packet> packet, Ipv4Address enbAddr, uint32_t teid) |
172 EpcSgwPgwApplication::SendToS1uSocket (Ptr<Packet> packet, Ipv4Address enbAddr, uint32_t teid) |
173 { |
173 { |