aboutsummaryrefslogtreecommitdiffstats
path: root/include/openbsc/tlv.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2008-12-26 20:25:35 +0000
committerHarald Welte <laforge@gnumonks.org>2008-12-26 20:25:35 +0000
commit702d8707a96a6d11dffe4ad36b6cd22584bf1238 (patch)
treefa1e6a08cc2189d5d76edb72d368bf875f71bf4c /include/openbsc/tlv.h
parent5d2f8eca60bbf126d88413301570b4d60140295d (diff)
working state up to location update and classmark inquiry
Diffstat (limited to 'include/openbsc/tlv.h')
-rw-r--r--include/openbsc/tlv.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/openbsc/tlv.h b/include/openbsc/tlv.h
index 4c007725d..38ca81150 100644
--- a/include/openbsc/tlv.h
+++ b/include/openbsc/tlv.h
@@ -6,6 +6,7 @@
#define TLV_GROSS_LEN(x) (x+2)
#define TLV16_GROSS_LEN(x) ((2*x)+2)
+#define TL16V_GROSS_LEN(x) (x+3)
static inline u_int8_t *tlv_put(u_int8_t *buf, u_int8_t tag, u_int8_t len,
const u_int8_t *val)
@@ -25,12 +26,29 @@ static inline u_int8_t *tlv16_put(u_int8_t *buf, u_int8_t tag, u_int8_t len,
return buf + len*2;
}
+static inline u_int8_t *tl16v_put(u_int8_t *buf, u_int8_t tag, u_int16_t len,
+ const u_int8_t *val)
+{
+ *buf++ = tag;
+ *buf++ = len >> 8;
+ *buf++ = len & 0xff;
+ memcpy(buf, val, len);
+ return buf + len*2;
+}
+
static inline u_int8_t *msgb_tlv16_put(struct msgb *msg, u_int8_t tag, u_int8_t len, const u_int16_t *val)
{
u_int8_t *buf = msgb_put(msg, TLV16_GROSS_LEN(len));
return tlv16_put(buf, tag, len, val);
}
+static inline u_int8_t *msgb_tl16v_put(struct msgb *msg, u_int8_t tag, u_int16_t len,
+ const u_int8_t *val)
+{
+ u_int8_t *buf = msgb_put(msg, TL16V_GROSS_LEN(len));
+ return tl16v_put(buf, tag, len, val);
+}
+
static inline u_int8_t *tv_put(u_int8_t *buf, u_int8_t tag,
u_int8_t val)
{