[svn r243] Added features to dinamically recognize others MythTV servers using UPnP.
1.1 --- a/gmyth/autogen.sh Thu Jan 04 17:17:41 2007 +0000
1.2 +++ b/gmyth/autogen.sh Thu Jan 04 21:16:44 2007 +0000
1.3 @@ -23,6 +23,8 @@
1.4 . common/autogen-helper.sh
1.5
1.6 CONFIGURE_DEF_OPT='--enable-maintainer-mode'
1.7 +# uncomment below to disable the UPnP features
1.8 +#CONFIGURE_DEF_OPT+=' --disable-upnp'
1.9 CONFIGURE_EXT_OPT="$@"
1.10
1.11 autogen_options
2.1 --- a/gmyth/configure.ac Thu Jan 04 17:17:41 2007 +0000
2.2 +++ b/gmyth/configure.ac Thu Jan 04 21:16:44 2007 +0000
2.3 @@ -232,7 +232,7 @@
2.4 enable_upnp=yes)
2.5
2.6 if test "x$enable_upnp" = "xyes" ; then
2.7 - PKG_CHECK_MODULES(CYBERLINK,
2.8 + PKG_CHECK_MODULES(CYBERLINK_UPNP,
2.9 clinkc,
2.10 HAVE_CYBERLINK=yes, HAVE_CYBERLINK=no)
2.11 fi
3.1 --- a/gmyth/src/Makefile.am Thu Jan 04 17:17:41 2007 +0000
3.2 +++ b/gmyth/src/Makefile.am Thu Jan 04 21:16:44 2007 +0000
3.3 @@ -26,6 +26,11 @@
3.4 gmyth_uri.c \
3.5 $(BUILT_SOURCES)
3.6
3.7 +if WITH_UPNP
3.8 +libgmyth_la_SOURCES += \
3.9 + gmyth_upnp.c
3.10 +endif
3.11 +
3.12 EXTRA_libgmyth_la_SOURCES = gmyth_marshal.list
3.13
3.14 gmyth_marshal.h: gmyth_marshal.list
3.15 @@ -76,5 +81,10 @@
3.16 gmyth_backendinfo.h \
3.17 gmyth_programinfo.h \
3.18 gmyth_uri.h
3.19 +
3.20 +if WITH_UPNP
3.21 +libgmyth_include_HEADERS += \
3.22 + gmyth_upnp.h
3.23 +endif
3.24
3.25 CLEANFILES = $(BUILT_SOURCES)
4.1 --- a/gmyth/src/gmyth_backendinfo.c Thu Jan 04 17:17:41 2007 +0000
4.2 +++ b/gmyth/src/gmyth_backendinfo.c Thu Jan 04 21:16:44 2007 +0000
4.3 @@ -32,6 +32,10 @@
4.4 #include "gmyth_uri.h"
4.5 #include "gmyth_debug.h"
4.6
4.7 +#ifdef WITH_UPNP
4.8 +#include "gmyth_upnp.h"
4.9 +#endif
4.10 +
4.11 static void gmyth_backend_info_class_init (GMythBackendInfoClass *klass);
4.12 static void gmyth_backend_info_init (GMythBackendInfo *object);
4.13
4.14 @@ -107,7 +111,7 @@
4.15 {
4.16 GMythBackendInfo *backend_info =
4.17 GMYTH_BACKEND_INFO (g_object_new(GMYTH_BACKEND_INFO_TYPE, NULL));
4.18 -
4.19 +
4.20 gmyth_backend_info_set_hostname (backend_info, hostname);
4.21 gmyth_backend_info_set_username (backend_info, username);
4.22 gmyth_backend_info_set_password (backend_info, password);
4.23 @@ -145,8 +149,21 @@
4.24 gmyth_backend_info_set_hostname (GMythBackendInfo *backend_info, const gchar *hostname)
4.25 {
4.26 g_return_if_fail (backend_info != NULL);
4.27 -
4.28 - backend_info->hostname = g_strdup (hostname);
4.29 +
4.30 + if ( NULL == hostname || strlen(hostname) <= 0 )
4.31 + {
4.32 + #ifdef WITH_UPNP
4.33 + GMythUPnP *gmyth_upnp = gmyth_upnp_new( backend_info );
4.34 + backend_info = gmyth_upnp_get_backend_info( gmyth_upnp );
4.35 + backend_info->hostname = g_strdup ( gmyth_upnp_get_host( gmyth_upnp ) );
4.36 + g_object_unref( gmyth_upnp );
4.37 + #else
4.38 + gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." );
4.39 + return NULL;
4.40 + #endif
4.41 + } else {
4.42 + backend_info->hostname = g_strdup (hostname);
4.43 + }
4.44 }
4.45
4.46 void
4.47 @@ -178,7 +195,20 @@
4.48 {
4.49 g_return_if_fail (backend_info != NULL);
4.50
4.51 - backend_info->port = port;
4.52 + if ( port <= 0 )
4.53 + {
4.54 + #ifdef WITH_UPNP
4.55 + GMythUPnP *gmyth_upnp = gmyth_upnp_new( backend_info );
4.56 + backend_info = gmyth_upnp_get_backend_info( gmyth_upnp );
4.57 + backend_info->port = gmyth_upnp_get_port( gmyth_upnp );
4.58 + g_object_unref( gmyth_upnp );
4.59 + #else
4.60 + gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." );
4.61 + return NULL;
4.62 + #endif
4.63 + } else {
4.64 + backend_info->port = port;
4.65 + }
4.66 }
4.67
4.68 const gchar*
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/gmyth/src/gmyth_upnp.c Thu Jan 04 21:16:44 2007 +0000
5.3 @@ -0,0 +1,345 @@
5.4 +/**
5.5 + * GMyth Library
5.6 + *
5.7 + * @file gmyth/gmyth_upnp.c
5.8 + *
5.9 + * @brief <p> GMythUPnP allows that a MythTV frontend discovers a
5.10 + * MythTV backend, using the UPnP architecture.
5.11 + *
5.12 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
5.13 + * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
5.14 + *
5.15 + *//*
5.16 + *
5.17 + * This program is free software; you can redistribute it and/or modify
5.18 + * it under the terms of the GNU Lesser General Public License as published by
5.19 + * the Free Software Foundation; either version 2 of the License, or
5.20 + * (at your option) any later version.
5.21 + *
5.22 + * This program is distributed in the hope that it will be useful,
5.23 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.24 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.25 + * GNU General Public License for more details.
5.26 + *
5.27 + * You should have received a copy of the GNU Lesser General Public License
5.28 + * along with this program; if not, write to the Free Software
5.29 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5.30 + *
5.31 + */
5.32 +
5.33 +#include "gmyth_upnp.h"
5.34 +
5.35 +#include <arpa/inet.h>
5.36 +#include <sys/types.h>
5.37 +#include <sys/socket.h>
5.38 +#include <netdb.h>
5.39 +#include <errno.h>
5.40 +#include <stdlib.h>
5.41 +
5.42 +#include "gmyth_backendinfo.h"
5.43 +#include "gmyth_socket.h"
5.44 +#include "gmyth_uri.h"
5.45 +#include "gmyth_debug.h"
5.46 +
5.47 +#define GMYTH_UPNP_MAX_SEARCHS 10
5.48 +
5.49 +static void gmyth_upnp_class_init (GMythUPnPClass *klass);
5.50 +static void gmyth_upnp_init (GMythUPnP *object);
5.51 +
5.52 +static void gmyth_upnp_dispose (GObject *object);
5.53 +static void gmyth_upnp_finalize (GObject *object);
5.54 +
5.55 +static gboolean gmyth_upnp_initialize ( GMythUPnP *gmyth_upnp, GMythBackendInfo *gmyth_backend_info );
5.56 +
5.57 +static gboolean gmyth_upnp_print_cp_device_list( CgUpnpControlPoint* controlPt, gchar **udn,
5.58 + GList **mythtv_servers_lst );
5.59 +
5.60 +G_DEFINE_TYPE(GMythUPnP, gmyth_upnp, G_TYPE_OBJECT)
5.61 +
5.62 +static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
5.63 +
5.64 +static void
5.65 +gmyth_upnp_class_init (GMythUPnPClass *klass)
5.66 +{
5.67 + GObjectClass *gobject_class;
5.68 +
5.69 + gobject_class = (GObjectClass *) klass;
5.70 +
5.71 + gobject_class->dispose = gmyth_upnp_dispose;
5.72 + gobject_class->finalize = gmyth_upnp_finalize;
5.73 +}
5.74 +
5.75 +static void
5.76 +gmyth_upnp_init ( GMythUPnP *gmyth_upnp )
5.77 +{
5.78 + gmyth_upnp->upnp_dev_found = FALSE;
5.79 +
5.80 + gmyth_upnp->uri = NULL;
5.81 + gmyth_upnp->host = NULL;
5.82 + gmyth_upnp->port = 0;
5.83 + gmyth_upnp->protocol = NULL;
5.84 +
5.85 + gmyth_upnp->gmyth_backend_info = NULL;
5.86 +
5.87 + gmyth_upnp->control_point = NULL;
5.88 +
5.89 +}
5.90 +
5.91 +/** Creates a new instance of GMythUPnP.
5.92 + *
5.93 + * @return a new instance of GMythUPnP.
5.94 + */
5.95 +GMythUPnP *
5.96 +gmyth_upnp_new ( GMythBackendInfo *gmyth_backend_info )
5.97 +{
5.98 + GMythUPnP *gmyth_upnp = GMYTH_UPNP (g_object_new (GMYTH_UPNP_TYPE, NULL));
5.99 +
5.100 + gmyth_upnp->gmyth_backend_info = gmyth_backend_info;
5.101 +
5.102 + if ( !gmyth_upnp_initialize ( gmyth_upnp, gmyth_backend_info ) )
5.103 + return NULL;
5.104 +
5.105 + return gmyth_upnp;
5.106 +}
5.107 +
5.108 +static void
5.109 +gmyth_upnp_dispose (GObject *object)
5.110 +{
5.111 + GMythUPnP *gmyth_upnp = GMYTH_UPNP(object);
5.112 +
5.113 + if ( gmyth_upnp->control_point != NULL ) {
5.114 + cg_upnp_controlpoint_stop( gmyth_upnp->control_point );
5.115 + cg_upnp_controlpoint_delete( gmyth_upnp->control_point );
5.116 + gmyth_upnp->control_point = NULL;
5.117 + }
5.118 +
5.119 + if ( gmyth_upnp->uri != NULL ) {
5.120 + g_free ( gmyth_upnp->uri );
5.121 + gmyth_upnp->uri = NULL;
5.122 + }
5.123 +
5.124 + if ( gmyth_upnp->host != NULL ) {
5.125 + g_free ( gmyth_upnp->host );
5.126 + gmyth_upnp->host = NULL;
5.127 + }
5.128 +
5.129 + if ( gmyth_upnp->protocol != NULL ) {
5.130 + g_free ( gmyth_upnp->protocol );
5.131 + gmyth_upnp->protocol = NULL;
5.132 + }
5.133 +
5.134 + if ( gmyth_upnp->mythtv_servers != NULL ) {
5.135 + g_list_free( gmyth_upnp->mythtv_servers );
5.136 + gmyth_upnp->mythtv_servers = NULL;
5.137 + }
5.138 +
5.139 + G_OBJECT_CLASS (gmyth_upnp_parent_class)->dispose (object);
5.140 +}
5.141 +
5.142 +static void
5.143 +gmyth_upnp_finalize (GObject *object)
5.144 +{
5.145 + g_signal_handlers_destroy (object);
5.146 +
5.147 + G_OBJECT_CLASS (gmyth_upnp_parent_class)->finalize (object);
5.148 +}
5.149 +
5.150 +/**
5.151 + * Create a control point and start it.
5.152 + */
5.153 +static gboolean
5.154 +gmyth_upnp_initialize ( GMythUPnP *gmyth_upnp, GMythBackendInfo *gmyth_backend_info )
5.155 +{
5.156 +
5.157 + gboolean ret = FALSE;
5.158 +
5.159 + GMythURI* uri = NULL;
5.160 +
5.161 + guint iter_count = GMYTH_UPNP_MAX_SEARCHS;
5.162 +
5.163 + g_return_val_if_fail( gmyth_backend_info != NULL, FALSE );
5.164 +
5.165 + /* Create the cybergarage control point */
5.166 + gmyth_upnp->control_point = cg_upnp_controlpoint_new();
5.167 + /* cg_upnp_controlpoint_setdevicelistener( gmyth_upnp->control_point, device_listener ); */
5.168 +
5.169 + /* Start the control point */
5.170 + if ( cg_upnp_controlpoint_start( gmyth_upnp->control_point ) == FALSE)
5.171 + {
5.172 + gmyth_debug( "Unable to start UPnP control point!!!" );
5.173 + goto done;
5.174 + }
5.175 + else
5.176 + {
5.177 + gmyth_debug( "Control point started." );
5.178 + }
5.179 +
5.180 + while ( gmyth_upnp->upnp_dev_found == FALSE && ( --iter_count > 0 ) ) {
5.181 +
5.182 + gmyth_debug( "UPnP MythTV Client control point is searching MythTV AV Device server...\n" );
5.183 +
5.184 + if ( gmyth_upnp->control_point != NULL )
5.185 + cg_upnp_controlpoint_search ( gmyth_upnp->control_point,
5.186 + "urn:schemas-upnp-org:service:ContentDirectory:1" );
5.187 +
5.188 + /* just to avoid clinkc pthread concurrency faults */
5.189 + cg_wait( 1000 );
5.190 +
5.191 + /* discover if it was found */
5.192 + gmyth_upnp->upnp_dev_found = gmyth_upnp_print_cp_device_list( gmyth_upnp->control_point, &gmyth_upnp->udn,
5.193 + &gmyth_upnp->mythtv_servers );
5.194 +
5.195 + }
5.196 +
5.197 + if ( gmyth_upnp->upnp_dev_found ) {
5.198 +
5.199 + gmyth_debug( "Found UPnP MythTV AV Device...\n" );
5.200 +
5.201 + if ( g_list_first( gmyth_upnp->mythtv_servers ) != NULL && (g_list_first( gmyth_upnp->mythtv_servers ))->data != NULL )
5.202 + {
5.203 + gmyth_upnp->uri = (gchar*) (g_list_first( gmyth_upnp->mythtv_servers ))->data;
5.204 + uri = gmyth_uri_new_with_value( gmyth_upnp->uri );
5.205 +
5.206 + gmyth_upnp->host = gmyth_uri_get_host( uri );
5.207 + gmyth_upnp->port = gmyth_uri_get_port( uri );
5.208 + gmyth_upnp->protocol = gmyth_uri_get_protocol( uri );
5.209 +
5.210 + /* sets all the discovered data from the UPnP remote device, like host name, IP address, port,... */
5.211 + if ( NULL != gmyth_upnp->host )
5.212 + gmyth_backend_info_set_hostname ( gmyth_upnp->gmyth_backend_info, gmyth_upnp->host );
5.213 +
5.214 + if ( gmyth_upnp->port > 0 )
5.215 + gmyth_backend_info_set_port ( gmyth_upnp->gmyth_backend_info, gmyth_upnp->port );
5.216 +
5.217 + ret = TRUE;
5.218 + }
5.219 + }
5.220 +
5.221 +done:
5.222 +
5.223 + if ( uri != NULL )
5.224 + {
5.225 + g_object_unref( uri );
5.226 + uri = NULL;
5.227 + }
5.228 +
5.229 + return ret;
5.230 +
5.231 +}
5.232 +
5.233 +/**
5.234 + * Prints the Control Point's device list
5.235 + */
5.236 +static gboolean
5.237 +gmyth_upnp_print_cp_device_list( CgUpnpControlPoint* controlPt, gchar **udn, GList **mythtv_servers_lst )
5.238 +{
5.239 +
5.240 + g_return_val_if_fail( mythtv_servers_lst != NULL, FALSE );
5.241 + g_return_val_if_fail( controlPt != NULL, FALSE );
5.242 +
5.243 + gchar* mythtvFriendlyName = "Myth";
5.244 + /* begin assertion about the size of discovered devices */
5.245 + gint numDevices = cg_upnp_controlpoint_getndevices(controlPt);
5.246 + gint cntDevs = 0;
5.247 + //CgUpnpDeviceList *devList = NULL;
5.248 + CgUpnpDevice *childDev;
5.249 + gchar *devName = NULL, *dev_url = NULL;
5.250 + gboolean upnp_dev_found = FALSE;
5.251 +
5.252 + gmyth_debug( "UPnP MythTV AV Device list size = %d\n", numDevices );
5.253 +
5.254 + for ( childDev = cg_upnp_controlpoint_getdevices(controlPt); childDev != NULL;
5.255 + childDev = cg_upnp_device_next(childDev) ) {
5.256 + devName = cg_upnp_device_getfriendlyname(childDev);
5.257 + dev_url = cg_upnp_device_getlocationfromssdppacket( childDev );
5.258 + gmyth_debug( "Device's friendly name = %s, and device's URL = %s\n", devName, dev_url );
5.259 + if ( upnp_dev_found = ( g_strstr_len( devName, strlen( devName ), mythtvFriendlyName ) != NULL ) ) {
5.260 + *udn = cg_upnp_device_getudn( childDev );
5.261 + *mythtv_servers_lst = g_list_append( *mythtv_servers_lst, dev_url );
5.262 + }
5.263 + ++cntDevs;
5.264 + }
5.265 +
5.266 + if ( upnp_dev_found == TRUE ) {
5.267 + gmyth_debug( "MythTV AV Device found, from a total of %d devices.\n", cntDevs );
5.268 + } else if ( numDevices == cntDevs ) {
5.269 + gmyth_debug( "MythTV AV Device not found, from a total of %d devices.\n", cntDevs );
5.270 + } else {
5.271 + gmyth_debug( "Control Point's MythTV AV Device count is wrong: iterated over %d devices, but there are %d registered devices.\n", cntDevs, numDevices );
5.272 + }
5.273 +
5.274 + return upnp_dev_found;
5.275 +
5.276 +}
5.277 +
5.278 +/** Gets the GMythBackendInfo host object associated to this upnp.
5.279 + *
5.280 + * @return The string host object currently valid or NULL if the settings
5.281 + * were not opened.
5.282 + */
5.283 +gchar*
5.284 +gmyth_upnp_get_host ( GMythUPnP *gmyth_upnp )
5.285 +{
5.286 +
5.287 + if ( NULL == gmyth_upnp || NULL == gmyth_upnp->host )
5.288 + {
5.289 + gmyth_debug ("[%s] GMythUPnP host field not initialized\n", __FUNCTION__);
5.290 + return NULL;
5.291 + }
5.292 +
5.293 + return gmyth_upnp->host;
5.294 +}
5.295 +
5.296 +/** Gets the GMythBackendInfo port object associated to this upnp.
5.297 + *
5.298 + * @return The string object currently valid or NULL if the port number.
5.299 + */
5.300 +gint
5.301 +gmyth_upnp_get_port( GMythUPnP *gmyth_upnp )
5.302 +{
5.303 +
5.304 + if ( NULL == gmyth_upnp || gmyth_upnp->port <= 0 )
5.305 + {
5.306 + gmyth_debug ("[%s] GMythUPnP host field not initialized\n", __FUNCTION__);
5.307 + return NULL;
5.308 + }
5.309 +
5.310 + return gmyth_upnp->port;
5.311 +}
5.312 +
5.313 +/** Gets the UPnP AV devices server's list associated to this upnp.
5.314 + *
5.315 + * @return The GList* containing all the URI values for each recognized UPnP device,
5.316 + * or NULL if it couldn't recognize any MythTV AV device.
5.317 + */
5.318 +GList*
5.319 +gmyth_upnp_get_servers ( GMythUPnP *gmyth_upnp )
5.320 +{
5.321 +
5.322 + if ( NULL == gmyth_upnp || NULL == gmyth_upnp->mythtv_servers )
5.323 + {
5.324 + gmyth_debug ("[%s] GMythUPnP has no MythTV servers recognized.\n", __FUNCTION__);
5.325 + return NULL;
5.326 + }
5.327 +
5.328 + return gmyth_upnp->mythtv_servers;
5.329 +}
5.330 +
5.331 +/** Gets the GMythBackendInfo object associated to this upnp.
5.332 + *
5.333 + * @return The GMythBackendInfo object currently valid or NULL if the settings
5.334 + * were not opened.
5.335 + */
5.336 +GMythBackendInfo*
5.337 +gmyth_upnp_get_backend_info ( GMythUPnP *gmyth_upnp )
5.338 +{
5.339 +
5.340 + if ( NULL == gmyth_upnp || NULL == gmyth_upnp->gmyth_backend_info )
5.341 + {
5.342 + gmyth_debug ("[%s] GMythUPnP not initialized\n", __FUNCTION__);
5.343 + return NULL;
5.344 + }
5.345 +
5.346 + return gmyth_upnp->gmyth_backend_info;
5.347 +}
5.348 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/gmyth/src/gmyth_upnp.h Thu Jan 04 21:16:44 2007 +0000
6.3 @@ -0,0 +1,96 @@
6.4 +/**
6.5 + * GMyth Library
6.6 + *
6.7 + * @file gmyth/gmyth_uri.h
6.8 + *
6.9 + * @brief <p> GMythURI utils
6.10 + * - Extracts and parses a URI char string, in according with the RFC 2396
6.11 + * [http://www.ietf.org/rfc/rfc2396.txt]
6.12 + *
6.13 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
6.14 + * @author Rosfran Borges <rosfran.borges@indt.org.br>
6.15 + *
6.16 + *//*
6.17 + *
6.18 + * This program is free software; you can redistribute it and/or modify
6.19 + * it under the terms of the GNU Lesser General Public License as published by
6.20 + * the Free Software Foundation; either version 2 of the License, or
6.21 + * (at your option) any later version.
6.22 + *
6.23 + * This program is distributed in the hope that it will be useful,
6.24 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.25 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.26 + * GNU General Public License for more details.
6.27 + *
6.28 + * You should have received a copy of the GNU Lesser General Public License
6.29 + * along with this program; if not, write to the Free Software
6.30 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6.31 + */
6.32 +
6.33 +#ifndef _GMYTH_UPNP_H_
6.34 +#define _GMYTH_UPNP_H_
6.35 +
6.36 +#include <glib.h>
6.37 +#include <glib-object.h>
6.38 +
6.39 +#include <stdlib.h>
6.40 +#include <stdio.h>
6.41 +#include <string.h>
6.42 +
6.43 +#include <cybergarage/upnp/cupnp.h>
6.44 +#include "gmyth_backendinfo.h"
6.45 +
6.46 +G_BEGIN_DECLS
6.47 +
6.48 +#define GMYTH_UPNP_TYPE (gmyth_upnp_get_type ())
6.49 +#define GMYTH_UPNP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_UPNP_TYPE, GMythUPnP))
6.50 +#define GMYTH_UPNP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_UPNP_TYPE, GMythUPnPClass))
6.51 +#define IS_GMYTH_UPNP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_UPNP_TYPE))
6.52 +#define IS_GMYTH_UPNP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_UPNP_TYPE))
6.53 +#define GMYTH_UPNP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_UPNP_TYPE, GMythUPnPClass))
6.54 +
6.55 +typedef struct _GMythUPnP GMythUPnP;
6.56 +typedef struct _GMythUPnPClass GMythUPnPClass;
6.57 +
6.58 +/****************************************
6.59 +* Data Type
6.60 +****************************************/
6.61 +
6.62 +struct _GMythUPnPClass
6.63 +{
6.64 + GObjectClass parent_class;
6.65 +
6.66 + /* callbacks */
6.67 + /* no one for now */
6.68 +};
6.69 +
6.70 +struct _GMythUPnP {
6.71 +
6.72 + GObject parent;
6.73 +
6.74 + gchar *uri;
6.75 + gchar *host;
6.76 + gint port;
6.77 + gchar *protocol;
6.78 +
6.79 + CgUpnpControlPoint* control_point;
6.80 +
6.81 + gchar *udn;
6.82 +
6.83 + GMythBackendInfo *gmyth_backend_info;
6.84 +
6.85 + GList* mythtv_servers;
6.86 +
6.87 + gboolean upnp_dev_found;
6.88 +
6.89 +};
6.90 +
6.91 +GType gmyth_upnp_get_type (void);
6.92 +GMythUPnP * gmyth_upnp_new ( GMythBackendInfo *gmyth_backend_info );
6.93 +gchar* gmyth_upnp_get_host ( GMythUPnP *gmyth_upnp );
6.94 +gint gmyth_upnp_get_port ( GMythUPnP *gmyth_upnp );
6.95 +GMythBackendInfo* gmyth_upnp_get_backend_info ( GMythUPnP *gmyth_upnp );
6.96 +
6.97 +G_END_DECLS
6.98 +
6.99 +#endif /* _GMYTH_UPNP_H_ */