msgb: add msgb_push_u{8,16,32}() functions

Those work analoguous to msgb_put_*() but pre-pend the given value
into the msg headroom, rather than appending it to the end.

Change-Id: I7de63e9d04c2d2b678f1f20eef37f9be2c4f5ec2
diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index 7c85771..9cb1c24 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -290,6 +290,36 @@
 	return msgb->data;
 }
 
+/*! \brief prepend a uint8 value to the head of the message
+ *  \param[in] msgb message buffer
+ *  \param[in] word unsigned 8bit byte to be prepended
+ */
+static inline void msgb_push_u8(struct msgb *msg, uint8_t word)
+{
+	uint8_t *space = msgb_push(msg, 1);
+	space[0] = word;
+}
+
+/*! \brief prepend a uint16 value to the head of the message
+ *  \param[in] msgb message buffer
+ *  \param[in] word unsigned 16bit byte to be prepended
+ */
+static inline void msgb_push_u16(struct msgb *msg, uint16_t word)
+{
+	uint16_t *space = (uint16_t *) msgb_push(msg, 2);
+	osmo_store16be(word, space);
+}
+
+/*! \brief prepend a uint32 value to the head of the message
+ *  \param[in] msgb message buffer
+ *  \param[in] word unsigned 32bit byte to be prepended
+ */
+static inline void msgb_push_u32(struct msgb *msg, uint32_t word)
+{
+	uint32_t *space = (uint32_t *) msgb_push(msg, 4);
+	osmo_store32be(word, space);
+}
+
 /*! \brief remove (pull) a header from the front of the message buffer
  *  \param[in] msgb message buffer
  *  \param[in] len number of octets to be pulled