Max has uploaded this change for review. ( https://gerrit.osmocom.org/12329
Change subject: MNCC: use log wrapper for call processing
......................................................................
MNCC: use log wrapper for call processing
Add log/debug wrappers to conveniently print local and remote call
references.
Change-Id: I5c44d7bb28f1ff895dd4f839d75840495503c916
---
M src/libmsc/mncc_builtin.c
1 file changed, 13 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/29/12329/1
diff --git a/src/libmsc/mncc_builtin.c b/src/libmsc/mncc_builtin.c
index 135a5e4..f3fe128 100644
--- a/src/libmsc/mncc_builtin.c
+++ b/src/libmsc/mncc_builtin.c
@@ -35,6 +35,9 @@
#include <osmocom/msc/gsm_data.h>
#include <osmocom/msc/transaction.h>
+#define DEBUGCC(ss, l, r, fmt, args...) DEBUGP(ss, "(call %x, remote %x) "
fmt "\n", l->callref, r->callref, ##args)
+#define LOGCC(ss, ll, l, r, fmt, args...) LOGP(ss, ll, "(call %x, remote %x) "
fmt "\n", l->callref, r->callref, ##args)
+
void *tall_call_ctx;
static LLIST_HEAD(call_list);
@@ -105,8 +108,7 @@
llist_add_tail(&remote->entry, &call_list);
remote->net = call->net;
remote->callref = new_callref++;
- DEBUGP(DMNCC, "(call %x) Creating new remote instance %x.\n",
- call->callref, remote->callref);
+ DEBUGCC(DMNCC, call, remote, "Creating new remote instance.");
/* link remote call */
call->remote_ref = remote->callref;
@@ -115,20 +117,20 @@
/* send call proceeding */
memset(&mncc, 0, sizeof(struct gsm_mncc));
mncc.callref = call->callref;
- DEBUGP(DMNCC, "(call %x) Accepting call.\n", call->callref);
+ DEBUGCC(DMNCC, call, remote, "Accepting call.");
mncc_tx_to_cc(call->net, MNCC_CALL_PROC_REQ, &mncc);
/* modify mode */
memset(&mncc, 0, sizeof(struct gsm_mncc));
mncc.callref = call->callref;
- DEBUGP(DMNCC, "(call %x) Modify channel mode\n", call->callref);
+ DEBUGCC(DMNCC, call, remote, "Modify channel mode.");
mncc_tx_to_cc(call->net, MNCC_LCHAN_MODIFY, &mncc);
/* send setup to remote */
// setup->fields |= MNCC_F_SIGNAL;
// setup->signal = GSM48_SIGNAL_DIALTONE;
setup->callref = remote->callref;
- DEBUGP(DMNCC, "(call %x) Forwarding SETUP to remote.\n", call->callref);
+ DEBUGCC(DMNCC, call, remote, "Forwarding SETUP to remote.");
return mncc_tx_to_cc(remote->net, MNCC_SETUP_REQ, setup);
out_reject:
@@ -146,7 +148,7 @@
if (!(remote = get_call_ref(call->remote_ref)))
return 0;
alert->callref = remote->callref;
- DEBUGP(DMNCC, "(call %x) Forwarding ALERT to remote.\n", call->callref);
+ DEBUGCC(DMNCC, call, remote, "Forwarding ALERT to remote.");
return mncc_tx_to_cc(remote->net, MNCC_ALERT_REQ, alert);
}
@@ -159,7 +161,7 @@
if (!(remote = get_call_ref(call->remote_ref)))
return 0;
notify->callref = remote->callref;
- DEBUGP(DMNCC, "(call %x) Forwarding NOTIF to remote.\n", call->callref);
+ DEBUGCC(DMNCC, call, remote, "Forwarding NOTIF to remote.");
return mncc_tx_to_cc(remote->net, MNCC_NOTIFY_REQ, notify);
}
@@ -180,13 +182,13 @@
if (!(remote = get_call_ref(call->remote_ref)))
return 0;
connect->callref = remote->callref;
- DEBUGP(DMNCC, "(call %x) Sending CONNECT to remote.\n", call->callref);
+ DEBUGCC(DMNCC, call, remote, "Sending CONNECT to remote.");
mncc_tx_to_cc(remote->net, MNCC_SETUP_RSP, connect);
/* bridge tch */
bridge.callref[0] = call->callref;
bridge.callref[1] = call->remote_ref;
- DEBUGP(DMNCC, "(call %x) Bridging with remote.\n", call->callref);
+ DEBUGCC(DMNCC, call, remote, "Bridging with remote.");
return mncc_tx_to_cc(call->net, MNCC_BRIDGE, &bridge);
}
@@ -206,8 +208,7 @@
return 0;
}
disc->callref = remote->callref;
- DEBUGP(DMNCC, "(call %x) Disconnecting remote with cause %d\n",
- remote->callref, disc->cause.value);
+ DEBUGCC(DMNCC, call, remote, "Disconnecting remote with cause %d",
disc->cause.value);
return mncc_tx_to_cc(remote->net, MNCC_DISC_REQ, disc);
}
@@ -222,8 +223,7 @@
}
rel->callref = remote->callref;
- DEBUGP(DMNCC, "(call %x) Releasing remote with cause %d\n",
- call->callref, rel->cause.value);
+ DEBUGCC(DMNCC, call, remote, "Releasing remote with cause %d",
rel->cause.value);
/*
* Release this side of the call right now. Otherwise we end up
--
To view, visit https://gerrit.osmocom.org/12329
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c44d7bb28f1ff895dd4f839d75840495503c916
Gerrit-Change-Number: 12329
Gerrit-PatchSet: 1
Gerrit-Owner: Max <[email protected]>