[MERGED] libosmocore[master]: msgb: Add msgb_hexdump_{l2, l3}() to dump l2 or l3 part of me...

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Feb 9 01:24:55 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: msgb: Add msgb_hexdump_{l2,l3}() to dump l2 or l3 part of message buffer
......................................................................


msgb: Add msgb_hexdump_{l2,l3}() to dump l2 or l3 part of message buffer

Change-Id: I98e85397fb541ee0fd711f2e1852f63f3bb87359
---
M include/osmocom/core/msgb.h
1 file changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved; Verified



diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index 335067e..9f4c444 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -509,4 +509,18 @@
 void msgb_set_talloc_ctx(void *ctx) OSMO_DEPRECATED("Use msgb_talloc_ctx_init() instead");
 int msgb_printf(struct msgb *msgb, const char *format, ...);
 
+static inline const char *msgb_hexdump_l2(const struct msgb *msg)
+{
+	if (!msgb_l2(msg) || !(msgb_l2len(msg)))
+		return "[]";
+	return osmo_hexdump(msgb_l2(msg), msgb_l2len(msg));
+}
+
+static inline const char *msgb_hexdump_l3(const struct msgb *msg)
+{
+	if (!msgb_l3(msg) || !(msgb_l3len(msg)))
+		return "[]";
+	return osmo_hexdump(msgb_l3(msg), msgb_l3len(msg));
+}
+
 /*! @} */

-- 
To view, visit https://gerrit.osmocom.org/6328
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I98e85397fb541ee0fd711f2e1852f63f3bb87359
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list