aboutsummaryrefslogtreecommitdiffstats
path: root/include/openbsc/tlv.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-02-15 03:34:15 +0000
committerHarald Welte <laforge@gnumonks.org>2009-02-15 03:34:15 +0000
commite0590df5242af3178dbf75d527536634be0b890b (patch)
treedbd35075876c1976b944f4a273a9b4148b7483fe /include/openbsc/tlv.h
parent49314f60802dac6950479fc5ee6cdb190a943d41 (diff)
* extend TLV parser to use a list of TLV type descriptions
* implement TLV type descriptions for NM * add operational/administrative/availability state keeping logic to abis_nm * explicitly print all NACK's in abis_nm * make sure we produce [not just for BS-11] valid channel attributes
Diffstat (limited to 'include/openbsc/tlv.h')
-rw-r--r--include/openbsc/tlv.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/openbsc/tlv.h b/include/openbsc/tlv.h
index 3bb586225..e21511685 100644
--- a/include/openbsc/tlv.h
+++ b/include/openbsc/tlv.h
@@ -109,15 +109,32 @@ static inline u_int8_t *msgb_tv16_push(struct msgb *msg, u_int8_t tag, u_int16_t
/* TLV parsing */
struct tlv_p_entry {
- u_int8_t len;
+ u_int16_t len;
u_int8_t *val;
};
+enum tlv_type {
+ TLV_TYPE_FIXED,
+ TLV_TYPE_T,
+ TLV_TYPE_TV,
+ TLV_TYPE_TLV,
+ TLV_TYPE_TL16V,
+};
+
+struct tlv_def {
+ enum tlv_type type;
+ u_int8_t fixed_len;
+};
+
+struct tlv_definition {
+ struct tlv_def def[0xff];
+};
+
struct tlv_parsed {
struct tlv_p_entry lv[0xff];
};
-int tlv_parse(struct tlv_parsed *dec, u_int8_t *buf, int buf_len);
+int tlv_parse(struct tlv_parsed *dec, const struct tlv_definition *def, u_int8_t *buf, int buf_len);
#define TLVP_PRESENT(x, y) ((x)->lv[y].val)
#define TLVP_LEN(x, y) (x)->lv[y].len