]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/emv/tlv.c
Merge pull request #474 from merlokk/df_fix
[proxmark3-svn] / client / emv / tlv.c
index d78f049e07bb7577cf7265fc0d12707420e01926..24125cc7d3175dd341eac4811dcdf4f9904cd94e 100644 (file)
@@ -308,7 +308,7 @@ void tlvdb_add(struct tlvdb *tlvdb, struct tlvdb *other)
        tlvdb->next = other;
 }
 
-void tlvdb_visit(const struct tlvdb *tlvdb, tlv_cb cb, void *data)
+void tlvdb_visit(const struct tlvdb *tlvdb, tlv_cb cb, void *data, int level)
 {
        struct tlvdb *next = NULL;
 
@@ -317,8 +317,9 @@ void tlvdb_visit(const struct tlvdb *tlvdb, tlv_cb cb, void *data)
 
        for (; tlvdb; tlvdb = next) {
                next = tlvdb->next;
-               cb(data, &tlvdb->tag);
-               tlvdb_visit(tlvdb->children, cb, data);
+               bool is_leaf = (tlvdb->children == NULL);
+               cb(data, &tlvdb->tag, level, is_leaf);
+               tlvdb_visit(tlvdb->children, cb, data, level+1);
        }
 }
 
Impressum, Datenschutz