encapsulate Message

368 views
Skip to first unread message

Hildebrand Christian

unread,
Nov 17, 2009, 7:43:06 AM11/17/09
to omn...@googlegroups.com
Hello,

i want to encapsulate a message. In the manual is an example but it don't work here could anybody help?
Here is my example:

void Server::sendMsgSps(cMessage *msg)
{
cMessage *encapMsg = new cMessage("encapMsg");
encapMsg->encapsulate(msg);
send(encapMsg, "spsOut");
}

When I wan't build it the compiler say: "'class cMessage' has no member named 'encapsulate'". But why?

Best regards
Christian


________________________________________

Christian Hildebrand
Student
System Design
IHP

Fon: +49 (335) 5625-784
Fax: +49 (335) 5625-671
E-Mail: hilde...@ihp-microelectronics.com
Website: <http://www.ihp-microelectronics.com/>
________________________________________

IHP GmbH
Innovations for High Performance Microelectronics
Leibniz-Institut fuer innovative Mikroelektronik
Im Technologiepark 25
15236 Frankfurt (Oder)
Germany

Geschaeftsfuehrer: Prof. Dr. Wolfgang Mehr, Manfred Stoecker, Vorsitzende des Aufsichtsrates: Konstanze Pistor
Handelsregister: HRB 1982 Amtsgericht Frankfurt (Oder) , Steuernummer: 061/12500152, Umsatzsteuer-ID: DE 138996546

Die IHP GmbH ist Mitglied der Leibniz-Gemeinschaft und wird von der Bundesrepublik Deutschland und dem Land Brandenburg institutionell finanziert.

Diese E-Mail enthaelt vertrauliche und / oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

This e-mail contains confidential and / or privileged information. If you are not the intended recipient or have received this e-mail in error, please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Patrick Haeflinger

unread,
Nov 17, 2009, 7:57:56 AM11/17/09
to omn...@googlegroups.com
Hi Christian,

I guess you are using OMNeT 4.0, in this version "encapsulate()" can only be used with cPacket class (and no longer with cMessage as in 3.x)
Have a look to the API

Hope this helps

Patrick


Hildebrand Christian a écrit :
________________________________________

IHP GmbH
Innovations for High Performance Microelectronics
Leibniz-Institut fuer innovative Mikroelektronik
Im Technologiepark 25
15236 Frankfurt (Oder)
Germany

Geschaeftsfuehrer: Prof. Dr. Wolfgang Mehr, Manfred Stoecker, Vorsitzende des Aufsichtsrates: Konstanze Pistor
Handelsregister: HRB 1982 Amtsgericht Frankfurt (Oder) , Steuernummer: 061/12500152, Umsatzsteuer-ID: DE 138996546

Die IHP GmbH ist Mitglied der Leibniz-Gemeinschaft und wird von der Bundesrepublik Deutschland und dem Land Brandenburg institutionell finanziert.

Diese E-Mail enthaelt vertrauliche und / oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

This e-mail contains confidential and / or privileged information. If you are not the intended recipient or have received this e-mail in error, please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

--

You received this message because you are subscribed to the Google Groups "omnetpp" group.
To post to this group, send email to omn...@googlegroups.com.
To unsubscribe from this group, send email to omnetpp+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/omnetpp?hl=.



  

Rudolf Hornig

unread,
Nov 17, 2009, 8:14:57 AM11/17/09
to omn...@googlegroups.com
Opss, this is an error in the manual. With omnet4 the encapsulation fuctionality has moved to the cPacket class.

Use cPacket instead of cMessage

Rudolf

Hildebrand Christian

unread,
Nov 17, 2009, 8:37:05 AM11/17/09
to omn...@googlegroups.com
Thx,

yes I use OMNeT 4.0. Damn I don't find anything like this in the api is there an other alternative? Maybe someone could change the manual for 4.0? Because here http://www.omnetpp.org/doc/omnetpp40/manual/usman.html this encapsulation is already declared.
Is there an alternative?

Best regards
Christian

________________________________________
Von: Patrick Haeflinger [mailto:patrick.h...@alcatel-lucent.fr]
Gesendet: Dienstag, 17. November 2009 13:58
An: omn...@googlegroups.com
Betreff: Re: [Omnetpp-l] encapsulate Message

Hi Christian,

I guess you are using OMNeT 4.0, in this version "encapsulate()" can only be used with cPacket class (and no longer with cMessage as in 3.x)
Have a look to the API

Hope this helps

Patrick



Patrick Haeflinger

unread,
Nov 17, 2009, 8:45:35 AM11/17/09
to omn...@googlegroups.com
Hi,

As Rudolf already said there is unfortunately an error in the manual.
An alternative... just use cPacket instead of cMessage ! is there a
problem for you to do that (cPacket is a subclass of cMessage)?

Patrick

Hildebrand Christian a �crit :

Hildebrand Christian

unread,
Nov 17, 2009, 9:58:48 AM11/17/09
to omn...@googlegroups.com
Hi,

