diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2019-02-28 05:50:06 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2019-04-12 02:15:25 +0200 |
commit | ff7074a0c7b62025473d8f1a950905ac2cb2f31c (patch) | |
tree | c543d89965b11e0d58d4e433ad81ec26668264ee /include | |
parent | 7c5346cd7005ad469702a2f74572b79de738fbbb (diff) |
add LOG_TRANS, proper context for all transactions
Change-Id: I2e60964d7a3c06d051debd1c707051a0eb3101ba
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/msc/transaction.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h index 830328bca..7ffcf3b78 100644 --- a/include/osmocom/msc/transaction.h +++ b/include/osmocom/msc/transaction.h @@ -3,14 +3,29 @@ #include <osmocom/msc/gsm_data.h> #include <osmocom/msc/gsm_subscriber.h> #include <osmocom/core/linuxlist.h> +#include <osmocom/core/fsm.h> #include <osmocom/msc/gsm_04_11.h> #include <osmocom/msc/mncc.h> +#include <osmocom/msc/debug.h> #include <osmocom/gsm/gsm0411_smc.h> #include <osmocom/gsm/gsm0411_smr.h> /* Used for late TID assignment */ #define TRANS_ID_UNASSIGNED 0xff +#define LOG_TRANS_CAT(trans, subsys, level, fmt, args...) \ + LOGP(subsys, level, \ + "trans(%s %s callref-0x%x tid-%u%s) " fmt, \ + (trans) ? gsm48_pdisc_name((trans)->protocol) : "NULL", \ + (trans) ? ((trans)->conn ? (trans)->conn->fi->id : vlr_subscr_name((trans)->vsub)) : "NULL", \ + (trans) ? (trans)->callref : 0, \ + (trans) ? (trans)->transaction_id : 0, \ + (trans) && (trans)->paging_request ? ",PAGING" : "", \ + ##args) + +#define LOG_TRANS(trans, level, fmt, args...) \ + LOG_TRANS_CAT(trans, trans_log_subsys(trans), level, fmt, ##args) + enum bridge_state { BRIDGE_STATE_NONE, BRIDGE_STATE_LOOPBACK_PENDING, @@ -118,3 +133,18 @@ int trans_assign_trans_id(const struct gsm_network *net, const struct vlr_subscr uint8_t protocol); struct gsm_trans *trans_has_conn(const struct ran_conn *conn); void trans_conn_closed(const struct ran_conn *conn); + +static inline int trans_log_subsys(const struct gsm_trans *trans) +{ + if (!trans) + return DMSC; + switch (trans->protocol) { + case GSM48_PDISC_CC: + return DCC; + case GSM48_PDISC_SMS: + return DLSMS; + default: + break; + } + return DMSC; +} |