From 6fb2dad334850b2a616bb2500b4df2797f6ed54f Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 19 May 2017 14:16:40 +0200 Subject: [PATCH] tm: updated old style log macros --- src/modules/tm/t_suspend.c | 20 ++++++++---------- src/modules/tm/tm_load.c | 18 ++++++++-------- src/modules/tm/tm_load.h | 16 +++++++-------- src/modules/tm/ut.h | 42 +++++++++++++++----------------------- 4 files changed, 41 insertions(+), 55 deletions(-) diff --git a/src/modules/tm/t_suspend.c b/src/modules/tm/t_suspend.c index f612efcbe30..ac532252224 100644 --- a/src/modules/tm/t_suspend.c +++ b/src/modules/tm/t_suspend.c @@ -119,8 +119,7 @@ int t_suspend(struct sip_msg *msg, /* this is a reply suspend find which branch */ if (t_check( msg , &branch )==-1){ - LOG(L_ERR, "ERROR: t_suspend_reply: " \ - "failed find UAC branch\n"); + LM_ERR("failed find UAC branch\n"); return -1; } LM_DBG("found a a match with branch id [%d] - " @@ -130,7 +129,7 @@ int t_suspend(struct sip_msg *msg, t->uac[branch].reply = sip_msg_cloner( msg, &sip_msg_len ); if (! t->uac[branch].reply ) { - LOG(L_ERR, "can't alloc' clone memory\n"); + LM_ERR("can't alloc' clone memory\n"); return -1; } t->uac[branch].end_reply = ((char*)t->uac[branch].reply) + sip_msg_len; @@ -339,7 +338,7 @@ int t_continue(unsigned int hash_index, unsigned int label, if (exec_pre_script_cb(t->uac[branch].reply, cb_type)>0) { if (run_top_route(route, t->uac[branch].reply, 0)<0){ - LOG(L_ERR, "ERROR: t_continue_reply: Error in run_top_route\n"); + LM_ERR("Error in run_top_route\n"); } exec_post_script_cb(t->uac[branch].reply, cb_type); } @@ -432,7 +431,7 @@ int t_continue(unsigned int hash_index, unsigned int label, tm_ctx_set_branch_index(T_BR_UNDEFINED); /* unref the transaction */ t_unref(t->uac[branch].reply); - LOG(L_DBG,"DEBUG: t_continue_reply: Freeing earlier cloned reply\n"); + LM_DBG("Freeing earlier cloned reply\n"); /* free lumps that were added during reply processing */ del_nonshm_lump( &(t->uac[branch].reply->add_rm) ); @@ -481,8 +480,7 @@ int t_continue(unsigned int hash_index, unsigned int label, if ((kill_transaction_unsafe(t, tm_error ? tm_error : E_UNSPEC)) <=0 ) { - LOG(L_ERR, "ERROR: t_continue: " - "reply generation failed\n"); + LM_ERR("reply generation failed\n"); /* The transaction must be explicitely released, * no more timer is running */ UNLOCK_ASYNC_CONTINUE(t); @@ -518,16 +516,14 @@ int t_cancel_suspend(unsigned int hash_index, unsigned int label) t = get_t(); if (!t || t == T_UNDEFINED) { - LOG(L_ERR, "ERROR: t_revoke_suspend: " \ - "no active transaction\n"); + LM_ERR("no active transaction\n"); return -1; } /* Only to double-check the IDs */ if ((t->hash_index != hash_index) || (t->label != label) ) { - LOG(L_ERR, "ERROR: t_revoke_suspend: " \ - "transaction id mismatch\n"); + LM_ERR("transaction id mismatch\n"); return -1; } @@ -563,7 +559,7 @@ int t_cancel_suspend(unsigned int hash_index, unsigned int label) }else{ branch = t->async_backup.backup_branch; - LOG(L_DBG,"DEBUG: t_cancel_suspend_reply: This is a cancel suspend for a response\n"); + LM_DBG("This is a cancel suspend for a response\n"); t->uac[branch].reply->msg_flags &= ~FL_RPL_SUSPENDED; if (t->uas.request) t->uas.request->msg_flags&= ~FL_RPL_SUSPENDED; diff --git a/src/modules/tm/tm_load.c b/src/modules/tm/tm_load.c index 5100271adf6..fea48378252 100644 --- a/src/modules/tm/tm_load.c +++ b/src/modules/tm/tm_load.c @@ -13,8 +13,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -32,7 +32,7 @@ int tm_init = 0; int load_tm( struct tm_binds *tmb) { if (!tm_init) { - LOG(L_ERR, "tm:load_tm: Module not initialized yet," + LM_ERR(" Module not initialized yet," " make sure that all modules that need" " tm module are loaded after tm in the configuration file\n"); return -1; @@ -42,29 +42,29 @@ int load_tm( struct tm_binds *tmb) /* exported to cfg */ if (!( tmb->t_newtran=(tnewtran_f)find_export("t_newtran", 0, 0)) ) { - LOG(L_ERR, LOAD_ERROR "'t_newtran' not found\n"); + LM_ERR(LOAD_ERROR "'t_newtran' not found\n"); return -1; } #ifdef USE_TCP if (!( tmb->t_relay_to_tcp=find_export("t_relay_to_tcp", 2, 0)) ) { - LOG(L_ERR, LOAD_ERROR "'t_relay_to_tcp' not found\n"); + LM_ERR(LOAD_ERROR "'t_relay_to_tcp' not found\n"); return -1; } #endif if (!( tmb->t_relay_to_udp=find_export("t_relay_to_udp", 2, 0)) ) { - LOG(L_ERR, LOAD_ERROR "'t_relay_to_udp' not found\n"); + LM_ERR(LOAD_ERROR "'t_relay_to_udp' not found\n"); return -1; } if (!( tmb->t_relay=find_export("t_relay", 0, 0)) ) { - LOG(L_ERR, LOAD_ERROR "'t_relay' not found\n"); + LM_ERR(LOAD_ERROR "'t_relay' not found\n"); return -1; } if (!(tmb->t_forward_nonack=(tfwd_f)find_export("t_forward_nonack",2,0))) { - LOG( L_ERR, LOAD_ERROR "'t_forward_nonack' not found\n"); + LM_ERR(LOAD_ERROR "'t_forward_nonack' not found\n"); return -1; } if (!(tmb->t_release=(trelease_f)find_export("t_release",0,0))) { - LOG( L_ERR, LOAD_ERROR "'t_release' not found\n"); + LM_ERR(LOAD_ERROR "'t_release' not found\n"); return -1; } /* if (!(tmb->t_reply=(treply_f)find_export(T_REPLY, 2, 0)) ) { diff --git a/src/modules/tm/tm_load.h b/src/modules/tm/tm_load.h index 39e0d1376ed..9fd36e94861 100644 --- a/src/modules/tm/tm_load.h +++ b/src/modules/tm/tm_load.h @@ -13,8 +13,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @@ -47,7 +47,7 @@ struct tm_binds { register_tmcb_f register_tmcb; cmd_function t_relay_to_udp; /* WARNING: failure_route unsafe */ - cmd_function t_relay_to_tcp; /* WARNING: failure_route unsafe */ + cmd_function t_relay_to_tcp; /* WARNING: failure_route unsafe */ cmd_function t_relay; /* WARNING: failure_route unsafe */ treplicate_uri_f t_replicate; /* WARNING: failure_route unsafe */ tnewtran_f t_newtran; @@ -143,12 +143,12 @@ static inline int load_tm_api(struct tm_binds* tmb) /* import the TM auto-loading function */ load_tm = (load_tm_f)find_export("load_tm", NO_SCRIPT, 0); - + if (load_tm == NULL) { - LOG(L_WARN, "Cannot import load_tm function from tm module\n"); + LM_WARN("Cannot import load_tm function from tm module\n"); return -1; } - + /* let the auto-loading function load all TM stuff */ if (load_tm(tmb) == -1) { return -1; @@ -191,13 +191,13 @@ static inline int tm_load_xapi(tm_xapi_t *xtmb) load_xtm = (load_xtm_f)find_export("load_xtm", NO_SCRIPT, 0); if (load_xtm == NULL) { - LOG(L_WARN, "Cannot import load_xtm function from tm module\n"); + LM_WARN("Cannot import load_xtm function from tm module\n"); return -1; } /* let the auto-loading function load all extra TM stuff */ if (load_xtm(xtmb) < 0) { - LOG(L_WARN, "Cannot bind xapi from tm module\n"); + LM_WARN("Cannot bind xapi from tm module\n"); return -1; } return 0; diff --git a/src/modules/tm/ut.h b/src/modules/tm/ut.h index 3f487d8330f..41e69c407f2 100644 --- a/src/modules/tm/ut.h +++ b/src/modules/tm/ut.h @@ -76,8 +76,7 @@ inline static enum sip_protos get_proto(enum sip_protos force_proto, return proto; case PROTO_WSS: /* should never see ;transport=wss */ default: - LOG(L_ERR, "ERROR: get_proto: unsupported transport:" - " %d\n", proto ); + LM_ERR("unsupported transport: %d\n", proto); return PROTO_NONE; } case PROTO_UDP: /* some protocol has been forced -- take it */ @@ -94,8 +93,7 @@ inline static enum sip_protos get_proto(enum sip_protos force_proto, #endif return force_proto; default: - LOG(L_ERR, "ERROR: get_proto: unsupported forced protocol: " - "%d\n", force_proto); + LM_ERR("unsupported forced protocol: %d\n", force_proto); return PROTO_NONE; } } @@ -112,15 +110,13 @@ inline static struct proxy_l *uri2proxy( str *uri, int proto ) enum sip_protos uri_proto; if (parse_uri(uri->s, uri->len, &parsed_uri) < 0) { - LOG(L_ERR, "ERROR: uri2proxy: bad_uri: [%.*s]\n", - uri->len, uri->s ); + LM_ERR("bad_uri: [%.*s]\n", uri->len, uri->s ); return 0; } if (parsed_uri.type==SIPS_URI_T){ if (parsed_uri.proto==PROTO_UDP) { - LOG(L_ERR, "ERROR: uri2proxy: bad transport for sips uri: %d\n", - parsed_uri.proto); + LM_ERR("bad transport for sips uri: %d\n", parsed_uri.proto); return 0; }else if (parsed_uri.proto != PROTO_WS) uri_proto=PROTO_TLS; @@ -134,8 +130,7 @@ inline static struct proxy_l *uri2proxy( str *uri, int proto ) parsed_uri.port_no, get_proto(proto, uri_proto)); if (p == 0) { - LOG(L_ERR, "ERROR: uri2proxy: bad maddr param in URI <%.*s>\n", - uri->len, ZSW(uri->s)); + LM_ERR("bad maddr param in URI <%.*s>\n", uri->len, ZSW(uri->s)); return 0; } } else @@ -144,8 +139,7 @@ inline static struct proxy_l *uri2proxy( str *uri, int proto ) parsed_uri.port_no, get_proto(proto, uri_proto)); if (p == 0) { - LOG(L_ERR, "ERROR: uri2proxy: bad host name in URI <%.*s>\n", - uri->len, ZSW(uri->s)); + LM_ERR("bad host name in URI <%.*s>\n", uri->len, ZSW(uri->s)); return 0; } @@ -172,15 +166,13 @@ inline static int get_uri_send_info(str* uri, str* host, unsigned short* port, enum sip_protos uri_proto; if (parse_uri(uri->s, uri->len, &parsed_uri) < 0) { - LOG(L_ERR, "ERROR: get_uri_send_info: bad_uri: %.*s\n", - uri->len, uri->s ); + LM_ERR("bad_uri: %.*s\n", uri->len, uri->s ); return -1; } if (parsed_uri.type==SIPS_URI_T){ if (parsed_uri.proto==PROTO_UDP) { - LOG(L_ERR, "ERROR: get_uri_send_info: bad transport for" - " sips uri: %d\n", parsed_uri.proto); + LM_ERR("bad transport for sips uri: %d\n", parsed_uri.proto); return -1; }else if (parsed_uri.proto != PROTO_WS) uri_proto=PROTO_TLS; @@ -196,7 +188,7 @@ inline static int get_uri_send_info(str* uri, str* host, unsigned short* port, #ifdef HONOR_MADDR if (parsed_uri.maddr_val.s && parsed_uri.maddr_val.len) { *host=parsed_uri.maddr_val; - DBG("maddr dst: %.*s:%d\n", parsed_uri.maddr_val.len, + LM_DBG("maddr dst: %.*s:%d\n", parsed_uri.maddr_val.len, parsed_uri.maddr_val.s, parsed_uri.port_no); } else #endif @@ -250,15 +242,13 @@ inline static struct dest_info *uri2dst2(struct dest_info* dst, #endif if (parse_uri(uri->s, uri->len, &parsed_uri) < 0) { - LOG(L_ERR, "ERROR: uri2dst: bad_uri: [%.*s]\n", - uri->len, uri->s ); + LM_ERR("bad_uri: [%.*s]\n", uri->len, uri->s ); return 0; } if (parsed_uri.type==SIPS_URI_T){ if (parsed_uri.proto==PROTO_UDP) { - LOG(L_ERR, "ERROR: uri2dst: bad transport for sips uri: %d\n", - parsed_uri.proto); + LM_ERR("bad transport for sips uri: %d\n", parsed_uri.proto); return 0; }else if (parsed_uri.proto!=PROTO_WS) uri_proto=PROTO_TLS; @@ -276,7 +266,7 @@ inline static struct dest_info *uri2dst2(struct dest_info* dst, #ifdef HONOR_MADDR if (parsed_uri.maddr_val.s && parsed_uri.maddr_val.len) { host=&parsed_uri.maddr_val; - DBG("maddr dst: [%.*s:%d]\n", parsed_uri.maddr_val.len, + LM_DBG("maddr dst: [%.*s:%d]\n", parsed_uri.maddr_val.len, parsed_uri.maddr_val.s, parsed_uri.port_no); } else #endif @@ -291,7 +281,7 @@ inline static struct dest_info *uri2dst2(struct dest_info* dst, if (err!=0){ if (ip_found==0){ if (err!=-E_DNS_EOR) - LOG(L_ERR, "ERROR: uri2dst: failed to resolve \"%.*s\" :" + LM_ERR("failed to resolve \"%.*s\" :" "%s (%d)\n", host->len, ZSW(host->s), dns_strerror(err), err); return 0; /* error, no ip found */ @@ -309,20 +299,20 @@ inline static struct dest_info *uri2dst2(struct dest_info* dst, return dst; /* found a good one */ } }while(dns_srv_handle_next(dns_h, err)); - ERR("no corresponding socket for \"%.*s\" af %d\n", host->len, + LM_ERR("no corresponding socket for \"%.*s\" af %d\n", host->len, ZSW(host->s), dst->to.s.sa_family); /* try to continue */ return dst; } #endif if (sip_hostport2su(&dst->to, host, parsed_uri.port_no, &dst->proto)!=0){ - ERR("failed to resolve \"%.*s\"\n", host->len, ZSW(host->s)); + LM_ERR("failed to resolve \"%.*s\"\n", host->len, ZSW(host->s)); return 0; } dst->send_sock = get_send_socket2(force_send_socket, &dst->to, dst->proto, 0); if (dst->send_sock==0) { - ERR("no corresponding socket found for \"%.*s\" af %d (%s:%s)\n", + LM_ERR("no corresponding socket found for \"%.*s\" af %d (%s:%s)\n", host->len, ZSW(host->s), dst->to.s.sa_family, proto2a(dst->proto), su2a(&dst->to, sizeof(dst->to))); /* ser_error = E_NO_SOCKET;*/