static gint compare_service (GUPnPServiceInfo *info1, GUPnPServiceInfo *info2) { const char *udn1; const char *udn2; udn1 = gupnp_service_info_get_udn (info1); udn2 = gupnp_service_info_get_udn (info2); return strcmp (udn1, udn2); }
static void got_introspection (GUPnPServiceInfo *info, GUPnPServiceIntrospection *introspection, const GError *error, G_GNUC_UNUSED gpointer user_data) { if (error) { g_warning ("Failed to create introspection for '%s': %s", gupnp_service_info_get_udn (info), error->message); return; } g_print ("service: %s\nlocation: %s\n", gupnp_service_info_get_udn (info), gupnp_service_info_get_location (info)); print_actions (introspection); print_state_variables (introspection); g_object_unref (introspection); }
static void _cp_service_unavail (GUPnPControlPoint *cp, GUPnPServiceProxy *proxy, GUPnPSimpleIgd *self) { guint i; for (i=0; i < self->priv->service_proxies->len; i++) { struct Proxy *prox = g_ptr_array_index (self->priv->service_proxies, i); if (prox->cp == cp && !strcmp (gupnp_service_info_get_udn (GUPNP_SERVICE_INFO (proxy)), gupnp_service_info_get_udn (GUPNP_SERVICE_INFO (prox->proxy)))) { free_proxy (prox); g_ptr_array_remove_index_fast (self->priv->service_proxies, i); break; } } }
void show_service_details (GUPnPServiceInfo *info) { char *details[32]; const SoupURI *uri; const char *str; int i = 0; details[i++] = _("Location"); str = gupnp_service_info_get_location (info); if (str) details[i++] = g_strdup (str); details[i++] = _("UDN"); str = gupnp_service_info_get_udn (info); if (str) details[i++] = g_strdup (str); details[i++] = _("Type"); str = gupnp_service_info_get_service_type (info); if (str) details[i++] = g_strdup (str); details[i++] = _("Base URL"); uri = gupnp_service_info_get_url_base (info); if (uri) details[i++] = soup_uri_to_string ((SoupURI *) uri, FALSE); details[i++] = _("Service ID"); details[i++] = gupnp_service_info_get_id (info); details[i++] = _("Service URL"); details[i++] = gupnp_service_info_get_scpd_url (info); details[i++] = _("Control URL"); details[i++] = gupnp_service_info_get_control_url (info); details[i++] = _("Event Subscription URL"); details[i++] = gupnp_service_info_get_event_subscription_url (info); details[i] = NULL; update_details ((const char **) details); /* Only free the values */ for (i = 1; details[i - 1]; i += 2) { if (details[i]) g_free (details[i]); } }
GUPnPDeviceInfo * get_service_device (GUPnPServiceInfo *service_info) { GUPnPDeviceInfo *info = NULL; GtkTreeModel *model; GtkTreeIter root_iter; GtkTreeIter iter; const char *udn; model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); g_assert (model != NULL); if (!gtk_tree_model_get_iter_first (model, &root_iter)) return NULL; udn = gupnp_service_info_get_udn (service_info); if (find_device (model, udn, &root_iter, &iter)) gtk_tree_model_get (model, &iter, 2, &info, -1); return info; }
static GList * find_service_node (GUPnPControlPoint *control_point, const char *udn, const char *service_type) { GList *l; l = control_point->priv->services; while (l) { GUPnPServiceInfo *info; info = GUPNP_SERVICE_INFO (l->data); if ((strcmp (gupnp_service_info_get_udn (info), udn) == 0) && (strcmp (gupnp_service_info_get_service_type (info), service_type) == 0)) break; l = l->next; } return l; }