is there an easyway like a cast for this one connection or i have to change the whole net to cPacket?

Christian

-----Ursprüngliche Nachricht-----
Von: Patrick Haeflinger [mailto:patrick.h...@alcatel-lucent.fr]
Gesendet: Dienstag, 17. November 2009 14:46
An: omn...@googlegroups.com
Betreff: Re: AW: [Omnetpp-l] encapsulate Message

Hi,

As Rudolf already said there is unfortunately an error in the manual.
An alternative... just use cPacket instead of cMessage ! is there a
problem for you to do that (cPacket is a subclass of cMessage)?

Patrick





Hildebrand Christian

unread,
Nov 17, 2009, 10:15:10 AM11/17/09
to omn...@googlegroups.com

Hi,

 

i change this but now the sending will not working:

 

cPacket *copyMsg = msg->dup();

send(copyMsg, transmitter);

 

How I have to change this to get this working?

 

Christian


Von: Rudolf Hornig [mailto:rudolf...@gmail.com]
Gesendet: Dienstag, 17. November 2009 14:15
An: omn...@googlegroups.com
Betreff: Re: [Omnetpp-l] encapsulate Message

 

Opss, this is an error in the manual. With omnet4 the encapsulation fuctionality has moved to the cPacket class.

 

Use cPacket instead of cMessage

 

Rudolf



_____________________________________________

Christian Hildebrand
Student
System Design
IHP

Fon: +49 (335) 5625-784
Fax: +49 (335) 5625-671
E-Mail: hilde...@ihp-microelectronics.com
Website: http://www.ihp-microelectronics.com

_____________________________________________

IHP GmbH
Innovations for High Performance Microelectronics
Leibniz-Institut für innovative Mikroelektronik

Im Technologiepark 25 
15236 Frankfurt (Oder)
Germany

Geschäftsführer:  Prof. Dr. Wolfgang Mehr, Manfred Stöcker, Vorsitzende des Aufsichtsrates: Konstanze Pistor


Handelsregister: HRB 1982 Amtsgericht Frankfurt (Oder) , Steuernummer: 061/12500152, Umsatzsteuer-ID: DE 138996546

Die IHP GmbH ist Mitglied der Leibniz-Gemeinschaft und wird von der Bundesrepublik Deutschland und dem Land Brandenburg institutionell finanziert.

Diese E-Mail enthält vertrauliche und / oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

Hildebrand Christian

unread,
Nov 18, 2009, 3:12:07 AM11/18/09
to omn...@googlegroups.com
Hi,

i change this. But Class::handleMessage(cPacket *msg) will not work.
How I could cast cPacket from cMessage? I try cMessage *sendCopyMsg = check_and_cast<cMessage *>(copyMsg); but it will not work. As anyone an idea how could I get this working?

Best regards
Christian

________________________________________
Von: Rudolf Hornig [mailto:rudolf...@gmail.com]
Gesendet: Dienstag, 17. November 2009 14:15
An: omn...@googlegroups.com
Betreff: Re: [Omnetpp-l] encapsulate Message

Opss, this is an error in the manual. With omnet4 the encapsulation fuctionality has moved to the cPacket class.

Use cPacket instead of cMessage

Rudolf


Vitali Anselm

unread,
Nov 18, 2009, 3:30:39 AM11/18/09
to omn...@googlegroups.com
Hello Christian,

the function handleMessage(cMessage *msg) is only valid for arguments of type cMessage.
As soon as your module receives your packet, you can cast it to cPacket class by:

cPacket *tempPtr = check_and_cast<cPacket *>(msg);

Then you can also use all function of class cPacket, e.g. encapsulate.

best regards,

Vitali Anselm

-----Ursprüngliche Nachricht-----
Von: "Hildebrand Christian" <hilde...@ihp-microelectronics.com>
Gesendet: 18.11.09 09:12:35
An: "omn...@googlegroups.com" <omn...@googlegroups.com>
Betreff: AW: [Omnetpp-l] encapsulate Message
--

You received this message because you are subscribed to the Google Groups "omnetpp" group.
To post to this group, send email to omn...@googlegroups.com.
To unsubscribe from this group, send email to omnetpp+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/omnetpp?hl=.





______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

Alfonso Ariza Quintana

unread,
Nov 19, 2009, 5:16:06 PM11/19/09
to omn...@googlegroups.com

cMessage *sendCopyMsg = check_and_cast<cMessage *>(copyMsg);??????    this is ilogical

what do you want? a copy?, check if it's a cPacket?
> --
>
> You received this message because you are subscribed to the Google Groups "omnetpp" group.
> To post to this group, send email to omn...@googlegroups.com.
> To unsubscribe from this group, send email to omnetpp+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/omnetpp?hl=.
>
>


¡Windows Phone ya está aquí! Mucho más que un teléfono. ¡Hazte con uno!
Reply all
Reply to author
Forward
0 new messages