pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40283?usp=email )
Change subject: sccp: Introduce LOGPSCU() log macro
......................................................................
sccp: Introduce LOGPSCU() log macro
Change-Id: I576a1783be57dead99cdf2a29d5539aee0becd0c
---
M src/sccp_helpers.c
M src/sccp_internal.h
M src/sccp_sclc.c
M src/sccp_scmg.c
M src/sccp_scoc.c
M src/sccp_user.c
6 files changed, 26 insertions(+), 22 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/83/40283/1
diff --git a/src/sccp_helpers.c b/src/sccp_helpers.c
index 6dd9ab8..6643e4e 100644
--- a/src/sccp_helpers.c
+++ b/src/sccp_helpers.c
@@ -33,6 +33,7 @@
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/sccp_helpers.h>
+#include "ss7_internal.h"
#include "sccp_internal.h"
#define SCU_MSG_SIZE 2048
@@ -159,12 +160,12 @@
struct osmo_scu_prim *prim;
if (!osmo_sccp_conn_id_exists(scu->inst, conn_id)) {
- LOGP(DLSCCP, LOGL_ERROR, "N-DATA.req TX error: unable to find connection ID
(local_ref) %u\n", conn_id);
+ LOGPSCU(scu, LOGL_ERROR, "N-DATA.req TX error: unable to find connection ID
(local_ref) %u\n", conn_id);
return -ENOTCONN;
}
if (len > SCCP_MAX_DATA) {
- LOGP(DLSCCP, LOGL_ERROR, "N-DATA.req TX error: amount of data %u > %u - ITU-T
Rec. Q.713 §4.7 limit\n",
+ LOGPSCU(scu, LOGL_ERROR, "N-DATA.req TX error: amount of data %u > %u - ITU-T
Rec. Q.713 §4.7 limit\n",
len, SCCP_MAX_DATA);
return -EMSGSIZE;
}
@@ -203,7 +204,7 @@
struct osmo_scu_disconn_param *param;
if (!osmo_sccp_conn_id_exists(scu->inst, conn_id)) {
- LOGP(DLSCCP, LOGL_ERROR, "N-DISCONNECT.req TX error: unable to find connection ID
(local_ref) %u\n", conn_id);
+ LOGPSCU(scu, LOGL_ERROR, "N-DISCONNECT.req TX error: unable to find connection ID
(local_ref) %u\n", conn_id);
return -ENOTCONN;
}
@@ -244,7 +245,7 @@
struct osmo_scu_connect_param *param;
if (!osmo_sccp_conn_id_exists(scu->inst, conn_id)) {
- LOGP(DLSCCP, LOGL_ERROR, "N-CONNECT.resp TX error: unable to find connection ID
(local_ref) %u\n", conn_id);
+ LOGPSCU(scu, LOGL_ERROR, "N-CONNECT.resp TX error: unable to find connection ID
(local_ref) %u\n", conn_id);
return -ENOTCONN;
}
diff --git a/src/sccp_internal.h b/src/sccp_internal.h
index 1421c64..37ada11 100644
--- a/src/sccp_internal.h
+++ b/src/sccp_internal.h
@@ -86,6 +86,10 @@
/* Application Server FSM Instance */
struct osmo_fsm_inst *as_fi;
};
+#define _LOGPSCU(scu, subsys, level, fmt, args ...) \
+ _LOGPSCI((scu)->inst, subsys, level, "SCU(%s) " fmt,
osmo_sccp_user_name(scu), ## args)
+#define LOGPSCU(scu, level, fmt, args ...) \
+ _LOGPSCU(scu, DLSCCP, level, fmt, ## args)
extern int DSCCP;
diff --git a/src/sccp_sclc.c b/src/sccp_sclc.c
index 75afb96..e012114 100644
--- a/src/sccp_sclc.c
+++ b/src/sccp_sclc.c
@@ -56,6 +56,7 @@
#include <osmocom/sccp/sccp_types.h>
#include "xua_internal.h"
+#include "ss7_internal.h"
#include "sccp_internal.h"
/* generate a 'struct xua_msg' of requested type from primitive data */
@@ -158,9 +159,8 @@
/* Connectionless by-passes this altogether */
return xua_gen_encode_and_send(scu, -1, prim, SUA_CL_CLDT);
default:
- LOGP(DLSCCP, LOGL_ERROR, "Received unknown SCCP User "
- "primitive %s from user\n",
- osmo_scu_prim_name(&prim->oph));
+ LOGPSCU(scu, LOGL_ERROR, "Received unknown SCCP User primitive %s from
user\n",
+ osmo_scu_prim_name(&prim->oph));
return -1;
}
}
@@ -294,7 +294,7 @@
rc = sclc_rx_cldr(inst, xua);
break;
default:
- _LOGPSCI(sccp, DLSUA, LOGL_NOTICE, "Received unknown/unsupported message
%s\n",
+ _LOGPSCI(inst, DLSUA, LOGL_NOTICE, "Received unknown/unsupported message
%s\n",
xua_hdr_dump(xua, &xua_dialect_sua));
break;
}
diff --git a/src/sccp_scmg.c b/src/sccp_scmg.c
index 755d272..6f7383c 100644
--- a/src/sccp_scmg.c
+++ b/src/sccp_scmg.c
@@ -34,6 +34,7 @@
#include <osmocom/sccp/sccp_types.h>
#include "xua_internal.h"
+#include "ss7_internal.h"
#include "sccp_internal.h"
/* ITU-T Q.714 5.3.3 Subsystem allowed */
@@ -262,7 +263,7 @@
case SCCP_SCMG_MSGT_SOG:
case SCCP_SCMG_MSGT_SSC:
default:
- LOGP(DLSCCP, LOGL_NOTICE, "Rx unsupported SCCP SCMG %s, ignoring\n",
+ LOGPSCU(scu, LOGL_NOTICE, "Rx unsupported SCCP SCMG %s, ignoring\n",
sccp_scmg_msgt_name(scmg->msg_type));
break;
}
@@ -296,10 +297,10 @@
rc = scmg_rx(scu, ¶m->calling_addr, ¶m->called_addr, scmg);
break;
case OSMO_PRIM(OSMO_SCU_PRIM_N_PCSTATE, PRIM_OP_INDICATION):
- LOGP(DLSCCP, LOGL_DEBUG, "Ignoring SCCP user primitive %s\n",
osmo_scu_prim_name(oph));
+ LOGPSCU(scu, LOGL_DEBUG, "Ignoring SCCP user primitive %s\n",
osmo_scu_prim_name(oph));
break;
default:
- LOGP(DLSCCP, LOGL_ERROR, "unsupported SCCP user primitive %s\n",
+ LOGPSCU(scu, LOGL_ERROR, "unsupported SCCP user primitive %s\n",
osmo_scu_prim_name(oph));
break;
}
diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index f2ea766..204fd19 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -1917,7 +1917,7 @@
int rc = 0;
int event;
- LOGP(DLSCCP, LOGL_DEBUG, "Received SCCP User Primitive (%s)\n",
+ LOGPSCU(scu, LOGL_DEBUG, "Received SCCP User Primitive (%s)\n",
osmo_scu_prim_name(&prim->oph));
switch (OSMO_PRIM_HDR(&prim->oph)) {
@@ -1930,8 +1930,8 @@
conn = conn_create_id(scu, prim->u.connect.conn_id);
if (!conn) {
/* FIXME: inform SCCP user with proper reply */
- LOGP(DLSCCP, LOGL_ERROR, "Cannot create conn-id for primitive %s\n",
- osmo_scu_prim_name(&prim->oph));
+ LOGPSCU(scu, LOGL_ERROR, "Cannot create conn-id for primitive %s\n",
+ osmo_scu_prim_name(&prim->oph));
return rc;
}
break;
@@ -1943,13 +1943,13 @@
conn = conn_find_by_id(inst, scu_prim_conn_id(prim));
if (!conn) {
/* FIXME: inform SCCP user with proper reply */
- LOGP(DLSCCP, LOGL_ERROR, "Received unknown conn-id %u for primitive %s\n",
- scu_prim_conn_id(prim), osmo_scu_prim_name(&prim->oph));
+ LOGPSCU(scu, LOGL_ERROR, "Received unknown conn-id %u for primitive %s\n",
+ scu_prim_conn_id(prim), osmo_scu_prim_name(&prim->oph));
return rc;
}
break;
default:
- LOGP(DLSCCP, LOGL_ERROR, "Received unknown primitive %s\n",
+ LOGPSCU(scu, LOGL_ERROR, "Received unknown primitive %s\n",
osmo_scu_prim_name(&prim->oph));
return -1;
}
diff --git a/src/sccp_user.c b/src/sccp_user.c
index e283f29..18561c4 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -169,9 +169,7 @@
* at the time this function returns. */
void osmo_sccp_user_unbind(struct osmo_sccp_user *scu)
{
- LOGP(DLSCCP, LOGL_INFO, "Unbinding user '%s' from SSN=%u PC=%s\n",
- scu->name, scu->ssn,
- osmo_ss7_pointcode_print(scu->inst->ss7, scu->pc));
+ LOGPSCU(scu, LOGL_INFO, "Unbinding user\n");
/* FIXME: free/release all connections held by this user? */
llist_del(&scu->list);
talloc_free(scu);
@@ -196,8 +194,8 @@
*/
int sccp_user_prim_up(struct osmo_sccp_user *scu, struct osmo_scu_prim *prim)
{
- LOGP(DLSCCP, LOGL_DEBUG, "Delivering %s to SCCP User '%s'\n",
- osmo_scu_prim_name(&prim->oph), scu->name);
+ LOGPSCU(scu, LOGL_DEBUG, "Delivering to SCCP User: %s\n",
+ osmo_scu_prim_name(&prim->oph));
return scu->prim_cb(&prim->oph, scu);
}
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40283?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I576a1783be57dead99cdf2a29d5539aee0becd0c
Gerrit-Change-Number: 40283
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>