It depends on what is "the Message" and from which module you want to send it.
If you are creating/testing application protocol then you might want to create new .msg file which describes the structure of your message.
INET's documentation has a section on working with packets https://inet.omnetpp.org/docs/developers-guide/ch-packets.html#representing-packets
The .msg
file can look something like this:
cplusplus {{
const B YOUR_APP_HEADER_LENGTH = B(6);
}}
class YourAppHeader extends FieldsChunk
{
chunkLength = YOUR_APP_HEADER_LENGTH;
int someField;
bool someBit;
};
then in your C++ code
Packet *packet = new Packet();
const auto& payload = makeShared<YourAppHeader>();
payload->setChunkLength(B(<someValue>));
payload->setSomeFiled(<intHere>);
packet->insertAtBack(payload);
//and then send it