Skip to content

Instantly share code, notes, and snippets.

@dtikhonov
Created May 22, 2019 20:27
Show Gist options
  • Save dtikhonov/bbfa9a824fa3d841105429f243184792 to your computer and use it in GitHub Desktop.
Save dtikhonov/bbfa9a824fa3d841105429f243184792 to your computer and use it in GitHub Desktop.
Tom De Decker QPACK scenario
/* Compile as follows:
* gcc -o tom-de-decker -Wall tom-de-decker.c libls-qpack.a
*/
#include <stdio.h>
#include "lsqpack.h"
int
main (void)
{
struct lsqpack_dec dec;
enum lsqpack_read_header_status status;
int s;
const unsigned char enc_in[] = {
"\xc1\x88\x60\xd5\x48\x5f\x2b\xce\x9a\x68"
"\xc1\x8a\x62\xa3\xa6\x53\xdb\x54\x8b\xce\x9a\x68"
"\xc1\x8d\x63\x67\x0c\x97\xa2\xa0\xfe\x2c\x2a\x17\xae\xa9\xbf"
};
const unsigned char header_block[4] = "\x03\x80\x10\xd1";
void *hblock;
struct lsqpack_header_set *hset;
const unsigned char *p;
lsqpack_dec_init(&dec, stderr, 1024, 16, NULL);
s = lsqpack_dec_enc_in(&dec, enc_in, sizeof(enc_in));
if (s != 0)
{
fprintf(stderr, "error feeding encoder stream\n");
return 1;
}
p = header_block;
status = lsqpack_dec_header_in(&dec, &hblock, 4, sizeof(header_block),
&p, sizeof(header_block), &hset, NULL, NULL);
printf("status: %u\n", status);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment