aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/pfcp/pfcp_msg.h
diff options
context:
space:
mode:
authorNeels Janosch Hofmeyr <nhofmeyr@sysmocom.de>2023-03-31 07:26:54 +0200
committerNeels Janosch Hofmeyr <nhofmeyr@sysmocom.de>2023-04-15 00:19:34 +0200
commite6ff99d7acbe270ed8f271daeaafc99e03a48176 (patch)
treedfe1ea8a5570152b978adc1c036eb0f35fe5b5dc /include/osmocom/pfcp/pfcp_msg.h
parent761e17039ab7d2e926b35feba1203b016a547f18 (diff)
pfcp_msg: refactor LOG_PFCP_MSG
It was requested during code review to make this a function and not a macro. One effective change: no longer log "NULL{fi=NULL}" when no m->ctx.session_fi or .peer_fi are set. Change-Id: Ic84090c9b1a34185577cfb2ea1efa9c07542df34
Diffstat (limited to 'include/osmocom/pfcp/pfcp_msg.h')
-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..0023353 100644
--- a/include/osmocom/pfcp/pfcp_msg.h
+++ b/include/osmocom/pfcp/pfcp_msg.h
@@ -42,30 +42,15 @@ 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...) \
+ LOGPSRC(DLPFCP, LEVEL, file, line, "%s: " FMT, osmo_pfcp_msg_log_info_c(OTC_SELECT, M), ##ARGS)
#define OSMO_LOG_PFCP_MSG(M, LEVEL, FMT, ARGS...) \
OSMO_LOG_PFCP_MSG_SRC(M, LEVEL, __FILE__, __LINE__, FMT, ##ARGS)
+int osmo_pfcp_msg_log_info_buf(char *buf, size_t buflen, const struct osmo_pfcp_msg *m);
+char *osmo_pfcp_msg_log_info_c(void *ctx, const struct osmo_pfcp_msg *m);
+
struct osmo_pfcp_header_parsed {
uint8_t version;
enum osmo_pfcp_message_type message_type;