Commit ac963f87 authored by Simon Morlat's avatar Simon Morlat
Browse files

Merge branch 'master' of belledonne-communications.com:belle-sip

parents 50052922 61c8cc5f
......@@ -52,6 +52,7 @@
<option id="gnu.cpp.compiler.macosx.exe.debug.option.debugging.level.1587258294" name="Debug Level" superClass="gnu.cpp.compiler.macosx.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.1778710346" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/Users/jehanmonnier/opt/include"/>
<listOptionValue builtIn="false" value="/opt/local/include"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.797856581" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
......@@ -66,29 +67,26 @@
</tool>
</toolChain>
</folderInfo>
<fileInfo id="cdt.managedbuild.config.gnu.macosx.exe.debug.341835025.1205048807" name="belle_sip_tester.c" rcbsApplicability="disable" resourcePath="tester/belle_sip_tester.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.1850485661">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.1850485661" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201">
<option id="gnu.c.compiler.option.include.paths.939495352" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<fileInfo id="cdt.managedbuild.config.gnu.macosx.exe.debug.341835025.1422516973" name="belle_sip_headers_tester.c" rcbsApplicability="disable" resourcePath="tester/belle_sip_headers_tester.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.476090798">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.476090798" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201">
<option id="gnu.c.compiler.option.include.paths.1874152018" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/Users/jehanmonnier/opt/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/belle-sip/include}&quot;"/>
<listOptionValue builtIn="false" value="/opt/local/include"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1598375635" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1419900147" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
</fileInfo>
<fileInfo id="cdt.managedbuild.config.gnu.macosx.exe.debug.341835025.1422516973" name="belle_sip_headers_tester.c" rcbsApplicability="disable" resourcePath="tester/belle_sip_headers_tester.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.476090798">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.476090798" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201">
<option id="gnu.c.compiler.option.include.paths.1874152018" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<fileInfo id="cdt.managedbuild.config.gnu.macosx.exe.debug.341835025.1205048807" name="belle_sip_tester.c" rcbsApplicability="disable" resourcePath="tester/belle_sip_tester.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.1850485661">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.1850485661" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201">
<option id="gnu.c.compiler.option.include.paths.939495352" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/Users/jehanmonnier/opt/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/belle-sip/include}&quot;"/>
<listOptionValue builtIn="false" value="/opt/local/include"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1419900147" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1598375635" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
</fileInfo>
<fileInfo id="cdt.managedbuild.config.gnu.macosx.exe.debug.341835025.66827395" name="cast_test.c" rcbsApplicability="disable" resourcePath="tester/cast_test.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.1522599976">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.1522599976" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201"/>
</fileInfo>
<fileInfo id="cdt.managedbuild.config.gnu.macosx.exe.debug.341835025.789517118" name="parser-antlr.c" rcbsApplicability="disable" resourcePath="tester/belle_sip_uri_tester.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.75619886">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.75619886" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201">
<option id="gnu.c.compiler.option.include.paths.246079056" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
......@@ -99,6 +97,16 @@
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.170614653" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
</fileInfo>
<fileInfo id="cdt.managedbuild.config.gnu.macosx.exe.debug.341835025.569616755" name="belle_sip_message_tester.c" rcbsApplicability="disable" resourcePath="tester/belle_sip_message_tester.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.156963690">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201.156963690" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug.315151201">
<option id="gnu.c.compiler.option.include.paths.1281017285" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/Users/jehanmonnier/opt/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/belle-sip/include}&quot;"/>
<listOptionValue builtIn="false" value="/opt/local/include"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1005505490" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
</fileInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="include"/>
......
......@@ -62,11 +62,11 @@ void belle_sip_header_address_set_displayname(belle_sip_header_address_t* addres
**************************************************************************************/
typedef struct _belle_sip_header belle_sip_header_t;
const char* belle_sip_header_get_name (const belle_sip_header_t* obj);
void belle_sip_header_set_name (belle_sip_header_t* obj,const char* value);
const char *belle_sip_header_get_name(const belle_sip_header_t *h);
#define BELLE_SIP_HEADER(h) BELLE_SIP_CAST(h,belle_sip_header_t)
#define BELLE_SIP_HEADER(t) BELLE_SIP_CAST(t,belle_sip_header_t)
/***********************
* Contact header object
************************/
......
......@@ -30,10 +30,7 @@
/************************
* header
***********************/
struct _belle_sip_header {
belle_sip_object_t base;
char* name;
};
GET_SET_STRING(belle_sip_header,name);
void belle_sip_header_init(belle_sip_header_t *header) {
......@@ -41,7 +38,7 @@ void belle_sip_header_init(belle_sip_header_t *header) {
belle_sip_object_init((belle_sip_object_t*)header); /*super*/
}
static void belle_sip_header_destroy(belle_sip_header_t *header){
void belle_sip_header_destroy(belle_sip_header_t *header){
if (header->name) belle_sip_free((void*)header->name);
}
......
......@@ -348,10 +348,16 @@ void belle_sip_param_pair_unref(belle_sip_param_pair_t* obj);
void belle_sip_header_address_set_quoted_displayname(belle_sip_header_address_t* address,const char* value);
/*calss header*/
struct _belle_sip_header {
belle_sip_object_t base;
const char* name;
};
void belle_sip_header_destroy(belle_sip_header_t *header);
void belle_sip_header_init(belle_sip_header_t* obj);
/*class parameters*/
struct _belle_sip_parameters {
belle_sip_object_t base;
belle_sip_header_t base;
belle_sip_list_t* param_list;
belle_sip_list_t* paramnames_list;
};
......
......@@ -47,7 +47,7 @@ request_line
CRLF ;
sip_version
: 'SIP/' DIGIT '.' DIGIT;
: word;// 'SIP/' DIGIT '.' DIGIT;
message_header [belle_sip_message_t* message]
......
......@@ -18,20 +18,21 @@
#include "belle-sip/belle-sip.h"
#include "belle-sip/parameters.h"
#include "belle_sip_internal.h"
#include "belle-sip/headers.h"
void belle_sip_parameters_destroy(belle_sip_parameters_t* params) {
if (params->param_list) belle_sip_list_free (params->param_list);
if (params->paramnames_list) belle_sip_list_free (params->paramnames_list);
belle_sip_header_destroy(BELLE_SIP_HEADER(params));
}
void belle_sip_parameters_init(belle_sip_parameters_t *obj) {
belle_sip_object_init_type(obj,belle_sip_parameters_t);
belle_sip_object_init((belle_sip_object_t*)obj);
belle_sip_header_init((belle_sip_header_t*)obj);
}
belle_sip_parameters_t* belle_sip_parameters_new() {
belle_sip_parameters_t* l_object = (belle_sip_parameters_t*)belle_sip_object_new(belle_sip_parameters_t,(belle_sip_object_destroy_t)belle_sip_parameters_destroy);
belle_sip_object_init((belle_sip_object_t*)l_object);
belle_sip_header_init((belle_sip_header_t*)l_object);
return l_object;
}
......
......@@ -42,6 +42,7 @@ static int belle_sip_headers_container_comp_func(const headers_container_t *a, c
}
static void belle_sip_message_init(belle_sip_message_t *message){
belle_sip_object_init_type(message,belle_sip_message_t);
belle_sip_object_init((belle_sip_object_t*)message);
}
headers_container_t* belle_sip_headers_container_get(belle_sip_message_t* message,const char* header_name) {
......@@ -66,13 +67,15 @@ const belle_sip_list_t* belle_sip_message_get_headers(belle_sip_message_t *messa
}
struct _belle_sip_request {
belle_sip_message_t message;
const char* method;
};
static void belle_sip_request_destroy(belle_sip_request_t* request) {
if (request->method) belle_sip_free((void*)(request->method));
}
BELLE_SIP_NEW(request,message)
BELLE_SIP_PARSE(request)
GET_SET_STRING(belle_sip_request,method);
void belle_sip_request_set_uri(belle_sip_request_t* request,belle_sip_uri_t* uri) {
......@@ -82,15 +85,6 @@ belle_sip_uri_t * belle_sip_request_get_uri(belle_sip_request_t *request){
return NULL;
}
const char * belle_sip_request_get_method(const belle_sip_request_t *req){
return NULL;
}
void belle_sip_request_set_method(belle_sip_request_t* request,const char* method) {
}
int belle_sip_message_is_request(belle_sip_message_t *msg){
return 0;
}
......
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "belle-sip/belle-sip.h"
#include <stdio.h>
#include "CUnit/Basic.h"
static int init_suite_message(void) {
return 0;
}
static int clean_suite_message(void) {
return 0;
}
static void testMessage(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"\
"CSeq: 1 REGISTER\r\n"\
"Contact: <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"\
"Content-Length: 0\r\n\r\n";
belle_sip_message_t* message = belle_sip_message_parse(raw_message);
belle_sip_request_t* request = BELLE_SIP_REQUEST(message);
CU_ASSERT_STRING_EQUAL(belle_sip_request_get_method(request),"REGISTER");
}
int belle_sip_message_test_suite () {
CU_pSuite pSuite = NULL;
/* add a suite to the registry */
pSuite = CU_add_suite("message suite", init_suite_message, clean_suite_message);
if (NULL == pSuite) {
return CU_get_error();
}
/* add the tests to the suite */
/* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */
if ((NULL == CU_add_test(pSuite, "test of simple messgae", testMessage))
)
{
return CU_get_error();
}
return CU_get_error();
}
......@@ -20,6 +20,7 @@
extern int belle_sip_uri_test_suite ();
extern int belle_sip_headers_test_suite ();
extern int belle_sip_message_test_suite ();
int main (int argc, char *argv[]) {
......@@ -32,6 +33,7 @@ int main (int argc, char *argv[]) {
belle_sip_headers_test_suite ();
belle_sip_message_test_suite();
/* Run all tests using the CUnit Basic interface */
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
......
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