[reSIProcate] [resiprocate] New headers and parameters from RFC 3455 and UUI drafts (#6)

Dario Bozzali Dario.Bozzali at ifmgroup.it
Wed Oct 8 04:58:23 CDT 2014


Hi all,
I added a couple of tests in testParserCategories.cxx to test new class TokenOrQuotedStringCategory.
Executing tests I found a bug in my code (so tests were useful… ☺), since I had to use defineParam2 to define purpose parameter since it used in both GenericUri and TokenOrQuotedStringCategory (otherwise purpose parameter factory is undefined for TokenOrQuotedStringCategory objects).
Please have a look at code in pull request and let me know if you have additional suggestions.
Best regards,
Dario

From: resiprocate-devel [mailto:resiprocate-devel-bounces at resiprocate.org] On Behalf Of Dario Bozzali
Sent: lunedì 6 ottobre 2014 18.12
To: 'Scott Godin'
Cc: resiprocate-devel at resiprocate.org
Subject: Re: [reSIProcate] [resiprocate] New headers and parameters from RFC 3455 and UUI drafts (#6)

Hi Scott,
I committed in the pull request the class TokenOrQuotedStringCategory, that can be used also for P-Visited-Network-ID.
I changed makefile and project files to build TokenOrQuotedStringCategory.cxx and Travis CI builds successfully.
I tested new class on my system using User-to-User header.
Could you please check if pull request could be ok now?
Best regards,
Dario.

From: slgodin at gmail.com<mailto:slgodin at gmail.com> [mailto:slgodin at gmail.com] On Behalf Of Scott Godin
Sent: lunedì 6 ottobre 2014 16.56
To: Dario Bozzali
Cc: resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
Subject: Re: [reSIProcate] [resiprocate] New headers and parameters from RFC 3455 and UUI drafts (#6)

> Do you think that it could also be necessary / useful having a class to handle tokens without a value like P-Charging-Vector?

Here is the grammar for P-Charging-Vector:

      P-Charging-Vector     = "P-Charging-Vector" HCOLON icid-value

                              *(SEMI charge-params)

      charge-params         = icid-gen-addr / orig-ioi /

                              term-ioi / generic-param

      icid-value            = "icid-value" EQUAL gen-value

      icid-gen-addr         = "icid-generated-at" EQUAL host

      orig-ioi              = "orig-ioi" EQUAL gen-value

      term-ioi              = "term-ioi" EQUAL gen-value



Looks to me like icid-value=<?> is actually the token value and not a parameter (even  though it looks like a parameter) - also it is not optional like other parameters.  I think John Gregg's treatment of this header makes sense.  Defining a new header category is possible, but seems overkill to me.



Scott

On Sat, Oct 4, 2014 at 7:05 AM, Dario Bozzali <Dario.Bozzali at ifmgroup.it<mailto:Dario.Bozzali at ifmgroup.it>> wrote:

Hi Scott,

I will try to create the new class next week.

I think that I could take the same approach used for QuotedDataParameter, deriving class from Token and adding a data member mQuoted that is set while parsing and it is used to encode stream.

Do you think that it could also be necessary / useful having a class to handle tokens without a value like P-Charging-Vector?

Maybe I could try to write also a class like TokenWithoutValue or ParametersToken (any suggestions for the name would be appreciated): value might contain the complete string with all the parameters, but in first position we expect a parameter (param=value;...), so when we stream the object we don't put ';' at the start of the string.

Best regards,

Dario



________________________________
Da: slgodin at gmail.com<mailto:slgodin at gmail.com> [slgodin at gmail.com<mailto:slgodin at gmail.com>] per conto di Scott Godin [sgodin at sipspectrum.com<mailto:sgodin at sipspectrum.com>]
Inviato: venerdì 3 ottobre 2014 17.50
A: Dario Bozzali
Cc: resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
Oggetto: Re: [reSIProcate] [resiprocate] New headers and parameters from RFC 3455 and UUI drafts (#6)
Sorry for my mistake in the last email - QuotedDataParameter is for parameters not headers.   You could use the StringCategory type, but then you won't get any special stack handling of header parameters.

I think the proper solution is to create a custom header parser class (like WarningCategory) that will handle a token or quoted string and the parameters that go with it (named something like: TokenOrQuotedStringCategory).

Scott


On Fri, Oct 3, 2014 at 6:28 AM, Dario Bozzali <Dario.Bozzali at ifmgroup.it<mailto:Dario.Bozzali at ifmgroup.it>> wrote:
Hello Scott,
In draft-ietf-cuss-sip-uui-17 draft (section 4.1) the value of User-to-User header is defined as a token or a quoted string.

UUI         = "User-to-User" HCOLON uui-value *(COMMA uui-value)
uui-value   = uui-data *(SEMI uui-param)
uui-data    = token / quoted-string
uui-param   = pkg-param / cont-param / enc-param / generic-param
pkg-param   = "purpose" EQUAL pkg-param-value
pkg-param-value = token
cont-param  = "content" EQUAL cont-param-value
cont-param-value = token
enc-param   = "encoding" EQUAL enc-param-value
enc-param-value = token / "hex"

Maybe Token is a proper type for UUI value, but like in the case of P-Charging-Vector header we must handle “special cases”. Something similar to the following code:

Data uuiData(Data::from(msg.header(h_UserToUser).c_str()));
ParseBuffer uuiBuffer(uuiData);
if (!uuiBuffer.eof()) {
    try {
        // extract the UUI value
        const char* uuiStart = uuiBuffer.skipWhitespace();
        const char* uuiEnd = NULL;
        if (*uuiBuffer.position() == Symbols::DOUBLE_QUOTE[0]) {
            uuiBuffer.skipChar();
           uuiStart = uuiBuffer.position();
            uuiEnd = uuiBuffer.skipToEndQuote();
       }
        else {
            uuiEnd = uuiBuffer.skipToChar(';');
        }
        if ((int)(uuiEnd - uuiStart) >= 0) {
            Data uuiDataValue;
            uuiBuffer.data(uuiDataValue, uuiStart);
            // use uuiDataValue
        }
    }
    catch (resip::BaseException& ex) {
        // handle parsing error, if any
    }
}

What is your opinion? Can we continue to use Token type?

Best regards,
Dario.

From: slgodin at gmail.com<mailto:slgodin at gmail.com> [mailto:slgodin at gmail.com<mailto:slgodin at gmail.com>] On Behalf Of Scott Godin
Sent: giovedì 2 ottobre 2014 21.44
To: Dario Bozzali
Cc: resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
Subject: Re: [reSIProcate] [resiprocate] New headers and parameters from RFC 3455 and UUI drafts (#6)

>Scenario 1 related to User-to-User header.
>How to parse the following header?
>User-to-User: "the quick silver fox jumped over the lazy brown dog";encoding=hex
>When I try to get the value of the header I obtain the string ""the" because Token::parse() method skip till first whitespace or semicolon.

Perhaps the header type you used is wrong then.  If the Data is always quoted you should use QuotedDataParameter instead of Token.

Scott

On Thu, Oct 2, 2014 at 9:43 AM, Dario Bozzali <Dario.Bozzali at ifmgroup.it<mailto:Dario.Bozzali at ifmgroup.it>> wrote:
Hi all,
I'm executing some additional tests on new headers. I have a couple of doubts, but I don't know if there is a bug in the pull request or in my test scenarios.

Scenario 1 related to User-to-User header.
How to parse the following header?
User-to-User: "the quick silver fox jumped over the lazy brown dog";encoding=hex
When I try to get the value of the header I obtain the string ""the" because Token::parse() method skip till first whitespace or semicolon.

Scenario 2 related to P-Charging-Vector header.
P-Charging-Value has icid-value mandatory parameter and other optional parameters. I understood that it should be modelled as a Token with empty value, but in this way one ";" is inserted before icid-value.
Example:
        P-Charging-Vector: ;icid-value=B6012049-0080-42D3-982E-473B24816316;icid-generated-at=192.168.56.1;orig-ioi=myserver

What is the right way to set header value?
Should I use a icid-value parameter to set P-Charging-Vector value?

Something like this:

        Token chargingVectorToken;
        DataParameter icidValueParam(ParameterTypes::icidValue);
        icidValueParam.value() = Data("B6012049-0080-42D3-982E-473B24816316");
        Data icidData;
        DataStream icidDataStream(icidData);
        icidValueParam.encode(icidDataStream);
        chargingVectorToken.value() = icidData;
        chargingVectorToken.param(p_icidGeneratedAt) = Data("192.168.56.1");
        chargingVectorToken.param(p_origIoi) = Data("myserver");

Maybe John Gregg could help me on this.

Thank you in advance and kind regards.

Dario

-----Original Message-----
From: resiprocate-devel [mailto:resiprocate-devel-bounces at resiprocate.org<mailto:resiprocate-devel-bounces at resiprocate.org>] On Behalf Of Dario Bozzali
Sent: martedì 23 settembre 2014 18.34
To: 'Daniel Pocock'
Cc: resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
Subject: Re: [reSIProcate] [resiprocate] New headers and parameters from RFC 3455 and UUI drafts (#6)

Hi Daniel,
Excluding DayOfWeekHash and MonthHash from build I was able to compile without changing DateCategory.cxx.
DayOfWeekHash and MonthHash are built because tool configured in project is "C/C++ Compiler Tool" instead of "Custom Build Tool" as per other header files.

Regards,
Dario.

-----Original Message-----
From: Daniel Pocock [mailto:daniel at pocock.pro<mailto:daniel at pocock.pro>]
Sent: martedì 23 settembre 2014 18.24
To: Dario Bozzali
Cc: resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
Subject: Re: [resiprocate] New headers and parameters from RFC 3455 and UUI drafts (#6)


Hi Dario,

I notice that MethodHash is including string.h and ctype.h so I've added those same includes to DateCategory.cxx so they will be included before DayOfWeekHash and MonthHash

Can you just confirm, Visual Studio is not trying to compile these cxx files into separate objects?  It should only be including them when it compiles DateCategory.cxx so they should all become part of the object file DateCategory.o

Regards,

Daniel

On 23/09/14 18:08, Dario Bozzali wrote:
> Hi Daniel,
> Below I reported the output obtained using Visual Studio 2005 to build master.
> Dario.
>
> 1>DayOfWeekHash.cxx
> 1>dayofweek.gperf(5) : error C2146: syntax error : missing ';' before identifier 'type'
> 1>dayofweek.gperf(5) : error C4430: missing type specifier - int
> 1>assumed. Note: C++ does not support default-int
> 1>dayofweek.gperf(5) : error C4430: missing type specifier - int
> 1>assumed. Note: C++ does not support default-int
> 1>dayofweek.gperf(13) : error C2065: 'Sat' : undeclared identifier
> 1>dayofweek.gperf(13) : error C2078: too many initializers
> 1>dayofweek.gperf(8) : error C2065: 'Mon' : undeclared identifier
> 1>dayofweek.gperf(7) : error C2065: 'Sun' : undeclared identifier
> 1>dayofweek.gperf(10) : error C2065: 'Wed' : undeclared identifier
> 1>dayofweek.gperf(11) : error C2065: 'Thu' : undeclared identifier
> 1>dayofweek.gperf(12) : error C2065: 'Fri' : undeclared identifier
> 1>dayofweek.gperf(9) : error C2065: 'Tue' : undeclared identifier
> 1>dayofweek.gperf(20) : error C3861: 'strncmp': identifier not found
> 1>MonthHash.cxx
> 1>month.gperf(5) : error C2146: syntax error : missing ';' before identifier 'type'
> 1>month.gperf(5) : error C4430: missing type specifier - int assumed.
> 1>Note: C++ does not support default-int
> 1>month.gperf(5) : error C4430: missing type specifier - int assumed.
> 1>Note: C++ does not support default-int
> 1>month.gperf(12) : error C2065: 'Jun' : undeclared identifier
> 1>month.gperf(12) : error C2078: too many initializers
> 1>month.gperf(13) : error C2065: 'Jul' : undeclared identifier
> 1>month.gperf(7) : error C2065: 'Jan' : undeclared identifier
> 1>month.gperf(11) : error C2065: 'May' : undeclared identifier
> 1>month.gperf(8) : error C2065: 'Feb' : undeclared identifier
> 1>month.gperf(9) : error C2065: 'Mar' : undeclared identifier
> 1>month.gperf(10) : error C2065: 'Apr' : undeclared identifier
> 1>month.gperf(18) : error C2065: 'Dec' : undeclared identifier
> 1>month.gperf(14) : error C2065: 'Aug' : undeclared identifier
> 1>month.gperf(15) : error C2065: 'Sep' : undeclared identifier
> 1>month.gperf(16) : error C2065: 'Oct' : undeclared identifier
> 1>month.gperf(17) : error C2065: 'Nov' : undeclared identifier
> 1>month.gperf(28) : error C3861: 'strncmp': identifier not found
>
> -----Original Message-----
> From: Daniel Pocock [mailto:daniel at pocock.pro<mailto:daniel at pocock.pro>]
> Sent: martedì 23 settembre 2014 17.48
> To: Dario Bozzali
> Cc: resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
> Subject: Re: [resiprocate] New headers and parameters from RFC 3455
> and UUI drafts (#6)
>
>
>
> On 23/09/14 17:42, Dario Bozzali wrote:
>> Hi Daniel,
>> I solved the compiling issue changing Visual Studio project settings to exclude DayOfWeekHash.cxx and MonthHash.cxx from build. I commit this change for every VS version.
>> Now I will take a look at conflict issue.
>
>
> That sounds odd.  If you checkout the master branch, without any of your changes, does it build with those files included?
>
> If it doesn't build on master, can you tell me what error it gives?
>

_______________________________________________
resiprocate-devel mailing list
resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel

_______________________________________________
resiprocate-devel mailing list
resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20141008/e6ee6a4b/attachment.htm>


More information about the resiprocate-devel mailing list