Commit f2e989bb authored by Simon Morlat's avatar Simon Morlat

added interface notion, channel in progress

parent 0ef20763
......@@ -98,6 +98,13 @@ typedef enum belle_sip_type_id{
}belle_sip_type_id_t;
#define BELLE_SIP_INTERFACE_ID(_interface) _interface##_id
typedef enum belle_sip_interface_id{
belle_sip_interface_id_first=1,
BELLE_SIP_INTERFACE_ID(belle_sip_channel_listener_t)
}belle_sip_interface_id_t;
/**
* belle_sip_object_t is the base object.
* It is the base class for all belle sip non trivial objects.
......@@ -140,9 +147,15 @@ void belle_sip_object_delete(void *obj);
void *belle_sip_object_cast(belle_sip_object_t *obj, belle_sip_type_id_t id, const char *castname, const char *file, int fileno);
void *belle_sip_object_cast_to_interface(belle_sip_object_t *obj, belle_sip_interface_id_t id, const char *castname, const char *file, int fileno);
char* belle_sip_object_to_string(belle_sip_object_t* obj);
unsigned int belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id);
int belle_sip_object_marshal(belle_sip_object_t* obj, char* buff,unsigned int offset,size_t buff_size);
int belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id);
int belle_sip_object_implements(belle_sip_object_t *obj, belle_sip_interface_id_t id);
void *belle_sip_malloc(size_t size);
void *belle_sip_malloc0(size_t size);
......@@ -153,8 +166,11 @@ char * belle_sip_strdup(const char *s);
BELLE_SIP_END_DECLS
#define BELLE_SIP_CAST(obj,_type) ((_type*)belle_sip_object_cast((belle_sip_object_t *)(obj), _type##_id, #_type, __FILE__, __LINE__))
#define BELLE_SIP_INTERFACE_CAST(obj,_iface) ((_iface*)belle_sip_object_interface_cast((belle_sip_object_t*)(obj),_iface##_id,#_iface,__FILE__,__LINE__))
#define BELLE_SIP_IMPLEMENTS(obj,_iface) belle_sip_object_implements((belle_sip_object_t*)obj,_iface##_id)
#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(obj,_type##_id)
#define BELLE_SIP_IS_INSTANCE_OF(obj,_type) belle_sip_object_is_instance_of((belle_sip_object_t*)obj,_type##_id)
typedef struct belle_sip_listening_point belle_sip_listening_point_t;
......
......@@ -260,6 +260,8 @@ int belle_sdp_base_description_marshal(belle_sdp_base_description_t* base_descri
}
return current_offset-offset;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sdp_base_description_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sdp_base_description_t,belle_sip_object_t,belle_sdp_base_description_destroy,NULL,belle_sdp_base_description_marshal);
static int belle_sdp_base_description_attribute_comp_func(const belle_sdp_attribute_t* a, const char*b) {
......@@ -982,6 +984,7 @@ static void belle_sdp_mime_parameter_destroy(belle_sdp_mime_parameter_t *mime_pa
if (mime_parameter->parameters) belle_sip_free((void*)mime_parameter->parameters);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sdp_mime_parameter_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sdp_mime_parameter_t,belle_sip_object_t,belle_sdp_mime_parameter_destroy,NULL,NULL);
belle_sdp_mime_parameter_t* belle_sdp_mime_parameter_new() {
......
......@@ -56,6 +56,9 @@ int belle_sip_header_marshal(belle_sip_header_t* header, char* buff,unsigned int
return 0;
}
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_header_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_header_t,belle_sip_object_t,belle_sip_header_destroy,NULL,belle_sip_header_marshal);
......
......@@ -42,7 +42,7 @@ typedef int (*belle_sip_object_marshal_t)(belle_sip_object_t* obj, char* buff,un
struct _belle_sip_object_vptr{
belle_sip_type_id_t id;
struct _belle_sip_object_vptr *parent;
void *interfaces; /*unused for the moment*/
belle_sip_interface_id_t **interfaces; /*NULL terminated table of */
belle_sip_object_destroy_t destroy;
belle_sip_object_clone_t clone;
belle_sip_object_marshal_t marshal;
......@@ -73,7 +73,7 @@ extern belle_sip_object_vptr_t belle_sip_object_t_vptr;
#define BELLE_SIP_VPTR_INIT(object_type,parent_type) \
BELLE_SIP_TYPE_ID(object_type), \
(belle_sip_object_vptr_t*)&BELLE_SIP_OBJECT_VPTR_NAME(parent_type), \
NULL
(belle_sip_interface_id_t**)object_type##interfaces_table
#define BELLE_SIP_INSTANCIATE_VPTR(object_type,parent_type,destroy,clone,marshal) \
......@@ -84,8 +84,44 @@ extern belle_sip_object_vptr_t belle_sip_object_t_vptr;
(belle_sip_object_marshal_t)marshal\
}
#define BELLE_SIP_INTERFACE_METHODS_TYPE(interface_name) methods_##interface_name
#define BELLE_SIP_DECLARE_INTERFACE_BEGIN(interface_name) \
typedef struct struct##interface_name interface_name;\
typedef struct struct_methods_##interface_name BELLE_SIP_INTERFACE_METHODS_TYPE(interface_name);\
struct struct_methods_##interface_name {\
belle_sip_interface_id_t id;
#define BELLE_SIP_DECLARE_INTERFACE_END };
#define BELLE_SIP_IMPLEMENT_INTERFACE_BEGIN(object_type,interface_name) \
static BELLE_SIP_INTERFACE_METHODS_TYPE(interface_name) methods_##object_type##_##interface_name={\
BELLE_SIP_INTERFACE_ID(interface_name),
#define BELLE_SIP_IMPLEMENT_INTERFACE_END };
#define BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(object_type)\
static belle_sip_type_id_t * object_type##interfaces_table[]={\
NULL \
}
#define BELLE_SIP_DECLARE_IMPLEMENTED_INTERFACES_1(object_type,iface1) \
static belle_sip_type_id_t * object_type##interfaces_table[]={\
(belle_sip_type_id_t*)&methods_##object_type##_##iface1, \
NULL \
}
#define BELLE_SIP_DECLARE_IMPLEMENTED_INTERFACES_2(object_type,iface1,iface2) \
static belle_sip_type_id_t * object_type##interfaces_table[]={\
(belle_sip_type_id_t*)&methods_##object_type##_##iface1, \
(belle_sip_type_id_t*)&methods_##object_type##_##iface2, \
NULL \
}
/*etc*/
#define BELLE_SIP_INTERFACE_GET_METHODS(obj,interface) \
((BELLE_SIP_INTERFACE_METHODS_TYPE(interface)*)belle_sip_object_get_interface_methods((belle_sip_object_t*)obj,BELLE_SIP_INTERFACE_ID(interface)))
struct _belle_sip_object{
belle_sip_object_vptr_t *vptr;
......@@ -95,7 +131,7 @@ struct _belle_sip_object{
};
belle_sip_object_t * _belle_sip_object_new(size_t objsize, belle_sip_object_vptr_t *vptr, int initially_unowed);
int belle_sip_object_marshal(belle_sip_object_t* obj, char* buff,unsigned int offset,size_t buff_size);
void *belle_sip_object_get_interface_methods(belle_sip_object_t *obj, belle_sip_interface_id_t ifid);
#define belle_sip_object_new(_type) (_type*)_belle_sip_object_new(sizeof(_type),(belle_sip_object_vptr_t*)&BELLE_SIP_OBJECT_VPTR_NAME(_type),0)
#define belle_sip_object_new_unowed(_type)(_type*)_belle_sip_object_new(sizeof(_type),(belle_sip_object_vptr_t*)&BELLE_SIP_OBJECT_VPTR_NAME(_type),1)
......@@ -164,6 +200,7 @@ BELLE_SIP_DECLARE_VPTR(belle_sdp_uri_t);
BELLE_SIP_DECLARE_VPTR(belle_sdp_version_t);
BELLE_SIP_DECLARE_VPTR(belle_sdp_base_description_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_source_t);
BELLE_SIP_DECLARE_VPTR(belle_sdp_mime_parameter_t);
......@@ -414,6 +451,7 @@ belle_sip_##object_type##_t* belle_sip_##object_type##_parse (const char* value)
#define BELLE_SIP_NEW(object_type,super_type) BELLE_SIP_NEW_HEADER(object_type,super_type,NULL)
#define BELLE_SIP_NEW_HEADER(object_type,super_type,name) BELLE_SIP_NEW_HEADER_INIT(object_type,super_type,name,header)
#define BELLE_SIP_NEW_HEADER_INIT(object_type,super_type,name,init_type) \
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_##object_type##_t); \
BELLE_SIP_INSTANCIATE_VPTR( belle_sip_##object_type##_t\
, belle_sip_##super_type##_t\
, belle_sip_##object_type##_destroy\
......@@ -586,6 +624,7 @@ belle_sdp_##object_type##_t* belle_sdp_##object_type##_parse (const char* value)
return l_parsed_object;\
}
#define BELLE_SDP_NEW(object_type,super_type) \
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sdp_##object_type##_t); \
BELLE_SIP_INSTANCIATE_VPTR( belle_sdp_##object_type##_t\
, super_type##_t\
, belle_sdp_##object_type##_destroy\
......@@ -597,6 +636,7 @@ belle_sdp_##object_type##_t* belle_sdp_##object_type##_parse (const char* value)
return l_object;\
}
#define BELLE_SDP_NEW_WITH_CTR(object_type,super_type) \
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sdp_##object_type##_t); \
BELLE_SIP_INSTANCIATE_VPTR( belle_sdp_##object_type##_t\
, super_type##_t\
, belle_sdp_##object_type##_destroy\
......
......@@ -42,6 +42,7 @@ void belle_sip_fd_source_init(belle_sip_source_t *s, belle_sip_source_func_t fun
s->notify=func;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_source_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_source_t,belle_sip_object_t,belle_sip_source_destroy,NULL,NULL);
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){
......@@ -89,6 +90,8 @@ static int main_loop_done(void *data, unsigned int events){
return TRUE;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_main_loop_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_main_loop_t,belle_sip_object_t,belle_sip_main_loop_destroy,NULL,NULL);
belle_sip_main_loop_t *belle_sip_main_loop_new(void){
......
......@@ -27,9 +27,11 @@ static int has_type(belle_sip_object_t *obj, belle_sip_type_id_t id){
}
return FALSE;
}
unsigned int belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id) {
int belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id) {
return has_type(obj,id);
}
belle_sip_object_t * _belle_sip_object_new(size_t objsize, belle_sip_object_vptr_t *vptr, int initially_unowed){
belle_sip_object_t *obj=(belle_sip_object_t *)belle_sip_malloc0(objsize);
obj->ref=initially_unowed ? 0 : 1;
......@@ -121,6 +123,36 @@ void *belle_sip_object_cast(belle_sip_object_t *obj, belle_sip_type_id_t id, con
return obj;
}
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){
belle_sip_interface_id_t **ifaces=vptr->interfaces;
if (ifaces!=NULL){
for(;*ifaces!=0;++ifaces){
if (**ifaces==ifid){
return *ifaces;
}
}
}
}
}
return NULL;
}
int belle_sip_object_implements(belle_sip_object_t *obj, belle_sip_interface_id_t id){
return belle_sip_object_get_interface_methods(obj,id)!=NULL;
}
void *belle_sip_object_cast_to_interface(belle_sip_object_t *obj, belle_sip_interface_id_t ifid, const char *castname, const char *file, int fileno){
if (obj!=NULL){
if (belle_sip_object_get_interface_methods(obj,ifid)==0){
belle_sip_fatal("Bad cast to interface %s at %s:%i",castname,file,fileno);
return NULL;
}
}
return obj;
}
void belle_sip_object_set_name(belle_sip_object_t* object,const char* name) {
if (object->name) {
......
......@@ -62,7 +62,8 @@ void belle_sip_resolver_context_destroy(belle_sip_resolver_context_t *ctx){
}
}
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_resolver_context_t, belle_sip_source_t, belle_sip_resolver_context_destroy, NULL, NULL);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_resolver_context_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_resolver_context_t, belle_sip_source_t,belle_sip_resolver_context_destroy, NULL, NULL);
static int resolver_callback(belle_sip_resolver_context_t *ctx){
ctx->cb(ctx->cb_data, ctx->name, ctx->ai);
......
......@@ -96,6 +96,7 @@ int belle_sip_uri_marshal(belle_sip_uri_t* uri, char* buff,unsigned int offset,u
}
BELLE_SIP_PARSE(uri);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_uri_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_uri_t,belle_sip_parameters_t,belle_sip_uri_destroy,belle_sip_uri_clone,belle_sip_uri_marshal);
......
......@@ -19,13 +19,19 @@
#include "belle_sip_internal.h"
void belle_sip_channel_listener_on_state_changed(belle_sip_channel_listener_t *obj,
belle_sip_channel_t *chan,
belle_sip_channel_state_t state){
BELLE_SIP_INTERFACE_GET_METHODS(obj,belle_sip_channel_listener_t)->on_state_changed(obj,chan,state);
}
static void belle_sip_channel_destroy(belle_sip_channel_t *obj){
if (obj->peer) freeaddrinfo(obj->peer);
belle_sip_free(obj->peer_name);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_channel_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_channel_t)=
{
{
......@@ -37,13 +43,14 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_channel_t)=
};
static void belle_sip_channel_init(belle_sip_channel_t *obj, belle_sip_provider_t *prov, const char *peername, int peer_port){
static void belle_sip_channel_init(belle_sip_channel_t *obj, belle_sip_stack_t *stack, const char *peername, int peer_port){
obj->peer_name=belle_sip_strdup(peername);
obj->peer_port=peer_port;
obj->peer=NULL;
obj->prov=prov;
obj->stack=stack;
}
int belle_sip_channel_matches(const belle_sip_channel_t *obj, const char *peername, int peerport){
return strcmp(peername,obj->peer_name)==0 && peerport==obj->peer_port;
}
......@@ -60,6 +67,11 @@ const struct addrinfo * belle_sip_channel_get_peer(belle_sip_channel_t *obj){
return obj->peer;
}
static void channel_set_state(belle_sip_channel_t *obj, belle_sip_channel_state_t state){
obj->state=state;
if (obj->listener)
belle_sip_channel_listener_on_state_changed(obj->listener,obj,state);
}
static void send_message(belle_sip_channel_t *obj, belle_sip_message_t *msg){
char buffer[belle_sip_network_buffer_size];
......@@ -67,13 +79,7 @@ static void send_message(belle_sip_channel_t *obj, belle_sip_message_t *msg){
if (len>0){
int ret=belle_sip_channel_send(obj,buffer,len);
if (ret==-1){
belle_sip_io_error_event_t ev;
obj->state=BELLE_SIP_CHANNEL_ERROR;
ev.transport=BELLE_SIP_OBJECT_VPTR(obj,belle_sip_channel_t)->transport;
ev.source=obj->prov;
ev.port=obj->peer_port;
ev.host=obj->peer_name;
BELLE_SIP_PROVIDER_INVOKE_LISTENERS(obj->prov,process_io_error,&ev);
channel_set_state(obj,BELLE_SIP_CHANNEL_ERROR);
}
}
}
......@@ -105,22 +111,16 @@ static void channel_res_done(void *data, const char *name, struct addrinfo *res)
obj->resolver_id=0;
if (res){
obj->peer=res;
obj->state=BELLE_SIP_CHANNEL_RES_DONE;
channel_set_state(obj,BELLE_SIP_CHANNEL_RES_DONE);
}else{
belle_sip_io_error_event_t ev;
obj->state=BELLE_SIP_CHANNEL_ERROR;
ev.transport=BELLE_SIP_OBJECT_VPTR(obj,belle_sip_channel_t)->transport;
ev.source=obj->prov;
ev.port=obj->peer_port;
ev.host=obj->peer_name;
BELLE_SIP_PROVIDER_INVOKE_LISTENERS(obj->prov,process_io_error,&ev);
channel_set_state(obj,BELLE_SIP_CHANNEL_ERROR);
}
channel_process_queue(obj);
}
int belle_sip_channel_resolve(belle_sip_channel_t *obj){
obj->state=BELLE_SIP_CHANNEL_RES_IN_PROGRESS;
obj->resolver_id=belle_sip_resolve(obj->peer_name, obj->peer_port, 0, channel_res_done, obj, obj->prov->stack->ml);
channel_set_state(obj,BELLE_SIP_CHANNEL_RES_IN_PROGRESS);
obj->resolver_id=belle_sip_resolve(obj->peer_name, obj->peer_port, 0, channel_res_done, obj, obj->stack->ml);
return 0;
}
......@@ -175,11 +175,13 @@ static int udp_channel_recv(belle_sip_channel_t *obj, void *buf, size_t buflen){
}
int udp_channel_connect(belle_sip_channel_t *obj, const struct sockaddr *addr, socklen_t socklen){
obj->state=BELLE_SIP_CHANNEL_READY;
channel_set_state(obj,BELLE_SIP_CHANNEL_READY);
channel_process_queue(obj);
return 0;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_udp_channel_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_udp_channel_t)=
{
{
......@@ -224,16 +226,16 @@ static int create_udp_socket(const char *addr, int port){
return sock;
}
belle_sip_channel_t * belle_sip_channel_new_udp_master(belle_sip_provider_t *prov, const char *localname, int localport){
belle_sip_channel_t * belle_sip_channel_new_udp_master(belle_sip_stack_t *stack, const char *localname, int localport){
belle_sip_udp_channel_t *obj=belle_sip_object_new(belle_sip_udp_channel_t);
belle_sip_channel_init((belle_sip_channel_t*)obj,prov,"",-1);
belle_sip_channel_init((belle_sip_channel_t*)obj,stack,"",-1);
obj->sock=create_udp_socket(localname, localport);
return (belle_sip_channel_t*)obj;
}
belle_sip_channel_t * belle_sip_channel_new_udp_slave(belle_sip_channel_t *master, const char *peername, int peerport){
belle_sip_udp_channel_t *obj=belle_sip_object_new(belle_sip_udp_channel_t);
belle_sip_channel_init((belle_sip_channel_t*)obj,master->prov,peername,peerport);
belle_sip_channel_init((belle_sip_channel_t*)obj,master->stack,peername,peerport);
obj->sock=((belle_sip_udp_channel_t*)master)->sock;
return (belle_sip_channel_t*)obj;
}
......
......@@ -25,7 +25,7 @@
#endif
static const int belle_sip_network_buffer_size=64535;
static const int belle_sip_network_buffer_size=65535;
typedef enum belle_sip_channel_state{
BELLE_SIP_CHANNEL_INIT,
......@@ -36,6 +36,7 @@ typedef enum belle_sip_channel_state{
BELLE_SIP_CHANNEL_ERROR
}belle_sip_channel_state_t;
/**
* belle_sip_channel_t is an object representing a single communication channel ( socket or file descriptor),
* unlike the belle_sip_listening_point_t that can owns several channels for TCP or TLS (incoming server child sockets or
......@@ -43,10 +44,17 @@ typedef enum belle_sip_channel_state{
**/
typedef struct belle_sip_channel belle_sip_channel_t;
BELLE_SIP_DECLARE_INTERFACE_BEGIN(belle_sip_channel_listener_t)
void (*on_state_changed)(belle_sip_channel_listener_t *obj, belle_sip_channel_t *, belle_sip_channel_state_t state);
BELLE_SIP_DECLARE_INTERFACE_END
void belle_sip_channel_listener_on_state_changed(belle_sip_channel_listener_t *obj, belle_sip_channel_t *, belle_sip_channel_state_t state);
struct belle_sip_channel{
belle_sip_source_t base;
belle_sip_stack_t *stack;
belle_sip_channel_state_t state;
belle_sip_provider_t *prov;/*we need the provider to notify connection errors*/
belle_sip_channel_listener_t *listener;
char *peer_name;
int peer_port;
unsigned long resolver_id;
......@@ -56,11 +64,13 @@ struct belle_sip_channel{
#define BELLE_SIP_CHANNEL(obj) BELLE_SIP_CAST(obj,belle_sip_channel_t)
belle_sip_channel_t * belle_sip_channel_new_udp_master(belle_sip_provider_t *prov, const char *locname, int locport);
belle_sip_channel_t * belle_sip_channel_new_udp_master(belle_sip_stack_t *stack, const char *locname, int locport);
belle_sip_channel_t * belle_sip_channel_new_udp_slave(belle_sip_channel_t *master, const char *peername, int peerport);
belle_sip_channel_t * belle_sip_channel_new_tcp(belle_sip_provider_t *prov, const char *name, int port);
belle_sip_channel_t * belle_sip_channel_new_tcp(belle_sip_stack_t *stack, const char *name, int port);
void belle_sip_channel_add_listener(belle_sip_channel_t *chan, belle_sip_channel_listener_t *l);
int belle_sip_channel_matches(const belle_sip_channel_t *obj, const char *peername, int peerport);
......
......@@ -55,6 +55,7 @@ static void belle_sip_listening_point_remove_channel(belle_sip_listening_point_t
}
#endif
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_listening_point_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_listening_point_t,belle_sip_object_t,belle_sip_listening_point_uninit,NULL,NULL);
const char *belle_sip_listening_point_get_ip_address(const belle_sip_listening_point_t *lp){
......@@ -101,6 +102,7 @@ static void belle_sip_udp_listening_point_uninit(belle_sip_udp_listening_point_t
belle_sip_object_unref(lp->channel);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_udp_listening_point_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_udp_listening_point_t,belle_sip_listening_point_t,belle_sip_udp_listening_point_uninit,NULL,NULL);
......
......@@ -48,6 +48,8 @@ static void belle_sip_message_destroy(belle_sip_message_t *msg){
belle_sip_list_free(msg->header_list);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_message_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_message_t,belle_sip_object_t,belle_sip_message_destroy,NULL,NULL);
belle_sip_message_t* belle_sip_message_parse (const char* value) {
......
......@@ -33,6 +33,15 @@ static void belle_sip_provider_uninit(belle_sip_provider_t *p){
belle_sip_list_free(p->lps);
}
static void channel_state_changed(belle_sip_channel_listener_t *obj, belle_sip_channel_t *chan, belle_sip_channel_state_t state){
}
BELLE_SIP_IMPLEMENT_INTERFACE_BEGIN(belle_sip_provider_t,belle_sip_channel_listener_t)
channel_state_changed
BELLE_SIP_IMPLEMENT_INTERFACE_END
BELLE_SIP_DECLARE_IMPLEMENTED_INTERFACES_1(belle_sip_provider_t,belle_sip_channel_listener_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_provider_t,belle_sip_object_t,belle_sip_provider_uninit,NULL,NULL);
belle_sip_provider_t *belle_sip_provider_new(belle_sip_stack_t *s, belle_sip_listening_point_t *lp){
......
......@@ -25,6 +25,7 @@ static void belle_sip_stack_destroy(belle_sip_stack_t *stack){
belle_sip_list_free(stack->lp);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_stack_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_stack_t,belle_sip_object_t,belle_sip_stack_destroy,NULL,NULL);
belle_sip_stack_t * belle_sip_stack_new(const char *properties){
......@@ -43,7 +44,7 @@ const belle_sip_timer_config_t *belle_sip_stack_get_timer_config(const belle_sip
belle_sip_listening_point_t *belle_sip_stack_create_listening_point(belle_sip_stack_t *s, const char *ipaddress, int port, const char *transport){
belle_sip_listening_point_t *lp=NULL;
if (strcasecmp(transport,"UDP")==0){
lp=belle_sip_udp_listening_point_new (s,ipaddress,port);
lp=belle_sip_udp_listening_point_new(s,ipaddress,port);
}else{
belle_sip_fatal("Unsupported transport %s",transport);
}
......
......@@ -46,6 +46,7 @@ static void transaction_destroy(belle_sip_transaction_t *t){
if (t->final_response) belle_sip_object_unref(t->final_response);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_transaction_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_transaction_t,belle_sip_object_t,transaction_destroy,NULL,NULL);
void *belle_sip_transaction_get_application_data(const belle_sip_transaction_t *t){
......@@ -136,6 +137,7 @@ void belle_sip_server_transaction_send_response(belle_sip_server_transaction_t *
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_VPTR(belle_sip_server_transaction_t,belle_sip_transaction_t,server_transaction_destroy,NULL,NULL);
belle_sip_server_transaction_t * belle_sip_server_transaction_new(belle_sip_provider_t *prov,belle_sip_request_t *req){
......@@ -340,6 +342,7 @@ void belle_sip_client_transaction_add_response(belle_sip_client_transaction_t *t
static void client_transaction_destroy(belle_sip_client_transaction_t *t ){
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_client_transaction_t);
BELLE_SIP_INSTANCIATE_VPTR(belle_sip_client_transaction_t, belle_sip_transaction_t,client_transaction_destroy,NULL,NULL);
belle_sip_client_transaction_t * belle_sip_client_transaction_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
......
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