[libdmapsharing] Add transport protocol record to DMAPMdnsBrowserService Signed-off-by: W. Michael Petullo <mike flyn



commit 39fee49a22b96e37e31a3f21b5d5fdebacf017a1
Author: W. Michael Petullo <mike flyn org>
Date:   Mon May 23 14:42:45 2011 -0500

    Add transport protocol record to DMAPMdnsBrowserService
    Signed-off-by: W. Michael Petullo <mike flyn org>

 TODO                                     |    3 +++
 distro/libdmapsharing.spec               |    2 +-
 libdmapsharing/dmap-mdns-browser-avahi.c |   11 +++++++++--
 libdmapsharing/dmap-mdns-browser.h       |   12 +++++++++++-
 4 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/TODO b/TODO
index 15722af..771a06d 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,8 @@
 = Short term ===================================================================
 
+Add more txt record handling to browser. Add comments indicating that
+we should subclass for DACP and RAOP.
+
 Noah: DNS-SD implementation
 	Finish browser side support.
 	Update MacPorts port to no longer require avahi.
diff --git a/distro/libdmapsharing.spec b/distro/libdmapsharing.spec
index 6c864ad..3cbaf15 100644
--- a/distro/libdmapsharing.spec
+++ b/distro/libdmapsharing.spec
@@ -1,5 +1,5 @@
 Name: libdmapsharing
-Version: 2.9.8
+Version: 2.9.10
 Release: 1%{?dist}
 License: LGPLv2+
 Source: http://www.flyn.org/projects/libdmapsharing/libdmapsharing-%{version}.tar.gz
diff --git a/libdmapsharing/dmap-mdns-browser-avahi.c b/libdmapsharing/dmap-mdns-browser-avahi.c
index 12890fc..7ee0d79 100644
--- a/libdmapsharing/dmap-mdns-browser-avahi.c
+++ b/libdmapsharing/dmap-mdns-browser-avahi.c
@@ -359,7 +359,8 @@ resolve_cb (AvahiServiceResolver * service_resolver,
 	    DMAPMdnsBrowser * browser)
 {
 	gchar *name = NULL;
-	gchar *pair = NULL;	/* FIXME: extract DACP-specific items into sub-class? See also howl code. */
+	gchar *pair = NULL;	/* FIXME: extract DACP-specific items into sub-class. Ensure in Howl and dns-sd code too. */
+	DMAPMdnsBrowserTransportProtocol transport_protocol = DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_TCP; // FIXME: subclass
 	gchar host[AVAHI_ADDRESS_STR_MAX];
 	gboolean pp = FALSE;
 	DMAPMdnsBrowserService *service;
@@ -412,6 +413,11 @@ resolve_cb (AvahiServiceResolver * service_resolver,
 				} else if (strcmp (key, "Pair") == 0) {
 					/* Pair is used when first connecting to a DACP remote */
 					pair = g_strdup (value);
+				} else if (strcmp (key, "tp") == 0) {
+					/* RAOP transport protocol */
+					transport_protocol = strstr (value, "UDP")
+					                   ? DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_UDP
+							   : DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_TCP;
 				}
 
 				g_free (key);
@@ -430,7 +436,8 @@ resolve_cb (AvahiServiceResolver * service_resolver,
 		service->name = name;
 		service->host = g_strdup (host);
 		service->port = port;
-		service->pair = pair;
+		service->pair = pair; // FIXME: subclass
+		service->transport_protocol = transport_protocol; // FIXME: subclass
 		service->password_protected = pp;
 		browser->priv->services =
 			g_slist_append (browser->priv->services, service);
diff --git a/libdmapsharing/dmap-mdns-browser.h b/libdmapsharing/dmap-mdns-browser.h
index 5b46ec0..65b6ce3 100644
--- a/libdmapsharing/dmap-mdns-browser.h
+++ b/libdmapsharing/dmap-mdns-browser.h
@@ -87,6 +87,15 @@ typedef enum
 	DMAP_MDNS_BROWSER_SERVICE_TYPE_LAST = DMAP_MDNS_BROWSER_SERVICE_TYPE_RAOP
 } DMAPMdnsBrowserServiceType;
 
+// FIXME: this is only for RAOP and corresponds to the "tp" txt record.
+// This should be in a sub-class.
+typedef enum
+{
+	DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_TCP = 0,
+	DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_UDP,
+	DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_LAST = DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_UDP
+} DMAPMdnsBrowserTransportProtocol;
+
 static const char * const service_type_name[] = {
 	NULL,
 	"_daap._tcp",
@@ -108,7 +117,8 @@ struct _DMAPMdnsBrowserService
 	gchar *host;
 	guint port;
 	gboolean password_protected;
-	gchar *pair;
+	gchar *pair;                                         // FIXME: subclass
+	DMAPMdnsBrowserTransportProtocol transport_protocol; // FIXME: subclass
 };
 
 struct _DMAPMdnsBrowserClass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]