Hi,<br> Can you implement this in a working code. Sorry but I'm not C expert. I started to learn C from several weeks.<br>This is a very valuable for me, I'm sure many people will use it too.<br><br>Regards<br>Peter<br>
<br><div class="gmail_quote">On Sat, May 7, 2011 at 1:33 AM, Marcus Nascimento <span dir="ltr"><<a href="mailto:marcus.cps@gmail.com">marcus.cps@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
You may use a something like this (pseudo alike code):<div><br></div><div>// Method 1 parameters structure</div><div>typedef struct {</div><div> int methd1param1;</div><div> gchar method1param2[20];</div><div>} method1_st;</div>
<div><br></div><div>// Method 2 parameters structure</div><div>typedef struct {</div><div> int method2param1;</div><div> int method2param2;</div><div> int method2param3;</div><div>} method2_st;</div><div><br></div><div>
// other methods declaration</div><div><br></div><div><div>// Method call structure</div></div><div>typedef struct {</div><div> int methodId,</div><div> union params {</div><div> method1_st method1params;</div><div>
method2_st method2params;</div>
<div> // other methods parameters.</div><div> } method_call;</div><div><br></div><div>Then, you fill a method_call structure with the Id of the method you want to call.</div><div>And them you can fill the parameters of this method inside the union.</div>
<div>Then you have to serialize that method_call into an array of bytes to send it to the other side.</div><div>In the other side, you do the oposite.</div><div><br></div><div>Note that the union gives you guarantee on the size of the method call.</div>
<div>So you don't have to read the first field (method id) to know how many bytes you need to read after to get all the parameters.</div><div>I know this is a waste of bandwidth/memory, but it makes your code much simpler. Tradeoffs are there everytime.</div>
<div><br></div><div>You may face some trouble with threads and SIG_PIPE when you use sockets. If you decide to go this way, I can give you some hints.</div><div><br></div><div>I know iIt is cumbersome, but it was the best option to me. Maybe not for you.</div>
<div><br></div><div>I did something like this, but I used a much more complex structure based on C++ and polimorphism to automate the serialization and deserialization work.</div><div>It is working very smooth. I'm sorry not to provide you the real code. I did it in my work and I cant open that to you.</div>
<div><br></div><div>There are a lot of options to do serialization. I went to a "do it yourself" approach, but you may use some of the available libs around.</div><div>If I remember well, there is a library called FUSION that does that.</div>
<div>There is a Google library that does that.</div><div><br></div><div>I'm not really the best person to talk about serialization. Maybe you can ask some general forum on that.</div><div><br></div><div>Regards.</div>
<div>Marcus</div><div><div></div><div class="h5"><div><br><div class="gmail_quote">On Fri, May 6, 2011 at 7:12 PM, Peter Penzov <span dir="ltr"><<a href="mailto:peter.penzov@gmail.com" target="_blank">peter.penzov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br> I know that there is IPC solution but as far as I know it can only be used to send simple message to other daemon. I don't have idea how I can call a remote function using Unix Domain Socket (AF_UNIX) to call a function.<br>
<br>Any idea?<br><br>Regards<br><font color="#888888">Peter</font><div><div></div><div><br><br><br><div class="gmail_quote">On Sat, May 7, 2011 at 1:08 AM, Marcus Nascimento <span dir="ltr"><<a href="mailto:marcus.cps@gmail.com" target="_blank">marcus.cps@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi,<div><br></div><div>In fact, yes! There is. You can use more general IPC systems like Sockets, Pipes, Shared Memory and so on.</div>
<div>I like Sockets very much. In fact, DBus itself is based in unix sockets.</div><div>
<br></div><div>You have to choose deppending on your needs. What do you want to do? Maybe I can help you.</div><div><br></div><div><div>I had some trouble recently with Dbus because its C implementation (dbus glib porting) imposes the use of a GMainLoop for signal support. That wasn't possible because I was working on a library to be linked into a very large gamma of embedded systems. So I chose Sockets and implemented a full custom solution for my needs.</div>
</div><div><br></div><font color="#888888"><div>Marcus.</div></font><div><div></div><div><div><br><div class="gmail_quote">On Fri, May 6, 2011 at 7:01 PM, Peter Penzov <span dir="ltr"><<a href="mailto:peter.penzov@gmail.com" target="_blank">peter.penzov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi,<br> I found alternatives to DBUS but it seens that they are outdated:<br><br>Orbit(Corba) - is seems that it's not developed since 2004<br>
<br>SunRPC - it's too not maintained <br><br>Linux Doors - it's not maintained <br>
<br>There is internal RPC in Linux that I may use <a href="http://www.cs.cf.ac.uk/Dave/C/node33.html" target="_blank">http://www.cs.cf.ac.uk/Dave/C/node33.html</a><br><br>Is there another way to call a remote function?<br>
<br>Regards<br><font color="#888888">
<br>Peter</font><div><div></div><div><br><br><div class="gmail_quote">On Fri, May 6, 2011 at 11:32 PM, Marcus Nascimento <span dir="ltr"><<a href="mailto:marcus.cps@gmail.com" target="_blank">marcus.cps@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<div><br></div><div>As far as I know, DBUS can handle only one call at a time for a given service (daemon).</div><div><br></div><div>I tried to use feedback this way and it failed (A calling "k" and B calling "s" inside the body of "k").</div>
<div>I know It is possible to use signals while a given call is ongoing.</div><div><br></div><div>I'm not exactly sure about this, anyone more skilled than me may say the opposite.</div>
<div><div>Maybe you should go for a Prove of Concept.</div></div><div><br></div><div>Regards.</div><div>Marcus</div><div><br></div><div><br><div class="gmail_quote"><div><div></div><div>
On Fri, May 6, 2011 at 4:47 PM, Peter Penzov <span dir="ltr"><<a href="mailto:peter.penzov@gmail.com" target="_blank">peter.penzov@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div>
Hi,<br>
Is it possible to call a remote function in another <acronym title="Disk and Execution Monitor">daemon</acronym>? Here is the setup:<br>
I have two daemons <acronym title="Disk and Execution Monitor">- daemon</acronym> A with function "s" and <acronym title="Disk and Execution Monitor">daemon</acronym> B with function "k". I need a way function "s" from <acronym title="Disk and Execution Monitor">daemon</acronym> A to call a function "k" from <acronym title="Disk and Execution Monitor">daemon</acronym> B and pass some arguments. When the request is processed function "k" returns the output to function "s". Is this possible?<br>
Regards<br><font color="#888888">
Peter
</font><br></div></div>_______________________________________________<br>
dbus mailing list<br>
<a href="mailto:dbus@lists.freedesktop.org" target="_blank">dbus@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dbus" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dbus</a><br>
<br></blockquote></div><br>
</div>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>
</div>
</div></div></blockquote></div><br>