<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/html" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Ross Burton</title><link>http://www.burtonini.com/blog</link><description>A potted account of Ross' life</description><language>en</language><ttl>60</ttl><dc:creator>Ross Burton</dc:creator><admin:generatorAgent rdf:resource="http://pyblosxom.sourceforge.net/"/><admin:errorReportsTo rdf:resource="mailto:ross@burtonini.com"/><item><title>GUPnP Autogeneration</title><guid isPermaLink="false">computers/upnp-gen-2008-05-22-16-25</guid><link>http://www.burtonini.com/blog/computers/upnp-gen-2008-05-22-16-25</link><description>The problem with GUPnP is that (like DBus) when programming from C you need to specify the types of each ...</description><content:encoded><![CDATA[<p>
  The problem with GUPnP is that (like DBus) when programming from C you need to
  specify the types of each argument when making a method call:
</p>
<pre>gupnp_service_proxy_send_action (proxy,
                                   "AddPortMapping", &amp;error,
                                   /* In arguments */
                                   "NewRemoteHost", G_TYPE_STRING, "",
                                   "NewExternalPort", G_TYPE_UINT, external_port,
                                   "NewProtocol", G_TYPE_STRING, "TCP",
                                   "NewInternalPort", G_TYPE_UINT, internal_port,
                                   "NewInternalClient", G_TYPE_STRING, internal_host,
                                   "NewEnabled", G_TYPE_BOOLEAN, TRUE,
                                   "NewPortMappingDescription", G_TYPE_STRING, desc,
                                   "NewLeaseDuration", G_TYPE_UINT, 0,
                                   NULL,
                                   /* Out arguments */
                                   NULL);</pre>
<p>
  Now, that really is quite tiresome.  It basically means that you need to have
  the service reference to hand when coding, because you need to know the name
  and type of each argument. Luckily for DBus part of <tt>dbus-glib</tt> is a
  binding tool which can create type-safe wrappers so that making method calls
  is much easier.  Wouldn't it be nice if there was something similar for GUPnP,
  which generated inline functions with prototypes like this:
</p>
<pre>static inline gboolean
AddPortMapping (GUPnPServiceProxy *proxy,
                char * in_NewRemoteHost,
                unsigned int in_NewExternalPort,
                char * in_NewProtocol,
                unsigned int in_NewInternalPort,
                char * in_NewInternalClient,
                gboolean in_NewEnabled,
                char * in_NewPortMappingDescription,
                unsigned int in_NewLeaseDuration,
                GError **error);</pre>
<p>
  Well, now there is.  I've put
  the <a href="http://burtonini.com/computing/gupnp-bind.py">initial code
  here</a> but will be moving this into GUPnP itself shortly.  The next task is
  to add asynchronous wrappers just as in dbus-glib, but that shouldn't be too
  hard.
</p>
]]></content:encoded><category domain="http://www.burtonini.com">/computers</category><dc:date>2008-05-22T15:25:00Z</dc:date></item></channel></rss>