fix bug with nested structs and implicit mode
encode to buffer so entire TLV is sent in one write
rewrite to use ldap/asn1