tlv_parser.c File Reference
TLV parser
`#include <stdio.h>`
`#include <stdint.h>`
`#include <errno.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/gsm/tlv.h>`

## Functions

int | tlv_dump (struct tlv_parsed *dec)
| Dump parsed TLV structure to stdout. More...
struct tlv_parsed * | osmo_tlvp_copy (const struct tlv_parsed *tp_orig, void *ctx)
| Copy tlv_parsed using given talloc context. More...
int | osmo_tlvp_merge (struct tlv_parsed *dst, const struct tlv_parsed *src)
| Merge all tlv_parsed attributes of 'src' into 'dst'. More...
int | tlv_encode_one (struct msgb *msg, enum tlv_type type, uint8_t tag, unsigned int len, const uint8_t *val)
| Encode a single TLV into given message buffer. More...
int | tlv_encode (struct msgb *msg, const struct tlv_definition *def, const struct tlv_parsed *tp)
| Encode a set of decoded TLVs according to a given definition into a message buffer. More...
int | tlv_encode_ordered (struct msgb *msg, const struct tlv_definition *def, const struct tlv_parsed *tp, const uint8_t *tag_order, unsigned int tag_order_len)
| Encode a set of decoded TLVs according to a given definition and IE order into a message buffer. More...
int | tlv_parse_one (uint8_t *o_tag, uint16_t *o_len, const uint8_t **o_val, const struct tlv_definition *def, const uint8_t *buf, int buf_len)
| Parse a single TLV encoded IE. More...
int | tlv_parse (struct tlv_parsed *dec, const struct tlv_definition *def, const uint8_t *buf, int buf_len, uint8_t lv_tag, uint8_t lv_tag2)
| Parse an entire buffer of TLV encoded Information Elements. More...
int | tlv_parse2 (struct tlv_parsed *dec, int dec_multiples, const struct tlv_definition *def, const uint8_t *buf, int buf_len, uint8_t lv_tag, uint8_t lv_tag2)
| Like tlv_parse(), but capable of decoding multiple occurences of the same IE. More...
void | tlv_def_patch (struct tlv_definition *dst, const struct tlv_definition *src)
| take a master (src) tlv_definition and fill up all empty slots in 'dst' More...
static | __attribute__ ((constructor))
int | osmo_shift_v_fixed (uint8_t **data, size_t *data_len, size_t len, uint8_t **value)
| Advance the data pointer, subtract length and assign value pointer. More...
int | osmo_match_shift_tv_fixed (uint8_t **data, size_t *data_len, uint8_t tag, size_t len, uint8_t **value)
| Match tag, check length and assign value pointer. More...
int | osmo_match_shift_tlv (uint8_t **data, size_t *data_len, uint8_t expected_tag, uint8_t **value, size_t *value_len)
| Verify TLV header and advance data / subtract length. More...
int | osmo_shift_tlv (uint8_t **data, size_t *data_len, uint8_t *tag, uint8_t **value, size_t *value_len)
| Extract TLV and advance data pointer + subtract length. More...
int | osmo_shift_lv (uint8_t **data, size_t *data_len, uint8_t **value, size_t *value_len)
| Extract LV and advance data pointer + subtract length. More...
const char * | osmo_tlv_prot_msg_name (const struct osmo_tlv_prot_def *pdef, uint8_t msg_type)
| get the message name for given msg_type in protocol pdef More...
const char * | osmo_tlv_prot_ie_name (const struct osmo_tlv_prot_def *pdef, uint8_t iei)
| get the IE name for given IEI in protocol pdef More...
int | osmo_tlv_prot_validate_tp (const struct osmo_tlv_prot_def *pdef, uint8_t msg_type, const struct tlv_parsed *tp, int log_subsys, const char *log_pfx)
| Validate an already TLV-decoded message against the protocol definition. More...
int | osmo_tlv_prot_parse (const struct osmo_tlv_prot_def *pdef, struct tlv_parsed *dec, unsigned int dec_multiples, uint8_t msg_type, const uint8_t *buf, unsigned int buf_len, uint8_t lv_tag, uint8_t lv_tag2, int log_subsys, const char *log_pfx)
| Parse + Validate a TLV-encoded message against the protocol definition. More...

## Variables

struct tlv_definition | tvlv_att_def
struct tlv_definition | vtvlv_gan_att_def
static __thread char | ienamebuf [32]
static __thread char | msgnamebuf [32]