src/devices/emu/emu-net-device.cc
changeset 3842 545ddf9398ed
parent 3836 e3aa8940f23b
child 3847 784c45b27326
     1.1 --- a/src/devices/emu/emu-net-device.cc	Thu Oct 30 15:34:02 2008 -0700
     1.2 +++ b/src/devices/emu/emu-net-device.cc	Wed Nov 05 14:49:21 2008 -0800
     1.3 @@ -502,44 +502,23 @@
     1.4    NS_LOG_LOGIC ("Pkt source is " << header.GetSource ());
     1.5    NS_LOG_LOGIC ("Pkt destination is " << header.GetDestination ());
     1.6  
     1.7 -  //
     1.8 -  // An IP host group address is mapped to an Ethernet multicast address
     1.9 -  // by placing the low-order 23-bits of the IP address into the low-order
    1.10 -  // 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex).
    1.11 -  //
    1.12 -  // We are going to receive all packets destined to any multicast address,
    1.13 -  // which means clearing the low-order 23 bits the header destination 
    1.14 -  //
    1.15 -  Mac48Address mcDest;
    1.16 -  uint8_t      mcBuf[6];
    1.17 -
    1.18 -  header.GetDestination ().CopyTo (mcBuf);
    1.19 -  mcBuf[3] &= 0x80;
    1.20 -  mcBuf[4] = 0;
    1.21 -  mcBuf[5] = 0;
    1.22 -  mcDest.CopyFrom (mcBuf);
    1.23 -
    1.24 -  Mac48Address multicast = Mac48Address::ConvertFrom (GetMulticast ());
    1.25 -  Mac48Address broadcast = Mac48Address::ConvertFrom (GetBroadcast ());
    1.26 -  Mac48Address destination = Mac48Address::ConvertFrom (GetAddress ());
    1.27 -
    1.28    LlcSnapHeader llc;
    1.29    packet->RemoveHeader (llc);
    1.30    uint16_t protocol = llc.GetType ();
    1.31  
    1.32    PacketType packetType;
    1.33        
    1.34 -  if (header.GetDestination () == broadcast)
    1.35 +  if (header.GetDestination ().IsBroadcast ())
    1.36      {
    1.37        NS_LOG_LOGIC ("Pkt destination is PACKET_BROADCAST");
    1.38        packetType = NS3_PACKET_BROADCAST;
    1.39      }
    1.40 -  else if (mcDest == multicast)
    1.41 +  else if (header.GetDestination ().IsMulticast ())
    1.42      {
    1.43        NS_LOG_LOGIC ("Pkt destination is PACKET_MULTICAST");
    1.44        packetType = NS3_PACKET_MULTICAST;
    1.45      }
    1.46 -  else if (header.GetDestination () == destination)
    1.47 +  else if (header.GetDestination () == m_address)
    1.48      {
    1.49        NS_LOG_LOGIC ("Pkt destination is PACKET_HOST");
    1.50        packetType = NS3_PACKET_HOST;
    1.51 @@ -841,26 +820,21 @@
    1.52    return false;
    1.53  }
    1.54  
    1.55 -Address 
    1.56 -EmuNetDevice::GetMulticast (void) const
    1.57 -{
    1.58 -  return Mac48Address ("01:00:5e:00:00:00");
    1.59 -}
    1.60 -
    1.61 -Address 
    1.62 -EmuNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const
    1.63 +  Address 
    1.64 +EmuNetDevice::GetMulticast (Ipv4Address multicastGroup) const
    1.65  {
    1.66    NS_LOG_FUNCTION (multicastGroup);
    1.67  
    1.68 -  Mac48Address addr = Mac48Address::GetMulticast (multicastGroup);
    1.69 +  Mac48Address ad = Mac48Address::GetMulticast (multicastGroup);
    1.70  
    1.71    //
    1.72    // Implicit conversion (operator Address ()) is defined for Mac48Address, so
    1.73    // use it by just returning the EUI-48 address which is automagically converted
    1.74    // to an Address.
    1.75    //
    1.76 -  NS_LOG_LOGIC ("Multicast address is " << addr);
    1.77 -  return addr;
    1.78 +  NS_LOG_LOGIC ("multicast address is " << ad);
    1.79 +
    1.80 +  return ad;
    1.81  }
    1.82  
    1.83  bool