aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-06-08 14:00:03 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2022-08-09 18:21:23 +0200
commitac517a9b6595aee327d0d3e766e220d24a4c9881 (patch)
treebae39f2ccec4f58c2bb6c63e8fd65fc35706c2f0 /include/osmocom
parenta2c40c4dbe035fb5420bef75eba35756ab1bf73e (diff)
implement OSMO_LOG_PFCP_MSG_SRC as va function
This was requested by code review. Change-Id: I1713868ebb9583c67f0a4ecc9558263f6888a24d
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/pfcp/pfcp_msg.h25
1 files changed, 5 insertions, 20 deletions
diff --git a/include/osmocom/pfcp/pfcp_msg.h b/include/osmocom/pfcp/pfcp_msg.h
index 4affa54..fed1114 100644
--- a/include/osmocom/pfcp/pfcp_msg.h
+++ b/include/osmocom/pfcp/pfcp_msg.h
@@ -42,26 +42,8 @@ struct osmo_pfcp_msg;
#define OSMO_PFCP_MSGB_ALLOC_SIZE 2048
-#define OSMO_LOG_PFCP_MSG_SRC(M, LEVEL, file, line, FMT, ARGS...) do { \
- struct osmo_fsm_inst *_fi = (M) ? ((M)->ctx.session_fi ?: (M)->ctx.peer_fi) : NULL; \
- enum osmo_pfcp_cause *cause = osmo_pfcp_msg_cause(M); \
- if ((M)->h.seid_present) { \
- LOGPFSMSLSRC(_fi, DLPFCP, LEVEL, file, line, \
- "%s%s PFCP seq-%u SEID-0x%"PRIx64" %s%s%s: " FMT, \
- _fi ? "" : osmo_sockaddr_to_str_c(OTC_SELECT, &(M)->remote_addr), \
- (M)->rx ? "-rx->" : "<-tx-", (M)->h.sequence_nr, \
- (M)->h.seid, \
- osmo_pfcp_message_type_str((M)->h.message_type), cause ? ": " : "", \
- cause ? osmo_pfcp_cause_str(*cause) : "", ##ARGS); \
- } else { \
- LOGPFSMSLSRC(_fi, DLPFCP, LEVEL, file, line, \
- "%s%s PFCP seq-%u %s%s%s: " FMT, \
- _fi ? "" : osmo_sockaddr_to_str_c(OTC_SELECT, &(M)->remote_addr), \
- (M)->rx ? "-rx->" : "<-tx-", (M)->h.sequence_nr, \
- osmo_pfcp_message_type_str((M)->h.message_type), cause ? ": " : "", \
- cause ? osmo_pfcp_cause_str(*cause) : "", ##ARGS); \
- } \
- } while (0)
+#define OSMO_LOG_PFCP_MSG_SRC(M, LEVEL, file, line, FMT, ARGS...) \
+ osmo_log_pfcp_msg_src(M, LEVEL, file, line, FMT, ##ARGS)
#define OSMO_LOG_PFCP_MSG(M, LEVEL, FMT, ARGS...) \
OSMO_LOG_PFCP_MSG_SRC(M, LEVEL, __FILE__, __LINE__, FMT, ##ARGS)
@@ -198,3 +180,6 @@ static inline struct osmo_pfcp_ie_node_id *osmo_pfcp_msg_node_id(const struct os
int osmo_pfcp_msg_to_str_buf(char *buf, size_t buflen, const struct osmo_pfcp_msg *m);
char *osmo_pfcp_msg_to_str_c(void *ctx, const struct osmo_pfcp_msg *m);
+
+void osmo_log_pfcp_msg_src(const struct osmo_pfcp_msg *m, unsigned int level, const char *file, int line,
+ const char *fmt, ...);