(tlv) - TLV library

Library (tlv)

This library provides TLV (tag length value) data operation procedures.

High level APIs

Creates EMV type TLV parser.

This procedure returns a procedure which accepts a binary port as its argument.

The keyword argument object-builder specifies how to construct a TLV object. The default value is tlv-builder.

Returns #t if the given object is TLV object otherwise #f.

Function tlv-tag tlv

Returns TLV tag of given TLV object tlv.

Returns TLV binary data if the given TLV object tlv is not constructed, otherwise #f.

Returns TLV components of given TLV object tlv. If the _tlv_is not constructed, this returns ().

Converts given TLV object tlv to bytevector.

out must be binary output port.

Writes given TLV object tlv to out as TLV data.

Dump given TLV object tlv as human readable form.

Custom object builder

Sometimes default TLV object is not convenient to use. Then users can create own object from TLV data passing own object builder to the make-emv-tlv-parser procedure.

Default TLV object builder. User should not use this procedure directly.

first-byte is the first byte of the leading TLV object.

tag is the read tag of the TLV object.

data is either a list of TLV object or bytevector. User can check it with constructed? argument.

constructed? indicates if the TLV object is constructed or not. If this is #t then data is a list of TLV objects.