Re: [gupnp] [PATCH] Respond to M-SEARCH requests for urns specifying an eligible version



On Thursday 10 June 2010 05:17:56 pm Zeeshan Ali (Khattak) wrote:
> Hi,
>
> > From bd8a30b61dcd5ad29259a575ce1095f3f9b15462 Mon Sep 17 00:00:00 2001
> > From: Stephen Depooter <stephend xandros com>
> > Date: Wed, 9 Jun 2010 15:51:11 -0400
> > Subject: [PATCH] Respond to M-SEARCH requests for urns specifying an
> > eligible version
> >
> > UPNP requires that we only respond to M-SEARCH requests for urn:
> > interfaces where we implement a compatible version of the specified
> > interface.
>
>   Thanks for submitting patch. Two things:
>
> 1. Could you please provide a reference for this requirement?
> 2. You patch includes unrelated changes so please remove those.

Patch updated:
Description of the requirement in UPNP Device Architecture added to 
description.

Extra white space fixes removed.

I have attached the patch as well as inlined it to ensure that at least one 
copy comes through cleanly.


--

From 56c7761d56c5ee8dd46eaa049e2dd1499a1918e2 Mon Sep 17 00:00:00 2001
From: Stephen Depooter <stephend xandros com>
Date: Mon, 14 Jun 2010 15:57:52 -0400
Subject: [PATCH] Respond to M-SEARCH requests for urns specifying an eligable 
version

UPNP requires that we only respond to M-SEARCH requests for urn:
queries where we implement a compatible version of the specified
interface.  This is documented in UPNP Device Architecture version 1.1
section 1.3.2.
---
 libgssdp/gssdp-resource-group.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/libgssdp/gssdp-resource-group.c b/libgssdp/gssdp-resource-group.c
index 9a98409..e61e87d 100644
--- a/libgssdp/gssdp-resource-group.c
+++ b/libgssdp/gssdp-resource-group.c
@@ -737,9 +737,11 @@ message_received_cb (GSSDPClient        *client,
                      gpointer            user_data)
 {
         GSSDPResourceGroup *resource_group;
-        const char *target, *mx_str;
+        const char *target, *mx_str, *target_version_str;
         gboolean want_all;
+        gboolean do_version_match;
         int mx;
+        int target_version;
         GList *l;
 
         resource_group = GSSDP_RESOURCE_GROUP (user_data);
@@ -760,6 +762,16 @@ message_received_cb (GSSDPClient        *client,
                 return;
         }
 
+	target_version = 0;
+        do_version_match = (strncmp (target, "urn:", 4) == 0);
+        if (do_version_match) {
+                /* target is a URN, need to deal with version. */
+                target_version_str = g_strrstr (target, ":") + 1;
+                target_version = atoi(target_version_str);
+        }
+
+
+
         /* Is this the "ssdp:all" target? */
         want_all = (strcmp (target, GSSDP_ALL_RESOURCES) == 0);
 
@@ -781,6 +793,16 @@ message_received_cb (GSSDPClient        *client,
                                    target,
                                    0,
                                    NULL)) {
+                        if (do_version_match) {
+                                char* resource_version_str = 
g_strrstr(resource->target, ":") + 1;
+                                int resource_version = 
atoi(resource_version_str);
+                                if (target_version > resource_version)
+                                        continue;
+			}
+
+
+
+
                         /* Match. */
                         guint timeout;
                         DiscoveryResponse *response;
-- 
1.5.6.5



-- 
Stephen Depooter
<stephend xandros com>
From 56c7761d56c5ee8dd46eaa049e2dd1499a1918e2 Mon Sep 17 00:00:00 2001
From: Stephen Depooter <stephend xandros com>
Date: Mon, 14 Jun 2010 15:57:52 -0400
Subject: [PATCH] Respond to M-SEARCH requests for urns specifying an eligable version

UPNP requires that we only respond to M-SEARCH requests for urn:
queries where we implement a compatible version of the specified
interface.  This is documented in UPNP Device Architecture version 1.1
section 1.3.2.
---
 libgssdp/gssdp-resource-group.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/libgssdp/gssdp-resource-group.c b/libgssdp/gssdp-resource-group.c
index 9a98409..e61e87d 100644
--- a/libgssdp/gssdp-resource-group.c
+++ b/libgssdp/gssdp-resource-group.c
@@ -737,9 +737,11 @@ message_received_cb (GSSDPClient        *client,
                      gpointer            user_data)
 {
         GSSDPResourceGroup *resource_group;
-        const char *target, *mx_str;
+        const char *target, *mx_str, *target_version_str;
         gboolean want_all;
+        gboolean do_version_match;
         int mx;
+        int target_version;
         GList *l;
 
         resource_group = GSSDP_RESOURCE_GROUP (user_data);
@@ -760,6 +762,16 @@ message_received_cb (GSSDPClient        *client,
                 return;
         }
 
+	target_version = 0;
+        do_version_match = (strncmp (target, "urn:", 4) == 0);
+        if (do_version_match) {
+                /* target is a URN, need to deal with version. */
+                target_version_str = g_strrstr (target, ":") + 1;
+                target_version = atoi(target_version_str);
+        }
+
+
+
         /* Is this the "ssdp:all" target? */
         want_all = (strcmp (target, GSSDP_ALL_RESOURCES) == 0);
 
@@ -781,6 +793,16 @@ message_received_cb (GSSDPClient        *client,
                                    target,
                                    0,
                                    NULL)) {
+                        if (do_version_match) {
+                                char* resource_version_str = g_strrstr(resource->target, ":") + 1;
+                                int resource_version = atoi(resource_version_str);
+                                if (target_version > resource_version)
+                                        continue;
+			}
+
+
+
+
                         /* Match. */
                         guint timeout;
                         DiscoveryResponse *response;
-- 
1.5.6.5



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