Harald Welte has submitted this change and it was merged. ( 
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, 12 insertions(+), 13 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Stefan Sperling: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/libmsc/mncc_builtin.c b/src/libmsc/mncc_builtin.c
index 135a5e4..fbdc5b4 100644
--- a/src/libmsc/mncc_builtin.c
+++ b/src/libmsc/mncc_builtin.c
@@ -35,6 +35,8 @@
 #include <osmocom/msc/gsm_data.h>
 #include <osmocom/msc/transaction.h>

+#define DEBUGCC(l, r, fmt, args...)   DEBUGP(DMNCC, "(call %x, remote %x) " 
fmt, l->callref, r->callref, ##args)
+
 void *tall_call_ctx;

 static LLIST_HEAD(call_list);
@@ -105,8 +107,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(call, remote, "Creating new remote instance.\n");

        /* link remote call */
        call->remote_ref = remote->callref;
@@ -115,20 +116,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(call, remote, "Accepting call.\n");
        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(call, remote, "Modify channel mode.\n");
        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(call, remote, "Forwarding SETUP to remote.\n");
        return mncc_tx_to_cc(remote->net, MNCC_SETUP_REQ, setup);

 out_reject:
@@ -146,7 +147,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(call, remote, "Forwarding ALERT to remote.\n");
        return mncc_tx_to_cc(remote->net, MNCC_ALERT_REQ, alert);
 }

@@ -159,7 +160,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(call, remote, "Forwarding NOTIF to remote.\n");
        return mncc_tx_to_cc(remote->net, MNCC_NOTIFY_REQ, notify);
 }

@@ -180,13 +181,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(call, remote, "Sending CONNECT to remote.\n");
        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(call, remote, "Bridging with remote.\n");

        return mncc_tx_to_cc(call->net, MNCC_BRIDGE, &bridge);
 }
@@ -206,8 +207,7 @@
                return 0;
        }
        disc->callref = remote->callref;
-       DEBUGP(DMNCC, "(call %x) Disconnecting remote with cause %d\n",
-               remote->callref, disc->cause.value);
+       DEBUGCC(call, remote, "Disconnecting remote with cause %d\n", 
disc->cause.value);
        return mncc_tx_to_cc(remote->net, MNCC_DISC_REQ, disc);
 }

@@ -222,8 +222,7 @@
        }

        rel->callref = remote->callref;
-       DEBUGP(DMNCC, "(call %x) Releasing remote with cause %d\n",
-               call->callref, rel->cause.value);
+       DEBUGCC(call, remote, "Releasing remote with cause %d\n", 
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: merged
Gerrit-Change-Id: I5c44d7bb28f1ff895dd4f839d75840495503c916
Gerrit-Change-Number: 12329
Gerrit-PatchSet: 5
Gerrit-Owner: Max <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Stefan Sperling <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>

Reply via email to