im trying to build a network where the nodes communicate using Ethernet. My plan is to create a message which will be used in multiple simple modules inside the nodes and pass that information to a inet::Packet and send it between the nodes. So, im first trying to understand how to use the communication protocol by implementing a simple network where one of the nodes creates a packet and the other receives it. Im amble to create the Packet but upon receiving it, the node informs that the protocol is unknown and drops it. I'm following the examples of the EtherTrafficGen.cc, EtherAppClient.cc in the inet folder and the Developer's Guide to try to implement it but i think im a bit lost.
The code for the packet creation is the following:
void masterDispatcher::initialize()
{
// Message test that will be used in other modules
Frame *test = new Frame;
test->setTest(24);
// Ethernet Packet
inet::MacAddress destMACAddress;
inet::Packet *datapacket = new inet::Packet("test", inet::IEEE802CTRL_DATA);
// Data
const auto& frame = inet::makeShared<EthernetFrame>();
frame->setChunkLength(inet::B(1));
frame->setTestEther(test->getTest());
datapacket->insertAtBack(frame);
// Header
datapacket->addTagIfAbsent<inet::MacAddressReq>()->setDestAddress(destMACAddress.BROADCAST_ADDRESS);
auto ieee802SapReq = datapacket->addTagIfAbsent<inet::Ieee802SapReq>();
ieee802SapReq->setSsap(-1);
ieee802SapReq->setDsap(-1);
send(datapacket, "lowerLayerOut");
}
The network that im using is the one in the image: Implemented Network. Similiar to the EtherHost of INET, llc is the EtherEncap and the eth is the IEthernetInterface. Can anyone give me some tips of how to use this protocol?