Commit cb0ff00a authored by jehan's avatar jehan
Browse files

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

parents 3cfd37d1 1e97cde6
bellesipdir=$(includedir)/belle-sip
bellesip_HEADERS=\
object.h \
uri.h \
list.h \
headers.h \
......@@ -14,6 +15,7 @@ bellesip_HEADERS=\
listener.h \
dialog.h \
utils.h \
auth-helper.h \
belle-sdp.h \
belle-sip.h
......
......@@ -113,6 +113,8 @@ belle_sip_source_t * belle_sip_timeout_source_new(belle_sip_source_func_t func,
void belle_sip_source_set_timeout(belle_sip_source_t *s, unsigned int value_ms);
unsigned int belle_sip_source_get_timeout(const belle_sip_source_t *s);
belle_sip_source_t * belle_sip_fd_source_new(belle_sip_source_func_t func, void *data, int fd, unsigned int events, unsigned int timeout_value_ms);
unsigned long belle_sip_source_get_id(belle_sip_source_t *s);
......
......@@ -184,7 +184,7 @@ BELLE_SIP_END_DECLS
#define BELLE_SIP_OBJECT(obj) BELLE_SIP_CAST(obj,belle_sip_object_t)
#define BELLE_SIP_IS_INSTANCE_OF(obj,_type) belle_sip_object_is_instance_of((belle_sip_object_t*)obj,_type##_id)
#define BELLE_SIP_OBJECT_IS_INSTANCE_OF(obj,_type) BELLE_SIP_IS_INSTANCE_OF(obj,_type)
#define belle_sip_object_describe_type(type) \
belle_sip_object_describe_type_from_name(#type)
......
......@@ -38,18 +38,19 @@ libbellesip_la_SOURCES= \
belle_sip_parameters.c \
belle_sdp_impl.c \
transaction.c \
listeningpoint.c \
listeningpoint.c listeningpoint_internal.h \
sipstack.c \
provider.c \
channel.c channel.h \
message.c \
md5.c \
md5.c md5.h \
auth_helper.c \
ict.c \
nict.c \
transports/udp_listeningpoint.c \
transports/udp_channel.c \
transports/stream_channel.c \
transports/stream_listeningpoint.c
transports/stream_listeningpoint.c
libbellesip_la_CFLAGS=$(STRICT_OPTIONS) $(ANTLR_CFLAGS)
......
......@@ -444,7 +444,24 @@ struct belle_sip_transaction{
void *appdata;
};
BELLE_SIP_DECLARE_VPTR(belle_sip_transaction_t)
BELLE_SIP_DECLARE_CUSTOM_VPTR_BEGIN(belle_sip_transaction_t,belle_sip_object_t)
void (*on_terminate)(belle_sip_transaction_t *obj);
BELLE_SIP_DECLARE_CUSTOM_VPTR_END
static inline const belle_sip_timer_config_t * belle_sip_transaction_get_timer_config(belle_sip_transaction_t *obj){
return belle_sip_stack_get_timer_config(obj->provider->stack);
}
static inline void belle_sip_transaction_start_timer(belle_sip_transaction_t *obj, belle_sip_source_t *timer){
belle_sip_main_loop_add_source(obj->provider->stack->ml,timer);
}
static inline void belle_sip_transaction_stop_timer(belle_sip_transaction_t *obj, belle_sip_source_t *timer){
belle_sip_main_loop_remove_source(obj->provider->stack->ml,timer);
}
void belle_sip_transaction_notify_timeout(belle_sip_transaction_t *t);
/*
*
......@@ -460,7 +477,7 @@ struct belle_sip_client_transaction{
BELLE_SIP_DECLARE_CUSTOM_VPTR_BEGIN(belle_sip_client_transaction_t,belle_sip_transaction_t)
void (*send_request)(belle_sip_client_transaction_t *);
void (*on_response)(belle_sip_client_transaction_t *obj, belle_sip_response_t *resp);
int (*on_response)(belle_sip_client_transaction_t *obj, belle_sip_response_t *resp);
BELLE_SIP_DECLARE_CUSTOM_VPTR_END
void belle_sip_client_transaction_init(belle_sip_client_transaction_t *obj, belle_sip_provider_t *prov, belle_sip_request_t *req);
......@@ -479,6 +496,9 @@ belle_sip_ict_t * belle_sip_ict_new(belle_sip_provider_t *prov, belle_sip_reques
struct belle_sip_nict{
belle_sip_client_transaction_t base;
belle_sip_source_t *timer_F;
belle_sip_source_t *timer_E;
belle_sip_source_t *timer_K;
};
typedef struct belle_sip_nict belle_sip_nict_t;
......
......@@ -133,6 +133,11 @@ void belle_sip_source_set_timeout(belle_sip_source_t *s, unsigned int value_ms){
s->timeout=value_ms;
}
unsigned int belle_sip_source_get_timeout(const belle_sip_source_t *s){
return s->timeout;
}
static int match_source_id(const void *s, const void *pid){
if ( ((belle_sip_source_t*)s)->id==(unsigned long)pid){
return 0;
......
......@@ -22,7 +22,11 @@
static void ict_destroy(belle_sip_ict_t *obj){
}
static void ict_on_response(belle_sip_ict_t *obj, belle_sip_response_t *resp){
static void on_ict_terminate(belle_sip_ict_t *obj){
}
static int ict_on_response(belle_sip_ict_t *obj, belle_sip_response_t *resp){
return 0;
}
static void ict_send_request(belle_sip_ict_t *obj){
......@@ -36,13 +40,16 @@ BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_ict_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_ict_t)={
{
{
BELLE_SIP_VPTR_INIT(belle_sip_ict_t,belle_sip_client_transaction_t,FALSE),
(belle_sip_object_destroy_t)ict_destroy,
NULL,
NULL
{
BELLE_SIP_VPTR_INIT(belle_sip_ict_t,belle_sip_client_transaction_t,FALSE),
(belle_sip_object_destroy_t)ict_destroy,
NULL,
NULL
},
(void (*)(belle_sip_transaction_t*))on_ict_terminate
},
(void (*)(belle_sip_client_transaction_t*))ict_send_request,
(void (*)(belle_sip_client_transaction_t*,belle_sip_response_t*))ict_on_response
(int (*)(belle_sip_client_transaction_t*,belle_sip_response_t*))ict_on_response
}
};
......
......@@ -240,10 +240,6 @@ belle_sip_response_t* belle_sip_response_event_get_response(const belle_sip_resp
/*private provider API*/
void belle_sip_provider_set_transaction_terminated(belle_sip_provider_t *p, belle_sip_transaction_t *t){
belle_sip_transaction_terminated_event_t ev;
ev.source=p;
ev.transaction=t;
ev.is_server_transaction=BELLE_SIP_IS_INSTANCE_OF(t,belle_sip_server_transaction_t);
BELLE_SIP_PROVIDER_INVOKE_LISTENERS(p,process_transaction_terminated,&ev);
}
......@@ -20,7 +20,7 @@
static void belle_sip_transaction_init(belle_sip_transaction_t *t, belle_sip_provider_t *prov, belle_sip_request_t *req){
if (req) belle_sip_object_ref(req);
t->request=req;
t->request=(belle_sip_request_t*)belle_sip_object_ref(req);
t->provider=prov;
}
......@@ -33,10 +33,13 @@ static void transaction_destroy(belle_sip_transaction_t *t){
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_transaction_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_transaction_t)={
{
BELLE_SIP_VPTR_INIT(belle_sip_transaction_t,belle_sip_object_t,FALSE),
(belle_sip_object_destroy_t) transaction_destroy,
NULL,/*no clone*/
NULL,/*no marshall*/
},
NULL /*on_terminate*/
};
void *belle_sip_transaction_get_application_data(const belle_sip_transaction_t *t){
......@@ -56,14 +59,30 @@ belle_sip_transaction_state_t belle_sip_transaction_get_state(const belle_sip_tr
}
void belle_sip_transaction_terminate(belle_sip_transaction_t *t){
belle_sip_transaction_terminated_event_t ev;
t->state=BELLE_SIP_TRANSACTION_TERMINATED;
belle_sip_provider_set_transaction_terminated(t->provider,t);
BELLE_SIP_OBJECT_VPTR(t,belle_sip_transaction_t)->on_terminate(t);
ev.source=t->provider;
ev.transaction=t;
ev.is_server_transaction=BELLE_SIP_IS_INSTANCE_OF(t,belle_sip_server_transaction_t);
BELLE_SIP_PROVIDER_INVOKE_LISTENERS(t->provider,process_transaction_terminated,&ev);
}
belle_sip_request_t *belle_sip_transaction_get_request(belle_sip_transaction_t *t){
return t->request;
}
void belle_sip_transaction_notify_timeout(belle_sip_transaction_t *t){
belle_sip_timeout_event_t ev;
ev.source=t->provider;
ev.transaction=t;
ev.is_server_transaction=BELLE_SIP_OBJECT_IS_INSTANCE_OF(t,belle_sip_server_transaction_t);
BELLE_SIP_PROVIDER_INVOKE_LISTENERS(t->provider,process_timeout,&ev);
}
/*
* Server transaction
*/
......@@ -74,12 +93,15 @@ static void server_transaction_destroy(belle_sip_server_transaction_t *t){
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_server_transaction_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_server_transaction_t)={
{
{
BELLE_SIP_VPTR_INIT(belle_sip_server_transaction_t,belle_sip_transaction_t,FALSE),
(belle_sip_object_destroy_t) server_transaction_destroy,
NULL,
NULL
}
},
NULL
}
};
belle_sip_server_transaction_t * belle_sip_server_transaction_new(belle_sip_provider_t *prov,belle_sip_request_t *req){
......@@ -122,6 +144,24 @@ void belle_sip_client_transaction_send_request(belle_sip_client_transaction_t *t
}
}
void belle_sip_client_transaction_add_response(belle_sip_client_transaction_t *t, belle_sip_response_t *resp){
belle_sip_transaction_t *base=(belle_sip_transaction_t*)t;
int pass=BELLE_SIP_OBJECT_VPTR(t,belle_sip_client_transaction_t)->on_response(t,resp);
if (pass){
belle_sip_response_event_t ev;
if (base->prov_response)
belle_sip_object_unref(base->prov_response);
base->prov_response=(belle_sip_response_t*)belle_sip_object_ref(resp);
ev.source=base->provider;
ev.response=resp;
ev.client_transaction=t;
ev.dialog=NULL;
BELLE_SIP_PROVIDER_INVOKE_LISTENERS(base->provider,process_response_event,&ev);
}
}
static void client_transaction_destroy(belle_sip_client_transaction_t *t ){
}
......@@ -146,9 +186,12 @@ BELLE_SIP_IMPLEMENT_INTERFACE_END
BELLE_SIP_DECLARE_IMPLEMENTED_INTERFACES_1(belle_sip_client_transaction_t, belle_sip_channel_listener_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_client_transaction_t)={
{
BELLE_SIP_VPTR_INIT(belle_sip_client_transaction_t,belle_sip_transaction_t,FALSE),
(belle_sip_object_destroy_t)client_transaction_destroy,
NULL,
{
BELLE_SIP_VPTR_INIT(belle_sip_client_transaction_t,belle_sip_transaction_t,FALSE),
(belle_sip_object_destroy_t)client_transaction_destroy,
NULL,
NULL
},
NULL
},
NULL,
......@@ -167,6 +210,3 @@ belle_sip_nist_t *belle_sip_nist_new(belle_sip_provider_t *prov, belle_sip_reque
return NULL;
}
belle_sip_nict_t *belle_sip_nict_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
return NULL;
}
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