summaryrefslogtreecommitdiff
path: root/lib/stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stream.h')
-rw-r--r--lib/stream.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/stream.h b/lib/stream.h
index 23f85d809b..4f75f121ca 100644
--- a/lib/stream.h
+++ b/lib/stream.h
@@ -386,6 +386,16 @@ static inline const uint8_t *ptr_get_be32(const uint8_t *ptr, uint32_t *out)
return ptr + 4;
}
+static inline uint8_t *ptr_get_be16(uint8_t *ptr, uint16_t *out)
+{
+ uint16_t tmp;
+
+ memcpy(&tmp, ptr, sizeof(tmp));
+ *out = ntohs(tmp);
+
+ return ptr + 2;
+}
+
/*
* so Normal stream_getX functions assert. Which is anathema
* to keeping a daemon up and running when something goes south