Genode RPC: Handling vector parameters
정복득
bd.jeong at ...60...
Mon Jul 16 11:17:28 CEST 2012
Okay. Now I changed my rpc params to transferable types.
I am using Rpc_in_buffer<> instead of std::string.
I want to receive a feedback message from a server through an Rpc_in_buffer<> argument,
but the client doesn't receive the results from the server correctly while working correclty with an character array.
I should not use Rpc_in_buffer for a reply message from a server?
I added test codes to the hello_tutorials :
------ include/hello_session/client.h----
typedef Genode::Rpc_in_buffer<24> String;
virtual void feedback_mymsg(String &msg) = 0;
GENODE_RPC(Rpc_feedback_mymsg, void, feedback_mymsg, String &);
GENODE_RPC(Rpc_say_hello, Rpc_add, Rpc_feedback_mymsg);
------client/main.cc-----------------
Hello::String string_mymsg = "hello from client";
h.feedback_mymsg(string_mymsg);
PDBG("from server[%p] base:[%p] msg:%s size:%d\n", &string_mymsg, string_mymsg.base(), string_mymsg.string(), string_mymsg.size());
-------server/main.cc------------
void feedback_mymsg(String &msg) {
msg = "hello from server";
PDBG("SERVER: base:[%p]", msg.base());
}
The client correctly prints out the size of the result message, but the base values is same as the server's.
------- Original Message -------
Sender : Christian Helmuth<christian.helmuth at ...1...>
Date : 2012-07-13 16:29 (GMT+09:00)
Title : Re: Genode RPC: Handling vector parameters
Hello 정복득,
On Thu, Jul 12, 2012 at 09:16:19AM +0000, 정복득 wrote:
> I need to use parameters of std::vector<std::string> type for my RPC
> program, but it doesn't seem to work. (I want to define a RPC
> function passing varible number of strings as a parameter. The
> number of strings is very flexible.) I read about the transferable
> argument types from the 11.05 release notes.
The RPC mechanism does not support (de)marshalling of complex types
like std::vector<std::string> as the serialization of such types
cannot be implemented in a generic way but needs type-specific
serialization functions.
> If vector isn't one of the transferable argument type, could you
> give me an alternative programming tip?
This issue comes up from time to time and we always encourage the
users to enter a discussion about what they really want to achieve
resp. to clarify the details of the use case. So, please allow me to
give some background information:
* The RPC mechanism is just one basic synchronous communication
mechanism. Therefore, it's suited for configuration interfaces and
interfaces with simple parameters, i.e. C++ base or POD types. The
mechanism is not inteded to support structured bulk traffic with
complex serialization tasks.
* The base mechanism used for RPC is the IPC mechanism of the base
platform, which is usually limited with regard to the maximum
message size. For Fiasco.OC, the limiting factor is the size of the
UTCB.
* Besides RPC, Genode also supports the packet-stream interface, which
is a packet-based shared-memory mechanism (see
os/include/os/packet_stream.h and os/include/packet_stream_rx/tx).
The packet stream is well suited for bulk traffic and also supports
asynchronous operation.
With this background, we could revisit your usage scenario and come up
with an approach that fits best.
Unfortunately, the serialization of std::vector<std::string> is in any
case out of the scope of the base framework, but should not be that
hard.
Regards
--
Christian Helmuth
Genode Labs
http://www.genode-labs.com/ · http://genode.org/ · /?d?iː.n??d/
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Gesch?ftsf?hrer: Dr.-Ing. Norman Feske, Christian Helmuth
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Genode-main mailing list
Genode-main at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main
<p> </p><p> </p>
More information about the users
mailing list