diff --git a/src/inet/emulation/linklayer/ethernet/ExtEthernetSocket.cc b/src/inet/emulation/linklayer/ethernet/ExtEthernetSocket.cc index e610cbd1e09..892a1731fef 100644 --- a/src/inet/emulation/linklayer/ethernet/ExtEthernetSocket.cc +++ b/src/inet/emulation/linklayer/ethernet/ExtEthernetSocket.cc @@ -66,12 +66,9 @@ void ExtEthernetSocket::handleMessage(cMessage *message) socket_address.sll_addr[4] = macAddress.getAddressByte(4); socket_address.sll_addr[5] = macAddress.getAddressByte(5); - uint8_t buffer[packet->getByteLength()]; - auto bytesChunk = packet->peekAllAsBytes(); - size_t packetLength = bytesChunk->copyToBuffer(buffer, sizeof(buffer)); - ASSERT(packetLength == (size_t)packet->getByteLength()); - - int sent = sendto(fd, buffer, packetLength, 0, (struct sockaddr *)&socket_address, sizeof(socket_address)); + auto bytes = packet->peekDataAsBytes()->getBytes(); + auto packetLength = bytes.size(); + int sent = sendto(fd, bytes.data(), packetLength, 0, (struct sockaddr *)&socket_address, sizeof(socket_address)); if ((size_t)sent == packetLength) EV_INFO << "Sent " << packetLength << " packet to '" << device << "' device.\n"; else diff --git a/src/inet/emulation/linklayer/ethernet/ExtLowerEthernetInterface.ned b/src/inet/emulation/linklayer/ethernet/ExtLowerEthernetInterface.ned index cfe85fc4f64..5eccbc2e3ef 100644 --- a/src/inet/emulation/linklayer/ethernet/ExtLowerEthernetInterface.ned +++ b/src/inet/emulation/linklayer/ethernet/ExtLowerEthernetInterface.ned @@ -10,6 +10,8 @@ package inet.emulation.linklayer.ethernet; import inet.emulation.common.ExtInterface; import inet.linklayer.contract.IEthernetInterface; +import inet.physicallayer.wired.ethernet.IEthernetPhyLayer; + // // This module provides an Ethernet network interface suitable for emulation. // The lower part of the network interface is realized in the real world using @@ -20,6 +22,7 @@ module ExtLowerEthernetInterface extends ExtInterface like IEthernetInterface parameters: string protocol = default("ethernetmac"); double bitrate @unit(bps) = default(nan bps); + *.bitrate = default(this.bitrate); gates: input cutthroughIn @loose; output cutthroughOut @loose; @@ -29,7 +32,13 @@ module ExtLowerEthernetInterface extends ExtInterface like IEthernetInterface parameters: @display("p=300,200"); } + phyLayer: like IEthernetPhyLayer { + parameters: + transmitter.clockModule = default(""); + @display("p=400,500"); + } connections allowunconnected: - upperLayerIn --> { @display("m=n"); } --> socket.upperLayerIn; + phys$i --> { @display("m=s"); } --> phyLayer.lowerLayerIn; + phyLayer.upperLayerOut --> socket.upperLayerIn; upperLayerOut <-- { @display("m=n"); } <-- socket.upperLayerOut; }