Re: [rtcweb] Syntax issues in draft-ietf-rtcweb-sdp

Adam Roach <adam@nostrum.com> Sun, 03 December 2017 20:40 UTC

Return-Path: <adam@nostrum.com>
X-Original-To: rtcweb@ietfa.amsl.com
Delivered-To: rtcweb@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D1A40127011 for <rtcweb@ietfa.amsl.com>; Sun, 3 Dec 2017 12:40:49 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.88
X-Spam-Level:
X-Spam-Status: No, score=-1.88 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, T_SPF_HELO_PERMERROR=0.01, T_SPF_PERMERROR=0.01] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cbxEyEE7PEAC for <rtcweb@ietfa.amsl.com>; Sun, 3 Dec 2017 12:40:48 -0800 (PST)
Received: from nostrum.com (raven-v6.nostrum.com [IPv6:2001:470:d:1130::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F1EA0126D85 for <rtcweb@ietf.org>; Sun, 3 Dec 2017 12:40:47 -0800 (PST)
Received: from Svantevit.local (99-152-146-228.lightspeed.dllstx.sbcglobal.net [99.152.146.228]) (authenticated bits=0) by nostrum.com (8.15.2/8.15.2) with ESMTPSA id vB3KeebJ068689 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 3 Dec 2017 14:40:41 -0600 (CST) (envelope-from adam@nostrum.com)
X-Authentication-Warning: raven.nostrum.com: Host 99-152-146-228.lightspeed.dllstx.sbcglobal.net [99.152.146.228] claimed to be Svantevit.local
To: Harald Alvestrand <harald@alvestrand.no>, "rtcweb@ietf.org" <rtcweb@ietf.org>
Cc: draft-ietf-rtcweb-sdp@tools.ietf.org
References: <92b7b153-754a-0237-ad0a-6ec08c40e262@nostrum.com> <4615d633-dfc8-4ce5-593e-5c996046cecf@alvestrand.no>
From: Adam Roach <adam@nostrum.com>
Message-ID: <231d0e13-9a2d-0805-46ff-764547005135@nostrum.com>
Date: Sun, 03 Dec 2017 14:40:35 -0600
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:52.0) Gecko/20100101 Thunderbird/52.5.0
MIME-Version: 1.0
In-Reply-To: <4615d633-dfc8-4ce5-593e-5c996046cecf@alvestrand.no>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Content-Language: en-US
Archived-At: <https://mailarchive.ietf.org/arch/msg/rtcweb/R_SQWEUe8upBaGR-KLCpVouxlFI>
Subject: Re: [rtcweb] Syntax issues in draft-ietf-rtcweb-sdp
X-BeenThere: rtcweb@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Real-Time Communication in WEB-browsers working group list <rtcweb.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/rtcweb/>
List-Post: <mailto:rtcweb@ietf.org>
List-Help: <mailto:rtcweb-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 03 Dec 2017 20:40:50 -0000

On 12/3/17 2:22 PM, Harald Alvestrand wrote:
> Great to see attention on this!
>
> Nils Ohlmeier also wrote an extraction script
> (https://github.com/nils-ohlmeier/sdpextractor - I have suggested a PR
> that changes the file name format), do you want to publish yours too?
>

What I wrote was mostly done for the purpose of validating, so 
extraction is a very small part of it. It's also a bit fragile, in that 
it heavily relies on the exact format of the -08 XML source. With those 
caveats (and the warning that it's written in perl), the relevant 
portion of my script is:

#!/usr/bin/perl

my $source = 'draft-ietf-rtcweb-sdp-08.xml';

open(S, $source) || die $!;
$xml = join ('',<S>);
close (S);
$xml =~ s/<!--.*?-->//gos;

while ($xml =~ /<texttable anchor="[^"]*" 
title="([^"]*)">(.*?)<\/texttable>/gos) {
   my $title = $1;
   my $body = $2;
   my $column = 0;
   my $sdp = '';
   while ($body =~ /<c>(.*?)<\/c>/gos) {
     if ($column == 0){
       my $line = $1;
       $line =~ s/[ \t]*[\r\n]+[ \t]*/ /gos;
       if ($line !~ /\*\*/) {
         $sdp .= "$line\n";
       }
     }
     $column = 1 - $column;
   }
   &process($title, $sdp);
}

You'll have to write your own "process" subroutine to do whatever you 
want to happen with the extracted SDP.

/a