On Wed, Apr 23, 2014 at 4:24 PM, Willy Tarreau <w...@1wt.eu> wrote:

> On Wed, Apr 23, 2014 at 04:19:17PM -0400, David S wrote:
> > On Wed, Apr 23, 2014 at 5:45 AM, Willy Tarreau <w...@1wt.eu> wrote:
> >
> > > (...)
> > > Otherwise your patch looks fine. Do you want me to merge it ? If so,
> > > please could you provide a commit message with it ?
> > >
> > > Thanks,
> > > Willy
> > >
> >
> > First, I'll update the documentation to keep it in sync with the code.
> >
> > Thinking ahead to adding TLVs to follow the header, do you have a
> favorite
> > generic TLV implementation that you can merge in, or would you rather us
> > develop something specific from scratch?
>
> Take a look at src/peers.c, from what I remember, the sync protocol uses
> TLV as well, but I don't remember if there was anything specific, as in
> my opinion it's quite straightforward.
>
> Concerning the length, we could use a variable size encoding but that's
> painful for the decoder in general. And sometimes even for the encoder.
> So probably better stick to 16 bits for all lengths.
>
> Thanks,
> Willy
>
>
What do you think of this?

#define PP2_TYPE_SSL        0x20
#define PP2_TYPE_SSL_CN     0x21
#define PP2_TYPE_SSL_DN     0x22
#define PP2_TYPE_SSL_ALPN   0x23
#define PP2_TYPE_SSL_SNI....0x24

struct tlv {
uint8_t type;
uint8_t reserved;
uint16_t length;
uint8_t value[0]
};

struct tlv_ssl {
uint8_t type;
uint8_t reserved;
uint16_t length;
uint32_t version;
uint32_t client;
uint32_t verify;
uint8_t sub_tlv[0]
};

struct tlv_cn {
uint8_t type;
uint8_t reserved;
uint16_t length;
unit8_t cn[0];
};

struct tlv_dn {
uint8_t type;
uint8_t reserved;
uint16_t length;
unit8_t dn[0];
};

struct tlv_alpn {
uint8_t type;
uint8_t reserved;
uint16_t length;
unit8_t alpn[0];
};

struct tlv_sni {
uint8_t type;
uint8_t reserved;
uint16_t length;
unit8_t sni[0];
};

Reply via email to