Commit a2733548 authored by jehan's avatar jehan

add compressed header implementation

parent 326cfb8c
......@@ -74,7 +74,7 @@
<tool id="cdt.managedbuild.tool.gnu.archiver.macosx.base.84823320" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base.1713349409" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.base.3940526" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.base">
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1609070473" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1609070473" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols"/>
<option id="gnu.c.compiler.option.preprocessor.undef.symbol.1484649451" name="Undefined symbols (-U)" superClass="gnu.c.compiler.option.preprocessor.undef.symbol" valueType="undefDefinedSymbols">
<listOptionValue builtIn="false" value="__cplusplus"/>
</option>
......@@ -124,6 +124,7 @@
</buildTargets>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
......@@ -166,7 +167,7 @@
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.557244179;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.1730055672;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.1327025999.2120750423;cdt.managedbuild.tool.gnu.c.compiler.input.1221270428">
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290.;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.3940526;cdt.managedbuild.tool.gnu.c.compiler.input.2089521215">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
......@@ -204,12 +205,12 @@
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<runAction arguments="-s -C src discovery" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290.;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.3940526;cdt.managedbuild.tool.gnu.c.compiler.input.2089521215">
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.557244179;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.1730055672;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.1327025999.2120750423;cdt.managedbuild.tool.gnu.c.compiler.input.1221270428">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
......@@ -247,7 +248,7 @@
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-s -C src discovery" command="make" useDefault="true"/>
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
......@@ -296,5 +297,4 @@
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
......@@ -738,7 +738,11 @@ belle_sip_hop_t* belle_sip_response_get_return_hop(belle_sip_response_t *msg);
strcasecmp(#token,(const char*)(INPUT->toStringTT(INPUT,LT(1),LT(strlen(#token)))->chars)) == 0:0)
char* _belle_sip_str_dup_and_unquote_string(const char* quoted_string);
#define IS_HEADER_NAMED(name,compressed_name) IS_TOKEN(name) || (compressed_name && IS_TOKEN(compressed_name))
#define IS_HEADER_NAMED(name,compressed_name) (IS_TOKEN(compressed_name) || IS_TOKEN(name))
#define STRCASECMP_HEADER_NAMED(name,compressed_name,value) \
(strcasecmp(compressed_name,(const char*)value) == 0 || strcasecmp(name,(const char*)value) == 0 )
/*********************************************************
* SDP
*/
......
......@@ -397,7 +397,7 @@ response_digest
: LDQUOT hexdigit* RDQUOT;
*/
/*callid header*/
call_id_token: {IS_TOKEN(Call-ID)}? token;
call_id_token: {IS_HEADER_NAMED(Call-ID,i)}? token;
header_call_id returns [belle_sip_header_call_id_t* ret]
scope { belle_sip_header_call_id_t* current; }
......@@ -421,7 +421,7 @@ info_param
| 'card' | token ) ) | generic_param;
*/
/* contact header */
contact_token: {IS_TOKEN(Contact)}? token;
contact_token: {IS_HEADER_NAMED(Contact,m)}? token;
header_contact returns [belle_sip_header_contact_t* ret]
scope { belle_sip_header_contact_t* current; belle_sip_header_contact_t* first; }
......@@ -541,7 +541,7 @@ huit_alpha
;
*/
/*content_length_token : {strcmp("Content-Length",(const char*)(INPUT->toStringTT(INPUT,LT(1),LT(14)))->chars) == 0}? token;*/
content_length_token : {IS_TOKEN(Content-Length)}? token;
content_length_token : {IS_HEADER_NAMED(Content-Length,l)}? token;
header_content_length returns [belle_sip_header_content_length_t* ret]
scope { belle_sip_header_content_length_t* current; }
@init {$header_content_length::current = belle_sip_header_content_length_new(); $ret=$header_content_length::current; }
......@@ -556,7 +556,7 @@ catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
}
content_length:DIGIT+;
content_type_token : {IS_TOKEN(Content-Type)}? token;
content_type_token : {IS_HEADER_NAMED(Content-Type,c)}? token;
header_content_type returns [belle_sip_header_content_type_t* ret]
scope { belle_sip_header_content_type_t* current;}
@init { $header_content_type::current = belle_sip_header_content_type_new();$ret=$header_content_type::current; }
......@@ -666,7 +666,7 @@ catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
$ret=NULL;
}
from_token: {IS_TOKEN(From)}? token;
from_token: {IS_HEADER_NAMED(From,f)}? token;
header_from returns [belle_sip_header_from_t* ret]
scope { belle_sip_header_from_t* current; }
@init { $header_from::current = belle_sip_header_from_new();$ret = $header_from::current; }
......@@ -982,7 +982,7 @@ timestamp
delay
: (DIGIT)* ( '.' (DIGIT)* )?;
*/
to_token: {IS_TOKEN(To)}? token;
to_token: {IS_HEADER_NAMED(To,t)}? token;
header_to returns [belle_sip_header_to_t* ret]
scope { belle_sip_header_to_t* current; }
@init { $header_to::current = belle_sip_header_to_new(); $ret = $header_to::current;}
......@@ -1046,7 +1046,7 @@ product
product_version
: token;
via_token: {IS_TOKEN(Via)}? token;
via_token: {IS_HEADER_NAMED(Via,v)}? token;
header_via returns [belle_sip_header_via_t* ret]
scope { belle_sip_header_via_t* current; belle_sip_header_via_t* first; }
@init { $header_via::current = NULL;$ret = NULL;}
......@@ -1183,7 +1183,7 @@ catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
header_p_preferred_identity returns [belle_sip_header_p_preferred_identity_t* ret]
@init { $ret=NULL; }
: {IS_HEADER_NAMED(P-Preferred-Identity,NULL)}? token /*"P-Preferred-Identity"*/
: {IS_TOKEN(P-Preferred-Identity)}? token /*"P-Preferred-Identity"*/
hcolon header_address_base[(belle_sip_header_address_t*)belle_sip_header_p_preferred_identity_new()] {$ret=(belle_sip_header_p_preferred_identity_t*)$header_address_base.ret;};
header_privacy returns [belle_sip_header_privacy_t* ret]
......@@ -1203,17 +1203,17 @@ privacy_val: token {belle_sip_header_privacy_add_privacy($header_privacy::curren
header_extension[ANTLR3_BOOLEAN check_for_known_header] returns [belle_sip_header_t* ret]
: header_name
hcolon
header_value {if (check_for_known_header && strcasecmp("Contact",(const char*)$header_name.text->chars) == 0) {
header_value {if (check_for_known_header && STRCASECMP_HEADER_NAMED(BELLE_SIP_CONTACT,"m",(const char*)$header_name.text->chars)) {
$ret = BELLE_SIP_HEADER(belle_sip_header_contact_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("From",(const char*)$header_name.text->chars) == 0) {
} else if (check_for_known_header && STRCASECMP_HEADER_NAMED(BELLE_SIP_FROM,"f",(const char*)$header_name.text->chars)) {
$ret = BELLE_SIP_HEADER(belle_sip_header_from_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("To",(const char*)$header_name.text->chars) == 0) {
} else if (check_for_known_header && STRCASECMP_HEADER_NAMED(BELLE_SIP_TO,"t",(const char*)$header_name.text->chars)) {
$ret = BELLE_SIP_HEADER(belle_sip_header_to_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("Call-ID",(const char*)$header_name.text->chars) == 0) {
} else if (check_for_known_header && STRCASECMP_HEADER_NAMED(BELLE_SIP_CALL_ID,"i",(const char*)$header_name.text->chars)) {
$ret = BELLE_SIP_HEADER(belle_sip_header_call_id_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("Content-Length",(const char*)$header_name.text->chars) == 0) {
} else if (check_for_known_header && STRCASECMP_HEADER_NAMED(BELLE_SIP_CONTENT_LENGTH,"l",(const char*)$header_name.text->chars)) {
$ret = BELLE_SIP_HEADER(belle_sip_header_content_length_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("Content-Type",(const char*)$header_name.text->chars) == 0) {
} else if (check_for_known_header && STRCASECMP_HEADER_NAMED(BELLE_SIP_CONTENT_TYPE,"c",(const char*)$header_name.text->chars)) {
$ret = BELLE_SIP_HEADER(belle_sip_header_content_type_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("CSeq",(const char*)$header_name.text->chars) == 0) {
$ret = BELLE_SIP_HEADER(belle_sip_header_cseq_parse((const char*)$header_extension.text->chars));
......@@ -1221,7 +1221,7 @@ header_extension[ANTLR3_BOOLEAN check_for_known_header] returns [belle_sip_head
$ret = BELLE_SIP_HEADER(belle_sip_header_route_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("Record-Route",(const char*)$header_name.text->chars) == 0) {
$ret = BELLE_SIP_HEADER(belle_sip_header_record_route_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("Via",(const char*)$header_name.text->chars) == 0) {
} else if (check_for_known_header && STRCASECMP_HEADER_NAMED(BELLE_SIP_VIA,"v",(const char*)$header_name.text->chars)) {
$ret = BELLE_SIP_HEADER(belle_sip_header_via_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcasecmp("Authorization",(const char*)$header_name.text->chars) == 0) {
$ret = BELLE_SIP_HEADER(belle_sip_header_authorization_parse((const char*)$header_extension.text->chars));
......
......@@ -27,7 +27,7 @@
static void test_simple_contact_header(void) {
belle_sip_header_contact_t* L_tmp;
belle_sip_uri_t* L_uri;
belle_sip_header_contact_t* L_contact = belle_sip_header_contact_parse("Contact:sip:titi.com");
belle_sip_header_contact_t* L_contact = belle_sip_header_contact_parse("m:sip:titi.com");
char* l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_contact));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_contact));
L_tmp = belle_sip_header_contact_parse(l_raw_header);
......@@ -87,7 +87,7 @@ static void test_complex_contact_header(void) {
static void test_from_header(void) {
belle_sip_header_from_t* L_tmp;
belle_sip_uri_t* L_uri;
belle_sip_header_from_t* L_from = belle_sip_header_from_parse("From:<sip:titi.com;transport=tcp>;tag=dlfjklcn6545614XX");
belle_sip_header_from_t* L_from = belle_sip_header_from_parse("f:<sip:titi.com;transport=tcp>;tag=dlfjklcn6545614XX");
char* 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);
......@@ -134,7 +134,7 @@ static void test_contact_header_with_paramless_address_spec(void) {
static void test_to_header(void) {
belle_sip_uri_t* L_uri;
belle_sip_header_to_t* L_to = belle_sip_header_to_parse("To : < sip:titi.com;transport=tcp> ; tag = dlfjklcn6545614XX");
belle_sip_header_to_t* L_to = belle_sip_header_to_parse("t : < sip:titi.com;transport=tcp> ; tag = dlfjklcn6545614XX");
char* l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_to));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_to));
L_to = belle_sip_header_to_parse(l_raw_header);
......@@ -161,7 +161,7 @@ static void test_via_header(void) {
belle_sip_header_via_t* L_tmp;
belle_sip_header_t* l_next;
belle_sip_header_via_t* L_next_via;
belle_sip_header_via_t* L_via = belle_sip_header_via_parse("Via: SIP/2.0/UDP [::1]:5062;rport;received=::1;branch=z9hG4bK368560724");
belle_sip_header_via_t* L_via = belle_sip_header_via_parse("v: SIP/2.0/UDP [::1]:5062;rport;received=::1;branch=z9hG4bK368560724");
char* l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_via));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_via));
L_tmp = belle_sip_header_via_parse(l_raw_header);
......@@ -191,7 +191,7 @@ static void test_via_header(void) {
static void test_call_id_header(void) {
belle_sip_header_call_id_t* L_tmp;
belle_sip_header_call_id_t* L_call_id = belle_sip_header_call_id_parse("Call-ID: 1665237789@titi.com");
belle_sip_header_call_id_t* L_call_id = belle_sip_header_call_id_parse("i: 1665237789@titi.com");
char* l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_call_id));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_call_id));
L_tmp= belle_sip_header_call_id_parse(l_raw_header);
......@@ -226,7 +226,7 @@ static void test_cseq_header(void) {
static void test_content_type_header(void) {
belle_sip_header_content_type_t* L_tmp;
belle_sip_header_content_type_t* L_content_type = belle_sip_header_content_type_parse("Content-Type: text/html; charset=ISO-8859-4");
belle_sip_header_content_type_t* L_content_type = belle_sip_header_content_type_parse("c: text/html; charset=ISO-8859-4");
char* l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_content_type));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_content_type));
L_tmp = belle_sip_header_content_type_parse(l_raw_header);
......
......@@ -59,18 +59,18 @@ static void check_uri_and_headers(belle_sip_message_t* message) {
static void testRegisterMessage(void) {
const char* raw_message = "REGISTER sip:192.168.0.20 SIP/2.0\r\n"\
"Via: SIP/2.0/UDP 192.168.1.8:5062;rport;branch=z9hG4bK1439638806\r\n"\
"From: <sip:jehan-mac@sip.linphone.org>;tag=465687829\r\n"\
"To: <sip:jehan-mac@sip.linphone.org>\r\n"\
"Call-ID: 1053183492\r\n"\
"v: SIP/2.0/UDP 192.168.1.8:5062;rport;branch=z9hG4bK1439638806\r\n"\
"f: <sip:jehan-mac@sip.linphone.org>;tag=465687829\r\n"\
"t: <sip:jehan-mac@sip.linphone.org>\r\n"\
"i: 1053183492\r\n"\
"CSeq: 1 REGISTER\r\n"\
"Contact: <sip:jehan-mac@192.168.1.8:5062>\r\n"\
"m: <sip:jehan-mac@192.168.1.8:5062>\r\n"\
"Max-Forwards: 70\r\n"\
"User-Agent: Linphone/3.3.99.10 (eXosip2/3.3.0)\r\n"\
"Expires: 3600\r\n"\
"Proxy-Authorization: Digest username=\"8117396\", realm=\"Realm\", nonce=\"MTMwNDAwMjIxMjA4NzVkODY4ZmZhODMzMzU4ZDJkOTA1NzM2NTQ2NDZlNmIz"\
", uri=\"sip:linphone.net\", response=\"eed376ff7c963441255ec66594e470e7\", algorithm=MD5, cnonce=\"0a4f113b\", qop=auth, nc=00000001\r\n"\
"Content-Length: 0\r\n\r\n";
"l: 0\r\n\r\n";
belle_sip_request_t* request;
belle_sip_message_t* message = belle_sip_message_parse(raw_message);
char* encoded_message = belle_sip_object_to_string(BELLE_SIP_OBJECT(message));
......@@ -100,7 +100,7 @@ static void testInviteMessage(void) {
"Call-ID: Y2NlNzg0ODc0ZGIxODU1MWI5MzhkNDVkNDZhOTQ4YWU.\r\n"\
"CSeq: 1 INVITE\r\n"\
"Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO\r\n"\
"Content-Type: application/sdp\r\n"\
"c: application/sdp\r\n"\
"Supported: replaces\r\n"\
"Authorization: Digest username=\"003332176\", realm=\"sip.ovh.net\", nonce=\"24212965507cde726e8bc37e04686459\", uri=\"sip:sip.ovh.net\", response=\"896e786e9c0525ca3085322c7f1bce7b\", algorithm=MD5, opaque=\"241b9fb347752f2\"\r\n"\
"User-Agent: X-Lite 4 release 4.0 stamp 58832\r\n"\
......@@ -114,6 +114,7 @@ static void testInviteMessage(void) {
CU_ASSERT_STRING_EQUAL(belle_sip_request_get_method(request),"INVITE");
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Contact"));
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Authorization"));
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Content-Type"));
check_uri_and_headers(message);
belle_sip_object_unref(message);
belle_sip_free(encoded_message);
......@@ -201,7 +202,8 @@ static void test_extract_source(void) {
"Subject: Phone call\r\n"
"User-Agent: Linphone/3.5.2 (eXosip2/3.6.0)\r\n"
"Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO\r\n"
"Content-Length: 0\r\n\r\n";
"Content-Type: application/sdp\r\n"\
"Content-Length: 230\r\n\r\n";
const char * invite_2="INVITE sip:jehan@81.56.113.2:50343;transport=tcp;line=f18e0009dd6cc43 SIP/2.0\r\n"
"Via: SIP/2.0/UDP 192.168.1.12:15060;rport=15060;branch=z9hG4bK1596944937;received=81.56.113.2\r\n"
......@@ -222,6 +224,7 @@ static void test_extract_source(void) {
belle_sip_message_t* message = belle_sip_message_parse(invite_1);
belle_sip_request_t* request = BELLE_SIP_REQUEST(message);
belle_sip_uri_t* source =belle_sip_request_extract_origin(request);
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Content-type"));
CU_ASSERT_PTR_NOT_NULL(source);
CU_ASSERT_STRING_EQUAL(belle_sip_uri_get_host(source),"37.59.129.73");
CU_ASSERT_EQUAL(belle_sip_uri_get_port(source),0);
......
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