Commit 5ea99706 authored by Erwan Croze's avatar Erwan Croze 👋🏻
Browse files

Fix compilation error with new GCC7

parent 8abfd2f6
......@@ -186,6 +186,9 @@ if(MSVC)
set(SIP_MESSAGE_PARSER_COMPILE_FLAGS "${SIP_MESSAGE_PARSER_COMPILE_FLAGS} /wd4267") # Disable "possible loss of data" warnings
set_source_files_properties(grammars/belle_sip_messageParser.c PROPERTIES COMPILE_FLAGS "${SIP_MESSAGE_PARSER_COMPILE_FLAGS}")
else()
get_source_file_property(DNS_C_COMPILE_FLAGS dns.c COMPILE_FLAGS)
set(DNS_C_COMPILE_FLAGS "${DNS_C_COMPILE_FLAGS} -Wno-error")
set_source_files_properties(dns.c PROPERTIES COMPILE_FLAGS "${DNS_C_COMPILE_FLAGS}")
get_source_file_property(SIP_MESSAGE_PARSER_COMPILE_FLAGS grammars/belle_sip_messageParser.c COMPILE_FLAGS)
set(SIP_MESSAGE_PARSER_COMPILE_FLAGS "${SIP_MESSAGE_PARSER_COMPILE_FLAGS} -Wno-sign-compare")
set_source_files_properties(grammars/belle_sip_messageParser.c PROPERTIES COMPILE_FLAGS "${SIP_MESSAGE_PARSER_COMPILE_FLAGS}")
......@@ -231,6 +234,3 @@ if(ENABLE_SHARED)
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
......@@ -18,6 +18,7 @@
#include "belle_sip_internal.h"
#include "dns.h"
#include <bctoolbox/defs.h>
#include <stdlib.h>
#ifdef __APPLE__
......@@ -51,7 +52,7 @@ struct belle_sip_dns_srv{
belle_sip_combined_resolver_context_t *root_resolver;/* used internally to combine SRV and A queries*/
belle_sip_resolver_context_t *a_resolver; /* used internally to combine SRV and A queries*/
struct addrinfo *a_results; /* used internally to combine SRV and A queries*/
};
static void belle_sip_dns_srv_destroy(belle_sip_dns_srv_t *obj){
......@@ -195,10 +196,10 @@ static struct dns_resolv_conf *resconf(belle_sip_simple_resolver_context_t *ctx)
belle_sip_error("%s dns_resconf_open error: %s", __FUNCTION__, dns_strerror(error));
return NULL;
}
path = belle_sip_stack_get_dns_resolv_conf_file(ctx->base.stack);
servers = ctx->base.stack->dns_servers;
if (servers){
belle_sip_message("%s using application supplied dns server list.", __FUNCTION__);
error = dns_resconf_nameservers_from_list(ctx->resconf, servers);
......@@ -250,13 +251,13 @@ static struct dns_resolv_conf *resconf(belle_sip_simple_resolver_context_t *ctx)
return NULL;
}
}
if (error==0){
char ip[64];
char serv[10];
int using_ipv6=FALSE;
size_t i;
belle_sip_message("Resolver is using DNS server(s):");
for(i=0;i<sizeof(ctx->resconf->nameserver)/sizeof(ctx->resconf->nameserver[0]);++i){
struct sockaddr *ns_addr=(struct sockaddr*)&ctx->resconf->nameserver[i];
......@@ -339,7 +340,7 @@ static belle_sip_dns_srv_t *srv_elect_one(belle_sip_list_t *srv_list){
belle_sip_list_t *elem;
belle_sip_dns_srv_t *srv;
int rand_number;
for(elem=srv_list;elem!=NULL;elem=elem->next){
srv=(belle_sip_dns_srv_t*)elem->data;
sum+=srv->weight;
......@@ -458,7 +459,7 @@ static void append_dns_result(belle_sip_simple_resolver_context_t *ctx, struct a
char host[NI_MAXHOST + 1];
int gai_err;
int family=ctx->family;
if ((gai_err=bctbx_getnameinfo(addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST)) != 0){
belle_sip_error("append_dns_result(): getnameinfo() failed: %s",gai_strerror(gai_err));
return;
......@@ -482,7 +483,7 @@ static int resolver_process_data(belle_sip_simple_resolver_context_t *ctx, unsig
belle_sip_warning("Simulating DNS timeout");
simulated_timeout=1;
}
if (simulated_timeout || ((revents & BELLE_SIP_EVENT_TIMEOUT) && ((int)(belle_sip_time_ms()-ctx->start_time)>=timeout))) {
belle_sip_error("%s timed-out", __FUNCTION__);
belle_sip_resolver_context_notify(BELLE_SIP_RESOLVER_CONTEXT(ctx));
......@@ -662,7 +663,7 @@ static int _resolver_send_query(belle_sip_simple_resolver_context_t *ctx) {
static int resolver_process_data_delayed(belle_sip_simple_resolver_context_t *ctx, unsigned int revents) {
int err=_resolver_send_query(ctx);
if (err==0) return BELLE_SIP_CONTINUE;
return BELLE_SIP_STOP;
}
......@@ -918,7 +919,7 @@ static void combined_resolver_context_check_finished(belle_sip_combined_resolver
belle_sip_list_t *elem;
struct addrinfo *final=NULL;
unsigned char finished=TRUE;
for(elem=obj->srv_results;elem!=NULL;elem=elem->next){
belle_sip_dns_srv_t *srv=(belle_sip_dns_srv_t*)elem->data;
if (!srv->a_done) {
......@@ -1095,6 +1096,7 @@ belle_sip_resolver_context_t * belle_sip_stack_resolve_a(belle_sip_stack_t *stac
switch(family){
case AF_UNSPEC:
family=AF_INET6;
BCTBX_NO_BREAK; /*intentionally no break*/
case AF_INET6:
return belle_sip_stack_resolve_dual(stack,name,port,cb,data);
break;
......@@ -1150,14 +1152,14 @@ int belle_sip_get_src_addr_for(const struct sockaddr *dest, socklen_t destlen, s
int af_type=dest->sa_family;
int sock=(int)bctbx_socket(af_type,SOCK_DGRAM,IPPROTO_UDP);
int ret = 0;
if (sock==(belle_sip_socket_t)-1){
if (af_type == AF_INET){
belle_sip_fatal("Could not create socket: %s",belle_sip_get_socket_error_string());
}
goto fail;
}
if (af_type==AF_INET6 && (IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6*)dest)->sin6_addr))){
/*this is actually required only for windows, who is unable to provide an ipv4 mapped local address if the remote is ipv4 mapped,
and unable to provide a correct local address if the remote address is true ipv6 address when in dual stack mode*/
......@@ -1174,7 +1176,7 @@ int belle_sip_get_src_addr_for(const struct sockaddr *dest, socklen_t destlen, s
belle_sip_error("belle_sip_get_src_addr_for: bctbx_getsockname() failed: %s",belle_sip_get_socket_error_string_from_code(-ret));
goto fail;
}
if (af_type==AF_INET6){
struct sockaddr_in6 *sin6=(struct sockaddr_in6*)src;
sin6->sin6_port=htons(local_port);
......@@ -1182,7 +1184,7 @@ int belle_sip_get_src_addr_for(const struct sockaddr *dest, socklen_t destlen, s
struct sockaddr_in *sin=(struct sockaddr_in*)src;
sin->sin_port=htons(local_port);
}
belle_sip_close_socket(sock);
return ret;
fail:
......
......@@ -17,6 +17,7 @@
*/
#include "belle_sip_internal.h"
#include <bctoolbox/defs.h>
static void belle_sip_dialog_init_200Ok_retrans(belle_sip_dialog_t *obj, belle_sip_response_t *resp);
static int belle_sip_dialog_handle_200Ok(belle_sip_dialog_t *obj, belle_sip_response_t *msg);
......@@ -54,7 +55,7 @@ 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_BEGIN(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,
......@@ -146,7 +147,7 @@ static int belle_sip_dialog_init_as_uas(belle_sip_dialog_t *obj, belle_sip_reque
/*remote party already set */
obj->local_party=(belle_sip_header_address_t*)belle_sip_object_ref(to);
return 0;
}
......@@ -180,7 +181,7 @@ static int belle_sip_dialog_init_as_uac(belle_sip_dialog_t *obj, belle_sip_reque
&& belle_sip_uri_is_secure(requri)){
obj->is_secure=TRUE;
}
obj->local_cseq=belle_sip_header_cseq_get_seq_number(cseq);
/*call id is already set */
/*local_tag is already set*/
......@@ -189,7 +190,7 @@ static int belle_sip_dialog_init_as_uac(belle_sip_dialog_t *obj, belle_sip_reque
if (strcmp(belle_sip_request_get_method(req),"INVITE")==0){
set_last_out_invite(obj,req);
}
return 0;
}
......@@ -208,7 +209,7 @@ int belle_sip_dialog_expired(const belle_sip_dialog_t *dialog){
static int belle_sip_dialog_schedule_expiration(belle_sip_dialog_t *dialog, belle_sip_message_t *request){
belle_sip_header_expires_t *expires = belle_sip_message_get_header_by_type(request, belle_sip_header_expires_t);
int expires_value;
if (!expires) return BELLE_SIP_CONTINUE;
expires_value = belle_sip_header_expires_get_expires(expires);
if (dialog->expiration_timer){
......@@ -218,7 +219,7 @@ static int belle_sip_dialog_schedule_expiration(belle_sip_dialog_t *dialog, bell
}
belle_sip_message("belle_sip_dialog_schedule_expiration() dialog=%p expires_value=%i", dialog, expires_value);
if (expires_value == 0) return BELLE_SIP_STOP;
dialog->expiration_timer = belle_sip_main_loop_create_timeout(dialog->provider->stack->ml,
dialog->expiration_timer = belle_sip_main_loop_create_timeout(dialog->provider->stack->ml,
(belle_sip_source_func_t) belle_sip_dialog_on_expired,
dialog,
expires_value * 1000,
......@@ -282,7 +283,7 @@ int belle_sip_dialog_establish(belle_sip_dialog_t *obj, belle_sip_request_t *req
belle_sip_error("No to in response.");
return -1;
}
if (!obj->is_server) {
belle_sip_header_contact_t *ct=belle_sip_message_get_header_by_type(resp,belle_sip_header_contact_t);
const belle_sip_list_t* elem;
......@@ -301,7 +302,7 @@ int belle_sip_dialog_establish(belle_sip_dialog_t *obj, belle_sip_request_t *req
obj->route_set=belle_sip_list_prepend(obj->route_set,belle_sip_object_ref(belle_sip_header_route_create(
(belle_sip_header_address_t*)elem->data)));
}
check_route_set(obj->route_set);
/*via might be unknown at dialog creation*/
if (strcasecmp(belle_sip_header_via_get_protocol(via),"TLS")==0
......@@ -360,11 +361,11 @@ static void belle_sip_dialog_init_200Ok_retrans(belle_sip_dialog_t *obj, belle_s
obj->timer_200Ok=belle_sip_timeout_source_new((belle_sip_source_func_t)dialog_on_200Ok_timer,obj,cfg->T1);
belle_sip_object_set_name((belle_sip_object_t*)obj->timer_200Ok,"dialog_200Ok_timer");
belle_sip_main_loop_add_source(obj->provider->stack->ml,obj->timer_200Ok);
obj->timer_200Ok_end=belle_sip_timeout_source_new((belle_sip_source_func_t)dialog_on_200Ok_end,obj,cfg->T1*64);
belle_sip_object_set_name((belle_sip_object_t*)obj->timer_200Ok_end,"dialog_200Ok_timer_end");
belle_sip_main_loop_add_source(obj->provider->stack->ml,obj->timer_200Ok_end);
obj->last_200Ok=(belle_sip_response_t*)belle_sip_object_ref(resp);
}
......@@ -389,13 +390,13 @@ void belle_sip_dialog_stop_200Ok_retrans(belle_sip_dialog_t *obj){
/* returns true if the dialog is terminated by the NOTIFY request or response*/
static int belle_sip_dialog_should_terminate_by_notify(belle_sip_dialog_t *obj, belle_sip_transaction_t* transaction, int as_uas){
int should_terminate = FALSE;
if (obj->type == BELLE_SIP_DIALOG_SUBSCRIBE_NOTIFY) {
belle_sip_request_t *req=belle_sip_transaction_get_request(transaction);
belle_sip_response_t *resp=belle_sip_transaction_get_response(transaction);
belle_sip_header_subscription_state_t* subscription_state_header=belle_sip_message_get_header_by_type(req,belle_sip_header_subscription_state_t);
int code = resp ? belle_sip_response_get_status_code(resp) : 0;
if (!subscription_state_header || strcasecmp(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,belle_sip_header_subscription_state_get_state(subscription_state_header)) ==0) {
if (as_uas){
/*terminate the dialog when the application replies the 200 Ok*/
......@@ -445,10 +446,10 @@ int belle_sip_dialog_update(belle_sip_dialog_t *obj, belle_sip_transaction_t* tr
int is_notify = strcmp(belle_sip_request_get_method(req),"NOTIFY")==0;
belle_sip_message("Dialog [%p]: now updated by transaction [%p].",obj, transaction);
if (resp)
code=belle_sip_response_get_status_code(resp);
if (as_uas && code == 491) { /**/
belle_sip_message("Dialog [%p]: don't update last transaction by transaction [%p].",obj, transaction);
} else {
......@@ -460,7 +461,7 @@ int belle_sip_dialog_update(belle_sip_dialog_t *obj, belle_sip_transaction_t* tr
belle_sip_header_privacy_t *privacy_header=belle_sip_message_get_header_by_type(req,belle_sip_header_privacy_t);
SET_OBJECT_PROPERTY(obj,privacy,privacy_header);
}
/*first update local/remote cseq*/
if (as_uas) {
belle_sip_header_cseq_t* cseq=belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_cseq_t);
......@@ -470,7 +471,7 @@ int belle_sip_dialog_update(belle_sip_dialog_t *obj, belle_sip_transaction_t* tr
/*else ACK is handled by transaction, not dialog*/
}
switch (obj->state){
case BELLE_SIP_DIALOG_NULL:
/*always establish a dialog*/
......@@ -480,7 +481,8 @@ int belle_sip_dialog_update(belle_sip_dialog_t *obj, belle_sip_transaction_t* tr
set_state(obj,BELLE_SIP_DIALOG_EARLY);
break;
}/* no break for code >200 because need to call belle_sip_dialog_establish_full*/
}/* no break*/
}
BCTBX_NO_BREAK; /*intentionally no break*/
case BELLE_SIP_DIALOG_EARLY:
/*don't terminate dialog for UPDATE*/
if (code>=300 && (is_invite || is_subscribe)) {
......@@ -524,7 +526,7 @@ int belle_sip_dialog_update(belle_sip_dialog_t *obj, belle_sip_transaction_t* tr
belle_sip_header_contact_t *ct;
if (as_uas){
ct=belle_sip_message_get_header_by_type(req,belle_sip_header_contact_t);
}else{
if (is_invite)
set_last_out_invite(obj,req);
......@@ -533,7 +535,7 @@ int belle_sip_dialog_update(belle_sip_dialog_t *obj, belle_sip_transaction_t* tr
if (ct){
belle_sip_dialog_update_remote_target(obj, ct);
}
}
if (is_invite){
if (code>=200 && code<300){
......@@ -590,7 +592,7 @@ int belle_sip_dialog_update(belle_sip_dialog_t *obj, belle_sip_transaction_t* tr
/*ignore*/
break;
}
end:
if (delete_dialog) belle_sip_dialog_delete(obj);
else {
......@@ -617,7 +619,7 @@ belle_sip_dialog_t *belle_sip_dialog_new(belle_sip_transaction_t *t){
belle_sip_error("belle_sip_dialog_new(): no from tag!");
return NULL;
}
to = belle_sip_message_get_header_by_type(t->request,belle_sip_header_to_t);
if (to == NULL){
belle_sip_error("belle_sip_dialog_new(): no to in request!");
......@@ -647,7 +649,7 @@ belle_sip_dialog_t *belle_sip_dialog_new(belle_sip_transaction_t *t){
obj->provider=t->provider;
obj->pending_trans_checking_enabled=1;
obj->call_id=(belle_sip_header_call_id_t*)belle_sip_object_ref(call_id);
if (strcmp(belle_sip_request_get_method(t->request),"INVITE") == 0){
obj->type = BELLE_SIP_DIALOG_INVITE;
}else if (strcmp(belle_sip_request_get_method(t->request),"SUBSCRIBE") == 0){
......@@ -655,10 +657,10 @@ belle_sip_dialog_t *belle_sip_dialog_new(belle_sip_transaction_t *t){
}else{
belle_sip_error("belle_sip_dialog_new(): unsupported request [%s] for creating a dialog.", belle_sip_request_get_method(t->request));
}
belle_sip_object_ref(t);
obj->last_transaction=t;
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(t,belle_sip_server_transaction_t)){
obj->remote_tag=belle_sip_strdup(from_tag);
obj->local_tag=belle_sip_strdup(BELLE_SIP_SERVER_TRANSACTION(t)->to_tag);
......@@ -677,7 +679,7 @@ belle_sip_dialog_t *belle_sip_dialog_new(belle_sip_transaction_t *t){
}
belle_sip_dialog_init_as_uac(obj,belle_sip_transaction_get_request(t));
}
belle_sip_message("New %s dialog [%p] , local tag [%s], remote tag [%s]"
,obj->is_server?"server":"client"
......@@ -692,7 +694,7 @@ belle_sip_request_t *belle_sip_dialog_create_ack(belle_sip_dialog_t *obj, unsign
belle_sip_header_cseq_t *cseqh;
belle_sip_request_t *invite=obj->last_out_invite;
belle_sip_request_t *ack;
if (!invite){
belle_sip_error("No INVITE to ACK.");
return NULL;
......@@ -734,12 +736,12 @@ belle_sip_request_t *belle_sip_dialog_create_ack(belle_sip_dialog_t *obj, unsign
static belle_sip_request_t *create_request(belle_sip_dialog_t *obj, const char *method, int full){
belle_sip_request_t *req;
char* from_tag=NULL, *to_tag=NULL;
if (!obj->remote_target){
belle_sip_error("dialog [%p]: no remote_target set, unable to create request.", obj);
return NULL;
}
if (!belle_sip_parameters_has_parameter(BELLE_SIP_PARAMETERS(obj->local_party), "tag")) {
/*special case for dialog created by server transaction*/
from_tag = obj->local_tag;
......@@ -757,7 +759,7 @@ static belle_sip_request_t *create_request(belle_sip_dialog_t *obj, const char *
belle_sip_header_to_create(obj->remote_party,to_tag),
belle_sip_header_via_new(),
0);
if (full && obj->route_set) {
belle_sip_message_add_headers((belle_sip_message_t*)req,obj->route_set);
}
......@@ -784,7 +786,7 @@ static int dialog_can_create_request(belle_sip_dialog_t *obj, const char *method
belle_sip_request_t * belle_sip_dialog_create_queued_request(belle_sip_dialog_t *obj, const char *method){
belle_sip_request_t *req;
if (!dialog_can_create_request(obj, method)) return NULL;
if (strcmp(method,"INVITE")==0 || strcmp(method,"SUBSCRIBE")==0){
/*we don't allow requests that can update the dialog's state to be sent asynchronously*/
......@@ -805,7 +807,7 @@ static void belle_sip_dialog_update_local_cseq(belle_sip_dialog_t *obj, const ch
belle_sip_request_t *belle_sip_dialog_create_request(belle_sip_dialog_t *obj, const char *method){
belle_sip_request_t *req;
if (!dialog_can_create_request(obj, method)) return NULL;
/*don't prevent to send a BYE in any case */
if ( obj->pending_trans_checking_enabled
......@@ -819,7 +821,7 @@ belle_sip_request_t *belle_sip_dialog_create_request(belle_sip_dialog_t *obj, co
} /*else UPDATE transaction can be send in // */
}
belle_sip_dialog_update_local_cseq(obj,method);
req=create_request(obj,method,TRUE);
return req;
}
......@@ -848,25 +850,25 @@ static belle_sip_request_t *_belle_sip_dialog_create_request_from(belle_sip_dial
const char *method=belle_sip_request_get_method(initial_req);
belle_sip_header_content_length_t* content_lenth;
belle_sip_list_t* headers;
if (queued) req=belle_sip_dialog_create_queued_request(obj,method);
else req=belle_sip_dialog_create_request(obj,method);
if (req==NULL) return NULL;
content_lenth = belle_sip_message_get_header_by_type(initial_req,belle_sip_header_content_length_t);
/*first copy non system headers*/
headers = belle_sip_message_get_all_headers(BELLE_SIP_MESSAGE(initial_req));
belle_sip_list_for_each2(headers,(void (*)(void *, void *))copy_non_system_headers,req);
belle_sip_list_free(headers);
/*replicate via user parameters, if any, useful for 'alias' parameter in SUBSCRIBE requests*/
{
belle_sip_header_via_t *orig_via=belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(initial_req),belle_sip_header_via_t);
belle_sip_header_via_t *new_via=belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_via_t);
belle_sip_parameters_copy_parameters_from(BELLE_SIP_PARAMETERS(new_via),BELLE_SIP_PARAMETERS(orig_via));
}
/*copy body*/
if (content_lenth && belle_sip_header_content_length_get_content_length(content_lenth)>0) {
belle_sip_message_set_body(BELLE_SIP_MESSAGE(req),belle_sip_message_get_body(BELLE_SIP_MESSAGE(initial_req)),belle_sip_header_content_length_get_content_length(content_lenth));
......@@ -884,7 +886,7 @@ belle_sip_request_t *belle_sip_dialog_create_queued_request_from(belle_sip_dialo
void belle_sip_dialog_delete(belle_sip_dialog_t *obj){
size_t dropped_transactions;
if (obj->expiration_timer){
belle_sip_main_loop_remove_source(obj->provider->stack->ml, obj->expiration_timer);
belle_sip_object_unref(obj->expiration_timer);
......@@ -990,7 +992,7 @@ int belle_sip_dialog_match(belle_sip_dialog_t *obj, belle_sip_message_t *msg, in
call_id_value=belle_sip_header_call_id_get_call_id(call_id);
from_tag=belle_sip_header_from_get_tag(from);
to_tag=belle_sip_header_to_get_tag(to);
return _belle_sip_dialog_match(obj,call_id_value,as_uas ? to_tag : from_tag, as_uas ? from_tag : to_tag);
}
......@@ -999,7 +1001,7 @@ int _belle_sip_dialog_match(belle_sip_dialog_t *obj, const char *call_id, const
/*Dialog created by notify matching subscription are still in NULL state if (obj->state==BELLE_SIP_DIALOG_NULL) belle_sip_fatal("_belle_sip_dialog_match() must not be used for dialog in null state.");*/
dcid=belle_sip_header_call_id_get_call_id(obj->call_id);
return strcmp(dcid,call_id)==0
&& strcmp(obj->local_tag,local_tag)==0
&& strcmp(obj->local_tag,local_tag)==0
&& obj->remote_tag /* handle 180 without to tag */ && strcmp(obj->remote_tag,remote_tag)==0;
}
......@@ -1080,7 +1082,7 @@ int belle_sip_dialog_is_authorized_transaction(const belle_sip_dialog_t *dialog,
const char* last_transaction_request;
if (strcasecmp(method,"BYE")==0)
return TRUE; /*don't reject a BYE*/
last_transaction_request = belle_sip_request_get_method(belle_sip_transaction_get_request(dialog->last_transaction));
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(dialog->last_transaction,belle_sip_client_transaction_t)
&& strcmp(last_transaction_request,"SUBSCRIBE")==0 && strcmp(method,"NOTIFY")==0){
......@@ -1103,9 +1105,9 @@ void belle_sip_dialog_queue_client_transaction(belle_sip_dialog_t *dialog, belle
static void _belle_sip_dialog_process_queue(belle_sip_dialog_t* dialog){
belle_sip_client_transaction_t *tr=NULL;
if (dialog->state==BELLE_SIP_DIALOG_TERMINATED || belle_sip_dialog_request_pending(dialog)) goto end;
dialog->queued_ct=belle_sip_list_pop_front(dialog->queued_ct,(void**)&tr);
if (tr){
belle_sip_message("Dialog [%p]: sending queued request.",dialog);
......
......@@ -117,6 +117,7 @@
#endif
#include <bctoolbox/port.h>
#include <bctoolbox/defs.h>
/*
* C O M P I L E R V E R S I O N & F E A T U R E D E T E C T I O N
......@@ -6297,7 +6298,7 @@ static int dns_socket(struct sockaddr *local, int type, int *error_) {
#endif
if (-1 == (fd = socket(local->sa_family, type|flags, 0)))
goto soerr;
if (local->sa_family == AF_INET6){
int value=0;
setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&value, sizeof(value));
......@@ -10057,4 +10058,3 @@ int main(int argc, char **argv) {
#elif DNS_GNUC_PREREQ(4,6,0)
#pragma GCC diagnostic pop
#endif
......@@ -17,6 +17,8 @@
*/
#include <bctoolbox/defs.h>
#include "belle_sip_internal.h"
typedef struct belle_http_channel_context belle_http_channel_context_t;
......@@ -266,6 +268,7 @@ static void channel_state_changed(belle_sip_channel_listener_t *obj, belle_sip_c
break;
case BELLE_SIP_CHANNEL_ERROR:
http_channel_context_handle_io_error(ctx, chan);
BCTBX_NO_BREAK; /*intentionally no break*/
case BELLE_SIP_CHANNEL_DISCONNECTED:
if (!chan->force_close) provider_remove_channel(ctx->provider,chan);
break;
......@@ -492,7 +495,7 @@ int belle_http_provider_set_tls_crypto_config(belle_http_provider_t *obj, belle_
void belle_http_provider_set_recv_error(belle_http_provider_t *obj, int recv_error) {
belle_sip_list_t *it;
for(it=obj->tcp_channels;it!=NULL;it=it->next){
belle_sip_channel_t *chan = (belle_sip_channel_t*)it->data;
chan->simulated_recv_return=recv_error;
......@@ -504,4 +507,3 @@ void belle_http_provider_set_recv_error(belle_http_provider_t *obj, int recv_err
chan->base.notify_required=(recv_error<=0);
}
}
......@@ -16,10 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
/**
* INVITE client transaction implementation.
**/
#include <bctoolbox/defs.h>
#include "belle_sip_internal.h"
......@@ -104,7 +106,7 @@ static void ict_on_response(belle_sip_ict_t *obj, belle_sip_response_t *resp){
switch (base->state){
case BELLE_SIP_TRANSACTION_CALLING:
belle_sip_transaction_set_state(base,BELLE_SIP_TRANSACTION_PROCEEDING);
/* no break*/
BCTBX_NO_BREAK; /*intentionally no break*/
case BELLE_SIP_TRANSACTION_PROCEEDING:
if (code>=300){
belle_sip_transaction_set_state(base,BELLE_SIP_TRANSACTION_COMPLETED);
......@@ -141,7 +143,7 @@ static int ict_on_timer_A(belle_sip_ict_t *obj){
belle_sip_transaction_t *base=(belle_sip_transaction_t*)obj;
if (!base->channel) return BELLE_SIP_STOP;
switch(base->state){
case BELLE_SIP_TRANSACTION_CALLING:
{
......@@ -154,7 +156,7 @@ static int ict_on_timer_A(belle_sip_ict_t *obj){
default:
break;
}
return BELLE_SIP_CONTINUE;
}
......@@ -177,7 +179,7 @@ static void ict_send_request(belle_sip_ict_t *obj){
const belle_sip_timer_config_t *cfg=belle_sip_transaction_get_timer_config(base);
belle_sip_transaction_set_state(base,BELLE_SIP_TRANSACTION_CALLING);
if (!belle_sip_channel_is_reliable(base->channel)){
obj->timer_A=belle_sip_timeout_source_new((belle_sip_source_func_t)ict_on_timer_A,obj,cfg->T1);
belle_sip_transaction_start_timer(base,obj->timer_A);
......@@ -185,7 +187,7 @@ static void ict_send_request(belle_sip_ict_t *obj){
obj->timer_B=belle_sip_timeout_source_new((belle_sip_source_func_t)ict_on_timer_B,obj,cfg->T1*64);
belle_sip_transaction_start_timer(base,obj->timer_B);
belle_sip_channel_queue_message(base->channel,(belle_sip_message_t*)base->request);
}
......@@ -214,4 +216,3 @@ belle_sip_ict_t *belle_sip_ict_new(belle_sip_provider_t *prov, belle_sip_request
belle_sip_client_transaction_init((belle_sip_client_transaction_t*)obj,prov,req);
return obj;
}
......@@ -16,10 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
/**
* non-INVITE server transaction implementation.
**/
#include <bctoolbox/defs.h>
#include "belle_sip_internal.h"
static void nist_on_terminate(belle_sip_nist_t *obj){
......@@ -63,7 +65,7 @@ static int nist_send_new_response(belle_sip_nist_t *obj, belle_sip_response_t *r
belle_sip_channel_queue_message(base->channel,(belle_sip_message_t*)resp);
break;
}
/* no break nist can directly pass from TRYING to PROCEEDING*/
BCTBX_NO_BREAK; /* no break nist can directly pass from TRYING to PROCEEDING*/
case BELLE_SIP_TRANSACTION_PROCEEDING:
if (code>=200){
nist_set_completed(obj);
......
......@@ -16,6 +16,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <bctoolbox/defs.h>
#include "belle_sip_internal.h"
#include "belle-sip/refresher.h"
......@@ -111,7 +113,7 @@ static void process_dialog_terminated(belle_sip_listener_t *user_ctx, const bell
* so there is no need to reschedule a retry here.*/
belle_sip_warning("Refresher [%p] still started but expired, retrying",refresher);
if (refresher->listener) refresher->listener(refresher,refresher->user_data,481, "dialod terminated", TRUE);
}
}
......@@ -336,7 +338,7 @@ static void process_response_event(belle_sip_listener_t *user_ctx, const belle_s
return; /*do not notify this kind of error*/
}