I need to make a MANET routing protocol, so I'm looking at GPSR and DSDV source code in INET to get an insight of how to do it.
I checked the files DsdvHello.msg
and Gpsr.msg
where the classes that represent packets of these protocols are defined. Those classes extend FieldsChunk
class. I assumed that I had to define the packets of my protocol the same way, so I made the file Protocolo.msg
in my project like the following.
cplusplus {{
#include "inet/common/packet/chunk/FieldsChunk.h"
#include "inet/networklayer/contract/ipv6/Ipv6Address.h"
}}
class FieldsChunk;
class Ipv6Address;
class Hola extends FieldsChunk {
Ipv6Address ip;
string ubicacion;
}
class Adios extends FieldsChunk {
Ipv6Address ip;
}
I'm not sure if I'm doing right, but I'm doing it as I see in DsdvHello.msg
and Gpsr.msg
and the Message Definitions chapter in the OMNeT++ Simulation Manual.
I selected INET in Project>Properties>Project References, but when I build my project, I get the message fatal error: inet/common/packet/chunk/FieldsChunk.h: No such file or directory
when it tries to compile my .msg
file.
I also have a NED file that uses IManetRouting (also from INET) without problems, but for some reason it doesn't find FieldsChunk.h
and IPv6Address.h
inside the .msg
file.
Can anyone tell me if I need to do anything else so that I can use those classes in my .msg
file?
Change Protocolo.msg
into:
import inet.common.INETDefs;
import inet.common.packet.chunk.Chunk;
import inet.networklayer.contract.ipv6.Ipv6Address;
namespace inet;
class Hola extends FieldsChunk {
Ipv6Address ip;
string ubicacion;
}
class Adios extends FieldsChunk {
Ipv6Address ip;
}
Then go to Properties
of your project, select OMNeT++
| Makemake
| src folder | Options...
and:
Compile
tab check "Add include paths exported from referenced projects"in Custom
tab add the following line:
MSGC:=$(MSGC) --msg6