Commit ce931ad1 authored by Simon Morlat's avatar Simon Morlat

use function call to obtain object's vptr, instead of using an extern variable.

parent 82e6fdc6
......@@ -33,16 +33,16 @@
#define BELLESIP_INLINE inline
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__WIN32__)
#ifdef WIN32
#ifdef BELLESIP_EXPORTS
#define BELLESIP_EXPORT __declspec(dllexport)
#define BELLESIP_VAR_EXPORT __declspec(dllexport)
//#define BELLESIP_VAR_EXPORT __declspec(dllexport)
#else
#define BELLESIP_EXPORT
#define BELLESIP_VAR_EXPORT extern __declspec(dllimport)
//#define BELLESIP_VAR_EXPORT extern __declspec(dllimport)
#endif
#else
#define BELLESIP_VAR_EXPORT extern
//#define BELLESIP_VAR_EXPORT extern
#define BELLESIP_EXPORT extern
#endif
......
......@@ -38,38 +38,48 @@ typedef unsigned int belle_sip_type_id_t;
#define BELLE_SIP_OBJECT_VPTR_NAME(object_type) object_type##_vptr
#define BELLE_SIP_OBJECT_GET_VPTR_FUNC(object_type) object_type##_vptr_get
#define BELLE_SIP_OBJECT_VPTR_TYPE(object_type) object_type##_vptr_t
#define BELLE_SIP_DECLARE_VPTR(object_type) \
typedef belle_sip_object_vptr_t BELLE_SIP_OBJECT_VPTR_TYPE(object_type);\
BELLESIP_VAR_EXPORT BELLE_SIP_OBJECT_VPTR_TYPE(object_type) BELLE_SIP_OBJECT_VPTR_NAME(object_type);
BELLESIP_EXPORT BELLE_SIP_OBJECT_VPTR_TYPE(object_type) * BELLE_SIP_OBJECT_GET_VPTR_FUNC(object_type)(void);
#define BELLE_SIP_DECLARE_CUSTOM_VPTR_BEGIN(object_type, parent_type) \
typedef struct object_type##_vptr_struct BELLE_SIP_OBJECT_VPTR_TYPE(object_type);\
extern BELLE_SIP_OBJECT_VPTR_TYPE(object_type) BELLE_SIP_OBJECT_VPTR_NAME(object_type);\
BELLESIP_EXPORT BELLE_SIP_OBJECT_VPTR_TYPE(object_type) * BELLE_SIP_OBJECT_GET_VPTR_FUNC(object_type)(void); \
struct object_type##_vptr_struct{\
BELLE_SIP_OBJECT_VPTR_TYPE(parent_type) base;
#define BELLE_SIP_DECLARE_CUSTOM_VPTR_END };
#define BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(object_type) \
BELLE_SIP_OBJECT_VPTR_TYPE(object_type) BELLE_SIP_OBJECT_VPTR_NAME(object_type)
#define BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(object_type) \
extern BELLE_SIP_OBJECT_VPTR_TYPE(object_type) BELLE_SIP_OBJECT_VPTR_NAME(object_type);\
BELLE_SIP_OBJECT_VPTR_TYPE(object_type) * BELLE_SIP_OBJECT_GET_VPTR_FUNC(object_type)(void){\
return &BELLE_SIP_OBJECT_VPTR_NAME(object_type); \
}\
BELLE_SIP_OBJECT_VPTR_TYPE(object_type) BELLE_SIP_OBJECT_VPTR_NAME(object_type)={
#define BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END };
#define BELLE_SIP_VPTR_INIT(object_type,parent_type,unowned) \
BELLE_SIP_TYPE_ID(object_type), \
#object_type,\
unowned,\
(belle_sip_object_vptr_t*)&BELLE_SIP_OBJECT_VPTR_NAME(parent_type), \
(belle_sip_object_get_vptr_t)BELLE_SIP_OBJECT_GET_VPTR_FUNC(parent_type), \
(belle_sip_interface_desc_t**)object_type##interfaces_table
#define BELLE_SIP_INSTANCIATE_VPTR(object_type,parent_type,destroy,clone,marshal,unowned) \
BELLE_SIP_OBJECT_VPTR_TYPE(object_type) BELLE_SIP_OBJECT_VPTR_NAME(object_type)={ \
static BELLE_SIP_OBJECT_VPTR_TYPE(object_type) BELLE_SIP_OBJECT_VPTR_NAME(object_type)={ \
BELLE_SIP_VPTR_INIT(object_type,parent_type,unowned), \
(belle_sip_object_destroy_t)destroy, \
(belle_sip_object_clone_t)clone, \
(belle_sip_object_marshal_t)marshal\
}; \
BELLE_SIP_OBJECT_VPTR_TYPE(object_type) * BELLE_SIP_OBJECT_GET_VPTR_FUNC(object_type)(void){\
return &BELLE_SIP_OBJECT_VPTR_NAME(object_type); \
}
/**
......@@ -117,12 +127,13 @@ typedef struct _belle_sip_object belle_sip_object_t;
typedef void (*belle_sip_object_destroy_t)(belle_sip_object_t*);
typedef void (*belle_sip_object_clone_t)(belle_sip_object_t* obj, const belle_sip_object_t *orig);
typedef int (*belle_sip_object_marshal_t)(belle_sip_object_t* obj, char* buff, size_t buff_size, size_t *offset);
typedef struct _belle_sip_object_vptr *(*belle_sip_object_get_vptr_t)(void);
struct _belle_sip_object_vptr{
belle_sip_type_id_t id;
const char *type_name;
int initially_unowned;
struct _belle_sip_object_vptr *parent;
belle_sip_object_get_vptr_t get_parent;
struct belle_sip_interface_desc **interfaces; /*NULL terminated table of */
belle_sip_object_destroy_t destroy;
belle_sip_object_clone_t clone;
......@@ -146,12 +157,10 @@ struct _belle_sip_object{
BELLE_SIP_BEGIN_DECLS
BELLESIP_VAR_EXPORT belle_sip_object_vptr_t belle_sip_object_t_vptr;
BELLESIP_EXPORT belle_sip_object_t * _belle_sip_object_new(size_t objsize, belle_sip_object_vptr_t *vptr);
#define belle_sip_object_new(_type) (_type*)_belle_sip_object_new(sizeof(_type),(belle_sip_object_vptr_t*)&BELLE_SIP_OBJECT_VPTR_NAME(_type))
#define belle_sip_object_new(_type) (_type*)_belle_sip_object_new(sizeof(_type),(belle_sip_object_vptr_t*)BELLE_SIP_OBJECT_GET_VPTR_FUNC(_type)())
/**
......@@ -170,7 +179,6 @@ int belle_sip_object_is_unowed(const belle_sip_object_t *obj);
**/
BELLESIP_EXPORT belle_sip_object_t * belle_sip_object_ref(void *obj);
/*#define BELLE_SIP_REF(object,type) (type*)belle_sip_object_ref(object);*/
/**
* Decrements the reference counter. When it drops to zero, the object is destroyed.
**/
......
......@@ -27,7 +27,7 @@ static int has_type(belle_sip_object_t *obj, belle_sip_type_id_t id){
while(vptr!=NULL){
if (vptr->id==id) return TRUE;
vptr=vptr->parent;
vptr=vptr->get_parent();
}
return FALSE;
}
......@@ -144,17 +144,25 @@ static belle_sip_error_code _belle_object_marshal(belle_sip_object_t* obj, char*
return belle_sip_snprintf(buff,buff_size,offset,"{%s::%s %p}",obj->vptr->type_name,obj->name ? obj->name : "(no name)",obj);
}
static belle_sip_object_vptr_t *no_parent(void){
return NULL;
}
belle_sip_object_vptr_t belle_sip_object_t_vptr={
BELLE_SIP_TYPE_ID(belle_sip_object_t),
"belle_sip_object_t",
FALSE,
NULL, /*no parent, it's god*/
no_parent, /*no parent, it's god*/
NULL,
_belle_sip_object_uninit,
_belle_sip_object_clone,
_belle_object_marshal
};
belle_sip_object_vptr_t *belle_sip_object_t_vptr_get(void){
return &belle_sip_object_t_vptr;
}
void belle_sip_object_delete(void *ptr){
belle_sip_object_t *obj=BELLE_SIP_OBJECT(ptr);
belle_sip_object_vptr_t *vptr;
......@@ -163,7 +171,7 @@ void belle_sip_object_delete(void *ptr){
vptr=obj->vptr;
while(vptr!=NULL){
if (vptr->destroy) vptr->destroy(obj);
vptr=vptr->parent;
vptr=vptr->get_parent();
}
belle_sip_object_data_clear(obj);
belle_sip_free(obj);
......@@ -171,15 +179,15 @@ void belle_sip_object_delete(void *ptr){
static belle_sip_object_vptr_t *find_common_floor(belle_sip_object_vptr_t *vptr1, belle_sip_object_vptr_t *vptr2){
belle_sip_object_vptr_t *it1,*it2;
for (it1=vptr1;it1!=NULL;it1=it1->parent){
for (it1=vptr1;it1!=NULL;it1=it1->get_parent()){
if (it1==vptr2)
return vptr2;
}
for(it2=vptr2;it2!=NULL;it2=it2->parent){
for(it2=vptr2;it2!=NULL;it2=it2->get_parent()){
if (vptr1==it2)
return vptr1;
}
return find_common_floor(vptr1->parent,vptr2);
return find_common_floor(vptr1->get_parent(),vptr2);
}
/*copy the content of ref object to new object, for the part they have in common in their inheritence diagram*/
......@@ -194,7 +202,7 @@ void _belle_sip_object_copy(belle_sip_object_t *newobj, const belle_sip_object_t
belle_sip_fatal("Object of type %s cannot be cloned, it does not provide a clone() implementation.",vptr->type_name);
return;
}else vptr->clone(newobj,ref);
vptr=vptr->parent;
vptr=vptr->get_parent();
}
}
......@@ -371,7 +379,7 @@ void *belle_sip_object_cast(belle_sip_object_t *obj, belle_sip_type_id_t id, con
void *belle_sip_object_get_interface_methods(belle_sip_object_t *obj, belle_sip_interface_id_t ifid){
if (obj!=NULL){
belle_sip_object_vptr_t *vptr;
for (vptr=obj->vptr;vptr!=NULL;vptr=vptr->parent){
for (vptr=obj->vptr;vptr!=NULL;vptr=vptr->get_parent()){
belle_sip_interface_desc_t **ifaces=vptr->interfaces;
if (ifaces!=NULL){
for(;*ifaces!=0;++ifaces){
......@@ -449,7 +457,7 @@ belle_sip_error_code belle_sip_object_marshal(belle_sip_object_t* obj, char* buf
else
return vptr->marshal(obj,buff,buff_size,offset);
} else {
vptr=vptr->parent;
vptr=vptr->get_parent();
}
}
return BELLE_SIP_NOT_IMPLEMENTED; /*no implementation found*/
......@@ -505,7 +513,7 @@ char * _belle_sip_object_describe_type(belle_sip_object_vptr_t *vptr){
belle_sip_snprintf(ret,maxbufsize,&pos,"\t%s is created initially %s\n",vptr->type_name,
vptr->initially_unowned ? "unowned" : "owned");
belle_sip_snprintf(ret,maxbufsize,&pos,"\nInheritance diagram:\n");
for(it=vptr;it!=NULL;it=it->parent){
for(it=vptr;it!=NULL;it=it->get_parent()){
l=belle_sip_list_prepend(l,it);
}
for(elem=l;elem!=NULL;elem=elem->next){
......@@ -516,7 +524,7 @@ char * _belle_sip_object_describe_type(belle_sip_object_vptr_t *vptr){
}
belle_sip_list_free(l);
belle_sip_snprintf(ret,maxbufsize,&pos,"\nImplemented interfaces:\n");
for(it=vptr;it!=NULL;it=it->parent){
for(it=vptr;it!=NULL;it=it->get_parent()){
belle_sip_interface_desc_t **desc=it->interfaces;
if (desc!=NULL){
for(;*desc!=NULL;desc++){
......@@ -540,13 +548,14 @@ char *belle_sip_object_describe_type_from_name(const char *name){
char *vptr_name;
void *handle;
void *symbol;
belle_sip_object_get_vptr_t vptr_getter;
handle=dlopen(NULL,RTLD_LAZY);
if (handle==NULL){
belle_sip_error("belle_sip_object_describe_type_from_name: dlopen() failed: %s",dlerror());
return NULL;
}
vptr_name=belle_sip_strdup_printf("%s_vptr",name);
vptr_name=belle_sip_strdup_printf("%s_vptr_get",name);
symbol=dlsym(handle,vptr_name);
belle_sip_free(vptr_name);
dlclose(handle);
......@@ -554,7 +563,8 @@ char *belle_sip_object_describe_type_from_name(const char *name){
belle_sip_error("belle_sip_object_describe_type_from_name: could not find vptr for type %s",name);
return NULL;
}
return _belle_sip_object_describe_type((belle_sip_object_vptr_t*)symbol);
vptr_getter=(belle_sip_object_get_vptr_t)symbol;
return _belle_sip_object_describe_type(vptr_getter());
}
#else
......
......@@ -562,7 +562,7 @@ static void dual_resolver_cancel(belle_sip_resolver_context_t *p){
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_resolver_context_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_resolver_context_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_resolver_context_t)
{
BELLE_SIP_VPTR_INIT(belle_sip_resolver_context_t,belle_sip_source_t,TRUE),
(belle_sip_object_destroy_t) NULL,
......@@ -570,11 +570,11 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_resolver_context_t)={
NULL
},
NULL
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_simple_resolver_context_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_simple_resolver_context_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_simple_resolver_context_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_simple_resolver_context_t,belle_sip_resolver_context_t,TRUE),
......@@ -584,10 +584,10 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_simple_resolver_context_t)={
},
simple_resolver_cancel
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_dual_resolver_context_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_dual_resolver_context_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_dual_resolver_context_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_dual_resolver_context_t,belle_sip_resolver_context_t,TRUE),
......@@ -597,10 +597,10 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_dual_resolver_context_t)={
},
dual_resolver_cancel
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_combined_resolver_context_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_combined_resolver_context_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_combined_resolver_context_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_combined_resolver_context_t,belle_sip_resolver_context_t,TRUE),
......@@ -610,7 +610,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_combined_resolver_context_t)={
},
combined_resolver_cancel
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
static char * srv_prefix_from_transport(const char *transport) {
char *prefix = "";
......
......@@ -71,15 +71,14 @@ static void belle_sip_channel_destroy(belle_sip_channel_t *obj){
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_channel_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_channel_t)=
{
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_channel_t)
{
BELLE_SIP_VPTR_INIT(belle_sip_channel_t,belle_sip_source_t,FALSE),
(belle_sip_object_destroy_t)belle_sip_channel_destroy,
NULL, /*clone*/
NULL, /*marshal*/
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
static void fix_incoming_via(belle_sip_request_t *msg, const struct addrinfo* origin){
char received[NI_MAXHOST];
......
......@@ -52,12 +52,13 @@ static void belle_sip_dialog_uninit(belle_sip_dialog_t *obj){
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_dialog_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_dialog_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_dialog_t)
BELLE_SIP_VPTR_INIT(belle_sip_dialog_t, belle_sip_object_t,TRUE),
(belle_sip_object_destroy_t)belle_sip_dialog_uninit,
NULL,
NULL
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
const char* belle_sip_dialog_state_to_string(const belle_sip_dialog_state_t state) {
switch(state) {
case BELLE_SIP_DIALOG_NULL: return "BELLE_SIP_DIALOG_NULL";
......
......@@ -185,7 +185,7 @@ static void ict_send_request(belle_sip_ict_t *obj){
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_ict_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_ict_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_ict_t)
{
{
{
......@@ -199,7 +199,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_ict_t)={
(void (*)(belle_sip_client_transaction_t*))ict_send_request,
(void (*)(belle_sip_client_transaction_t*,belle_sip_response_t*))ict_on_response
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
belle_sip_ict_t *belle_sip_ict_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
......
......@@ -162,7 +162,7 @@ static void ist_on_request_retransmission(belle_sip_nist_t *obj){
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_ist_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_ist_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_ist_t)
{
{
{
......@@ -176,7 +176,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_ist_t)={
(int (*)(belle_sip_server_transaction_t*, belle_sip_response_t *))ist_send_new_response,
(void (*)(belle_sip_server_transaction_t*))ist_on_request_retransmission,
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
belle_sip_ist_t *belle_sip_ist_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
......
......@@ -95,7 +95,7 @@ int belle_sip_listening_point_get_channel_count(const belle_sip_listening_point_
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_listening_point_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_listening_point_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_listening_point_t)
{
BELLE_SIP_VPTR_INIT(belle_sip_listening_point_t, belle_sip_object_t,FALSE),
(belle_sip_object_destroy_t)belle_sip_listening_point_uninit,
......@@ -104,7 +104,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_listening_point_t)={
},
NULL,
NULL
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
const char *belle_sip_listening_point_get_ip_address(const belle_sip_listening_point_t *lp){
return belle_sip_uri_get_host(lp->listening_uri);
......
......@@ -150,7 +150,7 @@ static void nict_destroy(belle_sip_nict_t *obj){
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_nict_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_nict_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_nict_t)
{
{
{
......@@ -164,7 +164,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_nict_t)={
(void (*)(belle_sip_client_transaction_t*))nict_send_request,
(void (*)(belle_sip_client_transaction_t*,belle_sip_response_t*))nict_on_response
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
belle_sip_nict_t *belle_sip_nict_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
......
......@@ -96,7 +96,7 @@ static void nist_on_request_retransmission(belle_sip_nist_t *obj){
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_nist_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_nist_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_nist_t)
{
{
{
......@@ -110,7 +110,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_nist_t)={
(int (*)(belle_sip_server_transaction_t*, belle_sip_response_t *))nist_send_new_response,
(void (*)(belle_sip_server_transaction_t*))nist_on_request_retransmission,
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
belle_sip_nist_t *belle_sip_nist_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
......
......@@ -71,7 +71,7 @@ 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_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_transaction_t)
{
BELLE_SIP_VPTR_INIT(belle_sip_transaction_t,belle_sip_object_t,FALSE),
(belle_sip_object_destroy_t) transaction_destroy,
......@@ -79,7 +79,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_transaction_t)={
NULL,/*no marshal*/
},
NULL /*on_terminate*/
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
void *belle_sip_transaction_get_application_data(const belle_sip_transaction_t *t){
return t->appdata;
......@@ -175,7 +175,7 @@ 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_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_server_transaction_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_server_transaction_t,belle_sip_transaction_t,FALSE),
......@@ -185,7 +185,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_server_transaction_t)={
},
NULL
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
void belle_sip_server_transaction_init(belle_sip_server_transaction_t *t, belle_sip_provider_t *prov,belle_sip_request_t *req){
const char *branch;
......@@ -505,7 +505,7 @@ NULL
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_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_client_transaction_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_client_transaction_t,belle_sip_transaction_t,FALSE),
......@@ -517,7 +517,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_client_transaction_t)={
},
NULL,
NULL
};
BELLE_SIP_INSTANCIATE_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){
belle_sip_header_via_t *via=BELLE_SIP_HEADER_VIA(belle_sip_message_get_header((belle_sip_message_t*)req,"via"));
......
......@@ -147,8 +147,7 @@ int stream_channel_connect(belle_sip_stream_channel_t *obj, const struct addrinf
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_stream_channel_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_stream_channel_t)=
{
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_stream_channel_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_stream_channel_t,belle_sip_channel_t,FALSE),
......@@ -163,7 +162,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_stream_channel_t)=
(int (*)(belle_sip_channel_t *, void *, size_t ))stream_channel_recv,
(void (*)(belle_sip_channel_t *))stream_channel_close,
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
int finalize_stream_connection(belle_sip_stream_channel_t *obj, struct sockaddr *addr, socklen_t* slen) {
int err, errnum;
......
......@@ -45,7 +45,7 @@ static belle_sip_channel_t *stream_create_channel(belle_sip_listening_point_t *l
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_stream_listening_point_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_stream_listening_point_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_stream_listening_point_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_stream_listening_point_t, belle_sip_listening_point_t,TRUE),
......@@ -56,7 +56,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_stream_listening_point_t)={
"TCP",
stream_create_channel
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
static belle_sip_socket_t create_server_socket(const char *addr, int port, int *family){
struct addrinfo hints={0};
......
......@@ -116,8 +116,7 @@ BELLE_SIP_DECLARE_CUSTOM_VPTR_END
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_tls_channel_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_tls_channel_t)=
{
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_tls_channel_t)
{
{
{
......@@ -134,7 +133,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_tls_channel_t)=
(void (*)(belle_sip_channel_t*))tls_channel_close
}
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
static int tls_channel_handshake(belle_sip_tls_channel_t *channel) {
int ret;
......
......@@ -36,7 +36,7 @@ static belle_sip_channel_t *tls_create_channel(belle_sip_listening_point_t *lp,
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_tls_listening_point_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_tls_listening_point_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_tls_listening_point_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_tls_listening_point_t, belle_sip_stream_listening_point_t,TRUE),
......@@ -47,7 +47,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_tls_listening_point_t)={
"TLS",
tls_create_channel
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
static int on_new_connection(void *userdata, unsigned int revents){
belle_sip_socket_t child;
......
......@@ -75,8 +75,7 @@ int udp_channel_connect(belle_sip_channel_t *obj, const struct addrinfo *ai){
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_udp_channel_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_udp_channel_t)=
{
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_udp_channel_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_udp_channel_t,belle_sip_channel_t,FALSE),
......@@ -91,7 +90,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_udp_channel_t)=
udp_channel_recv
/*no close method*/
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
belle_sip_channel_t * belle_sip_channel_new_udp(belle_sip_stack_t *stack, int sock, const char *bindip, int localport, const char *dest, int port){
belle_sip_udp_channel_t *obj=belle_sip_object_new(belle_sip_udp_channel_t);
......
......@@ -44,7 +44,7 @@ static belle_sip_channel_t *udp_create_channel(belle_sip_listening_point_t *lp,
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_udp_listening_point_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_udp_listening_point_t)={
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_udp_listening_point_t)
{
{
BELLE_SIP_VPTR_INIT(belle_sip_udp_listening_point_t, belle_sip_listening_point_t,TRUE),
......@@ -55,7 +55,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_udp_listening_point_t)={
"UDP",
udp_create_channel
}
};
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
static belle_sip_socket_t create_udp_socket(const char *addr, int port, int *family){
......
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