mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 00:59:20 +00:00
replace tabs with spaces and remove trailing spaces
This commit is contained in:
parent
ee6d1e5087
commit
4386f18b21
14 changed files with 277 additions and 277 deletions
|
|
@ -117,7 +117,7 @@ void sal_process_authentication(SalOp *op) {
|
|||
belle_sip_response_t *response=belle_sip_transaction_get_response((belle_sip_transaction_t*)op->pending_auth_transaction);
|
||||
belle_sip_header_from_t *from=belle_sip_message_get_header_by_type(initial_request,belle_sip_header_from_t);
|
||||
belle_sip_uri_t *from_uri=belle_sip_header_address_get_uri((belle_sip_header_address_t*)from);
|
||||
|
||||
|
||||
if (strcasecmp(belle_sip_uri_get_host(from_uri),"anonymous.invalid")==0){
|
||||
/*prefer using the from from the SalOp*/
|
||||
from_uri=belle_sip_header_address_get_uri((belle_sip_header_address_t*)sal_op_get_from_address(op));
|
||||
|
|
@ -137,7 +137,7 @@ void sal_process_authentication(SalOp *op) {
|
|||
ms_error("sal_process_authentication() op=[%p] cannot obtain new request from dialog.",op);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (belle_sip_provider_add_authorization(op->base.root->prov,new_request,response,from_uri,&auth_list)) {
|
||||
if (is_within_dialog) {
|
||||
sal_op_send_request(op,new_request);
|
||||
|
|
@ -308,7 +308,7 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even
|
|||
belle_sip_client_transaction_t* client_transaction = belle_sip_response_event_get_client_transaction(event);
|
||||
belle_sip_response_t* response = belle_sip_response_event_get_response(event);
|
||||
int response_code = belle_sip_response_get_status_code(response);
|
||||
|
||||
|
||||
if (!client_transaction) {
|
||||
ms_warning("Discarding stateless response [%i]",response_code);
|
||||
return;
|
||||
|
|
@ -334,11 +334,11 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even
|
|||
}
|
||||
|
||||
sal_op_assign_recv_headers(op,(belle_sip_message_t*)response);
|
||||
|
||||
|
||||
if (op->callbacks && op->callbacks->process_response_event) {
|
||||
/*handle authorization*/
|
||||
switch (response_code) {
|
||||
case 200:
|
||||
case 200:
|
||||
break;
|
||||
case 401:
|
||||
case 407:
|
||||
|
|
@ -677,10 +677,10 @@ static void set_tls_properties(Sal *ctx){
|
|||
if (lp){
|
||||
belle_sip_tls_listening_point_t *tlp=BELLE_SIP_TLS_LISTENING_POINT(lp);
|
||||
int verify_exceptions=0;
|
||||
|
||||
|
||||
if (!ctx->tls_verify) verify_exceptions=BELLE_SIP_TLS_LISTENING_POINT_BADCERT_ANY_REASON;
|
||||
else if (!ctx->tls_verify_cn) verify_exceptions=BELLE_SIP_TLS_LISTENING_POINT_BADCERT_CN_MISMATCH;
|
||||
|
||||
|
||||
belle_sip_tls_listening_point_set_root_ca(tlp,ctx->root_ca); /*root_ca might be NULL */
|
||||
belle_sip_tls_listening_point_set_verify_exceptions(tlp,verify_exceptions);
|
||||
}
|
||||
|
|
@ -802,7 +802,7 @@ void sal_auth_info_set_mode(SalAuthInfo* auth_info, SalAuthMode mode) { auth_inf
|
|||
void sal_certificates_chain_delete(SalCertificatesChain *chain) {
|
||||
belle_sip_object_unref((belle_sip_object_t *)chain);
|
||||
}
|
||||
void sal_signing_key_delete(SalSigningKey *key) {
|
||||
void sal_signing_key_delete(SalSigningKey *key) {
|
||||
belle_sip_object_unref((belle_sip_object_t *)key);
|
||||
}
|
||||
|
||||
|
|
@ -829,7 +829,7 @@ int sal_auth_compute_ha1(const char* userid,const char* realm,const char* passwo
|
|||
SalCustomHeader *sal_custom_header_append(SalCustomHeader *ch, const char *name, const char *value){
|
||||
belle_sip_message_t *msg=(belle_sip_message_t*)ch;
|
||||
belle_sip_header_t *h;
|
||||
|
||||
|
||||
if (msg==NULL){
|
||||
msg=(belle_sip_message_t*)belle_sip_request_new();
|
||||
belle_sip_object_ref(msg);
|
||||
|
|
@ -846,7 +846,7 @@ SalCustomHeader *sal_custom_header_append(SalCustomHeader *ch, const char *name,
|
|||
const char *sal_custom_header_find(const SalCustomHeader *ch, const char *name){
|
||||
if (ch){
|
||||
belle_sip_header_t *h=belle_sip_message_get_header((belle_sip_message_t*)ch,name);
|
||||
|
||||
|
||||
if (h){
|
||||
return belle_sip_header_get_unparsed_value(h);
|
||||
}
|
||||
|
|
@ -879,12 +879,12 @@ void sal_set_uuid(Sal *sal, const char *uuid){
|
|||
}
|
||||
|
||||
typedef struct {
|
||||
unsigned int time_low;
|
||||
unsigned short time_mid;
|
||||
unsigned short time_hi_and_version;
|
||||
unsigned char clock_seq_hi_and_reserved;
|
||||
unsigned char clock_seq_low;
|
||||
unsigned char node[6];
|
||||
unsigned int time_low;
|
||||
unsigned short time_mid;
|
||||
unsigned short time_hi_and_version;
|
||||
unsigned char clock_seq_hi_and_reserved;
|
||||
unsigned char clock_seq_low;
|
||||
unsigned char node[6];
|
||||
} sal_uuid_t;
|
||||
|
||||
|
||||
|
|
@ -892,7 +892,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len){
|
|||
sal_uuid_t uuid_struct;
|
||||
int i;
|
||||
int written;
|
||||
|
||||
|
||||
if (len==0) return -1;
|
||||
/*create an UUID as described in RFC4122, 4.4 */
|
||||
belle_sip_random_bytes((unsigned char*)&uuid_struct, sizeof(sal_uuid_t));
|
||||
|
|
@ -900,7 +900,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len){
|
|||
uuid_struct.clock_seq_hi_and_reserved|=1<<7;
|
||||
uuid_struct.time_hi_and_version&=~(0xf<<12);
|
||||
uuid_struct.time_hi_and_version|=4<<12;
|
||||
|
||||
|
||||
written=snprintf(uuid,len,"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", uuid_struct.time_low, uuid_struct.time_mid,
|
||||
uuid_struct.time_hi_and_version, uuid_struct.clock_seq_hi_and_reserved,
|
||||
uuid_struct.clock_seq_low);
|
||||
|
|
|
|||
|
|
@ -111,9 +111,9 @@ static int set_sdp_from_desc(belle_sip_message_t *msg, const SalMediaDescription
|
|||
}
|
||||
static void call_process_io_error(void *user_ctx, const belle_sip_io_error_event_t *event){
|
||||
SalOp* op=(SalOp*)user_ctx;
|
||||
|
||||
|
||||
if (op->state==SalOpStateTerminated) return;
|
||||
|
||||
|
||||
if (!op->dialog) {
|
||||
/*call terminated very early*/
|
||||
sal_error_info_set(&op->error_info,SalReasonIOError,503,"IO error",NULL);
|
||||
|
|
@ -129,7 +129,7 @@ static void process_dialog_terminated(void *ctx, const belle_sip_dialog_terminat
|
|||
if (op->dialog && op->dialog==belle_sip_dialog_terminated_event_get_dialog(event)) {
|
||||
/*belle_sip_transaction_t* trans=belle_sip_dialog_get_last_transaction(op->dialog);*/
|
||||
ms_message("Dialog [%p] terminated for op [%p]",belle_sip_dialog_terminated_event_get_dialog(event),op);
|
||||
|
||||
|
||||
switch(belle_sip_dialog_get_previous_state(op->dialog)) {
|
||||
case BELLE_SIP_DIALOG_CONFIRMED:
|
||||
if (op->state!=SalOpStateTerminated && op->state!=SalOpStateTerminating) {
|
||||
|
|
@ -192,7 +192,7 @@ static void call_process_response(void *op_base, const belle_sip_response_event_
|
|||
req=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(client_transaction));
|
||||
set_or_update_dialog(op,belle_sip_response_event_get_dialog(event));
|
||||
dialog_state=op->dialog?belle_sip_dialog_get_state(op->dialog):BELLE_SIP_DIALOG_NULL;
|
||||
|
||||
|
||||
ms_message("Op [%p] receiving call response [%i], dialog is [%p] in state [%s]",op,code,op->dialog,belle_sip_dialog_state_to_string(dialog_state));
|
||||
|
||||
switch(dialog_state) {
|
||||
|
|
@ -290,9 +290,9 @@ static void call_process_response(void *op_base, const belle_sip_response_event_
|
|||
|
||||
static void call_process_timeout(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
SalOp* op=(SalOp*)user_ctx;
|
||||
|
||||
|
||||
if (op->state==SalOpStateTerminated) return;
|
||||
|
||||
|
||||
if (!op->dialog) {
|
||||
/*call terminated very early*/
|
||||
sal_error_info_set(&op->error_info,SalReasonRequestTimeout,408,"Request timeout",NULL);
|
||||
|
|
@ -342,7 +342,7 @@ static void unsupported_method(belle_sip_server_transaction_t* server_transactio
|
|||
* Extract the sdp from a sip message.
|
||||
* If there is no body in the message, the session_desc is set to null, 0 is returned.
|
||||
* If body was present is not a SDP or parsing of SDP failed, -1 is returned and SalReason is set appropriately.
|
||||
*
|
||||
*
|
||||
**/
|
||||
static int extract_sdp(belle_sip_message_t* message,belle_sdp_session_description_t** session_desc, SalReason *error) {
|
||||
belle_sip_header_content_type_t* content_type=belle_sip_message_get_header_by_type(message,belle_sip_header_content_type_t);
|
||||
|
|
@ -388,7 +388,7 @@ static int process_sdp_for_invite(SalOp* op,belle_sip_request_t* invite) {
|
|||
belle_sip_object_unref(sdp);
|
||||
}else op->sdp_offering=TRUE; /*INVITE without SDP*/
|
||||
}else err=-1;
|
||||
|
||||
|
||||
if (err==-1){
|
||||
sal_call_decline(op,reason,NULL);
|
||||
}
|
||||
|
|
@ -582,7 +582,7 @@ int sal_call_set_local_media_description(SalOp *op, SalMediaDescription *desc){
|
|||
if (op->base.local_media)
|
||||
sal_media_description_unref(op->base.local_media);
|
||||
op->base.local_media=desc;
|
||||
|
||||
|
||||
if (op->base.remote_media){
|
||||
/*case of an incoming call where we modify the local capabilities between the time
|
||||
* the call is ringing and it is accepted (for example if you want to accept without video*/
|
||||
|
|
@ -597,7 +597,7 @@ int sal_call_set_local_media_description(SalOp *op, SalMediaDescription *desc){
|
|||
|
||||
static belle_sip_header_allow_t *create_allow(){
|
||||
belle_sip_header_allow_t* header_allow;
|
||||
header_allow = belle_sip_header_allow_create("INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE");
|
||||
header_allow = belle_sip_header_allow_create("INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE");
|
||||
return header_allow;
|
||||
}
|
||||
|
||||
|
|
@ -633,7 +633,7 @@ int sal_call(SalOp *op, const char *from, const char *to){
|
|||
}
|
||||
if (op->referred_by)
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),BELLE_SIP_HEADER(op->referred_by));
|
||||
|
||||
|
||||
return sal_op_send_request(op,invite);
|
||||
}
|
||||
|
||||
|
|
@ -679,7 +679,7 @@ int sal_call_notify_ringing(SalOp *op, bool_t early_media){
|
|||
belle_sip_response_t* ringing_response = sal_op_create_response_from_request(op,req,status_code);
|
||||
belle_sip_header_t *require;
|
||||
const char *tags=NULL;
|
||||
|
||||
|
||||
if (early_media){
|
||||
handle_offer_answer_response(op,ringing_response);
|
||||
}
|
||||
|
|
@ -692,7 +692,7 @@ int sal_call_notify_ringing(SalOp *op, bool_t early_media){
|
|||
}
|
||||
|
||||
#ifndef SAL_OP_CALL_FORCE_CONTACT_IN_RINGING
|
||||
if (tags && strstr(tags,"100rel")!=0)
|
||||
if (tags && strstr(tags,"100rel")!=0)
|
||||
#endif
|
||||
{
|
||||
belle_sip_header_address_t* contact= (belle_sip_header_address_t*)sal_op_get_contact_address(op);
|
||||
|
|
@ -740,7 +740,7 @@ int sal_call_accept(SalOp*h){
|
|||
if ((contact_header=sal_op_create_contact(h))) {
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),BELLE_SIP_HEADER(contact_header));
|
||||
}
|
||||
|
||||
|
||||
_sal_op_add_custom_headers(h, BELLE_SIP_MESSAGE(response));
|
||||
|
||||
handle_offer_answer_response(h,response);
|
||||
|
|
@ -757,7 +757,7 @@ int sal_call_decline(SalOp *op, SalReason reason, const char *redirection /*opti
|
|||
belle_sip_response_t* response;
|
||||
belle_sip_header_contact_t* contact=NULL;
|
||||
int status=sal_reason_to_sip_code(reason);
|
||||
|
||||
|
||||
if (reason==SalReasonRedirect){
|
||||
if (redirection!=NULL) {
|
||||
if (strstr(redirection,"sip:")!=0) status=302;
|
||||
|
|
@ -812,7 +812,7 @@ int sal_call_send_dtmf(SalOp *h, char dtmf){
|
|||
if (req){
|
||||
int bodylen;
|
||||
char dtmf_body[128]={0};
|
||||
|
||||
|
||||
snprintf(dtmf_body, sizeof(dtmf_body)-1, "Signal=%c\r\nDuration=250\r\n", dtmf);
|
||||
bodylen=strlen(dtmf_body);
|
||||
belle_sip_message_set_body((belle_sip_message_t*)req,dtmf_body,bodylen);
|
||||
|
|
|
|||
|
|
@ -90,19 +90,19 @@ SalAuthInfo * sal_op_get_auth_requested(SalOp *op){
|
|||
belle_sip_header_contact_t* sal_op_create_contact(SalOp *op){
|
||||
belle_sip_header_contact_t* contact_header;
|
||||
belle_sip_uri_t* contact_uri;
|
||||
|
||||
|
||||
if (sal_op_get_contact_address(op)) {
|
||||
contact_header = belle_sip_header_contact_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_contact_address(op)));
|
||||
} else {
|
||||
contact_header= belle_sip_header_contact_new();
|
||||
}
|
||||
|
||||
|
||||
if (!(contact_uri=belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(contact_header)))) {
|
||||
/*no uri, just creating a new one*/
|
||||
contact_uri=belle_sip_uri_new();
|
||||
belle_sip_header_address_set_uri(BELLE_SIP_HEADER_ADDRESS(contact_header),contact_uri);
|
||||
}
|
||||
|
||||
|
||||
belle_sip_uri_set_secure(contact_uri,sal_op_is_secure(op));
|
||||
if (op->privacy!=SalPrivacyNone){
|
||||
belle_sip_uri_set_user(contact_uri,NULL);
|
||||
|
|
@ -213,7 +213,7 @@ void sal_op_resend_request(SalOp* op, belle_sip_request_t* request) {
|
|||
}
|
||||
|
||||
static void add_headers(SalOp *op, belle_sip_header_t *h, belle_sip_message_t *msg){
|
||||
|
||||
|
||||
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(h,belle_sip_header_contact_t)){
|
||||
belle_sip_header_contact_t* newct;
|
||||
/*special case for contact, we want to keep everything from the custom contact but set automatic mode and add our own parameters as well*/
|
||||
|
|
@ -224,7 +224,7 @@ static void add_headers(SalOp *op, belle_sip_header_t *h, belle_sip_message_t *m
|
|||
}
|
||||
/*if a header already exists in the message, replace it*/
|
||||
belle_sip_message_set_header(msg,h);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _sal_op_add_custom_headers(SalOp *op, belle_sip_message_t *msg){
|
||||
|
|
@ -246,20 +246,20 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
|
|||
belle_sip_header_contact_t* contact;
|
||||
int result =-1;
|
||||
belle_sip_uri_t *next_hop_uri=NULL;
|
||||
|
||||
|
||||
if (add_contact) {
|
||||
contact = sal_op_create_contact(op);
|
||||
belle_sip_message_set_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_HEADER(contact));
|
||||
}
|
||||
|
||||
|
||||
_sal_op_add_custom_headers(op, (belle_sip_message_t*)request);
|
||||
|
||||
|
||||
if (!op->dialog || belle_sip_dialog_get_state(op->dialog) == BELLE_SIP_DIALOG_NULL) {
|
||||
/*don't put route header if dialog is in confirmed state*/
|
||||
const MSList *elem=sal_op_get_route_addresses(op);
|
||||
const char *transport;
|
||||
const char *method=belle_sip_request_get_method(request);
|
||||
|
||||
|
||||
if (elem) {
|
||||
outbound_proxy=belle_sip_header_address_get_uri((belle_sip_header_address_t*)elem->data);
|
||||
next_hop_uri=outbound_proxy;
|
||||
|
|
@ -284,7 +284,7 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((strcmp(method,"REGISTER")==0 || strcmp(method,"SUBSCRIBE")==0) && transport &&
|
||||
if ((strcmp(method,"REGISTER")==0 || strcmp(method,"SUBSCRIBE")==0) && transport &&
|
||||
(strcasecmp(transport,"TCP")==0 || strcasecmp(transport,"TLS")==0)){
|
||||
/*RFC 5923: add 'alias' parameter to tell the server that we want it to keep the connection for future requests*/
|
||||
belle_sip_header_via_t *via=belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request),belle_sip_header_via_t);
|
||||
|
|
@ -307,12 +307,12 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
|
|||
belle_sip_provider_add_authorization(op->base.root->prov,request,NULL,NULL,NULL);
|
||||
}
|
||||
result = belle_sip_client_transaction_send_request_to(client_transaction,next_hop_uri/*might be null*/);
|
||||
|
||||
|
||||
/*update call id if not set yet for this OP*/
|
||||
if (result == 0 && !op->base.call_id) {
|
||||
op->base.call_id=ms_strdup(belle_sip_header_call_id_get_call_id(BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request), belle_sip_header_call_id_t))));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
|
@ -323,9 +323,9 @@ int sal_op_send_request(SalOp* op, belle_sip_request_t* request) {
|
|||
return -1; /*sanity check*/
|
||||
}
|
||||
/*
|
||||
Header field where proxy ACK BYE CAN INV OPT REG
|
||||
___________________________________________________________
|
||||
Contact R o - - m o o
|
||||
Header field where proxy ACK BYE CAN INV OPT REG
|
||||
___________________________________________________________
|
||||
Contact R o - - m o o
|
||||
*/
|
||||
if (strcmp(belle_sip_request_get_method(request),"INVITE")==0
|
||||
||strcmp(belle_sip_request_get_method(request),"REGISTER")==0
|
||||
|
|
@ -415,7 +415,7 @@ SalReason sal_reason_to_sip_code(SalReason r){
|
|||
|
||||
SalReason _sal_reason_from_sip_code(int code) {
|
||||
if (code>=100 && code<300) return SalReasonNone;
|
||||
|
||||
|
||||
switch(code) {
|
||||
case 0:
|
||||
return SalReasonIOError;
|
||||
|
|
@ -490,7 +490,7 @@ void sal_error_info_reset(SalErrorInfo *ei){
|
|||
if (ei->warnings){
|
||||
ms_free(ei->warnings);
|
||||
ei->warnings=NULL;
|
||||
|
||||
|
||||
}
|
||||
if (ei->full_string){
|
||||
ms_free(ei->full_string);
|
||||
|
|
@ -522,7 +522,7 @@ void sal_op_set_error_info_from_response(SalOp *op, belle_sip_response_t *respon
|
|||
belle_sip_header_t *warning=belle_sip_message_get_header(BELLE_SIP_MESSAGE(response),"Warning");
|
||||
SalErrorInfo *ei=&op->error_info;
|
||||
const char *warnings;
|
||||
|
||||
|
||||
warnings=warning ? belle_sip_header_get_unparsed_value(warning) : NULL;
|
||||
if (warnings==NULL) warnings=reason_header ? belle_sip_header_get_unparsed_value(reason_header) : NULL;
|
||||
sal_error_info_set(ei,SalReasonUnknown,code,reason_phrase,warnings);
|
||||
|
|
@ -618,7 +618,7 @@ void sal_op_assign_recv_headers(SalOp *op, belle_sip_message_t *incoming){
|
|||
}
|
||||
|
||||
const char *sal_op_get_remote_contact(const SalOp *op){
|
||||
/*
|
||||
/*
|
||||
* remote contact is filled in process_response
|
||||
* return sal_custom_header_find(op->base.recv_custom_headers,"Contact");
|
||||
*/
|
||||
|
|
@ -649,16 +649,16 @@ bool_t sal_op_get_body(SalOp *op, belle_sip_message_t *msg, SalBody *salbody){
|
|||
belle_sip_header_content_type_t *content_type;
|
||||
belle_sip_header_content_length_t *clen=NULL;
|
||||
belle_sip_header_t *content_encoding;
|
||||
|
||||
|
||||
content_type=belle_sip_message_get_header_by_type(msg,belle_sip_header_content_type_t);
|
||||
if (content_type){
|
||||
body=belle_sip_message_get_body(msg);
|
||||
clen=belle_sip_message_get_header_by_type(msg,belle_sip_header_content_length_t);
|
||||
}
|
||||
content_encoding=belle_sip_message_get_header(msg,"Content-encoding");
|
||||
|
||||
|
||||
memset(salbody,0,sizeof(SalBody));
|
||||
|
||||
|
||||
if (content_type && body && clen) {
|
||||
salbody->type=belle_sip_header_content_type_get_type(content_type);
|
||||
salbody->subtype=belle_sip_header_content_type_get_subtype(content_type);
|
||||
|
|
@ -693,7 +693,7 @@ bool_t sal_op_is_ipv6(SalOp *op){
|
|||
belle_sip_transaction_t *tr=NULL;
|
||||
belle_sip_header_address_t *contact;
|
||||
belle_sip_request_t *req;
|
||||
|
||||
|
||||
if (op->refresher)
|
||||
tr=(belle_sip_transaction_t *)belle_sip_refresher_get_transaction(op->refresher);
|
||||
|
||||
|
|
@ -701,7 +701,7 @@ bool_t sal_op_is_ipv6(SalOp *op){
|
|||
tr=(belle_sip_transaction_t *)op->pending_client_trans;
|
||||
if (tr==NULL)
|
||||
tr=(belle_sip_transaction_t *)op->pending_server_trans;
|
||||
|
||||
|
||||
if (tr==NULL){
|
||||
ms_error("Unable to determine IP version from signaling operation.");
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
#include "lpconfig.h"
|
||||
|
|
@ -116,7 +116,7 @@ bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, const LinphoneAddress *f
|
|||
LinphoneChatRoom* linphone_core_get_or_create_chat_room(LinphoneCore* lc, const char* to) {
|
||||
LinphoneAddress *to_addr=linphone_core_interpret_url(lc,to);
|
||||
LinphoneChatRoom *ret;
|
||||
|
||||
|
||||
if (to_addr==NULL){
|
||||
ms_error("linphone_core_get_or_create_chat_room(): Cannot make a valid address with %s",to);
|
||||
return NULL;
|
||||
|
|
@ -176,7 +176,7 @@ static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatM
|
|||
char* content_type;
|
||||
const char *identity=NULL;
|
||||
time_t t=time(NULL);
|
||||
|
||||
|
||||
if (lp_config_get_int(cr->lc->config,"sip","chat_use_call_dialogs",0)){
|
||||
if((call = linphone_core_get_call_by_remote_address(cr->lc,cr->peer))!=NULL){
|
||||
if (call->state==LinphoneCallConnected ||
|
||||
|
|
@ -266,7 +266,7 @@ void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessag
|
|||
char *from;
|
||||
LinphoneChatMessage* msg;
|
||||
const SalCustomHeader *ch;
|
||||
|
||||
|
||||
addr=linphone_address_new(sal_msg->from);
|
||||
linphone_address_clean(addr);
|
||||
cr=linphone_core_get_chat_room(lc,addr);
|
||||
|
|
@ -278,20 +278,20 @@ void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessag
|
|||
}
|
||||
msg = linphone_chat_room_create_message(cr, sal_msg->text);
|
||||
linphone_chat_message_set_from(msg, cr->peer_url);
|
||||
|
||||
|
||||
{
|
||||
LinphoneAddress *to;
|
||||
to=sal_op_get_to(op) ? linphone_address_new(sal_op_get_to(op)) : linphone_address_new(linphone_core_get_identity(lc));
|
||||
msg->to=to;
|
||||
}
|
||||
|
||||
|
||||
msg->time=sal_msg->time;
|
||||
msg->state=LinphoneChatMessageStateDelivered;
|
||||
msg->is_read=FALSE;
|
||||
msg->dir=LinphoneChatMessageIncoming;
|
||||
ch=sal_op_get_recv_custom_header(op);
|
||||
if (ch) msg->custom_headers=sal_custom_header_clone(ch);
|
||||
|
||||
|
||||
if (sal_msg->url) {
|
||||
linphone_chat_message_set_external_body_url(msg, sal_msg->url);
|
||||
}
|
||||
|
|
@ -437,8 +437,8 @@ LinphoneChatMessage* linphone_chat_room_create_message(LinphoneChatRoom *cr, con
|
|||
* @return a new #LinphoneChatMessage
|
||||
*/
|
||||
LinphoneChatMessage* linphone_chat_room_create_message_2(
|
||||
LinphoneChatRoom *cr, const char* message, const char* external_body_url,
|
||||
LinphoneChatMessageState state, time_t time, bool_t is_read, bool_t is_incoming) {
|
||||
LinphoneChatRoom *cr, const char* message, const char* external_body_url,
|
||||
LinphoneChatMessageState state, time_t time, bool_t is_read, bool_t is_incoming) {
|
||||
LinphoneCore *lc=linphone_chat_room_get_lc(cr);
|
||||
|
||||
LinphoneChatMessage* msg = belle_sip_object_new(LinphoneChatMessage);
|
||||
|
|
@ -605,13 +605,13 @@ void linphone_chat_room_compose(LinphoneChatRoom *cr) {
|
|||
*/
|
||||
const char* linphone_chat_message_state_to_string(const LinphoneChatMessageState state) {
|
||||
switch (state) {
|
||||
case LinphoneChatMessageStateIdle:return "LinphoneChatMessageStateIdle";
|
||||
case LinphoneChatMessageStateIdle:return "LinphoneChatMessageStateIdle";
|
||||
case LinphoneChatMessageStateInProgress:return "LinphoneChatMessageStateInProgress";
|
||||
case LinphoneChatMessageStateDelivered:return "LinphoneChatMessageStateDelivered";
|
||||
case LinphoneChatMessageStateNotDelivered:return "LinphoneChatMessageStateNotDelivered";
|
||||
default: return "Unknown state";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -653,8 +653,8 @@ const char* linphone_chat_message_get_external_body_url(const LinphoneChatMessag
|
|||
|
||||
/**
|
||||
* Linphone message can carry external body as defined by rfc2017
|
||||
*
|
||||
* @param message a LinphoneChatMessage
|
||||
*
|
||||
* @param message a LinphoneChatMessage
|
||||
* @param url ex: access-type=URL; URL="http://www.foo.com/file"
|
||||
*/
|
||||
void linphone_chat_message_set_external_body_url(LinphoneChatMessage* message,const char* url) {
|
||||
|
|
@ -675,7 +675,7 @@ void linphone_chat_message_set_from(LinphoneChatMessage* message, const Linphone
|
|||
}
|
||||
|
||||
/**
|
||||
* Get origin of the message
|
||||
* Get origin of the message
|
||||
*@param message #LinphoneChatMessage obj
|
||||
*@return #LinphoneAddress
|
||||
*/
|
||||
|
|
@ -694,7 +694,7 @@ void linphone_chat_message_set_to(LinphoneChatMessage* message, const LinphoneAd
|
|||
}
|
||||
|
||||
/**
|
||||
* Get destination of the message
|
||||
* Get destination of the message
|
||||
*@param message #LinphoneChatMessage obj
|
||||
*@return #LinphoneAddress
|
||||
*/
|
||||
|
|
@ -780,7 +780,7 @@ bool_t linphone_chat_message_is_outgoing(LinphoneChatMessage* message) {
|
|||
* @return the id
|
||||
*/
|
||||
unsigned int linphone_chat_message_get_storage_id(LinphoneChatMessage* message) {
|
||||
return message->storage_id;
|
||||
return message->storage_id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ const char *linphone_online_status_to_string(LinphoneOnlineStatus ss){
|
|||
case LinphoneStatusPending:
|
||||
str=_("Pending");
|
||||
break;
|
||||
case LinphoneStatusVacation:
|
||||
str=_("Vacation");
|
||||
case LinphoneStatusVacation:
|
||||
str=_("Vacation");
|
||||
default:
|
||||
str=_("Unknown-bug");
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ LinphoneFriend *linphone_find_friend_by_out_subscribe(MSList *l, SalOp *op){
|
|||
|
||||
void __linphone_friend_do_subscribe(LinphoneFriend *fr){
|
||||
LinphoneCore *lc=fr->lc;
|
||||
|
||||
|
||||
if (fr->outsub==NULL){
|
||||
/* people for which we don't have yet an answer should appear as offline */
|
||||
fr->presence=NULL;
|
||||
|
|
@ -132,7 +132,7 @@ LinphoneFriend * linphone_friend_new(){
|
|||
obj->pol=LinphoneSPAccept;
|
||||
obj->presence=NULL;
|
||||
obj->subscribe=TRUE;
|
||||
return obj;
|
||||
return obj;
|
||||
}
|
||||
|
||||
LinphoneFriend *linphone_friend_new_with_address(const char *addr){
|
||||
|
|
@ -255,7 +255,7 @@ void linphone_friend_close_subscriptions(LinphoneFriend *lf){
|
|||
linphone_friend_unsubscribe(lf);
|
||||
if (lf->insub){
|
||||
sal_notify_presence_close(lf->insub);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf){
|
|||
**/
|
||||
void linphone_friend_update_subscribes(LinphoneFriend *fr, LinphoneProxyConfig *proxy, bool_t only_when_registered){
|
||||
int can_subscribe=1;
|
||||
|
||||
|
||||
if (only_when_registered && (fr->subscribe || fr->subscribe_active)){
|
||||
LinphoneProxyConfig *cfg=linphone_core_lookup_known_proxy(fr->lc,fr->uri);
|
||||
if (proxy && proxy!=cfg) return;
|
||||
|
|
@ -592,13 +592,13 @@ LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int inde
|
|||
int a;
|
||||
LinphoneFriend *lf;
|
||||
LpConfig *config=lc->config;
|
||||
|
||||
|
||||
sprintf(item,"friend_%i",index);
|
||||
|
||||
|
||||
if (!lp_config_has_section(config,item)){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
tmp=lp_config_get_string(config,item,"url",NULL);
|
||||
if (tmp==NULL) {
|
||||
return NULL;
|
||||
|
|
@ -614,7 +614,7 @@ LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int inde
|
|||
}
|
||||
a=lp_config_get_int(config,item,"subscribe",0);
|
||||
linphone_friend_send_subscribe(lf,a);
|
||||
|
||||
|
||||
linphone_friend_set_ref_key(lf,lp_config_get_string(config,item,"refkey",NULL));
|
||||
return lf;
|
||||
}
|
||||
|
|
@ -639,9 +639,9 @@ void linphone_friend_write_to_config_file(LpConfig *config, LinphoneFriend *lf,
|
|||
char key[50];
|
||||
char *tmp;
|
||||
const char *refkey;
|
||||
|
||||
|
||||
sprintf(key,"friend_%i",index);
|
||||
|
||||
|
||||
if (lf==NULL){
|
||||
lp_config_clean_section(config,key);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig
|
|||
}
|
||||
|
||||
const MSList *linphone_tunnel_get_servers(LinphoneTunnel *tunnel){
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel){
|
||||
|
|
@ -56,7 +56,7 @@ void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled){
|
|||
}
|
||||
|
||||
bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel){
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool_t linphone_tunnel_connected(LinphoneTunnel *tunnel){
|
||||
|
|
|
|||
|
|
@ -680,7 +680,7 @@ static void sip_config_read(LinphoneCore *lc)
|
|||
/*setting the dscp must be done before starting the transports, otherwise it is not taken into effect*/
|
||||
sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc));
|
||||
/*start listening on ports*/
|
||||
linphone_core_set_sip_transports(lc,&tr);
|
||||
linphone_core_set_sip_transports(lc,&tr);
|
||||
|
||||
tmpstr=lp_config_get_string(lc->config,"sip","contact",NULL);
|
||||
if (tmpstr==NULL || linphone_core_set_primary_contact(lc,tmpstr)==-1) {
|
||||
|
|
@ -844,7 +844,7 @@ static bool_t get_codec(LinphoneCore *lc, const char* type, int index, PayloadTy
|
|||
if (pt && enabled ) pt->flags|=PAYLOAD_TYPE_ENABLED;
|
||||
//ms_message("Found codec %s/%i",pt->mime_type,pt->clock_rate);
|
||||
if (pt==NULL) ms_warning("Ignoring codec config %s/%i with fmtp=%s because unsupported",
|
||||
mime,rate,fmtp ? fmtp : "");
|
||||
mime,rate,fmtp ? fmtp : "");
|
||||
*ret=pt;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -902,7 +902,7 @@ static MSList *add_missing_codecs(LinphoneCore *lc, SalStreamType mtype, MSList
|
|||
if (mtype==SalVideo && pt->type!=PAYLOAD_VIDEO)
|
||||
pt=NULL;
|
||||
else if (mtype==SalAudio && (pt->type!=PAYLOAD_AUDIO_PACKETIZED
|
||||
&& pt->type!=PAYLOAD_AUDIO_CONTINUOUS)){
|
||||
&& pt->type!=PAYLOAD_AUDIO_CONTINUOUS)){
|
||||
pt=NULL;
|
||||
}
|
||||
if (pt && ms_filter_codec_supported(pt->mime_type)){
|
||||
|
|
@ -912,7 +912,7 @@ static MSList *add_missing_codecs(LinphoneCore *lc, SalStreamType mtype, MSList
|
|||
payload_type_set_flag(pt,PAYLOAD_TYPE_ENABLED);
|
||||
}
|
||||
ms_message("Adding new codec %s/%i with fmtp %s",
|
||||
pt->mime_type,pt->clock_rate,pt->recv_fmtp ? pt->recv_fmtp : "");
|
||||
pt->mime_type,pt->clock_rate,pt->recv_fmtp ? pt->recv_fmtp : "");
|
||||
l=ms_list_insert_sorted(l,pt,(int (*)(const void *, const void *))codec_compare);
|
||||
}
|
||||
}
|
||||
|
|
@ -1391,8 +1391,8 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
|
|||
sal_set_user_pointer(lc->sal,lc);
|
||||
sal_set_callbacks(lc->sal,&linphone_sal_callbacks);
|
||||
|
||||
lc->network_last_check = 0;
|
||||
lc->network_last_status = FALSE;
|
||||
lc->network_last_check = 0;
|
||||
lc->network_last_status = FALSE;
|
||||
|
||||
lc->http_provider = belle_sip_stack_create_http_provider(sal_get_belle_sip_stack(lc->sal), "0.0.0.0");
|
||||
lc->http_verify_policy = belle_tls_verify_policy_new();
|
||||
|
|
@ -1501,7 +1501,7 @@ int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact)
|
|||
void linphone_core_get_local_ip(LinphoneCore *lc, int af, char *result){
|
||||
const char *ip;
|
||||
if (linphone_core_get_firewall_policy(lc)==LinphonePolicyUseNatAddress
|
||||
&& (ip=linphone_core_get_nat_address_resolved(lc))!=NULL){
|
||||
&& (ip=linphone_core_get_nat_address_resolved(lc))!=NULL){
|
||||
strncpy(result,ip,LINPHONE_IPADDR_SIZE);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2273,7 +2273,7 @@ void linphone_core_iterate(LinphoneCore *lc){
|
|||
}
|
||||
|
||||
if (lc->ringstream && lc->ringstream_autorelease && lc->dmfs_playing_start_time!=0
|
||||
&& (curtime-lc->dmfs_playing_start_time)>5){
|
||||
&& (curtime-lc->dmfs_playing_start_time)>5){
|
||||
MSPlayerState state;
|
||||
bool_t stop=TRUE;
|
||||
if (lc->ringstream->source && ms_filter_call_method(lc->ringstream->source,MS_PLAYER_GET_STATE,&state)==0){
|
||||
|
|
@ -2426,7 +2426,7 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
|
|||
}
|
||||
linphone_address_set_display_name(uri,NULL);
|
||||
linphone_proxy_config_normalize_number(proxy,url,normalized_username,
|
||||
sizeof(normalized_username));
|
||||
sizeof(normalized_username));
|
||||
linphone_address_set_username(uri,normalized_username);
|
||||
return uri;
|
||||
}else return NULL;
|
||||
|
|
@ -3005,10 +3005,10 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
|
|||
tmp=linphone_address_as_string(from_parsed);
|
||||
linphone_address_destroy(from_parsed);
|
||||
barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"),
|
||||
(sal_call_autoanswer_asked(call->op)) ?_(" and asked autoanswer."):_("."));
|
||||
(sal_call_autoanswer_asked(call->op)) ?_(" and asked autoanswer."):_("."));
|
||||
if (lc->vtable.show) lc->vtable.show(lc);
|
||||
if (lc->vtable.display_status)
|
||||
lc->vtable.display_status(lc,barmesg);
|
||||
lc->vtable.display_status(lc,barmesg);
|
||||
|
||||
/* play the ring if this is the only call*/
|
||||
if (ms_list_size(lc->calls)==1){
|
||||
|
|
@ -3275,7 +3275,7 @@ int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call)
|
|||
int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
|
||||
if (call->state!=LinphoneCallUpdatedByRemote){
|
||||
ms_error("linphone_core_accept_update(): invalid state %s to call this function.",
|
||||
linphone_call_state_to_string(call->state));
|
||||
linphone_call_state_to_string(call->state));
|
||||
return -1;
|
||||
}
|
||||
return _linphone_core_accept_call_update(lc, call, params);
|
||||
|
|
@ -3391,7 +3391,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
|
|||
LinphoneCall *rc=(LinphoneCall*)sal_op_get_user_pointer (replaced);
|
||||
if (rc){
|
||||
ms_message("Call %p replaces call %p. This last one is going to be terminated automatically.",
|
||||
call,rc);
|
||||
call,rc);
|
||||
linphone_core_terminate_call(lc,rc);
|
||||
}
|
||||
}
|
||||
|
|
@ -3772,7 +3772,7 @@ LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const c
|
|||
}
|
||||
|
||||
int linphone_core_send_publish(LinphoneCore *lc,
|
||||
LinphonePresenceModel *presence)
|
||||
LinphonePresenceModel *presence)
|
||||
{
|
||||
const MSList *elem;
|
||||
for (elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=ms_list_next(elem)){
|
||||
|
|
@ -4129,7 +4129,7 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap){
|
|||
if (sndcard==NULL){/*looks like a bug! take the first one !*/
|
||||
const MSList *elem=ms_snd_card_manager_get_list(ms_snd_card_manager_get());
|
||||
if (elem) sndcard=(MSSndCard*)elem->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sndcard==NULL) ms_error("Could not find a suitable soundcard !");
|
||||
return sndcard;
|
||||
|
|
@ -5040,7 +5040,7 @@ float linphone_core_get_static_picture_fps(LinphoneCore *lc) {
|
|||
if (vs && vs->source) {
|
||||
if (ms_filter_get_id(vs->source) == MS_STATIC_IMAGE_ID) {
|
||||
|
||||
float fps;
|
||||
float fps;
|
||||
|
||||
ms_filter_call_method(vs->source, MS_FILTER_GET_FPS,(void *)&fps);
|
||||
return fps;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t
|
|||
}
|
||||
|
||||
int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt){
|
||||
return payload_type_get_number(pt);
|
||||
return payload_type_get_number(pt);
|
||||
}
|
||||
|
||||
const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt){
|
||||
|
|
@ -129,7 +129,7 @@ static double get_audio_payload_bandwidth(LinphoneCore *lc, const PayloadType *p
|
|||
/*special case of aac 44K because ptime= 10ms*/
|
||||
npacket=100;
|
||||
}
|
||||
|
||||
|
||||
bitrate=get_codec_bitrate(lc,pt);
|
||||
packet_size= (((double)bitrate)/(npacket*8))+UDP_HDR_SZ+RTP_HDR_SZ+IP4_HDR_SZ;
|
||||
return packet_size*8.0*npacket;
|
||||
|
|
@ -162,7 +162,7 @@ bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, Payl
|
|||
{
|
||||
double codec_band;
|
||||
bool_t ret=FALSE;
|
||||
|
||||
|
||||
switch (pt->type){
|
||||
case PAYLOAD_AUDIO_CONTINUOUS:
|
||||
case PAYLOAD_AUDIO_PACKETIZED:
|
||||
|
|
@ -278,7 +278,7 @@ static int sendStunRequest(int sock, const struct sockaddr *server, socklen_t ad
|
|||
char buf[STUN_MAX_MESSAGE_SIZE];
|
||||
int len = STUN_MAX_MESSAGE_SIZE;
|
||||
StunAtrString username;
|
||||
StunAtrString password;
|
||||
StunAtrString password;
|
||||
StunMessage req;
|
||||
int err;
|
||||
memset(&req, 0, sizeof(StunMessage));
|
||||
|
|
@ -301,9 +301,9 @@ static int sendStunRequest(int sock, const struct sockaddr *server, socklen_t ad
|
|||
int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port){
|
||||
char tmphost[NI_MAXHOST]={0};
|
||||
char *p1, *p2;
|
||||
|
||||
|
||||
if ((sscanf(input, "[%64[^]]]:%d", tmphost, port) == 2) || (sscanf(input, "[%64[^]]]", tmphost) == 1)) {
|
||||
|
||||
|
||||
} else {
|
||||
p1 = strchr(input, ':');
|
||||
p2 = strrchr(input, ':');
|
||||
|
|
@ -324,9 +324,9 @@ int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, sock
|
|||
char host[NI_MAXHOST];
|
||||
int port_int=default_port;
|
||||
int ret;
|
||||
|
||||
|
||||
linphone_parse_host_port(server,host,sizeof(host),&port_int);
|
||||
|
||||
|
||||
snprintf(port, sizeof(port), "%d", port_int);
|
||||
memset(&hints,0,sizeof(hints));
|
||||
hints.ai_family=AF_UNSPEC;
|
||||
|
|
@ -346,7 +346,7 @@ int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, sock
|
|||
|
||||
static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id){
|
||||
char buf[STUN_MAX_MESSAGE_SIZE];
|
||||
int len = STUN_MAX_MESSAGE_SIZE;
|
||||
int len = STUN_MAX_MESSAGE_SIZE;
|
||||
StunMessage resp;
|
||||
len=recv(sock,buf,len,0);
|
||||
if (len>0){
|
||||
|
|
@ -370,7 +370,7 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
|
|||
const char *server=linphone_core_get_stun_server(lc);
|
||||
StunCandidate *ac=&call->ac;
|
||||
StunCandidate *vc=&call->vc;
|
||||
|
||||
|
||||
if (lc->sip_conf.ipv6_enabled){
|
||||
ms_warning("stun support is not implemented for ipv6");
|
||||
return -1;
|
||||
|
|
@ -389,7 +389,7 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
|
|||
struct timeval init,cur;
|
||||
double elapsed;
|
||||
int ret=0;
|
||||
|
||||
|
||||
if (ai==NULL){
|
||||
ms_error("Could not obtain stun server addrinfo.");
|
||||
return -1;
|
||||
|
|
@ -408,7 +408,7 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
|
|||
got_video=FALSE;
|
||||
ortp_gettimeofday(&init,NULL);
|
||||
do{
|
||||
|
||||
|
||||
int id;
|
||||
if (loops%20==0){
|
||||
ms_message("Sending stun requests...");
|
||||
|
|
@ -487,7 +487,7 @@ void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, Linphone
|
|||
if (ping_time_ms>0 && lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){
|
||||
ms_message("Stun server ping time is %i ms",ping_time_ms);
|
||||
threshold=lp_config_get_int(lc->config,"net","edge_ping_time",500);
|
||||
|
||||
|
||||
if (ping_time_ms>threshold){
|
||||
/* we might be in a 2G network*/
|
||||
params->low_bandwidth=TRUE;
|
||||
|
|
@ -536,7 +536,7 @@ void linphone_core_resolve_stun_server(LinphoneCore *lc){
|
|||
* - have a cache of the stun server addrinfo
|
||||
* - this cached value is returned when it is non-null
|
||||
* - an asynchronous resolution is asked each time this function is called to ensure frequent refreshes of the cached value.
|
||||
* - if no cached value exists, block for a short time; this case must be unprobable because the resolution will be asked each time the stun server value is
|
||||
* - if no cached value exists, block for a short time; this case must be unprobable because the resolution will be asked each time the stun server value is
|
||||
* changed.
|
||||
**/
|
||||
const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc){
|
||||
|
|
@ -957,7 +957,7 @@ unsigned int linphone_core_get_audio_features(LinphoneCore *lc){
|
|||
p=n;
|
||||
}
|
||||
}else ret=AUDIO_STREAM_FEATURE_ALL;
|
||||
|
||||
|
||||
if (ret==AUDIO_STREAM_FEATURE_ALL){
|
||||
/*since call recording is specified before creation of the stream in linphonecore,
|
||||
* it will be requested on demand. It is not necessary to include it all the time*/
|
||||
|
|
@ -987,7 +987,7 @@ static int get_local_ip_with_getifaddrs(int type, char *address, int size)
|
|||
#else
|
||||
#define UP_FLAG IFF_RUNNING /* resources allocated */
|
||||
#endif
|
||||
|
||||
|
||||
for (ifp = ifpstart; ifp != NULL; ifp = ifp->ifa_next) {
|
||||
if (ifp->ifa_addr && ifp->ifa_addr->sa_family == type
|
||||
&& (ifp->ifa_flags & UP_FLAG) && !(ifp->ifa_flags & IFF_LOOPBACK))
|
||||
|
|
@ -1042,8 +1042,8 @@ static int get_local_ip_for_with_connect(int type, const char *dest, char *resul
|
|||
if (err<0) {
|
||||
/*the network isn't reachable*/
|
||||
if (getSocketErrorCode()!=ENETUNREACH) ms_error("Error in connect: %s",strerror(errno));
|
||||
freeaddrinfo(res);
|
||||
close_socket(sock);
|
||||
freeaddrinfo(res);
|
||||
close_socket(sock);
|
||||
return -1;
|
||||
}
|
||||
freeaddrinfo(res);
|
||||
|
|
@ -1078,19 +1078,19 @@ static int get_local_ip_for_with_connect(int type, const char *dest, char *resul
|
|||
|
||||
int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
|
||||
int err;
|
||||
strcpy(result,type==AF_INET ? "127.0.0.1" : "::1");
|
||||
|
||||
strcpy(result,type==AF_INET ? "127.0.0.1" : "::1");
|
||||
|
||||
if (dest==NULL){
|
||||
if (type==AF_INET)
|
||||
dest="87.98.157.38"; /*a public IP address*/
|
||||
else dest="2a00:1450:8002::68";
|
||||
}
|
||||
err=get_local_ip_for_with_connect(type,dest,result);
|
||||
err=get_local_ip_for_with_connect(type,dest,result);
|
||||
if (err==0) return 0;
|
||||
|
||||
/* if the connect method failed, which happens when no default route is set,
|
||||
|
||||
/* if the connect method failed, which happens when no default route is set,
|
||||
* try to find 'the' running interface with getifaddrs*/
|
||||
|
||||
|
||||
#ifdef HAVE_GETIFADDRS
|
||||
/*we use getifaddrs for lookup of default interface */
|
||||
int found_ifs;
|
||||
|
|
@ -1103,7 +1103,7 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
|
|||
return -1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SalReason linphone_reason_to_sal(LinphoneReason reason){
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static PayloadType * find_payload_type_best_match(const MSList *l, const Payload
|
|||
/* the compare between G729 and G729A is for some stupid uncompliant phone*/
|
||||
if ( pt->mime_type && refpt->mime_type &&
|
||||
(strcasecmp(pt->mime_type,refpt->mime_type)==0 ||
|
||||
(strcasecmp(pt->mime_type, "G729") == 0 && strcasecmp(refpt->mime_type, "G729A") == 0 ))
|
||||
(strcasecmp(pt->mime_type, "G729") == 0 && strcasecmp(refpt->mime_type, "G729A") == 0 ))
|
||||
&& pt->clock_rate==refpt->clock_rate){
|
||||
candidate=pt;
|
||||
/*good candidate, check fmtp for H264 */
|
||||
|
|
@ -56,7 +56,7 @@ static PayloadType * find_payload_type_best_match(const MSList *l, const Payload
|
|||
mode2=atoi(value);
|
||||
}
|
||||
if (mode1==mode2)
|
||||
break; /*exact match */
|
||||
break; /*exact match */
|
||||
}
|
||||
}else break;
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t
|
|||
MSList *res=NULL;
|
||||
PayloadType *matched;
|
||||
bool_t found_codec=FALSE;
|
||||
|
||||
|
||||
for(e2=remote;e2!=NULL;e2=e2->next){
|
||||
PayloadType *p2=(PayloadType*)e2->data;
|
||||
matched=find_payload_type_best_match(local,p2);
|
||||
|
|
@ -85,7 +85,7 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t
|
|||
}else found_codec=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
newp=payload_type_clone(matched);
|
||||
if (p2->send_fmtp)
|
||||
payload_type_set_send_fmtp(newp,p2->send_fmtp);
|
||||
|
|
@ -95,7 +95,7 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t
|
|||
payload_type_set_number(newp,remote_number);
|
||||
if (reading_response && remote_number!=local_number){
|
||||
ms_warning("For payload type %s, proposed number was %i but the remote phone answered %i",
|
||||
newp->mime_type, local_number, remote_number);
|
||||
newp->mime_type, local_number, remote_number);
|
||||
/*
|
||||
We must add this payload type with our local numbering in order to be able to receive it.
|
||||
Indeed despite we must sent with the remote numbering, we must be able to receive with
|
||||
|
|
@ -132,28 +132,28 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t
|
|||
return res;
|
||||
}
|
||||
|
||||
static bool_t match_crypto_algo(const SalSrtpCryptoAlgo* local, const SalSrtpCryptoAlgo* remote,
|
||||
static bool_t match_crypto_algo(const SalSrtpCryptoAlgo* local, const SalSrtpCryptoAlgo* remote,
|
||||
SalSrtpCryptoAlgo* result, unsigned int* choosen_local_tag, bool_t use_local_key) {
|
||||
int i,j;
|
||||
for(i=0; i<SAL_CRYPTO_ALGO_MAX; i++) {
|
||||
if (remote[i].algo == 0)
|
||||
break;
|
||||
|
||||
/* Look for a local enabled crypto algo that matches one of the proposed by remote */
|
||||
/* Look for a local enabled crypto algo that matches one of the proposed by remote */
|
||||
for(j=0; j<SAL_CRYPTO_ALGO_MAX; j++) {
|
||||
if (remote[i].algo == local[j].algo) {
|
||||
result->algo = remote[i].algo;
|
||||
/* We're answering an SDP offer. Supply our master key, associated with the remote supplied tag */
|
||||
/* We're answering an SDP offer. Supply our master key, associated with the remote supplied tag */
|
||||
if (use_local_key) {
|
||||
strncpy(result->master_key, local[j].master_key, 41);
|
||||
result->tag = remote[i].tag;
|
||||
*choosen_local_tag = local[j].tag;
|
||||
*choosen_local_tag = local[j].tag;
|
||||
}
|
||||
/* We received an answer to our SDP crypto proposal. Copy matching algo remote master key to result, and memorize local tag */
|
||||
else {
|
||||
else {
|
||||
strncpy(result->master_key, remote[i].master_key, 41);
|
||||
result->tag = local[j].tag;
|
||||
*choosen_local_tag = local[j].tag;
|
||||
*choosen_local_tag = local[j].tag;
|
||||
}
|
||||
result->master_key[40] = '\0';
|
||||
return TRUE;
|
||||
|
|
@ -205,8 +205,8 @@ static SalStreamDir compute_dir_incoming(SalStreamDir local, SalStreamDir offere
|
|||
}
|
||||
|
||||
static void initiate_outgoing(const SalStreamDescription *local_offer,
|
||||
const SalStreamDescription *remote_answer,
|
||||
SalStreamDescription *result){
|
||||
const SalStreamDescription *remote_answer,
|
||||
SalStreamDescription *result){
|
||||
if (remote_answer->rtp_port!=0)
|
||||
result->payloads=match_payloads(local_offer->payloads,remote_answer->payloads,TRUE,FALSE);
|
||||
result->proto=remote_answer->proto;
|
||||
|
|
@ -233,8 +233,8 @@ static void initiate_outgoing(const SalStreamDescription *local_offer,
|
|||
|
||||
|
||||
static void initiate_incoming(const SalStreamDescription *local_cap,
|
||||
const SalStreamDescription *remote_offer,
|
||||
SalStreamDescription *result, bool_t one_matching_codec){
|
||||
const SalStreamDescription *remote_offer,
|
||||
SalStreamDescription *result, bool_t one_matching_codec){
|
||||
result->payloads=match_payloads(local_cap->payloads,remote_offer->payloads, FALSE, one_matching_codec);
|
||||
result->proto=remote_offer->proto;
|
||||
result->type=local_cap->type;
|
||||
|
|
@ -254,7 +254,7 @@ static void initiate_incoming(const SalStreamDescription *local_cap,
|
|||
memset(result->crypto, 0, sizeof(result->crypto));
|
||||
if (!match_crypto_algo(local_cap->crypto, remote_offer->crypto, &result->crypto[0], &result->crypto_local_tag, TRUE))
|
||||
result->rtp_port = 0;
|
||||
|
||||
|
||||
}
|
||||
strcpy(result->ice_pwd, local_cap->ice_pwd);
|
||||
strcpy(result->ice_ufrag, local_cap->ice_ufrag);
|
||||
|
|
@ -388,7 +388,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities
|
|||
strcpy(result->ice_ufrag, local_capabilities->ice_ufrag);
|
||||
result->ice_lite = local_capabilities->ice_lite;
|
||||
result->ice_completed = local_capabilities->ice_completed;
|
||||
|
||||
|
||||
strcpy(result->name,local_capabilities->name);
|
||||
|
||||
// Handle session RTCP XR attribute
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef offeranswer_h
|
||||
#define offeranswer_h
|
||||
|
||||
/**
|
||||
/**
|
||||
This header files defines the SDP offer answer API.
|
||||
It can be used by implementations of SAL directly.
|
||||
**/
|
||||
|
|
@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
**/
|
||||
int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer,
|
||||
const SalMediaDescription *remote_answer,
|
||||
SalMediaDescription *result);
|
||||
SalMediaDescription *result);
|
||||
|
||||
/**
|
||||
* Returns a media description to run the streams with, based on the local capabilities and
|
||||
|
|
@ -41,7 +41,7 @@ int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer,
|
|||
**/
|
||||
int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities,
|
||||
const SalMediaDescription *remote_offer,
|
||||
SalMediaDescription *result, bool_t one_matching_codec);
|
||||
|
||||
SalMediaDescription *result, bool_t one_matching_codec);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
/***************************************************************************
|
||||
* TODO / REMINDER LIST
|
||||
****************************************************************************/
|
||||
// to discuss
|
||||
// to discuss
|
||||
// For codecs that are able to change sample rates, the lowest and highest sample rates MUST be reported (e.g., 8000;16000).
|
||||
// moslq == moscq
|
||||
// video: what happens if doing stop/resume?
|
||||
// one time value: average? worst value?
|
||||
// rlq value: need algo to compute it
|
||||
// one time value: average? worst value?
|
||||
// rlq value: need algo to compute it
|
||||
/***************************************************************************
|
||||
* END OF TODO / REMINDER LIST
|
||||
****************************************************************************/
|
||||
|
|
@ -63,10 +63,10 @@ static void append_to_buffer_valist(char **buff, size_t *buff_size, size_t *offs
|
|||
size_t prevoffset = *offset;
|
||||
|
||||
#ifndef WIN32
|
||||
va_list cap;/*copy of our argument list: a va_list cannot be re-used (SIGSEGV on linux 64 bits)*/
|
||||
va_copy(cap,args);
|
||||
va_list cap;/*copy of our argument list: a va_list cannot be re-used (SIGSEGV on linux 64 bits)*/
|
||||
va_copy(cap,args);
|
||||
ret = belle_sip_snprintf_valist(*buff, *buff_size, offset, fmt, cap);
|
||||
va_end(cap);
|
||||
va_end(cap);
|
||||
#else
|
||||
ret = belle_sip_snprintf_valist(*buff, *buff_size, offset, fmt, args);
|
||||
#endif
|
||||
|
|
@ -225,7 +225,7 @@ static void append_metrics_to_buffer(char ** buffer, size_t * size, size_t * off
|
|||
|
||||
static void reporting_publish(const LinphoneCall* call, const reporting_session_report_t * report) {
|
||||
LinphoneContent content = {0};
|
||||
LinphoneAddress *addr;
|
||||
LinphoneAddress *addr;
|
||||
int expires = -1;
|
||||
size_t offset = 0;
|
||||
size_t size = 2048;
|
||||
|
|
@ -414,46 +414,46 @@ void linphone_reporting_call_stats_updated(LinphoneCall *call, int stats_type) {
|
|||
reporting_content_metrics_t * metrics = NULL;
|
||||
|
||||
LinphoneCallStats stats = call->stats[stats_type];
|
||||
mblk_t *block = NULL;
|
||||
mblk_t *block = NULL;
|
||||
|
||||
if (! reporting_enabled(call))
|
||||
if (! reporting_enabled(call))
|
||||
return;
|
||||
|
||||
if (stats.updated == LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE) {
|
||||
if (stats.updated == LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE) {
|
||||
metrics = &report->remote_metrics;
|
||||
if (rtcp_is_XR(stats.received_rtcp) == TRUE) {
|
||||
block = stats.received_rtcp;
|
||||
}
|
||||
} else if (stats.updated == LINPHONE_CALL_STATS_SENT_RTCP_UPDATE) {
|
||||
if (rtcp_is_XR(stats.received_rtcp) == TRUE) {
|
||||
block = stats.received_rtcp;
|
||||
}
|
||||
} else if (stats.updated == LINPHONE_CALL_STATS_SENT_RTCP_UPDATE) {
|
||||
metrics = &report->local_metrics;
|
||||
if (rtcp_is_XR(stats.sent_rtcp) == TRUE) {
|
||||
block = stats.sent_rtcp;
|
||||
}
|
||||
}
|
||||
if (block != NULL) {
|
||||
switch (rtcp_XR_get_block_type(block)) {
|
||||
case RTCP_XR_VOIP_METRICS: {
|
||||
uint8_t config;
|
||||
if (rtcp_is_XR(stats.sent_rtcp) == TRUE) {
|
||||
block = stats.sent_rtcp;
|
||||
}
|
||||
}
|
||||
if (block != NULL) {
|
||||
switch (rtcp_XR_get_block_type(block)) {
|
||||
case RTCP_XR_VOIP_METRICS: {
|
||||
uint8_t config;
|
||||
|
||||
metrics->quality_estimates.rcq = rtcp_XR_voip_metrics_get_r_factor(block);
|
||||
metrics->quality_estimates.moslq = rtcp_XR_voip_metrics_get_mos_lq(block) / 10.f;
|
||||
metrics->quality_estimates.moscq = rtcp_XR_voip_metrics_get_mos_cq(block) / 10.f;
|
||||
metrics->quality_estimates.rcq = rtcp_XR_voip_metrics_get_r_factor(block);
|
||||
metrics->quality_estimates.moslq = rtcp_XR_voip_metrics_get_mos_lq(block) / 10.f;
|
||||
metrics->quality_estimates.moscq = rtcp_XR_voip_metrics_get_mos_cq(block) / 10.f;
|
||||
|
||||
metrics->jitter_buffer.nominal = rtcp_XR_voip_metrics_get_jb_nominal(block);
|
||||
metrics->jitter_buffer.max = rtcp_XR_voip_metrics_get_jb_maximum(block);
|
||||
metrics->jitter_buffer.abs_max = rtcp_XR_voip_metrics_get_jb_abs_max(block);
|
||||
metrics->packet_loss.network_packet_loss_rate = rtcp_XR_voip_metrics_get_loss_rate(block);
|
||||
metrics->packet_loss.jitter_buffer_discard_rate = rtcp_XR_voip_metrics_get_discard_rate(block);
|
||||
metrics->jitter_buffer.nominal = rtcp_XR_voip_metrics_get_jb_nominal(block);
|
||||
metrics->jitter_buffer.max = rtcp_XR_voip_metrics_get_jb_maximum(block);
|
||||
metrics->jitter_buffer.abs_max = rtcp_XR_voip_metrics_get_jb_abs_max(block);
|
||||
metrics->packet_loss.network_packet_loss_rate = rtcp_XR_voip_metrics_get_loss_rate(block);
|
||||
metrics->packet_loss.jitter_buffer_discard_rate = rtcp_XR_voip_metrics_get_discard_rate(block);
|
||||
|
||||
config = rtcp_XR_voip_metrics_get_rx_config(block);
|
||||
metrics->session_description.packet_loss_concealment = (config >> 6) & 0x3;
|
||||
metrics->jitter_buffer.adaptive = (config >> 4) & 0x3;
|
||||
break;
|
||||
} default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
config = rtcp_XR_voip_metrics_get_rx_config(block);
|
||||
metrics->session_description.packet_loss_concealment = (config >> 6) & 0x3;
|
||||
metrics->jitter_buffer.adaptive = (config >> 4) & 0x3;
|
||||
break;
|
||||
} default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_reporting_publish(LinphoneCall* call) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ void sal_media_description_unref(SalMediaDescription *md){
|
|||
}
|
||||
|
||||
SalStreamDescription *sal_media_description_find_stream(SalMediaDescription *md,
|
||||
SalMediaProto proto, SalStreamType type){
|
||||
SalMediaProto proto, SalStreamType type){
|
||||
int i;
|
||||
for(i=0;i<md->n_active_streams;++i){
|
||||
SalStreamDescription *ss=&md->streams[i];
|
||||
|
|
@ -161,7 +161,7 @@ static bool_t payload_type_equals(const PayloadType *p1, const PayloadType *p2){
|
|||
*/
|
||||
/*
|
||||
if (!fmtp_equals(p1->recv_fmtp,p2->recv_fmtp) ||
|
||||
!fmtp_equals(p1->send_fmtp,p2->send_fmtp))
|
||||
!fmtp_equals(p1->send_fmtp,p2->send_fmtp))
|
||||
return FALSE;
|
||||
*/
|
||||
return TRUE;
|
||||
|
|
|
|||
110
coreapi/upnp.c
110
coreapi/upnp.c
|
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define UPNP_ADD_MAX_RETRY 4
|
||||
#define UPNP_REMOVE_MAX_RETRY 4
|
||||
#define UPNP_SECTION_NAME "uPnP"
|
||||
#define UPNP_CORE_READY_CHECK 1
|
||||
#define UPNP_CORE_READY_CHECK 1
|
||||
#define UPNP_CORE_RETRY_DELAY 10
|
||||
#define UPNP_CALL_RETRY_DELAY 3
|
||||
#define UPNP_UUID_LEN 128
|
||||
|
|
@ -79,7 +79,7 @@ struct _UpnpContext {
|
|||
|
||||
ms_mutex_t mutex;
|
||||
ms_cond_t empty_cond;
|
||||
|
||||
|
||||
time_t last_ready_check;
|
||||
LinphoneUpnpState last_ready_state;
|
||||
};
|
||||
|
|
@ -91,13 +91,13 @@ bool_t linphone_upnp_is_blacklisted(UpnpContext *ctx);
|
|||
|
||||
UpnpPortBinding *linphone_upnp_port_binding_new();
|
||||
UpnpPortBinding *linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_protocol protocol, int local_port, int external_port);
|
||||
UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port);
|
||||
UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port);
|
||||
UpnpPortBinding *linphone_upnp_port_binding_copy(const UpnpPortBinding *port);
|
||||
void linphone_upnp_port_binding_set_device_id(UpnpPortBinding *port, const char * device_id);
|
||||
bool_t linphone_upnp_port_binding_equal(const UpnpPortBinding *port1, const UpnpPortBinding *port2);
|
||||
UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(MSList *list, const UpnpPortBinding *port);
|
||||
UpnpPortBinding *linphone_upnp_port_binding_retain(UpnpPortBinding *port);
|
||||
void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **port_mapping, upnp_igd_ip_protocol protocol, int port, int retry_delay);
|
||||
void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **port_mapping, upnp_igd_ip_protocol protocol, int port, int retry_delay);
|
||||
void linphone_upnp_port_binding_log(int level, const char *msg, const UpnpPortBinding *port);
|
||||
void linphone_upnp_port_binding_release(UpnpPortBinding *port);
|
||||
void linphone_upnp_update_config(UpnpContext *lupnp);
|
||||
|
|
@ -108,7 +108,7 @@ MSList *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const cha
|
|||
void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port);
|
||||
void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port);
|
||||
|
||||
// uPnP
|
||||
// uPnP
|
||||
int linphone_upnp_context_send_remove_port_binding(UpnpContext *lupnp, UpnpPortBinding *port, bool_t retry);
|
||||
int linphone_upnp_context_send_add_port_binding(UpnpContext *lupnp, UpnpPortBinding *port, bool_t retry);
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ char * linphone_upnp_format_device_id(const char *device_id) {
|
|||
char *ret = NULL;
|
||||
char *tmp;
|
||||
char tchar;
|
||||
bool_t copy;
|
||||
bool_t copy;
|
||||
if(device_id == NULL) {
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -366,7 +366,7 @@ void linphone_upnp_context_destroy(UpnpContext *lupnp) {
|
|||
linphone_core_remove_iterate_hook(lupnp->lc, linphone_core_upnp_hook, lupnp);
|
||||
|
||||
ms_mutex_lock(&lupnp->mutex);
|
||||
|
||||
|
||||
if(lupnp->lc->network_reachable) {
|
||||
/* Send port binding removes */
|
||||
if(lupnp->sip_udp != NULL) {
|
||||
|
|
@ -391,7 +391,7 @@ void linphone_upnp_context_destroy(UpnpContext *lupnp) {
|
|||
upnp_igd_destroy(lupnp->upnp_igd_ctxt);
|
||||
lupnp->upnp_igd_ctxt = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* No more multi threading here */
|
||||
|
||||
/* Run one more time configuration update and proxy */
|
||||
|
|
@ -419,7 +419,7 @@ void linphone_upnp_context_destroy(UpnpContext *lupnp) {
|
|||
lupnp->removing_configs = ms_list_free(lupnp->removing_configs);
|
||||
ms_list_for_each(lupnp->pending_bindings,(void (*)(void*))linphone_upnp_port_binding_release);
|
||||
lupnp->pending_bindings = ms_list_free(lupnp->pending_bindings);
|
||||
|
||||
|
||||
ms_mutex_destroy(&lupnp->mutex);
|
||||
ms_cond_destroy(&lupnp->empty_cond);
|
||||
|
||||
|
|
@ -439,17 +439,17 @@ LinphoneUpnpState linphone_upnp_context_get_state(UpnpContext *lupnp) {
|
|||
|
||||
bool_t _linphone_upnp_context_is_ready_for_register(UpnpContext *lupnp) {
|
||||
bool_t ready = TRUE;
|
||||
|
||||
|
||||
// 1 Check global uPnP state
|
||||
ready = (lupnp->state == LinphoneUpnpStateOk);
|
||||
|
||||
|
||||
// 2 Check external ip address
|
||||
if(ready) {
|
||||
if (upnp_igd_get_external_ipaddress(lupnp->upnp_igd_ctxt) == NULL) {
|
||||
ready = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 3 Check sip ports bindings
|
||||
if(ready) {
|
||||
if(lupnp->sip_udp != NULL) {
|
||||
|
|
@ -468,7 +468,7 @@ bool_t _linphone_upnp_context_is_ready_for_register(UpnpContext *lupnp) {
|
|||
ready = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ready;
|
||||
}
|
||||
|
||||
|
|
@ -486,7 +486,7 @@ int linphone_upnp_context_get_external_port(UpnpContext *lupnp) {
|
|||
int port = -1;
|
||||
if(lupnp != NULL) {
|
||||
ms_mutex_lock(&lupnp->mutex);
|
||||
|
||||
|
||||
if(lupnp->sip_udp != NULL) {
|
||||
if(lupnp->sip_udp->state == LinphoneUpnpStateOk) {
|
||||
port = lupnp->sip_udp->external_port;
|
||||
|
|
@ -500,7 +500,7 @@ int linphone_upnp_context_get_external_port(UpnpContext *lupnp) {
|
|||
port = lupnp->sip_tls->external_port;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ms_mutex_unlock(&lupnp->mutex);
|
||||
}
|
||||
return port;
|
||||
|
|
@ -508,7 +508,7 @@ int linphone_upnp_context_get_external_port(UpnpContext *lupnp) {
|
|||
|
||||
bool_t linphone_upnp_is_blacklisted(UpnpContext *lupnp) {
|
||||
const char * device_model_name = upnp_igd_get_device_model_name(lupnp->upnp_igd_ctxt);
|
||||
const char * device_model_number = upnp_igd_get_device_model_number(lupnp->upnp_igd_ctxt);
|
||||
const char * device_model_number = upnp_igd_get_device_model_number(lupnp->upnp_igd_ctxt);
|
||||
const char * blacklist = lp_config_get_string(lupnp->lc->config, "net", "upnp_blacklist", NULL);
|
||||
bool_t blacklisted = FALSE;
|
||||
char *str;
|
||||
|
|
@ -521,7 +521,7 @@ bool_t linphone_upnp_is_blacklisted(UpnpContext *lupnp) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// Find in the list
|
||||
// Find in the list
|
||||
str = strdup(blacklist);
|
||||
pch = strtok(str, ";");
|
||||
while (pch != NULL && !blacklisted) {
|
||||
|
|
@ -537,7 +537,7 @@ bool_t linphone_upnp_is_blacklisted(UpnpContext *lupnp) {
|
|||
if(model_number == NULL || strcmp(model_number, device_model_number) == 0) {
|
||||
blacklisted = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
pch = strtok(NULL, ";");
|
||||
}
|
||||
free(str);
|
||||
|
|
@ -563,7 +563,7 @@ int linphone_upnp_context_send_add_port_binding(UpnpContext *lupnp, UpnpPortBind
|
|||
upnp_igd_port_mapping mapping;
|
||||
char description[128];
|
||||
int ret;
|
||||
|
||||
|
||||
if(lupnp->state != LinphoneUpnpStateOk) {
|
||||
return -2;
|
||||
}
|
||||
|
|
@ -587,7 +587,7 @@ int linphone_upnp_context_send_add_port_binding(UpnpContext *lupnp, UpnpPortBind
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No retry if specified
|
||||
if(port->retry != 0 && !retry) {
|
||||
return -1;
|
||||
|
|
@ -626,7 +626,7 @@ int linphone_upnp_context_send_add_port_binding(UpnpContext *lupnp, UpnpPortBind
|
|||
int linphone_upnp_context_send_remove_port_binding(UpnpContext *lupnp, UpnpPortBinding *port, bool_t retry) {
|
||||
upnp_igd_port_mapping mapping;
|
||||
int ret;
|
||||
|
||||
|
||||
if(lupnp->state != LinphoneUpnpStateOk) {
|
||||
return -2;
|
||||
}
|
||||
|
|
@ -649,7 +649,7 @@ int linphone_upnp_context_send_remove_port_binding(UpnpContext *lupnp, UpnpPortB
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No retry if specified
|
||||
if(port->retry != 0 && !retry) {
|
||||
return 1;
|
||||
|
|
@ -697,19 +697,19 @@ int linphone_core_update_upnp_audio_video(LinphoneCall *call, bool_t audio, bool
|
|||
/*
|
||||
* Audio part
|
||||
*/
|
||||
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->audio->rtp,
|
||||
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->audio->rtp,
|
||||
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->media_ports[0].rtp_port:0, UPNP_CALL_RETRY_DELAY);
|
||||
|
||||
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->audio->rtcp,
|
||||
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->audio->rtcp,
|
||||
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->media_ports[0].rtcp_port:0, UPNP_CALL_RETRY_DELAY);
|
||||
|
||||
|
||||
/*
|
||||
* Video part
|
||||
*/
|
||||
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->video->rtp,
|
||||
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->video->rtp,
|
||||
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->media_ports[1].rtp_port:0, UPNP_CALL_RETRY_DELAY);
|
||||
|
||||
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->video->rtcp,
|
||||
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->video->rtcp,
|
||||
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->media_ports[1].rtcp_port:0, UPNP_CALL_RETRY_DELAY);
|
||||
}
|
||||
|
||||
|
|
@ -756,16 +756,16 @@ void linphone_upnp_update_stream_state(UpnpStream *stream) {
|
|||
if((stream->rtp == NULL || stream->rtp->state == LinphoneUpnpStateOk || stream->rtp->state == LinphoneUpnpStateIdle) &&
|
||||
(stream->rtcp == NULL || stream->rtcp->state == LinphoneUpnpStateOk || stream->rtcp->state == LinphoneUpnpStateIdle)) {
|
||||
stream->state = LinphoneUpnpStateOk;
|
||||
} else if((stream->rtp != NULL &&
|
||||
(stream->rtp->state == LinphoneUpnpStateAdding || stream->rtp->state == LinphoneUpnpStateRemoving)) ||
|
||||
(stream->rtcp != NULL &&
|
||||
(stream->rtcp->state == LinphoneUpnpStateAdding || stream->rtcp->state == LinphoneUpnpStateRemoving))) {
|
||||
} else if((stream->rtp != NULL &&
|
||||
(stream->rtp->state == LinphoneUpnpStateAdding || stream->rtp->state == LinphoneUpnpStateRemoving)) ||
|
||||
(stream->rtcp != NULL &&
|
||||
(stream->rtcp->state == LinphoneUpnpStateAdding || stream->rtcp->state == LinphoneUpnpStateRemoving))) {
|
||||
stream->state = LinphoneUpnpStatePending;
|
||||
} else if((stream->rtp != NULL && stream->rtp->state == LinphoneUpnpStateKo) ||
|
||||
(stream->rtcp != NULL && stream->rtcp->state == LinphoneUpnpStateKo)) {
|
||||
stream->state = LinphoneUpnpStateKo;
|
||||
} else {
|
||||
ms_error("Invalid stream %p state", stream);
|
||||
ms_error("Invalid stream %p state", stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -799,7 +799,7 @@ int linphone_upnp_call_process(LinphoneCall *call) {
|
|||
* Update stat
|
||||
*/
|
||||
linphone_core_update_upnp_state_in_call_stats(call);
|
||||
|
||||
|
||||
/*
|
||||
* Update session state
|
||||
*/
|
||||
|
|
@ -820,7 +820,7 @@ int linphone_upnp_call_process(LinphoneCall *call) {
|
|||
}
|
||||
|
||||
ms_mutex_unlock(&lupnp->mutex);
|
||||
|
||||
|
||||
/* When change is done proceed update */
|
||||
if(oldState != LinphoneUpnpStateOk && oldState != LinphoneUpnpStateKo &&
|
||||
(newState == LinphoneUpnpStateOk || newState == LinphoneUpnpStateKo)) {
|
||||
|
|
@ -865,9 +865,9 @@ void linphone_upnp_update(UpnpContext *lupnp) {
|
|||
UpnpPortBinding *port_mapping, *port_mapping2;
|
||||
|
||||
ms_message("uPnP IGD: Name:%s", linphone_core_upnp_get_charptr_null(upnp_igd_get_device_name(lupnp->upnp_igd_ctxt)));
|
||||
ms_message("uPnP IGD: Device:%s %s",
|
||||
linphone_core_upnp_get_charptr_null(upnp_igd_get_device_model_name(lupnp->upnp_igd_ctxt)),
|
||||
linphone_core_upnp_get_charptr_null(upnp_igd_get_device_model_number(lupnp->upnp_igd_ctxt)));
|
||||
ms_message("uPnP IGD: Device:%s %s",
|
||||
linphone_core_upnp_get_charptr_null(upnp_igd_get_device_model_name(lupnp->upnp_igd_ctxt)),
|
||||
linphone_core_upnp_get_charptr_null(upnp_igd_get_device_model_number(lupnp->upnp_igd_ctxt)));
|
||||
ms_message("uPnP IGD: Refresh mappings");
|
||||
|
||||
if(lupnp->sip_udp != NULL) {
|
||||
|
|
@ -939,7 +939,7 @@ void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **por
|
|||
if(*port_mapping == NULL) {
|
||||
*port_mapping = linphone_upnp_port_binding_new_or_collect(lupnp->pending_bindings, protocol, port, port);
|
||||
}
|
||||
|
||||
|
||||
// Get addresses
|
||||
local_addr = upnp_igd_get_local_ipaddress(lupnp->upnp_igd_ctxt);
|
||||
external_addr = upnp_igd_get_external_ipaddress(lupnp->upnp_igd_ctxt);
|
||||
|
|
@ -972,7 +972,7 @@ void linphone_upnp_update_config(UpnpContext* lupnp) {
|
|||
char key[64];
|
||||
const MSList *item;
|
||||
UpnpPortBinding *port_mapping;
|
||||
|
||||
|
||||
/* Add configs */
|
||||
for(item = lupnp->adding_configs;item!=NULL;item=item->next) {
|
||||
port_mapping = (UpnpPortBinding *)item->data;
|
||||
|
|
@ -1006,7 +1006,7 @@ void linphone_upnp_update_proxy(UpnpContext* lupnp, bool_t force) {
|
|||
LinphoneUpnpState ready_state;
|
||||
const MSList *item;
|
||||
time_t now = (force)? (lupnp->last_ready_check + UPNP_CORE_READY_CHECK) : time(NULL);
|
||||
|
||||
|
||||
/* Refresh registers if we are ready */
|
||||
if(now - lupnp->last_ready_check >= UPNP_CORE_READY_CHECK) {
|
||||
lupnp->last_ready_check = now;
|
||||
|
|
@ -1046,7 +1046,7 @@ bool_t linphone_core_upnp_hook(void *data) {
|
|||
linphone_upnp_update_port_binding(lupnp, &lupnp->sip_tls, UPNP_IGD_IP_PROTOCOL_TCP, transport.tls_port, UPNP_CORE_RETRY_DELAY);
|
||||
}
|
||||
|
||||
linphone_upnp_update_proxy(lupnp, FALSE);
|
||||
linphone_upnp_update_proxy(lupnp, FALSE);
|
||||
linphone_upnp_update_config(lupnp);
|
||||
|
||||
ms_mutex_unlock(&lupnp->mutex);
|
||||
|
|
@ -1090,7 +1090,7 @@ UpnpPortBinding *linphone_upnp_port_binding_new() {
|
|||
port = ms_new0(UpnpPortBinding,1);
|
||||
ms_mutex_init(&port->mutex, NULL);
|
||||
port->state = LinphoneUpnpStateIdle;
|
||||
port->protocol = UPNP_IGD_IP_PROTOCOL_UDP;
|
||||
port->protocol = UPNP_IGD_IP_PROTOCOL_UDP;
|
||||
port->device_id = NULL;
|
||||
port->local_addr[0] = '\0';
|
||||
port->local_port = -1;
|
||||
|
|
@ -1114,20 +1114,20 @@ UpnpPortBinding *linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_prot
|
|||
UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port) {
|
||||
UpnpPortBinding *tmp_binding;
|
||||
UpnpPortBinding *end_binding;
|
||||
|
||||
|
||||
// Seek an binding with same protocol and local port
|
||||
end_binding = linphone_upnp_port_binding_new_with_parameters(protocol, local_port, -1);
|
||||
tmp_binding = linphone_upnp_port_binding_equivalent_in_list(list, end_binding);
|
||||
|
||||
// Must be not attached to any struct
|
||||
|
||||
// Must be not attached to any struct
|
||||
if(tmp_binding != NULL && tmp_binding->ref == 1) {
|
||||
linphone_upnp_port_binding_release(end_binding);
|
||||
end_binding = linphone_upnp_port_binding_retain(tmp_binding);
|
||||
} else {
|
||||
end_binding->external_port = external_port;
|
||||
}
|
||||
return end_binding;
|
||||
}
|
||||
return end_binding;
|
||||
}
|
||||
|
||||
UpnpPortBinding *linphone_upnp_port_binding_copy(const UpnpPortBinding *port) {
|
||||
UpnpPortBinding *new_port = NULL;
|
||||
|
|
@ -1174,8 +1174,8 @@ void linphone_upnp_port_binding_log(int level, const char *msg, const UpnpPortBi
|
|||
// Return true if the binding are equivalent. (Note external_port == -1 means "don't care")
|
||||
bool_t linphone_upnp_port_binding_equal(const UpnpPortBinding *port1, const UpnpPortBinding *port2) {
|
||||
return port1->protocol == port2->protocol &&
|
||||
port1->local_port == port2->local_port &&
|
||||
(port1->external_port == -1 || port2->external_port == -1 || port1->external_port == port2->external_port);
|
||||
port1->local_port == port2->local_port &&
|
||||
(port1->external_port == -1 || port2->external_port == -1 || port1->external_port == port2->external_port);
|
||||
}
|
||||
|
||||
UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(MSList *list, const UpnpPortBinding *port) {
|
||||
|
|
@ -1220,7 +1220,7 @@ void linphone_upnp_port_binding_release(UpnpPortBinding *port) {
|
|||
UpnpStream* linphone_upnp_stream_new() {
|
||||
UpnpStream *stream = ms_new0(UpnpStream,1);
|
||||
stream->state = LinphoneUpnpStateIdle;
|
||||
stream->rtp = NULL;
|
||||
stream->rtp = NULL;
|
||||
stream->rtcp = NULL;
|
||||
return stream;
|
||||
}
|
||||
|
|
@ -1269,10 +1269,10 @@ void linphone_upnp_session_destroy(UpnpSession *session) {
|
|||
linphone_upnp_context_send_remove_port_binding(lc->upnp, session->video->rtcp, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
session->call->stats[LINPHONE_CALL_STATS_AUDIO].upnp_state = LinphoneUpnpStateKo;
|
||||
session->call->stats[LINPHONE_CALL_STATS_VIDEO].upnp_state = LinphoneUpnpStateKo;
|
||||
|
||||
|
||||
linphone_upnp_stream_destroy(session->audio);
|
||||
linphone_upnp_stream_destroy(session->video);
|
||||
ms_free(session);
|
||||
|
|
@ -1302,12 +1302,12 @@ static void linphone_upnp_config_list_port_bindings_cb(const char *entry, struct
|
|||
int ret;
|
||||
bool_t valid = TRUE;
|
||||
UpnpPortBinding *port;
|
||||
|
||||
|
||||
ret = sscanf(entry, "%"UPNP_UUID_LEN_STR"[^-]-%3s-%i-%i", device_id, protocol_str, &external_port, &local_port);
|
||||
if(ret == 4) {
|
||||
// Handle only wanted device bindings
|
||||
if(device_id != NULL && strcmp(cookie->device_id, device_id) != 0) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if(linphone_upnp_strncmpi(protocol_str, "TCP", 3) == 0) {
|
||||
protocol = UPNP_IGD_IP_PROTOCOL_TCP;
|
||||
|
|
@ -1344,7 +1344,7 @@ MSList *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const cha
|
|||
void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port) {
|
||||
MSList *list;
|
||||
UpnpPortBinding *list_port;
|
||||
|
||||
|
||||
if(port->device_id == NULL) {
|
||||
ms_error("Can't remove port binding without device_id");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ struct _xml2lpc_context {
|
|||
LpConfig *lpc;
|
||||
xml2lpc_function cbf;
|
||||
void *ctx;
|
||||
|
||||
|
||||
xmlDoc *doc;
|
||||
xmlDoc *xsd;
|
||||
char errorBuffer[XML2LPC_BZ];
|
||||
|
|
@ -43,7 +43,7 @@ xml2lpc_context* xml2lpc_context_new(xml2lpc_function cbf, void *ctx) {
|
|||
xmlCtx->lpc = NULL;
|
||||
xmlCtx->cbf = cbf;
|
||||
xmlCtx->ctx = ctx;
|
||||
|
||||
|
||||
xmlCtx->doc = NULL;
|
||||
xmlCtx->xsd = NULL;
|
||||
xmlCtx->errorBuffer[0]='\0';
|
||||
|
|
@ -70,19 +70,19 @@ static void xml2lpc_context_clear_logs(xml2lpc_context *ctx) {
|
|||
}
|
||||
|
||||
static void xml2lpc_log(xml2lpc_context *xmlCtx, int level, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
if(xmlCtx->cbf != NULL) {
|
||||
xmlCtx->cbf((xmlCtx)->ctx, level, fmt, args);
|
||||
}
|
||||
va_end(args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) {
|
||||
xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx;
|
||||
int sl = strlen(xmlCtx->errorBuffer);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(xmlCtx->errorBuffer + sl, XML2LPC_BZ-sl, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
|
@ -90,25 +90,25 @@ static void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) {
|
|||
static void xml2lpc_genericxml_warning(void *ctx, const char *fmt, ...) {
|
||||
xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx;
|
||||
int sl = strlen(xmlCtx->warningBuffer);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(xmlCtx->warningBuffer + sl, XML2LPC_BZ-sl, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void dumpNodes(int level, xmlNode * a_node, xml2lpc_context *ctx) {
|
||||
xmlNode *cur_node = NULL;
|
||||
xmlNode *cur_node = NULL;
|
||||
|
||||
for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
|
||||
if (cur_node->type == XML_ELEMENT_NODE) {
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "node level: %d type: Element, name: %s", level, cur_node->name);
|
||||
} else {
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "node level: %d type: %d, name: %s", level, cur_node->type, cur_node->name);
|
||||
}
|
||||
for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
|
||||
if (cur_node->type == XML_ELEMENT_NODE) {
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "node level: %d type: Element, name: %s", level, cur_node->name);
|
||||
} else {
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "node level: %d type: %d, name: %s", level, cur_node->type, cur_node->name);
|
||||
}
|
||||
|
||||
dumpNodes(level + 1, cur_node->children, ctx);
|
||||
}
|
||||
dumpNodes(level + 1, cur_node->children, ctx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ static int processEntry(xmlElement *element, const char *sectionName, xml2lpc_co
|
|||
} else {
|
||||
xml2lpc_log(ctx, XML2LPC_WARNING, "ignored entry with no \"name\" attribute line:%d",xmlGetLineNo((xmlNode*)element));
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int processSection(xmlElement *element, xml2lpc_context *ctx) {
|
||||
|
|
@ -185,13 +185,13 @@ static int processSection(xmlElement *element, xml2lpc_context *ctx) {
|
|||
processEntry((xmlElement*)cur_node, name, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
xml2lpc_log(ctx, XML2LPC_WARNING, "ignored section with no \"name\" attribute, line:%d", xmlGetLineNo((xmlNode*)element));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
xml2lpc_log(ctx, XML2LPC_WARNING, "ignored section with no \"name\" attribute, line:%d", xmlGetLineNo((xmlNode*)element));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int processConfig(xmlElement *element, xml2lpc_context *ctx) {
|
||||
|
|
@ -199,19 +199,19 @@ static int processConfig(xmlElement *element, xml2lpc_context *ctx) {
|
|||
|
||||
for (cur_node = element->children; cur_node; cur_node = cur_node->next) {
|
||||
dumpNode(cur_node, ctx);
|
||||
if (cur_node->type == XML_ELEMENT_NODE &&
|
||||
if (cur_node->type == XML_ELEMENT_NODE &&
|
||||
strcmp((const char*)cur_node->name, "section") == 0 ) {
|
||||
processSection((xmlElement*)cur_node, ctx);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int processDoc(xmlNode *node, xml2lpc_context *ctx) {
|
||||
dumpNode(node, ctx);
|
||||
|
||||
if (node->type == XML_ELEMENT_NODE &&
|
||||
|
||||
if (node->type == XML_ELEMENT_NODE &&
|
||||
strcmp((const char*)node->name, "config") == 0 ) {
|
||||
processConfig((xmlElement*)node, ctx);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue