Commit d33a7887 authored by jehan's avatar jehan

add contact header parsing

parent a3ad258c
This diff is collapsed.
......@@ -19,6 +19,7 @@
#define BELLE_SIP_H
#include "belle-sip/uri.h"
#include "belle-sip/headers.h"
#include "belle-sip/list.h"
#include "belle-sip/mainloop.h"
......
/*
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/>.
*/
#ifndef HEADERS_H_
#define HEADERS_H_
#include "belle-sip/uri.h"
/***************************************************************************************
* header address
*
**************************************************************************************/
typedef struct _belle_sip_header_address belle_sip_header_address_t;
belle_sip_header_address_t* belle_sip_header_address_new();
void belle_sip_header_address_delete(belle_sip_header_address_t* contact);
belle_sip_header_address_t* belle_sip_header_address_parse (const char* address) ;
belle_sip_header_address_t* belle_sip_header_address_ref (belle_sip_header_address_t* address) ;
void belle_sip_header_address_unref (belle_sip_header_address_t* address) ;
/**
*
*/
belle_sip_uri_t* belle_sip_header_address_get_uri(belle_sip_header_address_t* address);
/**
*
*/
void belle_sip_header_address_set_uri(belle_sip_header_address_t* address, belle_sip_uri_t* uri);
/**
*
*/
const char* belle_sip_header_address_get_displayname(belle_sip_header_address_t* address);
/**
*
*/
void belle_sip_header_address_set_displayname(belle_sip_header_address_t* address, const char* uri);
/***************************************************************************************
* header common
*
**************************************************************************************/
typedef struct _belle_sip_header belle_sip_header_t;
/**
* Contact header object
*/
typedef struct _belle_sip_header_contact belle_sip_header_contact_t;
belle_sip_header_contact_t* belle_sip_header_contact_new();
void belle_sip_header_contact_delete(belle_sip_header_contact_t* contact);
belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact) ;
/**
* Returns the value of the expires parameter or -1 if no expires parameter was specified or if the parameter value cannot be parsed as an int.
*@returns value of the expires parameter measured in delta-seconds, O implies removal of Registration specified in Contact Header.
*
*/
int belle_sip_header_contact_get_expires(belle_sip_header_contact_t* contact);
/**
* Returns the value of the q-value parameter of this ContactHeader. The q-value parameter indicates the relative preference amongst a set of locations. q-values are decimal numbers from 0 to 1, with higher values indicating higher preference.
* @return the q-value parameter of this ContactHeader, -1 if the q-value is not set.
*/
float belle_sip_header_contact_get_qvalue(belle_sip_header_contact_t* contact);
/**
* Returns a boolean value that indicates if the contact header has the format of Contact: *.
* @return true if this is a wildcard address, false otherwise.
*/
unsigned int belle_sip_header_contact_is_wildcard(belle_sip_header_contact_t* contact);
/**
*
*/
int belle_sip_header_contact_set_expires(belle_sip_header_contact_t* contact, int expires);
/**
* Sets the qValue value of the Name Address.
*/
int belle_sip_header_contact_set_qvalue(belle_sip_header_contact_t* contact, float qValue);
/**
* Sets a wildcard on this contact address that is "*" is assigned to the contact header so that the header will have the format of Contact: *.
*
*/
void belle_sip_header_contact_set_wilcard(belle_sip_header_contact_t* contact);
#endif /* HEADERS_H_ */
......@@ -13,12 +13,26 @@
typedef struct _belle_sip_uri belle_sip_uri_t;
/**
*
*/
belle_sip_uri_t* belle_sip_uri_new();
/**
*
*/
void belle_sip_uri_delete(belle_sip_uri_t* uri);
/**
*
*/
belle_sip_uri_t* belle_sip_uri_parse (const char* uri) ;
/**
*
*/
belle_sip_uri_t* belle_sip_uri_ref (belle_sip_uri_t* address) ;
/**
*
*/
void belle_sip_uri_unref (belle_sip_uri_t* address) ;
/**
* Returns the value of the named header, or null if it is not set.
*
......
/*
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/headers.h"
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "belle_sip_messageParser.h"
#include "belle_sip_messageLexer.h"
#include "belle_sip_internal.h"
/************************
* header_address
***********************/
struct _belle_sip_header_address {
int ref;
const char* displayname;
belle_sip_uri_t* uri;
};
belle_sip_header_address_t* belle_sip_header_address_new() {
return (belle_sip_header_address_t*)belle_sip_new0(belle_sip_header_address_t);
}
void belle_sip_header_address_delete(belle_sip_header_address_t* contact) {
if (contact->displayname) free((void*)(contact->displayname));
if (contact->uri) belle_sip_uri_delete(contact->uri);
}
GET_SET_STRING(belle_sip_header_address,displayname);
belle_sip_uri_t* belle_sip_header_address_get_uri(belle_sip_header_address_t* address) {
return address->uri;
}
void belle_sip_header_address_set_uri(belle_sip_header_address_t* address, belle_sip_uri_t* uri) {
address->uri=uri;
}
BELLE_SIP_REF(header_address)
/************************
* header_contact
***********************/
struct _belle_sip_header_contact {
belle_sip_header_address_t address;
int ref;
belle_sip_header_address_t* header_address;
int expires;
float qvalue;
unsigned int wildcard;
};
belle_sip_header_contact_t* belle_sip_header_contact_new() {
return (belle_sip_header_contact_t*)belle_sip_new0(belle_sip_header_contact_t);
}
void belle_sip_header_contact_delete(belle_sip_header_contact_t* contact) {
if (contact->header_address) belle_sip_header_address_delete(contact->header_address);
}
BELLE_SIP_PARSE(header_contact);
GET_SET_INT_PRIVATE(belle_sip_header_contact,expires,int,_);
GET_SET_INT_PRIVATE(belle_sip_header_contact,qvalue,float,_);
GET_SET_BOOL(belle_sip_header_contact,wildcard,is);
int belle_sip_header_contact_set_expires(belle_sip_header_contact_t* contact, int expires) {
if (expires < 0 ) {
return -1;
}
_belle_sip_header_contact_set_expires(contact,expires);
return 0;
}
int belle_sip_header_contact_set_qvalue(belle_sip_header_contact_t* contact, float qValue) {
if (qValue != -1 || qValue < 0 || qValue >1) {
return -1;
}
_belle_sip_header_contact_set_qvalue(contact,qValue);
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/>.
*/
#ifndef belle_utils_h
#define belle_utils_h
......@@ -150,6 +166,87 @@ static inline void belle_sip_fatal(const char *fmt,...)
char * belle_sip_concat (const char *str, ...);
/*parameters accessors*/
#define GET_SET_STRING(object_type,attribute) \
const char* object_type##_get_##attribute (object_type##_t* obj) {\
return obj->attribute;\
}\
void object_type##_set_##attribute (object_type##_t* obj,const char* value) {\
if (obj->attribute != NULL) free((void*)obj->attribute);\
obj->attribute=malloc(strlen(value)+1);\
strcpy((char*)(obj->attribute),value);\
}
#define GET_SET_INT(object_type,attribute,type) GET_SET_INT_PRIVATE(object_type,attribute,type,)
#define GET_SET_INT_PRIVATE(object_type,attribute,type,set_prefix) \
type object_type##_get_##attribute (object_type##_t* obj) {\
return obj->attribute;\
}\
void set_prefix##object_type##_set_##attribute (object_type##_t* obj,type value) {\
obj->attribute=value;\
}
#define GET_SET_BOOL(object_type,attribute,getter) \
unsigned int object_type##_##getter##_##attribute (object_type##_t* obj) {\
return obj->attribute;\
}\
void object_type##_set_##attribute (object_type##_t* obj,unsigned int value) {\
obj->attribute=value;\
}
#define BELLE_SIP_PARSE(object_type) \
belle_sip_##object_type##_t* belle_sip_##object_type##_parse (const char* value) { \
pANTLR3_INPUT_STREAM input; \
pbelle_sip_messageLexer lex; \
pANTLR3_COMMON_TOKEN_STREAM tokens; \
pbelle_sip_messageParser parser; \
input = antlr3NewAsciiStringCopyStream (\
(pANTLR3_UINT8)value,\
(ANTLR3_UINT32)strlen(value),\
NULL);\
lex = belle_sip_messageLexerNew (input);\
tokens = antlr3CommonTokenStreamSourceNew (ANTLR3_SIZE_HINT, TOKENSOURCE(lex));\
parser = belle_sip_messageParserNew (tokens);\
belle_sip_##object_type##_t* l_parsed_object = parser->object_type(parser);\
parser ->free(parser);\
tokens ->free(tokens);\
lex ->free(lex);\
input ->close(input);\
return l_parsed_object;\
}
#define BELLE_SIP_REF(object_type) \
belle_sip_##object_type##_t* belle_sip_##object_type##_ref (belle_sip_##object_type##_t* obj) { \
obj->ref++;\
return obj;\
}\
void belle_sip_##object_type##_unref (belle_sip_##object_type##_t* obj) { \
obj->ref--; \
if (obj->ref < 0) {\
belle_sip_##object_type##_delete(obj);\
}\
}
typedef struct belle_sip_param_pair_t {
int ref;
char* name;
char* value;
} belle_sip_param_pair_t;
belle_sip_param_pair_t* belle_sip_param_pair_new(const char* name,const char* value);
void belle_sip_param_pair_delete(belle_sip_param_pair_t* pair) ;
int belle_sip_param_pair_comp_func(const belle_sip_param_pair_t *a, const char*b) ;
belle_sip_param_pair_t* belle_sip_param_pair_ref(belle_sip_param_pair_t* obj);
void belle_sip_param_pair_unref(belle_sip_param_pair_t* obj);
#ifdef __cplusplus
}
#endif
......
This diff is collapsed.
/*
* SipUri.cpp
*
* Created on: 18 sept. 2010
* Author: jehanmonnier
*/
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/uri.h"
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "belle_sip_uriParser.h"
#include "belle_sip_uriLexer.h"
#include "belle_sip_messageParser.h"
#include "belle_sip_messageLexer.h"
#include "belle_sip_internal.h"
#define GET_SET_STRING(object_type,attribute) \
const char* object_type##_get_##attribute (object_type##_t* obj) {\
return obj->attribute;\
}\
void object_type##_set_##attribute (object_type##_t* obj,const char* value) {\
if (obj->attribute != NULL) free((void*)obj->attribute);\
obj->attribute=malloc(strlen(value)+1);\
strcpy((char*)(obj->attribute),value);\
}
#define SIP_URI_GET_SET_STRING(attribute) GET_SET_STRING(belle_sip_uri,attribute)
#define GET_SET_INT(object_type,attribute,type) \
type object_type##_get_##attribute (object_type##_t* obj) {\
return obj->attribute;\
}\
void object_type##_set_##attribute (object_type##_t* obj,type value) {\
obj->attribute=value;\
}
#define SIP_URI_GET_SET_UINT(attribute) GET_SET_INT(belle_sip_uri,attribute,unsigned int)
#define SIP_URI_GET_SET_INT(attribute) GET_SET_INT(belle_sip_uri,attribute,int)
#define GET_SET_BOOL(object_type,attribute,getter) \
unsigned int object_type##_##getter##_##attribute (object_type##_t* obj) {\
return obj->attribute;\
}\
void object_type##_set_##attribute (object_type##_t* obj,unsigned int value) {\
obj->attribute=value;\
}
#define SIP_URI_GET_SET_BOOL(attribute) GET_SET_BOOL(belle_sip_uri,attribute,is)
#define SIP_URI_HAS_SET_BOOL(attribute) GET_SET_BOOL(belle_sip_uri,attribute,has)
......@@ -52,6 +39,7 @@
struct _belle_sip_uri {
int ref;
unsigned int secure;
char* user;
char* host;
......@@ -81,51 +69,12 @@ void belle_sip_uri_delete(belle_sip_uri_t* uri) {
free(uri);
}
typedef struct _header_pair {
char* name;
char* value;
} header_pair;
BELLE_SIP_REF(uri)
static header_pair* header_pair_new(const char* name,const char* value) {
header_pair* lPair = (header_pair*)malloc( sizeof(header_pair));
lPair->name=strdup(name);
lPair->value=strdup(value);
return lPair;
}
static void header_pair_delete(header_pair* pair) {
free(pair->name);
free(pair->value);
free (pair);
}
static int header_pair_comp_func(const header_pair *a, const char*b) {
return strcmp(a->name,b);
}
belle_sip_uri_t* belle_sip_uri_parse (const char* uri) {
pANTLR3_INPUT_STREAM input;
pbelle_sip_uriLexer lex;
pANTLR3_COMMON_TOKEN_STREAM tokens;
pbelle_sip_uriParser parser;
input = antlr3NewAsciiStringCopyStream (
(pANTLR3_UINT8)uri,
(ANTLR3_UINT32)strlen(uri),
NULL);
lex = belle_sip_uriLexerNew (input);
tokens = antlr3CommonTokenStreamSourceNew (ANTLR3_SIZE_HINT, TOKENSOURCE(lex));
parser = belle_sip_uriParserNew (tokens);
belle_sip_uri_t* l_parsed_uri = parser->an_sip_uri(parser);
// Must manually clean up
//
parser ->free(parser);
tokens ->free(tokens);
lex ->free(lex);
input ->close(input);
return l_parsed_uri;
}
BELLE_SIP_PARSE(uri);
belle_sip_uri_t* belle_sip_uri_new () {
belle_sip_uri_t* lUri = belle_sip_new0(belle_sip_uri_t);
......@@ -147,9 +96,9 @@ char* belle_sip_uri_to_string(belle_sip_uri_t* uri) {
const char* belle_sip_uri_get_header(belle_sip_uri_t* uri,const char* name) {
belle_sip_list_t * lResult = belle_sip_list_find_custom(uri->header_list, (belle_sip_compare_func)header_pair_comp_func, name);
belle_sip_list_t * lResult = belle_sip_list_find_custom(uri->header_list, (belle_sip_compare_func)belle_sip_param_pair_comp_func, name);
if (lResult) {
return ((header_pair*)(lResult->data))->value;
return ((belle_sip_param_pair_t*)(lResult->data))->value;
}
else {
return NULL;
......@@ -158,18 +107,18 @@ const char* belle_sip_uri_get_header(belle_sip_uri_t* uri,const char* name) {
void belle_sip_uri_set_header(belle_sip_uri_t* uri,const char* name,const char* value) {
/*1 check if present*/
belle_sip_list_t * lResult = belle_sip_list_find_custom(uri->headernames_list, (belle_sip_compare_func)strcmp, name);
/* first remove from headersnames list*/
/* first remove from header names list*/
if (lResult) {
belle_sip_list_remove_link(uri->headernames_list,lResult);
}
/* next from header list*/
lResult = belle_sip_list_find_custom(uri->header_list, (belle_sip_compare_func)header_pair_comp_func, name);
lResult = belle_sip_list_find_custom(uri->header_list, (belle_sip_compare_func)belle_sip_param_pair_comp_func, name);
if (lResult) {
header_pair_delete(lResult->data);
belle_sip_param_pair_delete(lResult->data);
belle_sip_list_remove_link(uri->header_list,lResult);
}
/* 2 insert*/
header_pair* lNewpair = header_pair_new(name,value);
belle_sip_param_pair_t* lNewpair = belle_sip_param_pair_new(name,value);
uri->header_list=belle_sip_list_append(uri->header_list,lNewpair);
uri->headernames_list=belle_sip_list_append(uri->headernames_list,lNewpair->name);
}
......
/*
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_internal.h"
......@@ -401,3 +417,28 @@ void belle_sip_free(void *ptr){
free(ptr);
}
/**
* parser parameter pair
*/
belle_sip_param_pair_t* belle_sip_param_pair_new(const char* name,const char* value) {
belle_sip_param_pair_t* lPair = (belle_sip_param_pair_t*)belle_sip_new0(belle_sip_param_pair_t);
lPair->name=strdup(name);
lPair->value=strdup(value);
return lPair;
}
void belle_sip_param_pair_delete(belle_sip_param_pair_t* pair) {
free(pair->name);
free(pair->value);
free (pair);
}
int belle_sip_param_pair_comp_func(const belle_sip_param_pair_t *a, const char*b) {
return strcmp(a->name,b);
}
BELLE_SIP_REF(param_pair)
/*
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"
int init_suite1(void) {
return 0;
}
int clean_suite1(void) {
return 0;
}
void test_simple_header_contact(void) {
belle_sip_header_contact_t* L_contact = belle_sip_header_contact_parse("Contact:sip:titi.com");
belle_sip_uri_t* L_uri = belle_sip_header_address_get_uri((belle_sip_header_address_t*)L_contact);
CU_ASSERT_PTR_NULL(belle_sip_uri_get_user(L_uri));
CU_ASSERT_STRING_EQUAL(belle_sip_uri_get_host(L_uri), "titi.com");
CU_ASSERT_PTR_NULL(belle_sip_uri_get_transport_param(L_uri));
belle_sip_header_contact_delete(L_contact);
}
void test_complex_header_contact_with(void) {
belle_sip_header_contact_t* L_contact = belle_sip_header_contact_parse("Contact: \"jremis\" <sip:titi.com>;expires=3600; q=0.7");
belle_sip_uri_t* L_uri = belle_sip_header_address_get_uri((belle_sip_header_address_t*)L_contact);
CU_ASSERT_PTR_NOT_NULL(L_uri);
CU_ASSERT_STRING_EQUAL(belle_sip_uri_get_host(L_uri), "titi.com");
CU_ASSERT_STRING_EQUAL(belle_sip_header_address_get_displayname((belle_sip_header_address_t*)L_contact), "jremis");
CU_ASSERT_EQUAL(belle_sip_header_contact_get_expires(L_contact),3600);
CU_ASSERT_EQUAL(belle_sip_header_contact_get_qvalue(L_contact),0.7);
belle_sip_header_contact_delete(L_contact);
}
int belle_sip_headers_test_suite() {
CU_pSuite pSuite = NULL;
/* add a suite to the registry */
pSuite = CU_add_suite("header_suite", init_suite1, clean_suite1);
/* add the tests to the suite */
/* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */
if (NULL == CU_add_test(pSuite, "test of simple contact header", test_simple_header_contact)) {
return CU_get_error();
}
}
/*
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 <stdio.h>
#include "CUnit/Basic.h"
extern int belle_sip_uri_test_suite ();
extern int belle_sip_headers_test_suite ();
int main (int argc, char *argv[]) {
/* initialize the CUnit test registry */
if (CUE_SUCCESS != CU_initialize_registry())
return CU_get_error();
belle_sip_uri_test_suite();
belle_sip_headers_test_suite ();
/* Run all tests using the CUnit Basic interface */
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
CU_cleanup_registry();
return CU_get_error();
}
//============================================================================
// Name : parser-antlr.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
/*
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/uri.h"
#include <stdio.h>
#include "CUnit/Basic.h"
int init_suite1(void) {
static int init_suite_uri(void) {
return 0;
}
int clean_suite1(void) {
static int clean_suite_uri(void) {
return 0;
}
void testSIMPLEURI(void) {
static void testSIMPLEURI(void) {
belle_sip_uri_t* L_uri = belle_sip_uri_parse("sip:titi.com");
CU_ASSERT_PTR_NULL(belle_sip_uri_get_user(L_uri));
CU_ASSERT_STRING_EQUAL(belle_sip_uri_get_host(L_uri), "titi.com");
......@@ -27,7 +37,7 @@ void testSIMPLEURI(void) {
belle_sip_uri_delete(L_uri);
}
void testCOMPLEXURI(void) {
static void testCOMPLEXURI(void) {
belle_sip_uri_t * L_uri = belle_sip_uri_parse("sip:toto@titi.com:5060;transport=tcp");
CU_ASSERT_STRING_EQUAL(belle_sip_uri_get_user(L_uri), "toto");
CU_ASSERT_EQUAL(belle_sip_uri_get_port(L_uri), 5060);
......@@ -35,7 +45,7 @@ void testCOMPLEXURI(void) {
CU_ASSERT_STRING_EQUAL(belle_sip_uri_get_transport_param(L_uri), "tcp");
belle_sip_uri_delete(L_uri);
}