|
|
| 66 |
m_rxAvailable (0) |
66 |
m_rxAvailable (0) |
| 67 |
{ |
67 |
{ |
| 68 |
NS_LOG_FUNCTION_NOARGS (); |
68 |
NS_LOG_FUNCTION_NOARGS (); |
|
|
69 |
m_allowBroadcast = false; |
| 69 |
} |
70 |
} |
| 70 |
|
71 |
|
| 71 |
UdpSocketImpl::~UdpSocketImpl () |
72 |
UdpSocketImpl::~UdpSocketImpl () |
|
|
| 370 |
// |
371 |
// |
| 371 |
if (dest.IsBroadcast ()) |
372 |
if (dest.IsBroadcast ()) |
| 372 |
{ |
373 |
{ |
|
|
374 |
if (!m_allowBroadcast) |
| 375 |
{ |
| 376 |
m_errno = ERROR_OPNOTSUPP; |
| 377 |
return -1; |
| 378 |
} |
| 373 |
NS_LOG_LOGIC ("Limited broadcast start."); |
379 |
NS_LOG_LOGIC ("Limited broadcast start."); |
| 374 |
for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ ) |
380 |
for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ ) |
| 375 |
{ |
381 |
{ |
|
|
| 431 |
if (route != 0) |
437 |
if (route != 0) |
| 432 |
{ |
438 |
{ |
| 433 |
NS_LOG_LOGIC ("Route exists"); |
439 |
NS_LOG_LOGIC ("Route exists"); |
|
|
440 |
if (!m_allowBroadcast) |
| 441 |
{ |
| 442 |
uint32_t outputIfIndex = ipv4->GetInterfaceForDevice (route->GetOutputDevice ()); |
| 443 |
uint32_t ifNAddr = ipv4->GetNAddresses (outputIfIndex); |
| 444 |
for (uint32_t addrI = 0; addrI < ifNAddr; ++addrI) |
| 445 |
{ |
| 446 |
Ipv4InterfaceAddress ifAddr = ipv4->GetAddress (outputIfIndex, addrI); |
| 447 |
if (dest == ifAddr.GetBroadcast ()) |
| 448 |
{ |
| 449 |
m_errno = ERROR_OPNOTSUPP; |
| 450 |
return -1; |
| 451 |
} |
| 452 |
} |
| 453 |
} |
| 454 |
|
| 434 |
header.SetSource (route->GetSource ()); |
455 |
header.SetSource (route->GetSource ()); |
| 435 |
m_udp->Send (p->Copy (), header.GetSource (), header.GetDestination (), |
456 |
m_udp->Send (p->Copy (), header.GetSource (), header.GetDestination (), |
| 436 |
m_endPoint->GetLocalPort (), port, route); |
457 |
m_endPoint->GetLocalPort (), port, route); |
|
|
| 706 |
void |
727 |
void |
| 707 |
UdpSocketImpl::SetAllowBroadcast (bool allowBroadcast) |
728 |
UdpSocketImpl::SetAllowBroadcast (bool allowBroadcast) |
| 708 |
{ |
729 |
{ |
| 709 |
if (!allowBroadcast) |
730 |
m_allowBroadcast = allowBroadcast; |
| 710 |
{ |
|
|
| 711 |
NS_FATAL_ERROR ("not implemented"); |
| 712 |
} |
| 713 |
} |
731 |
} |
| 714 |
|
732 |
|
| 715 |
bool |
733 |
bool |