equal
deleted
inserted
replaced
538 return 0; |
538 return 0; |
539 } |
539 } |
540 } |
540 } |
541 |
541 |
542 bool |
542 bool |
|
543 Ipv4L3Protocol::IsUnicast (Ipv4Address ad) const |
|
544 { |
|
545 NS_LOG_FUNCTION (this << ad); |
|
546 |
|
547 if (ad.IsBroadcast () || ad.IsMulticast ()) |
|
548 { |
|
549 return false; |
|
550 } |
|
551 else |
|
552 { |
|
553 // check for subnet-broadcast |
|
554 for (uint32_t ifaceIndex = 0; ifaceIndex < GetNInterfaces (); ifaceIndex++) |
|
555 { |
|
556 for (uint32_t j = 0; j < GetNAddresses (ifaceIndex); j++) |
|
557 { |
|
558 Ipv4InterfaceAddress ifAddr = GetAddress (ifaceIndex, j); |
|
559 NS_LOG_LOGIC ("Testing address " << ad << " with subnet-directed broadcast " << ifAddr.GetBroadcast () ); |
|
560 if (ad == ifAddr.GetBroadcast () ) |
|
561 { |
|
562 return false; |
|
563 } |
|
564 } |
|
565 } |
|
566 } |
|
567 |
|
568 return true; |
|
569 } |
|
570 |
|
571 bool |
543 Ipv4L3Protocol::IsUnicast (Ipv4Address ad, Ipv4Mask interfaceMask) const |
572 Ipv4L3Protocol::IsUnicast (Ipv4Address ad, Ipv4Mask interfaceMask) const |
544 { |
573 { |
545 NS_LOG_FUNCTION (this << ad << interfaceMask); |
574 NS_LOG_FUNCTION (this << ad << interfaceMask); |
546 return !ad.IsMulticast () && !ad.IsSubnetDirectedBroadcast (interfaceMask); |
575 return !ad.IsMulticast () && !ad.IsSubnetDirectedBroadcast (interfaceMask); |
547 } |
576 } |