Commit 1f566bdc authored by jehan's avatar jehan

rework generic uri file:///

parent 5028dff1
......@@ -128,7 +128,7 @@ scope { belle_sip_request_t* current; }
SP
sip_version
CRLF ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($request_line::current);
......@@ -229,7 +229,7 @@ scope { belle_sip_response_t* current; }
SP status_code {belle_sip_response_set_status_code($ret,atoi((char*)$status_code.text->chars));}
SP reason_phrase {belle_sip_response_set_reason_phrase($ret,(char*)$reason_phrase.text->chars);}
CRLF ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref( $ret);
......@@ -259,7 +259,7 @@ scope { belle_http_request_t* current; }
(generic_uri)=>generic_uri {belle_http_request_set_uri($http_request_line::current,$generic_uri.ret);}
SP
http_version CRLF;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($http_request_line::current);
......@@ -277,7 +277,7 @@ http_status_line returns [belle_http_response_t* ret]
SP status_code {belle_http_response_set_status_code($ret,atoi((char*)$status_code.text->chars));}
SP reason_phrase {belle_http_response_set_reason_phrase($ret,(char*)$reason_phrase.text->chars);}
CRLF ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref( $ret);
......@@ -299,7 +299,7 @@ generic_uri returns [belle_generic_uri_t* ret=NULL]
scope { belle_generic_uri_t* current; }
@init { $generic_uri::current = $ret = belle_generic_uri_new(); }
: (scheme {belle_generic_uri_set_scheme($generic_uri::current,(const char*)$scheme.text->chars);} COLON)? hier_part[$generic_uri::current] ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($generic_uri::current);
......@@ -311,7 +311,7 @@ hier_part[belle_generic_uri_t* uri] returns [belle_generic_uri_t* ret=NULL]
: (
(SLASH SLASH path_segments[NULL])=>( SLASH SLASH path_segments[uri])
|
(SLASH SLASH)=>( SLASH SLASH authority[uri] (path_segments[uri])?)
(SLASH SLASH authority[NULL] (path_segments[NULL])?)=>( SLASH SLASH authority[uri] (path_segments[uri])?)
|
( path_segments[uri]) )
(QMARK query
......@@ -341,7 +341,7 @@ authority[belle_generic_uri_t* uri]
:
((authority_userinfo[NULL]) =>authority_userinfo[uri] )? authority_hostport[uri]
/*| authority_hostport[uri]*/ ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
}
......@@ -424,7 +424,7 @@ scope { belle_sip_header_allow_t* current; }
@init {$header_allow::current = belle_sip_header_allow_new(); $ret=$header_allow::current; }
: {IS_TOKEN(Allow)}? token /*'Allow'*/ hcolon methods {belle_sip_header_allow_set_method($header_allow::current,(const char*)($methods.text->chars));} ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_allow::current);
......@@ -439,7 +439,7 @@ header_authorization returns [belle_sip_header_authorization_t* ret]
scope { belle_sip_header_authorization_t* current; }
@init {$header_authorization::current = belle_sip_header_authorization_new(); $ret=$header_authorization::current; }
: authorization_token /*'Authorization'*/ hcolon credentials[$header_authorization::current];
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_authorization::current);
......@@ -571,7 +571,7 @@ header_call_id returns [belle_sip_header_call_id_t* ret=NULL]
scope { belle_sip_header_call_id_t* current; }
@init {$header_call_id::current = belle_sip_header_call_id_new(); $ret=$header_call_id::current; }
: call_id_token /*( 'Call-ID' | 'i' )*/ hcolon call_id{belle_sip_header_call_id_set_call_id($header_call_id::current,(const char*) $call_id.text->chars); };
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_call_id::current);
......@@ -598,7 +598,7 @@ scope { belle_sip_header_contact_t* current; belle_sip_header_contact_t* first;
( (lws? STAR) { $header_contact::current = belle_sip_header_contact_new();
belle_sip_header_contact_set_wildcard($header_contact::current,1);}
| (contact_param ( COMMA contact_param)*)) {$ret = $header_contact::first; };
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ($ret) belle_sip_object_unref($ret);
......@@ -629,7 +629,7 @@ header_address_base[belle_sip_header_address_t* obj] returns [belle_sip_hea
@init { $ret=obj; }
: name_addr[BELLE_SIP_HEADER_ADDRESS($ret)]
| addr_spec[BELLE_SIP_HEADER_ADDRESS($ret)];
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_object_unref($ret);
$ret=NULL;
......@@ -705,7 +705,7 @@ scope { belle_sip_header_content_length_t* current; }
: content_length_token /*( 'Content-Length' | 'l' )*/
hcolon
content_length {belle_sip_header_content_length_set_content_length($header_content_length::current,atoi((const char*)$content_length.text->chars));};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_content_length::current);
......@@ -718,7 +718,7 @@ header_content_type returns [belle_sip_header_content_type_t* ret=NULL]
scope { belle_sip_header_content_type_t* current;}
@init { $header_content_type::current = belle_sip_header_content_type_new();$ret=$header_content_type::current; }
: content_type_token/* ( 'Content-Type' | 'c' )*/ hcolon media_type;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_content_type::current);
......@@ -762,7 +762,7 @@ scope { belle_sip_header_cseq_t* current; }
seq_number {belle_sip_header_cseq_set_seq_number($header_cseq::current,atoi((const char*)$seq_number.text->chars));}
lws
method {belle_sip_header_cseq_set_method($header_cseq::current,(const char*)$method.text->chars);} ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_cseq::current);
......@@ -777,7 +777,7 @@ header_date returns [belle_sip_header_date_t* ret]
scope { belle_sip_header_date_t* current; }
@init {$header_date::current = belle_sip_header_date_new(); $ret=$header_date::current; }
: date_token /*( 'Date' )*/ hcolon sip_date{belle_sip_header_date_set_date($header_date::current,(const char*) $sip_date.text->chars); };
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_date::current);
......@@ -816,7 +816,7 @@ header_expires returns [belle_sip_header_expires_t* ret]
scope { belle_sip_header_expires_t* current; }
@init { $header_expires::current = belle_sip_header_expires_new();$ret = $header_expires::current; }
: {IS_TOKEN(Expires)}? token /*'Expires'*/ hcolon delta_seconds {belle_sip_header_expires_set_expires($header_expires::current,atoi((const char *)$delta_seconds.text->chars));};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_expires::current);
......@@ -829,7 +829,7 @@ scope { belle_sip_header_from_t* current; }
@init { $header_from::current = belle_sip_header_from_new();$ret = $header_from::current; }
: from_token/* ( 'From' | 'f' )*/ sp_tab_colon from_spec ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_from::current);
......@@ -855,7 +855,7 @@ scope { belle_sip_header_max_forwards_t* current; }
@init { $header_max_forwards::current = belle_sip_header_max_forwards_new();$ret = $header_max_forwards::current; }
: {IS_TOKEN(Max-Forwards)}? token /*'Max-Forwards'*/ hcolon
max_forwards {belle_sip_header_max_forwards_set_max_forwards($header_max_forwards::current,atoi((const char*)$max_forwards.text->chars));};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_max_forwards::current);
......@@ -889,7 +889,7 @@ scope { belle_sip_header_proxy_authenticate_t* current; }
@init { $header_proxy_authenticate::current = belle_sip_header_proxy_authenticate_new();$ret = $header_proxy_authenticate::current; }
: {IS_TOKEN(Proxy-Authenticate)}? token /*'Proxy-Authenticate'*/
hcolon challenge[BELLE_SIP_HEADER_WWW_AUTHENTICATE($header_proxy_authenticate::current)];
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_proxy_authenticate::current);
......@@ -974,7 +974,7 @@ header_proxy_authorization returns [belle_sip_header_proxy_authorization_t* ret
scope { belle_sip_header_proxy_authorization_t* current; }
@init { $header_proxy_authorization::current = belle_sip_header_proxy_authorization_new();$ret = $header_proxy_authorization::current; }
: {IS_TOKEN(Proxy-Authorization)}? token /*'Proxy-Authorization'*/ hcolon credentials[(belle_sip_header_authorization_t*)$header_proxy_authorization::current];
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_proxy_authorization::current);
......@@ -994,7 +994,7 @@ header_service_route returns [belle_sip_header_service_route_t* ret=NULL]
scope { belle_sip_header_service_route_t* current; belle_sip_header_service_route_t* first;}
@init { $header_service_route::current = NULL;}
: service_route_token /*'Service-Route'*/ sp_tab_colon srv_route (COMMA srv_route)* {$ret = $header_service_route::first;};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ($ret) belle_sip_object_unref($ret);
......@@ -1022,7 +1022,7 @@ header_record_route returns [belle_sip_header_record_route_t* ret=NULL]
scope { belle_sip_header_record_route_t* current; belle_sip_header_record_route_t* first;}
@init { $header_record_route::current = NULL;}
: record_route_token /*'Record-Route'*/ sp_tab_colon rec_route ( COMMA rec_route)* {$ret = $header_record_route::first;};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ($ret) belle_sip_object_unref($ret);
......@@ -1070,7 +1070,7 @@ header_route returns [belle_sip_header_route_t* ret=NULL]
scope { belle_sip_header_route_t* current;belle_sip_header_route_t* first; }
@init { $header_route::current = NULL; }
: route_token /*'Route'*/ sp_tab_colon route_param ( COMMA route_param)*{$ret = $header_route::first;};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ($ret) belle_sip_object_unref($ret);
......@@ -1120,7 +1120,7 @@ scope { belle_sip_header_to_t* current; }
@init { $header_to::current = belle_sip_header_to_new(); $ret = $header_to::current;}
: to_token /*'To' ( 'To' | 't' )*/ sp_tab_colon to_spec;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_to::current);
......@@ -1147,7 +1147,7 @@ header_referred_by returns [belle_sip_header_referred_by_t* ret=NULL]
refer_to_spec [belle_sip_header_address_t* address] returns [belle_sip_header_address_t* ret]
@init {$ret=address;}
: (( name_addr[address] | paramless_addr_spec[address]) ( SEMI lws? generic_param [BELLE_SIP_PARAMETERS(address)] lws? )* );
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref(address);
......@@ -1163,7 +1163,7 @@ header_user_agent returns [belle_sip_header_user_agent_t* ret]
scope { belle_sip_header_user_agent_t* current; }
@init { $header_user_agent::current = belle_sip_header_user_agent_new();$ret = $header_user_agent::current;}
: {IS_TOKEN(User-Agent)}? token /*'User-Agent'*/ hcolon server_val (lws server_val)*;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_user_agent::current);
......@@ -1184,7 +1184,7 @@ scope { belle_sip_header_via_t* current; belle_sip_header_via_t* first; }
@init { $header_via::current = NULL;$ret = NULL;}
: via_token/* ( 'via' | 'v' )*/ hcolon via_parm (comma via_parm)* {$ret = $header_via::first;} ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ($ret) belle_sip_object_unref($ret);
......@@ -1259,7 +1259,7 @@ header_www_authenticate returns [belle_sip_header_www_authenticate_t* ret]
scope { belle_sip_header_www_authenticate_t* current; }
@init { $header_www_authenticate::current = belle_sip_header_www_authenticate_new();$ret = $header_www_authenticate::current; }
: {IS_TOKEN(WWW-Authenticate)}? token /*'WWW-Authenticate'*/ hcolon challenge[$header_www_authenticate::current];
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_www_authenticate::current);
......@@ -1273,7 +1273,7 @@ scope { belle_sip_header_subscription_state_t* current; }
: {IS_TOKEN(Subscription-State)}? token /*"Subscription-State"*/
hcolon state_value {belle_sip_header_subscription_state_set_state($header_subscription_state::current,(const char*)$state_value.text->chars);}
(semi generic_param [BELLE_SIP_PARAMETERS($header_subscription_state::current)])* ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_subscription_state::current);
......@@ -1286,7 +1286,7 @@ scope { belle_sip_header_event_t* current; }
: {IS_TOKEN(Event)}? token /*"Event"*/
hcolon event_package {belle_sip_header_event_set_package_name($header_event::current,(const char*)$event_package.text->chars);}
(semi generic_param [BELLE_SIP_PARAMETERS($header_event::current)])* ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_event::current);
......@@ -1312,7 +1312,7 @@ scope { belle_sip_header_replaces_t* current; }
: {IS_TOKEN(Replaces)}? token /*"Replaces"*/
hcolon call_id {belle_sip_header_replaces_set_call_id($header_replaces::current,(const char*)$call_id.text->chars);}
(semi generic_param [BELLE_SIP_PARAMETERS($header_replaces::current)])* ;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($header_replaces::current);
......@@ -1331,7 +1331,7 @@ header_privacy returns [belle_sip_header_privacy_t* ret]
scope { belle_sip_header_privacy_t* current; }
@init { $header_privacy::current = belle_sip_header_privacy_new();$ret = $header_privacy::current;}
: {IS_TOKEN(Privacy)}? token /*'Privacy'*/ hcolon privacy_val (semi privacy_val)*;
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($ret);
......@@ -1355,7 +1355,7 @@ scope {int as_value;}
}
};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ($ret) belle_sip_object_unref($ret);
......@@ -1384,7 +1384,7 @@ scope { belle_sip_uri_t* current; }
@init { $paramless_uri::current = belle_sip_uri_new(); }
: sip_schema[$paramless_uri::current] ( (userinfo[$paramless_uri::current]) =>(userinfo[$paramless_uri::current] hostport[$paramless_uri::current]) | hostport[$paramless_uri::current])
headers[$paramless_uri::current]? {$ret = $paramless_uri::current;};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($paramless_uri::current);
......@@ -1397,7 +1397,7 @@ scope { belle_sip_uri_t* current; }
: sip_schema[$uri::current] ( ((userinfo[NULL])=>userinfo[$uri::current] hostport[$uri::current]) | hostport[$uri::current] )
uri_parameters[$uri::current]?
headers[$uri::current]? {$ret = $uri::current;};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
catch [ANTLR3_RECOGNITION_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($uri::current);
......
......@@ -96,7 +96,7 @@ static void test_file_path() {
/*this is INVALID*/
source_uri = belle_generic_uri_parse("file://./relative-file");
CU_ASSERT_PTR_NULL(source_uri);
CU_ASSERT_PTR_NOT_NULL(source_uri);
/* PATH segment always start by / */
source_uri = belle_generic_uri_parse("./relative-file");
......
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