Commit 52632a80 authored by jehan's avatar jehan

improve parser error handling

gnutls must be optionnal
parent 826e86da
......@@ -60,7 +60,7 @@
<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.1209613831" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.macosx.base.973927327" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
<builder arguments="CFLAGS=&quot;-g&quot;" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.190701400" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
<builder arguments="CFLAGS=&quot;-g -Wall -Werror&quot;" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.190701400" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
<tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.419159753" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base">
<inputType id="cdt.managedbuild.tool.macosx.c.linker.input.1079464415" superClass="cdt.managedbuild.tool.macosx.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
......
......@@ -120,6 +120,7 @@ int belle_sip_header_address_marshal(belle_sip_header_address_t* header, char* b
}
BELLE_SIP_NEW(header_address,parameters)
BELLE_SIP_PARSE(header_address)
GET_SET_STRING(belle_sip_header_address,displayname);
void belle_sip_header_address_set_quoted_displayname(belle_sip_header_address_t* address,const char* value) {
......
......@@ -408,6 +408,12 @@ contact_param
}
: (name_addr[BELLE_SIP_HEADER_ADDRESS($header_contact::current)]
| addr_spec[BELLE_SIP_HEADER_ADDRESS($header_contact::current)]) (semi contact_params)*;
header_address returns [belle_sip_header_address_t* ret]
scope { belle_sip_header_address_t* current; }
@init { $header_address::current = belle_sip_header_address_new(); $ret=$header_address::current; }
: name_addr[BELLE_SIP_HEADER_ADDRESS($header_address::current)]
| addr_spec[BELLE_SIP_HEADER_ADDRESS($header_address::current)];
name_addr[belle_sip_header_address_t* object]
: ( display_name[object] )? sp_laquot_sp addr_spec[object] sp_raquot_sp;
......@@ -917,6 +923,13 @@ uri returns [belle_sip_uri_t* ret]
scope { belle_sip_uri_t* current; }
@init { $uri::current = belle_sip_uri_new(); }
: sip_schema ((userinfo hostport) | hostport ) uri_parameters? headers? {$ret = $uri::current;};
catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
{
belle_sip_error("[\%s] expecting [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
belle_sip_object_unref($uri::current);
$ret=NULL;
}
sip_token: {IS_TOKEN(sip)}? token;
sips_token: {IS_TOKEN(sips)}? token;
......
......@@ -111,11 +111,7 @@ belle_sip_uri_t* belle_sip_uri_new () {
char* belle_sip_uri_to_string(belle_sip_uri_t* uri) {
return belle_sip_concat( "sip:"
,(uri->user?uri->user:"")
,(uri->user?"@":"")
,uri->host
,NULL);
return belle_sip_object_to_string(BELLE_SIP_OBJECT(uri));
}
......
......@@ -162,6 +162,10 @@ belle_sip_provider_t *belle_sip_provider_new(belle_sip_stack_t *s, belle_sip_lis
}
int belle_sip_provider_add_listening_point(belle_sip_provider_t *p, belle_sip_listening_point_t *lp){
if (lp == NULL) {
belle_sip_error("Cannot add NULL lp to provider [%p]",p);
return -1;
}
p->lps=belle_sip_list_append(p->lps,belle_sip_object_ref(lp));
return 0;
}
......
......@@ -43,7 +43,9 @@ static void _gnutls_log_func( int level, const char* log) {
}
#endif /*HAVE_GNUTLS*/
belle_sip_stack_t * belle_sip_stack_new(const char *properties){
#ifdef HAVE_GNUTLS
int result;
#endif
belle_sip_stack_t *stack=belle_sip_object_new(belle_sip_stack_t);
stack->ml=belle_sip_main_loop_new ();
stack->timer_config.T1=500;
......
......@@ -93,8 +93,10 @@ static int init(void) {
belle_sip_provider_add_listening_point(prov,lp);
belle_sip_object_unref(lp);
lp=belle_sip_stack_create_listening_point(stack,"0.0.0.0",7061,"TLS");
belle_sip_provider_add_listening_point(prov,lp);
belle_sip_object_unref(lp);
if (lp) {
belle_sip_provider_add_listening_point(prov,lp);
belle_sip_object_unref(lp);
}
listener=belle_sip_object_new(test_listener_t);
belle_sip_provider_add_sip_listener(prov,BELLE_SIP_LISTENER(listener));
return 0;
......
......@@ -147,7 +147,11 @@ static void test_headers(void) {
belle_sip_object_unref(L_uri);
}
static void testSIMPLEURI_error(void) {
belle_sip_uri_t* L_uri = belle_sip_uri_parse("siptcom");
CU_ASSERT_PTR_NULL(L_uri);
}
int belle_sip_uri_test_suite () {
......@@ -169,7 +173,8 @@ int belle_sip_uri_test_suite () {
|| (NULL == CU_add_test(pSuite, "test of maddr uri", test_maddr))
|| (NULL == CU_add_test(pSuite, "test of headers", test_headers))
|| (NULL == CU_add_test(pSuite, "test of uri parameters", test_uri_parameters))
|| (NULL == CU_add_test(pSuite, "test of sips uri", testSIPSURI)))
|| (NULL == CU_add_test(pSuite, "test of sips uri", testSIPSURI))
|| (NULL == CU_add_test(pSuite, "test of error uri", testSIMPLEURI_error)))
{
return CU_get_error();
}
......
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