Commit d9256e82 authored by jehan's avatar jehan
Browse files

Merge branch 'master' of git.linphone.org:belle-sip

Conflicts:
	src/belle_sip_message.g
	tester/belle_sip_headers_tester.c
parents 32f03c56 5d3f6210
......@@ -68,7 +68,7 @@
</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" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<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"/>
......@@ -86,6 +86,9 @@
<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.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">
......@@ -98,8 +101,8 @@
</fileInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="tester"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="include"/>
<entry excluding="cast_test.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="tester"/>
</sourceEntries>
</configuration>
</storageModule>
......@@ -1151,7 +1154,7 @@
</folderInfo>
<fileInfo id="cdt.managedbuild.config.macosx.exe.release.1185931821.547162919" name="belle_sip_headers_tester.c" rcbsApplicability="disable" resourcePath="tester/belle_sip_headers_tester.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.release.845803029.1225849490">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.release.845803029.1225849490" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.release.845803029">
<option id="gnu.c.compiler.option.include.paths.485481417" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<option id="gnu.c.compiler.option.include.paths.485481417" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/opt/local/include"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.711687923" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
......
......@@ -24,7 +24,7 @@ CFLAGS="-g -O2"
if test x$GCC = xyes ; then
STRICT_OPTIONS=" -Wall -Werror"
dnl because of antlr3 we must accept a few warnings...
LESS_STRICT_OPTIONS="$STRICT_OPTIONS -Wno-error=unused-function -Wno-error=uninitialized"
LESS_STRICT_OPTIONS="$STRICT_OPTIONS -Wno-error=unused-function -Wno-error=uninitialized -Wno-error=unused-variable"
fi
......
......@@ -4,6 +4,8 @@ bellesip_HEADERS=\
uri.h \
list.h \
mainloop.h \
transaction.h \
message.h \
belle-sip.h
EXTRA_DIST=$(bellesip_HEADERS)
......@@ -18,10 +18,36 @@
#ifndef BELLE_SIP_H
#define BELLE_SIP_H
#include <stdlib.h>
#define BELLE_SIP_MAGIC(_type) _type##_magic
typedef enum belle_sip_magic{
belle_sip_magic_first=0x32445191,
BELLE_SIP_MAGIC(belle_sip_transaction_t),
BELLE_SIP_MAGIC(belle_sip_server_transaction_t),
BELLE_SIP_MAGIC(belle_sip_client_transaction_t),
belle_sip_magic_end
}belle_sip_magic_t;
#define BELLE_SIP_IMPLEMENT_CAST(_type) \
_type *_type##_cast(void *obj, const char *file, int line){ \
if (((_type*)obj)->magic==BELLE_SIP_MAGIC(_type)) return (_type*)obj; \
belle_sip_fatal("Bad cast to "#_type " at %s:%i", file, line);\
return NULL; \
}
#define BELLE_SIP_DECLARE_CAST(_type)\
_type *_type##_cast(void *obj, const char *file, int line);
#define BELLE_SIP_CAST(obj,_type) _type##_cast(obj, __FILE__, __LINE__)
#include "belle-sip/list.h"
#include "belle-sip/mainloop.h"
#include "belle-sip/uri.h"
#include "belle-sip/headers.h"
#include "belle-sip/message.h"
#include "belle-sip/transaction.h"
#undef TRUE
#define TRUE 1
......
......@@ -120,7 +120,7 @@ belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact)
void belle_sip_header_from_unref (belle_sip_header_from_t* from) ;
void belle_sip_header_from_set_tag(belle_sip_header_from_t* from,const char* tag);
void belle_sip_header_from_set_tag(belle_sip_header_from_t* from, const char* tag);
const char* belle_sip_header_from_get_tag(belle_sip_header_from_t* from);
......
/*
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_SIP_MESSAGE_H
#define BELLE_SIP_MESSAGE_H
typedef struct belle_sip_message bellesip_message_t;
typedef struct belle_sip_request belle_sip_request_t;
typedef struct belle_sip_response belle_sip_response_t;
#endif
/*
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_SIP_TRANSACTION_H
#define BELLE_SIP_TRANSACTION_H
typedef struct belle_sip_transaction belle_sip_transaction_t;
typedef struct belle_sip_server_transaction belle_sip_server_transaction_t;
typedef struct belle_sip_client_transaction belle_sip_client_transaction_t;
typedef enum belle_sip_transaction_state{
BELLE_SIP_TRANSACTION_CALLING,
BELLE_SIP_TRANSACTION_COMPLETED,
BELLE_SIP_TRANSACTION_CONFIRMED,
BELLE_SIP_TRANSACTION_PROCEEDING,
BELLE_SIP_TRANSACTION_TRYING,
BELLE_SIP_TRANSACTION_TERMINATED
}belle_sip_transaction_state_t;
void *belle_sip_transaction_get_application_data(const belle_sip_transaction_t *t);
void belle_sip_transaction_set_application_data(belle_sip_transaction_t *t, void *data);
const char *belle_sip_transaction_get_branch_id(const belle_sip_transaction_t *t);
belle_sip_transaction_state_t belle_sip_transaction_get_state(const belle_sip_transaction_t *t);
void belle_sip_transaction_terminate(belle_sip_transaction_t *t);
belle_sip_request_t *belle_sip_transaction_get_request(belle_sip_transaction_t *t);
void belle_sip_server_transaction_send_response(belle_sip_server_transaction_t *t);
belle_sip_request_t * belle_sip_client_transaction_create_cancel(belle_sip_client_transaction_t *t);
void belle_sip_client_transaction_send_request(belle_sip_client_transaction_t *t);
BELLE_SIP_DECLARE_CAST(belle_sip_transaction_t);
BELLE_SIP_DECLARE_CAST(belle_sip_client_transaction_t);
BELLE_SIP_DECLARE_CAST(belle_sip_server_transaction_t);
#define BELLE_SIP_TRANSACTION(t) BELLE_SIP_CAST(t,belle_sip_transaction_t)
#define BELLE_SIP_SERVER_TRANSACTION(t) BELLE_SIP_CAST(t,belle_sip_server_transaction_t)
#define BELLE_SIP_CLIENT_TRANSACTION(t) BELLE_SIP_CAST(t,belle_sip_client_transaction_t)
/*to be moved out when belle_sip_provider_t is implemented:*/
belle_sip_client_transaction_t * belle_sip_client_transaction_new(belle_sip_request_t *req);
belle_sip_server_transaction_t * belle_sip_server_transaction_new(belle_sip_request_t *req);
#endif
ANTLR=antlr3
grammar_files= \
$(srcdir)/belle_sip_uri.g
$(srcdir)/belle_sip_uri.g \
$(srcdir)/belle_sip_message.g
generated_src= \
belle_sip_uriParser.c belle_sip_uriParser.h \
belle_sip_uriLexer.c belle_sip_uriLexer.h
belle_sip_uriLexer.c belle_sip_uriLexer.h \
belle_sip_messageParser.c belle_sip_messageParser.h \
belle_sip_messageLexer.c belle_sip_messageLexer.h
$(generated_src) : $(grammar_files)
$(ANTLR) -make -fo $(builddir) $(grammar_files)
......@@ -22,9 +25,11 @@ lib_LTLIBRARIES=libbellesip.la
libbellesip_la_SOURCES=belle_sip_uri_impl.c \
belle_sip_headers_impl.c \
belle_sip_utils.c belle_sip_internal.h \
belle_sip_loop.c \
belle_sip_resolver.c belle_sip_resolver.h
belle_sip_resolver.c belle_sip_resolver.h \
transaction.c
libbellesip_la_CFLAGS=$(STRICT_OPTIONS)
......@@ -32,7 +37,6 @@ libbellesip_la_LIBADD=libbellesip_generated.la -lantlr3c
INCLUDES=-I$(top_srcdir)/include
EXTRA_DIST=$(grammar_files)
CLEANFILES=$(generated_src) *.tokens
......@@ -26,8 +26,10 @@
#include <errno.h>
#include <unistd.h>
/* include all public headers*/
#include "belle-sip/belle-sip.h"
struct _belle_sip_list {
struct _belle_sip_list *next;
struct _belle_sip_list *prev;
......@@ -236,7 +238,7 @@ belle_sip_##object_type##_t* belle_sip_##object_type##_parse (const char* value)
}
#define BELLE_SIP_NEW(object_type) \
belle_sip_##object_type##_t* belle_sip_##object_type##_ref (belle_sip_##object_type##_t* obj) { \
belle_sip_##object_type##_t* belle_sip_##object_type##_new (belle_sip_##object_type##_t* obj) { \
return (belle_sip_##object_type##_t*)belle_sip_new0(belle_sip_##object_type##_t);\
}
......@@ -277,4 +279,7 @@ void belle_sip_header_address_set_quoted_displayname(belle_sip_header_address_t*
}
#endif
/*include private headers */
#include "belle_sip_resolver.h"
#endif
......@@ -148,7 +148,10 @@ qvalue
| ( '1'( '.'DIGIT+)? );
*/
generic_param returns [belle_sip_param_pair_t* ret]
: SP* token ( SP* EQUAL SP* is_gen=gen_value )? {$ret=belle_sip_param_pair_new($token.text->chars,$is_gen.text?$gen_value.text->chars:NULL);};
: SP* token ( SP* EQUAL SP* is_gen=gen_value )? {
$ret=belle_sip_param_pair_new((const char*)($token.text->chars)
,$is_gen.text?(const char*)($gen_value.text->chars):NULL);
};
gen_value
: token | quoted_string;
......@@ -287,8 +290,8 @@ addr_spec[belle_sip_header_address_t* object]
: uri {belle_sip_header_address_set_uri(object,belle_sip_uri_ref($uri.ret));};//| absoluteURI;
display_name[belle_sip_header_address_t* object]
: token {belle_sip_header_address_set_displayname(object,$token.text->chars);}
| quoted_string {belle_sip_header_address_set_quoted_displayname(object,$quoted_string.text->chars);}
: token {belle_sip_header_address_set_displayname(object,(const char*)($token.text->chars));}
| quoted_string {belle_sip_header_address_set_quoted_displayname(object,(const char*)($quoted_string.text->chars));}
;
contact_params
......@@ -404,18 +407,18 @@ expires
: 'Expires' HCOLON delta_seconds;
*/
from_token: {strcmp("From",(const char*)(INPUT->toStringTT(INPUT,LT(1),LT(4)))->chars) == 0}? token;
header_from
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(); }
: from_token/* ( 'From' | 'f' )*/ HCOLON from_spec;
: from_token/* ( 'From' | 'f' )*/ HCOLON from_spec {$ret = $header_from::current;};
from_spec
: ( name_addr[$header_from::current] | addr_spec[$header_from::current] )
: ( name_addr[(belle_sip_header_address_t*)$header_from::current] | addr_spec[(belle_sip_header_address_t*)$header_from::current] )
( SEMI from_param )*;
from_param
: /*tag_param |*/ generic_param {belle_sip_param_pair_t* pair = $generic_param.ret ;
if (strcmp("tag",pair->name) == 0) {
belle_sip_header_from_set_tag($header_contact::current,pair->value);
belle_sip_header_from_set_tag($header_from::current,pair->value);
} else {
belle_sip_warning("unknown from param \%s",(const char *)$from_param.text->chars);
}
......@@ -807,4 +810,4 @@ STAR
SP
: ' '
;
OCTET : . ;
\ No newline at end of file
OCTET : . ;
......@@ -36,6 +36,7 @@ void belle_sip_resolver_context_destroy(belle_sip_resolver_context_t *ctx){
static int resolver_callback(belle_sip_resolver_context_t *ctx){
ctx->cb(ctx->cb_data, ctx->name, ctx->ai);
ctx->ai=NULL;
return 0;
}
......@@ -51,17 +52,35 @@ belle_sip_resolver_context_t *belle_sip_resolver_context_new(){
static void *belle_sip_resolver_thread(void *ptr){
belle_sip_resolver_context_t *ctx=(belle_sip_resolver_context_t *)ptr;
struct addrinfo *res=NULL;
struct addrinfo hints={0};
char serv[10];
int err;
snprintf(serv,sizeof(serv),"%i",ctx->port);
hints.ai_family=(ctx->hints & BELLE_SIP_RESOLVER_HINT_IPV6) ? AF_INET6 : AF_INET;
hints.ai_flags=AI_NUMERICSERV;
err=getaddrinfo(ctx->name,serv,&hints,&res);
if (err!=0){
belle_sip_error("DNS resolution of %s failed: %s",ctx->name,gai_strerror(err));
}else{
char tmp[64];
belle_sip_message("%s has address %s.",ctx->name,inet_ntop(res->ai_family,res->ai_addr,tmp,sizeof(tmp)));
ctx->ai=res;
}
if (write(ctx->ctlpipe[1],"q",1)==-1){
belle_sip_error("belle_sip_resolver_thread(): Fail to write on pipe.");
}
return NULL;
}
unsigned long belle_sip_resolve(const char *name, unsigned int hints, belle_sip_resolver_callback_t cb , void *data, belle_sip_main_loop_t *ml){
unsigned long belle_sip_resolve(const char *name, int port, unsigned int hints, belle_sip_resolver_callback_t cb , void *data, belle_sip_main_loop_t *ml){
belle_sip_resolver_context_t *ctx=belle_sip_resolver_context_new();
ctx->cb_data=data;
ctx->cb=cb;
ctx->name=belle_sip_strdup(name);
ctx->port=port;
ctx->hints=hints;
belle_sip_main_loop_add_source(ml,(belle_sip_source_t*)ctx);
pthread_create(&ctx->thread,NULL,belle_sip_resolver_thread,ctx);
......
......@@ -25,7 +25,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <pthread.h>
#define BELLE_SIP_RESOLVER_HINT_IPV6 (1)
......@@ -34,7 +34,11 @@
typedef struct belle_sip_resolver_context belle_sip_resolver_context_t;
typedef void (*belle_sip_resolver_callback_t)(void *data, const char *name, const struct addrinfo *result);
/**
* Callback prototype for asynchronous DNS resolution. The result addrinfo must be taken and (possibly later) freed by
* the callee, using freeaddrinfo().
**/
typedef void (*belle_sip_resolver_callback_t)(void *data, const char *name, struct addrinfo *result);
struct belle_sip_resolver_context{
......@@ -42,6 +46,7 @@ struct belle_sip_resolver_context{
belle_sip_resolver_callback_t cb;
void *cb_data;
char *name;
int port;
struct addrinfo *ai;
unsigned int hints;
pthread_t thread;
......@@ -51,7 +56,7 @@ struct belle_sip_resolver_context{
};
unsigned long belle_sip_resolve(const char *name, unsigned int hints, belle_sip_resolver_callback_t cb , void *data, belle_sip_main_loop_t *ml);
unsigned long belle_sip_resolve(const char *name, int port, unsigned int hints, belle_sip_resolver_callback_t cb , void *data, belle_sip_main_loop_t *ml);
......
......@@ -85,9 +85,6 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp) {
uint64_t start, end, delta, nano;
task_basic_info_data_t tinfo;
task_thread_times_info_data_t ttinfo;
mach_msg_type_number_t tflag;
int retval = -1;
switch (clk_id) {
......
/*
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"
struct belle_sip_transaction{
belle_sip_magic_t magic;
char *branch_id;
belle_sip_transaction_state_t state;
void *appdata;
belle_sip_request_t *request;
};
struct belle_sip_server_transaction{
belle_sip_transaction_t base;
belle_sip_magic_t magic;
};
struct belle_sip_client_transaction{
belle_sip_transaction_t base;
belle_sip_magic_t magic;
};
BELLE_SIP_IMPLEMENT_CAST(belle_sip_transaction_t);
BELLE_SIP_IMPLEMENT_CAST(belle_sip_server_transaction_t);
BELLE_SIP_IMPLEMENT_CAST(belle_sip_client_transaction_t);
void *belle_sip_transaction_get_application_data(const belle_sip_transaction_t *t){
return t->appdata;
}
void belle_sip_transaction_set_application_data(belle_sip_transaction_t *t, void *data){
t->appdata=data;
}
const char *belle_sip_transaction_get_branch_id(const belle_sip_transaction_t *t){
return t->branch_id;
}
belle_sip_transaction_state_t belle_sip_transaction_get_state(const belle_sip_transaction_t *t){
return t->state;
}
void belle_sip_transaction_terminate(belle_sip_transaction_t *t){
}
belle_sip_request_t *belle_sip_transaction_get_request(belle_sip_transaction_t *t){
return t->request;
}
void belle_sip_server_transaction_send_response(belle_sip_server_transaction_t *t){
}
belle_sip_request_t * belle_sip_client_transaction_create_cancel(belle_sip_client_transaction_t *t){
return NULL;
}
void belle_sip_client_transaction_send_request(belle_sip_client_transaction_t *t){
}
static void belle_sip_transaction_init(belle_sip_transaction_t *t, belle_sip_request_t *req){
t->magic=BELLE_SIP_MAGIC(belle_sip_transaction_t);
t->request=req;
}
belle_sip_client_transaction_t * belle_sip_client_transaction_new(belle_sip_request_t *req){
belle_sip_client_transaction_t *t=belle_sip_new0(belle_sip_client_transaction_t);
belle_sip_transaction_init((belle_sip_transaction_t*)t,req);
t->magic=BELLE_SIP_MAGIC(belle_sip_client_transaction_t);
return t;
}
belle_sip_server_transaction_t * belle_sip_server_transaction_new(belle_sip_request_t *req){
belle_sip_server_transaction_t *t=belle_sip_new0(belle_sip_server_transaction_t);
belle_sip_transaction_init((belle_sip_transaction_t*)t,req);
t->magic=BELLE_SIP_MAGIC(belle_sip_server_transaction_t);
return t;
}
if BUILD_TESTS
noinst_PROGRAMS=belle_sip_uri_tester
noinst_PROGRAMS=belle_sip_tester cast_test
belle_sip_uri_tester_SOURCES=belle_sip_uri_tester.c
belle_sip_tester_SOURCES=belle_sip_tester.c belle_sip_uri_tester.c belle_sip_headers_tester.c
cast_test_SOURCES=cast_test.c
INCLUDES=-I$(top_srcdir)/include
LDADD=$(top_builddir)/src/libbellesip.la -lcunit
AM_CFLAGS=$(STRICT_OPTIONS)
endif
......@@ -66,7 +66,7 @@ void test_complex_header_contact(void) {
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);
......@@ -79,5 +79,5 @@ int belle_sip_headers_test_suite() {
if (NULL == CU_add_test(pSuite, "test of complex contact header", test_complex_header_contact)) {
return CU_get_error();
}
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 <stdio.h>
#include "belle-sip/belle-sip.h"
int main(int argc, char *argv[]){
belle_sip_server_transaction_t *st=belle_sip_server_transaction_new(NULL);
belle_sip_client_transaction_t *ct=belle_sip_client_transaction_new(NULL);
belle_sip_transaction_t *t;
printf("Casting belle_sip_server_transaction_t to belle_sip_transaction_t\n");
t=BELLE_SIP_TRANSACTION(st);
printf("Ok.\n");
printf("Casting belle_sip_client_transaction_t to belle_sip_transaction_t\n");
t=BELLE_SIP_TRANSACTION(ct);
printf("Ok.\n");
printf("Casting belle_sip_server_transaction_t to belle_sip_client_transaction_t\n");
ct=BELLE_SIP_CLIENT_TRANSACTION(st);
printf("Ooops we should have aborted before.\n");
return 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