Commit c012afe7 authored by Erwan Croze's avatar Erwan Croze 👋🏻

Fix belle sip grammar to comply to RFC1123-2.1 for hostname

parent 94ef984f
......@@ -2,7 +2,7 @@
* This C source file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sdp.g
* - On : 2018-08-07 09:33:26
* - On : 2018-08-08 15:41:42
* - for the lexer : belle_sdpLexerLexer
*
* Editing it, at least manually, is not wise.
......
......@@ -2,7 +2,7 @@
* This C header file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sdp.g
* - On : 2018-08-07 09:33:26
* - On : 2018-08-08 15:41:42
* - for the lexer : belle_sdpLexerLexer
*
* Editing it, at least manually, is not wise.
......
......@@ -2,7 +2,7 @@
* This C source file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sdp.g
* - On : 2018-08-07 09:33:25
* - On : 2018-08-08 15:41:41
* - for the parser : belle_sdpParserParser
*
* Editing it, at least manually, is not wise.
......
......@@ -2,7 +2,7 @@
* This C header file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sdp.g
* - On : 2018-08-07 09:33:25
* - On : 2018-08-08 15:41:41
* - for the parser : belle_sdpParserParser
*
* Editing it, at least manually, is not wise.
......
......@@ -1891,7 +1891,7 @@ scope { const char* current; }
hostname : ( domainlabel DOT )* (toplabel)=>toplabel DOT? ;
domainlabel : alphanum | (alphanum ( alphanum | DASH )* alphanum) ;
toplabel : alpha | (alpha ( DASH? alphanum)+) ;
toplabel : alphanum ( DASH? alphanum)+;
ipv4address : three_digit DOT three_digit DOT three_digit DOT three_digit ;
ipv6reference returns [const char* ret=NULL] : LSBRAQUET ipv6address RSBRAQUET {$ret=(const char *)$ipv6address.text->chars;};
......
......@@ -2,7 +2,7 @@
* This C source file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sip_message.g
* - On : 2018-08-07 09:33:40
* - On : 2018-08-08 15:41:56
* - for the lexer : belle_sip_messageLexerLexer
*
* Editing it, at least manually, is not wise.
......
......@@ -2,7 +2,7 @@
* This C header file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sip_message.g
* - On : 2018-08-07 09:33:40
* - On : 2018-08-08 15:41:56
* - for the lexer : belle_sip_messageLexerLexer
*
* Editing it, at least manually, is not wise.
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* This C header file was generated by $ANTLR version 3.4
*
* - From the grammar source file : ../grammars/belle_sip_message.g
* - On : 2018-08-07 09:33:37
* - On : 2018-08-08 15:41:53
* - for the parser : belle_sip_messageParserParser
*
* Editing it, at least manually, is not wise.
......
......@@ -120,8 +120,39 @@ static void test_from_header(void) {
BC_ASSERT_STRING_EQUAL(belle_sip_header_from_get_tag(L_from),"dlfjklcn6545614XX");
belle_sip_object_unref(BELLE_SIP_OBJECT(L_from));
// Test Domain name RFC1123-2.1
L_from = belle_sip_header_from_parse("f:<sip:123jeff;transport=tcp>;tag=dlfjklcn6545614XX");
l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_from));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_from));
L_tmp = belle_sip_header_from_parse(l_raw_header);
L_from = BELLE_SIP_HEADER_FROM(belle_sip_object_clone(BELLE_SIP_OBJECT(L_tmp)));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_tmp));
belle_sip_free(l_raw_header);
/*test factory*/
L_uri = belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(L_from));
BC_ASSERT_PTR_NULL(belle_sip_uri_get_user(L_uri));
BC_ASSERT_STRING_EQUAL(belle_sip_uri_get_host(L_uri), "123jeff");
BC_ASSERT_STRING_EQUAL(belle_sip_header_from_get_tag(L_from),"dlfjklcn6545614XX");
belle_sip_object_unref(BELLE_SIP_OBJECT(L_from));
L_from = belle_sip_header_from_parse("f:<sip:12345678987;transport=tcp>;tag=dlfjklcn6545614XX");
l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_from));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_from));
L_tmp = belle_sip_header_from_parse(l_raw_header);
L_from = BELLE_SIP_HEADER_FROM(belle_sip_object_clone(BELLE_SIP_OBJECT(L_tmp)));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_tmp));
belle_sip_free(l_raw_header);
L_uri = belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(L_from));
BC_ASSERT_PTR_NULL(belle_sip_uri_get_user(L_uri));
BC_ASSERT_STRING_EQUAL(belle_sip_uri_get_host(L_uri), "12345678987");
BC_ASSERT_STRING_EQUAL(belle_sip_header_from_get_tag(L_from),"dlfjklcn6545614XX");
belle_sip_object_unref(BELLE_SIP_OBJECT(L_from));
// Test factory
L_from = belle_sip_header_from_create2("super <sip:titi.com:5060;lr;ttl=1;method=INVITE;maddr=192.168.0.1;transport=tcp?header=123>","12345-abc");
if (!BC_ASSERT_PTR_NOT_NULL(L_from)) return;
L_uri = belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(L_from));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment